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
Unused local variable
nlloyd/SubliminalCollaborator/libs/twisted/words/test/test_xmlstream.py
[ { "content": " def setUp(self):\n self.factory = xmlstream.XmlStreamFactoryMixin(None, test=None)\n self.factory.protocol = DummyProtocol", "metadata": "root.XmlStreamFactoryMixinTest.setUp", "header": "['class', 'XmlStreamFactoryMixinTest', '(', 'GenericXmlStreamFactoryTestsMixin', ')', ':', '___EOS___']", "index": 210 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Xm", "l", "Stream", "Factor", "y", "Mix", "in", "Test_", "(_", "Gene", "ric", "Xm", "l", "Stream", "Factor", "y", "Test", "s", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "factory_", "=_", "xmlstr", "eam_", "._", "Xm", "l", "Stream", "Factor", "y", "Mixin_", "(_", "None_", ",_", "test_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "factory_", "._", "protocol_", "=_", "Du", "mm", "y", "Protocol_", "\\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 ]
Unused local variable
fp7-ofelia/ocf/ofam/src/src/foam/task.py
[ { "content": " def execute (self):\n p = subprocess.Popen(\"python %s %s -j %s\" % (CMD, self.jobtype, self.jobid), shell=True)\n print \"EXECUTE [%s]: %s\" % (self.jobtype, self.jobid)\n return p.pid", "metadata": "root.Job.execute", "header": "['class', 'Job', '(', 'object', ')', ':', '___EOS___']", "index": 44 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Job_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "\"", "python", " ", "%", "s", " ", "%", "s", " ", "-", "j", " ", "%", "s", "\"_", "%_", "(_", "CMD_", ",_", "self_", "._", "job", "type_", ",_", "self_", "._", "jobid_", ")_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "EXECUTE", " ", "[", "%", "s", "]:", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "job", "type_", ",_", "self_", "._", "jobid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "p_", "._", "pid_", "\\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 ]
Unused import
intuition-io/insights/tests/algorithms/test_dummy.py
[ { "content": "'''\nTests for insights.algorithms.dummy\n'''\n\nfrom nose.tools import ok_, eq_\nfrom insights.test_framework import FactoryAlgorithmTestCase\nimport insights.algorithms.dummy as dummy\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class RandomAlgoTestCase(FactoryAlgorithmTestCase):\n\n\n\n\n\n\n\n", "metadata": "root.RandomAlgoTestCase", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def test_doc(self):\n self._check_yaml_doc(dummy.Random)", "metadata": "root.RandomAlgoTestCase.test_doc", "header": "['class', 'RandomAlgoTestCase', '(', 'FactoryAlgorithmTestCase', ')', ':', '___EOS___']", "index": 11 }, { "content": " def test_initialize_default(self):\n algo = dummy.Random()\n eq_(algo.identity, self.default_identity)\n eq_(algo.middlewares, [])\n ok_(algo.buy_trigger > 0.5 and algo.buy_trigger < 1)\n ok_(algo.sell_trigger > 0 and algo.sell_trigger < 0.5)", "metadata": "root.RandomAlgoTestCase.test_initialize_default", "header": "['class', 'RandomAlgoTestCase', '(', 'FactoryAlgorithmTestCase', ')', ':', '___EOS___']", "index": 14 }, { "content": " def test_initialize_custom_signal_triggers(self):\n algo = dummy.Random(properties={\n 'buy_trigger': 0.6,\n 'sell_trigger': 0.3,\n })\n eq_(algo.buy_trigger, 0.6)\n eq_(algo.sell_trigger, 0.3)", "metadata": "root.RandomAlgoTestCase.test_initialize_custom_signal_triggers", "header": "['class', 'RandomAlgoTestCase', '(', 'FactoryAlgorithmTestCase', ')', ':', '___EOS___']", "index": 21 }, { "content": " def test_initialize_custom_middlewares(self):\n algo = dummy.Random(properties={\n 'mobile': 'Nexus 5',\n 'interactive': True\n })\n eq_(len(algo.middlewares), 2)", "metadata": "root.RandomAlgoTestCase.test_initialize_custom_middlewares", "header": "['class', 'RandomAlgoTestCase', '(', 'FactoryAlgorithmTestCase', ')', ':', '___EOS___']", "index": 29 }, { "content": " def test_event_output(self):\n algo = dummy.Random()\n self._check_event_output(algo.event(self.event_data))", "metadata": "root.RandomAlgoTestCase.test_event_output", "header": "['class', 'RandomAlgoTestCase', '(', 'FactoryAlgorithmTestCase', ')', ':', '___EOS___']", "index": 36 }, { "content": " def test_deactivate_buy_and_sell(self):\n algo = dummy.Random(properties={\n 'buy_trigger': 10.0,\n 'sell_trigger': -10.0\n })\n signals = algo.event(self.event_data)\n eq_(signals['buy'], {})\n eq_(signals['sell'], {})", "metadata": "root.RandomAlgoTestCase.test_deactivate_buy_and_sell", "header": "['class', 'RandomAlgoTestCase', '(', 'FactoryAlgorithmTestCase', ')', ':', '___EOS___']", "index": 40 }, { "content": " def test_always_buy_and_cannot_sell(self):\n algo = dummy.Random(properties={\n 'buy_trigger': -10.0,\n 'sell_trigger': 10.0\n })\n signals = algo.event(self.event_data)\n ok_(signals['buy'])\n eq_(signals['sell'], {})", "metadata": "root.RandomAlgoTestCase.test_always_buy_and_cannot_sell", "header": "['class', 'RandomAlgoTestCase', '(', 'FactoryAlgorithmTestCase', ')', ':', '___EOS___']", "index": 49 }, { "content": " def test_always_sell_and_cannot_buy(self):\n algo = dummy.Random(properties={\n 'buy_trigger': 10.0,\n 'sell_trigger': 10.0\n })\n signals = algo.event(self.event_data)\n ok_(signals['sell'])\n eq_(signals['buy'], {})", "metadata": "root.RandomAlgoTestCase.test_always_sell_and_cannot_buy", "header": "['class', 'RandomAlgoTestCase', '(', 'FactoryAlgorithmTestCase', ')', ':', '___EOS___']", "index": 58 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "Test", "s", " ", "for", " ", "insights", ".", "algo", "rit", "hms", ".", "dummy", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "ok\\u_", ",_", "eq\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "insights", "_", "._", "test\\u", "framework_", "import_", "Factor", "y", "Algorit", "hm", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "insights", "_", "._", "algorithms_", "._", "dummy_", "as_", "dummy_", "\\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_", "Random", "Algo", "Test", "Case_", "(_", "Factor", "y", "Algorit", "hm", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Random", "Algo", "Test", "Case_", "(_", "Factor", "y", "Algorit", "hm", "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 ", " _", "self_", "._", "\\u", "check", "\\u", "yaml", "\\u", "doc_", "(_", "dummy_", "._", "Random_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Random", "Algo", "Test", "Case_", "(_", "Factor", "y", "Algorit", "hm", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "initialize", "\\u", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "algo_", "=_", "dummy_", "._", "Random_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "algo_", "._", "identity_", ",_", "self_", "._", "default", "\\u", "identity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "algo_", "._", "middle", "ware", "s_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ok\\u_", "(_", "algo_", "._", "buy", "\\u", "trigger_", ">_", "0.5_", "and_", "algo_", "._", "buy", "\\u", "trigger_", "<_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ok\\u_", "(_", "algo_", "._", "sell", "\\u", "trigger_", ">_", "0_", "and_", "algo_", "._", "sell", "\\u", "trigger_", "<_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Random", "Algo", "Test", "Case_", "(_", "Factor", "y", "Algorit", "hm", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "initialize", "\\u", "custom", "\\u", "signal", "\\u", "triggers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "algo_", "=_", "dummy_", "._", "Random_", "(_", "properties_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "buy", "\\u", "trigger", "'_", ":_", "0.6_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sell", "\\u", "trigger", "'_", ":_", "0.3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "algo_", "._", "buy", "\\u", "trigger_", ",_", "0.6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "algo_", "._", "sell", "\\u", "trigger_", ",_", "0.3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Random", "Algo", "Test", "Case_", "(_", "Factor", "y", "Algorit", "hm", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "initialize", "\\u", "custom", "\\u", "middle", "ware", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "algo_", "=_", "dummy_", "._", "Random_", "(_", "properties_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mobile", "'_", ":_", "'", "Nexus", " ", "5", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "interactive", "'_", ":_", "True_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "len_", "(_", "algo_", "._", "middle", "ware", "s_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Random", "Algo", "Test", "Case_", "(_", "Factor", "y", "Algorit", "hm", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "event", "\\u", "output_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "algo_", "=_", "dummy_", "._", "Random_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "check", "\\u", "event", "\\u", "output_", "(_", "algo_", "._", "event_", "(_", "self_", "._", "event", "\\u", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Random", "Algo", "Test", "Case_", "(_", "Factor", "y", "Algorit", "hm", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "deactivate", "\\u", "buy", "\\u", "and", "\\u", "sell", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "algo_", "=_", "dummy_", "._", "Random_", "(_", "properties_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "buy", "\\u", "trigger", "'_", ":_", "10.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sell", "\\u", "trigger", "'_", ":_", "-_", "10.0_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signals_", "=_", "algo_", "._", "event_", "(_", "self_", "._", "event", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "signals_", "[_", "'", "buy", "'_", "]_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "signals_", "[_", "'", "sell", "'_", "]_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Random", "Algo", "Test", "Case_", "(_", "Factor", "y", "Algorit", "hm", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "alw", "ay", "s", "\\u", "buy", "\\u", "and", "\\u", "cann", "ot", "\\u", "sell", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "algo_", "=_", "dummy_", "._", "Random_", "(_", "properties_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "buy", "\\u", "trigger", "'_", ":_", "-_", "10.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sell", "\\u", "trigger", "'_", ":_", "10.0_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signals_", "=_", "algo_", "._", "event_", "(_", "self_", "._", "event", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ok\\u_", "(_", "signals_", "[_", "'", "buy", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "signals_", "[_", "'", "sell", "'_", "]_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Random", "Algo", "Test", "Case_", "(_", "Factor", "y", "Algorit", "hm", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "alw", "ay", "s", "\\u", "sell", "\\u", "and", "\\u", "cann", "ot", "\\u", "buy", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "algo_", "=_", "dummy_", "._", "Random_", "(_", "properties_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "buy", "\\u", "trigger", "'_", ":_", "10.0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sell", "\\u", "trigger", "'_", ":_", "10.0_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signals_", "=_", "algo_", "._", "event_", "(_", "self_", "._", "event", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ok\\u_", "(_", "signals_", "[_", "'", "sell", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eq\\u_", "(_", "signals_", "[_", "'", "buy", "'_", "]_", ",_", "{_", "}_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 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
tomatohater/django-unfriendly/unfriendly/tests/views.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"Django view handlers for tests.\"\"\"\n\nfrom django.http import HttpResponse\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_view(request):\n \"\"\"\"Test view.\"\"\"\n return HttpResponse(request.get_full_path())", "metadata": "root.test_view", "header": "['module', '___EOS___']", "index": 6 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Dj", "ang", "o", " ", "view", " ", "handler", "s", " ", "for", " ", "tests", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Response_", "\\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_", "test\\u", "view_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\"", "Test", " ", "view", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "request_", "._", "get", "\\u", "full", "\\u", "path_", "(_", ")_", ")_" ]
[ 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, 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 ]
Unused import
openstack/python-blazarclient/climateclient/tests/test_base.py
[ { "content": "# Copyright (c) 2014 Mirantis 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\n# implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\n\nimport requests\n\nfrom climateclient import base\nfrom climateclient import exception\nfrom climateclient import tests\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BaseClientManagerTestCase(tests.TestCase):\n\n\n\n\n\n\n\n\n", "metadata": "root.BaseClientManagerTestCase", "header": "['module', '___EOS___']", "index": 23 }, { "content": " def setUp(self):\n super(BaseClientManagerTestCase, self).setUp()\n\n self.url = \"www.fake.com/reservation\"\n self.token = \"aaa-bbb-ccc\"\n self.fake_key = \"fake_key\"\n self.response = \"RESPONSE\"\n self.exception = exception\n\n self.manager = base.BaseClientManager(self.url, self.token)\n self.request = self.patch(requests, \"request\")", "metadata": "root.BaseClientManagerTestCase.setUp", "header": "['class', 'BaseClientManagerTestCase', '(', 'tests', '.', 'TestCase', ')', ':', '___EOS___']", "index": 25 }, { "content": " def test_get(self):\n self.patch(\n self.manager, \"request\").return_value = (\n self.response, {\"fake_key\": \"FAKE\"})\n self.assertEqual(self.manager._get(self.url, self.fake_key), \"FAKE\")", "metadata": "root.BaseClientManagerTestCase.test_get", "header": "['class', 'BaseClientManagerTestCase', '(', 'tests', '.', 'TestCase', ')', ':', '___EOS___']", "index": 37 }, { "content": " def test_create(self):\n self.patch(\n self.manager, \"request\").return_value = (\n self.response, {\"fake_key\": \"FAKE\"})\n self.assertEqual(self.manager._create(self.url, {}, self.fake_key),\n \"FAKE\")", "metadata": "root.BaseClientManagerTestCase.test_create", "header": "['class', 'BaseClientManagerTestCase', '(', 'tests', '.', 'TestCase', ')', ':', '___EOS___']", "index": 43 }, { "content": " def test_delete(self):\n request = self.patch(self.manager, \"request\")\n request.return_value = (self.response, {\"fake_key\": \"FAKE\"})\n self.manager._delete(self.url)\n request.assert_called_once_with(self.url, \"DELETE\")", "metadata": "root.BaseClientManagerTestCase.test_delete", "header": "['class', 'BaseClientManagerTestCase', '(', 'tests', '.', 'TestCase', ')', ':', '___EOS___']", "index": 50 }, { "content": " def test_update(self):\n self.patch(\n self.manager, \"request\").return_value = (\n self.response, {\"fake_key\": \"FAKE\"})\n self.assertEqual(self.manager._update(self.url, {}, self.fake_key),\n \"FAKE\")", "metadata": "root.BaseClientManagerTestCase.test_update", "header": "['class', 'BaseClientManagerTestCase', '(', 'tests', '.', 'TestCase', ')', ':', '___EOS___']", "index": 56 }, { "content": " def test_request_ok_with_body(self):\n self.request.return_value.status_code = 200\n self.request.return_value.text = '{\"key\": \"value\"}'\n\n kwargs = {\"body\": {\"key\": \"value\"}}\n\n self.assertEqual((\n self.request(), {\"key\": \"value\"}),\n self.manager.request(self.url, \"POST\", **kwargs))", "metadata": "root.BaseClientManagerTestCase.test_request_ok_with_body", "header": "['class', 'BaseClientManagerTestCase', '(', 'tests', '.', 'TestCase', ')', ':', '___EOS___']", "index": 63 }, { "content": " def test_request_ok_without_body(self):\n self.request.return_value.status_code = 200\n self.request.return_value.text = \"key\"\n\n kwargs = {\"body\": \"key\"}\n\n self.assertEqual((\n self.request(), None),\n self.manager.request(self.url, \"POST\", **kwargs))", "metadata": "root.BaseClientManagerTestCase.test_request_ok_without_body", "header": "['class', 'BaseClientManagerTestCase', '(', 'tests', '.', 'TestCase', ')', ':', '___EOS___']", "index": 73 }, { "content": " def test_request_fail_with_body(self):\n self.request.return_value.status_code = 400\n self.request.return_value.text = '{\"key\": \"value\"}'\n\n kwargs = {\"body\": {\"key\": \"value\"}}\n\n self.assertRaises(exception.ClimateClientException,\n self.manager.request,\n self.url, \"POST\", **kwargs)", "metadata": "root.BaseClientManagerTestCase.test_request_fail_with_body", "header": "['class', 'BaseClientManagerTestCase', '(', 'tests', '.', 'TestCase', ')', ':', '___EOS___']", "index": 83 }, { "content": " def test_request_fail_without_body(self):\n self.request.return_value.status_code = 400\n self.request.return_value.text = \"REAL_ERROR\"\n\n kwargs = {\"body\": \"key\"}\n\n self.assertRaises(exception.ClimateClientException,\n self.manager.request,\n self.url, \"POST\", **kwargs)", "metadata": "root.BaseClientManagerTestCase.test_request_fail_without_body", "header": "['class', 'BaseClientManagerTestCase', '(', 'tests', '.', 'TestCase', ')', ':', '___EOS___']", "index": 93 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2014", " ", "Mir", "anti", "s", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "climate", "client_", "import_", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "climate", "client_", "import_", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "climate", "client_", "import_", "tests_", "\\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_", "Base", "Client", "Manager", "Test", "Case_", "(_", "tests_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Base", "Client", "Manager", "Test", "Case_", "(_", "tests_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Base", "Client", "Manager", "Test", "Case_", ",_", "self_", ")_", "._", "set", "Up_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "url_", "=_", "\"", "www", ".", "fake", ".", "com", "/", "reserva", "tion", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "token_", "=_", "\"", "aaa", "-", "bbb", "-", "ccc", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fake", "\\u", "key_", "=_", "\"", "fake", "\\u", "key", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "=_", "\"", "RESPONSE", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "exception_", "=_", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "manager_", "=_", "base_", "._", "Base", "Client", "Manager_", "(_", "self_", "._", "url_", ",_", "self_", "._", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "request_", "=_", "self_", "._", "patch_", "(_", "requests_", ",_", "\"", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Client", "Manager", "Test", "Case_", "(_", "tests_", "._", "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 ", " _", "self_", "._", "patch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "manager_", ",_", "\"", "request", "\"_", ")_", "._", "return", "\\u", "value_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "response_", ",_", "{_", "\"", "fake", "\\u", "key", "\"_", ":_", "\"", "FAKE", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "manager_", "._", "\\u", "get_", "(_", "self_", "._", "url_", ",_", "self_", "._", "fake", "\\u", "key_", ")_", ",_", "\"", "FAKE", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Client", "Manager", "Test", "Case_", "(_", "tests_", "._", "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 ", " _", "self_", "._", "patch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "manager_", ",_", "\"", "request", "\"_", ")_", "._", "return", "\\u", "value_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "response_", ",_", "{_", "\"", "fake", "\\u", "key", "\"_", ":_", "\"", "FAKE", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "manager_", "._", "\\u", "create_", "(_", "self_", "._", "url_", ",_", "{_", "}_", ",_", "self_", "._", "fake", "\\u", "key_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "FAKE", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Client", "Manager", "Test", "Case_", "(_", "tests_", "._", "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 ", " _", "request_", "=_", "self_", "._", "patch_", "(_", "self_", "._", "manager_", ",_", "\"", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "return", "\\u", "value_", "=_", "(_", "self_", "._", "response_", ",_", "{_", "\"", "fake", "\\u", "key", "\"_", ":_", "\"", "FAKE", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "manager_", "._", "\\u", "delete_", "(_", "self_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "self_", "._", "url_", ",_", "\"", "DELET", "E", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Client", "Manager", "Test", "Case_", "(_", "tests_", "._", "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 ", " _", "self_", "._", "patch_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "manager_", ",_", "\"", "request", "\"_", ")_", "._", "return", "\\u", "value_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "response_", ",_", "{_", "\"", "fake", "\\u", "key", "\"_", ":_", "\"", "FAKE", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "manager_", "._", "\\u", "update_", "(_", "self_", "._", "url_", ",_", "{_", "}_", ",_", "self_", "._", "fake", "\\u", "key_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "FAKE", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Client", "Manager", "Test", "Case_", "(_", "tests_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "request", "\\u", "ok", "\\u", "with", "\\u", "body_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "request_", "._", "return", "\\u", "value_", "._", "status", "\\u", "code_", "=_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "request_", "._", "return", "\\u", "value_", "._", "text_", "=_", "'{", "\"", "key", "\":", " ", "\"", "value", "\"}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "\"", "body", "\"_", ":_", "{_", "\"", "key", "\"_", ":_", "\"", "value", "\"_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "request_", "(_", ")_", ",_", "{_", "\"", "key", "\"_", ":_", "\"", "value", "\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "manager_", "._", "request_", "(_", "self_", "._", "url_", ",_", "\"", "POST", "\"_", ",_", "**_", "kwargs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Client", "Manager", "Test", "Case_", "(_", "tests_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "request", "\\u", "ok", "\\u", "with", "out", "\\u", "body_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "request_", "._", "return", "\\u", "value_", "._", "status", "\\u", "code_", "=_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "request_", "._", "return", "\\u", "value_", "._", "text_", "=_", "\"", "key", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "\"", "body", "\"_", ":_", "\"", "key", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "request_", "(_", ")_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "manager_", "._", "request_", "(_", "self_", "._", "url_", ",_", "\"", "POST", "\"_", ",_", "**_", "kwargs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Client", "Manager", "Test", "Case_", "(_", "tests_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "request", "\\u", "fail", "\\u", "with", "\\u", "body_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "request_", "._", "return", "\\u", "value_", "._", "status", "\\u", "code_", "=_", "400_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "request_", "._", "return", "\\u", "value_", "._", "text_", "=_", "'{", "\"", "key", "\":", " ", "\"", "value", "\"}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "\"", "body", "\"_", ":_", "{_", "\"", "key", "\"_", ":_", "\"", "value", "\"_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exception_", "._", "Clim", "ate", "Client", "Exception_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "manager_", "._", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "url_", ",_", "\"", "POST", "\"_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Client", "Manager", "Test", "Case_", "(_", "tests_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "request", "\\u", "fail", "\\u", "with", "out", "\\u", "body_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "request_", "._", "return", "\\u", "value_", "._", "status", "\\u", "code_", "=_", "400_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "request_", "._", "return", "\\u", "value_", "._", "text_", "=_", "\"", "REAL", "\\u", "ERROR", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "\"", "body", "\"_", ":_", "\"", "key", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "exception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.py
[ { "content": "\"\"\"project-specific settings\"\"\"\n\nimport yaml\nimport os.path\n\nfrom mod import log, util, config\n\n#-------------------------------------------------------------------------------\n\n#-------------------------------------------------------------------------------\n \n#-------------------------------------------------------------------------------\n\n#-------------------------------------------------------------------------------\n\n#-------------------------------------------------------------------------------\n\n#-------------------------------------------------------------------------------\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def load(proj_dir) :\n \"\"\"load the .fips-settings.yml file from project directory\n\n :param proj_dir: absolute project directory\n :returns: dictionary object\n \"\"\"\n settings = None\n path = proj_dir + '/.fips-settings.yml'\n if os.path.isfile(path) :\n with open(path, 'r') as f :\n settings = yaml.load(f)\n if not settings :\n settings = {}\n return settings", "metadata": "root.load", "header": "['module', '___EOS___']", "index": 8 }, { "content": "def save(proj_dir, settings) :\n \"\"\"save settings back to .fips-settings.yml file in project directory\n\n :param proj_dir: absolute project directory\n :param settings: settings dictionary object\n \"\"\"\n path = proj_dir + '/.fips-settings.yml'\n with open(path, 'w') as f :\n yaml.dump(settings, f)", "metadata": "root.save", "header": "['module', '___EOS___']", "index": 24 }, { "content": "def get_default(key) :\n \"\"\"get the default value for a settings key\n\n :param key: settings key\n :returns: default value, or None if key is invalid\n \"\"\"\n if key == 'config' :\n return config.get_default_config()\n elif key == 'target' :\n return None\n elif key == 'jobs' :\n return 3\n elif key == 'ccache' :\n return False\n else :\n return None", "metadata": "root.get_default", "header": "['module', '___EOS___']", "index": 35 }, { "content": "def get(proj_dir, key) :\n \"\"\"return settings value by key, default value if the value\n doesn't exist in the project-local settings file\n\n :param proj_dir: absolute project directory\n :param key: settings key\n :returns: settings value, default value for key, or None\n \"\"\"\n util.ensure_valid_project_dir(proj_dir)\n\n value = None\n settings = load(proj_dir)\n if key in settings :\n value = settings[key]\n if value is None :\n value = get_default(key)\n\n return value", "metadata": "root.get", "header": "['module', '___EOS___']", "index": 53 }, { "content": "def set(proj_dir, key, value) :\n \"\"\"update a settings value by key and save project-local\n .fips-settings file\n\n :param proj_dir: absolute project directory\n :param key: settings key\n :param value: new value associated with key\n \"\"\"\n util.ensure_valid_project_dir(proj_dir)\n\n settings = load(proj_dir)\n settings[key] = value\n save(proj_dir, settings)\n\n proj_name = util.get_project_name_from_dir(proj_dir)\n if type(value) is bool :\n value_str = 'on' if value else 'off';\n else :\n value_str = str(value)\n log.info(\"'{}' set to '{}' in project '{}'\".format(key, value_str, proj_name))", "metadata": "root.set", "header": "['module', '___EOS___']", "index": 73 }, { "content": "def unset(proj_dir, key) :\n \"\"\"delete a settings value from the project-local settings file\n\n :param proj_dir: absolute project directory\n :param key: settings key\n \"\"\"\n util.ensure_valid_project_dir(proj_dir)\n\n settings = load(proj_dir)\n if key in settings :\n del settings[key]\n save(proj_dir, settings)\n\n proj_name = util.get_project_name_from_dir(proj_dir)\n log.info(\"'{}' unset in project '{}'\".format(key, proj_name))", "metadata": "root.unset", "header": "['module', '___EOS___']", "index": 95 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "project", "-", "specific", " ", "settings", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "yaml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mod_", "import_", "log_", ",_", "util_", ",_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "load_", "(_", "proj", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "load", " ", "the", " ", ".", "fips", "-", "settings", ".", "yml", " ", "file", " ", "from", " ", "project", " ", "director", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "proj", "\\u", "dir", ":", " ", " ", " ", " ", "abs", "olute", " ", "project", " ", "director", "y", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", " ", " ", "dictionar", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "proj", "\\u", "dir_", "+_", "'/.", "fips", "-", "settings", ".", "yml", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "path_", ",_", "'", "r", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "settings_", "=_", "yaml_", "._", "load_", "(_", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "settings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "settings_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "settings_", "\\u\\u\\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_", "save_", "(_", "proj", "\\u", "dir_", ",_", "settings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "save", " ", "settings", " ", "back", " ", "to", " ", ".", "fips", "-", "settings", ".", "yml", " ", "file", " ", "in", " ", "project", " ", "director", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "proj", "\\u", "dir", ":", " ", " ", " ", " ", "abs", "olute", " ", "project", " ", "director", "y", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "settings", ":", " ", " ", " ", " ", "settings", " ", "dictionar", "y", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "proj", "\\u", "dir_", "+_", "'/.", "fips", "-", "settings", ".", "yml", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "path_", ",_", "'", "w", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yaml_", "._", "dump_", "(_", "settings_", ",_", "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_", "def_", "get", "\\u", "default_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "get", " ", "the", " ", "default", " ", "value", " ", "for", " ", "a", " ", "settings", " ", "key", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "key", ":", " ", "settings", " ", "key", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", " ", " ", "default", " ", "value", ",", " ", "or", " ", "Non", "e", " ", "if", " ", "key", " ", "is", " ", "invalid", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "==_", "'", "config", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "config_", "._", "get", "\\u", "default", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "target", "'_", ":_", "\\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_", "elif_", "key_", "==_", "'", "jobs", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "'", "cca", "che", "'_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "proj", "\\u", "dir_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "return", " ", "settings", " ", "value", " ", "by", " ", "key", ",", " ", "default", " ", "value", " ", "if", " ", "the", " ", "value", "\\", "10", ";", " ", " ", " ", " ", "doe", "sn", "'", "t", " ", "exist", " ", "in", " ", "the", " ", "project", "-", "local", " ", "settings", " ", "file", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "proj", "\\u", "dir", ":", " ", " ", " ", " ", "abs", "olute", " ", "project", " ", "director", "y", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "key", ":", " ", " ", " ", " ", " ", "settings", " ", "key", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", " ", " ", "settings", " ", "value", ",", " ", "default", " ", "value", " ", "for", " ", "key", ",", " ", "or", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "ensure", "\\u", "valid", "\\u", "project", "\\u", "dir_", "(_", "proj", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "=_", "load_", "(_", "proj", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "in_", "settings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "settings_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "get", "\\u", "default_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "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_", "def_", "set_", "(_", "proj", "\\u", "dir_", ",_", "key_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "update", " ", "a", " ", "settings", " ", "value", " ", "by", " ", "key", " ", "and", " ", "save", " ", "project", "-", "local", "\\", "10", ";", " ", " ", " ", " ", ".", "fips", "-", "settings", " ", "file", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "proj", "\\u", "dir", ":", " ", " ", " ", " ", "abs", "olute", " ", "project", " ", "director", "y", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "key", ":", " ", " ", " ", " ", " ", "settings", " ", "key", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", ":", " ", " ", " ", "new", " ", "value", " ", "associate", "d", " ", "with", " ", "key", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "ensure", "\\u", "valid", "\\u", "project", "\\u", "dir_", "(_", "proj", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "=_", "load_", "(_", "proj", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "[_", "key_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save_", "(_", "proj", "\\u", "dir_", ",_", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proj", "\\u", "name_", "=_", "util_", "._", "get", "\\u", "project", "\\u", "name", "\\u", "from", "\\u", "dir_", "(_", "proj", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "value_", ")_", "is_", "bool_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value", "\\u", "str_", "=_", "'", "on", "'_", "if_", "value_", "else_", "'", "off", "'_", ";_", "\\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", "\\u", "str_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "log_", "._", "info_", "(_", "\"'{", "}'", " ", "set", " ", "to", " ", "'{}'", " ", "in", " ", "project", " ", "'{}'\"_", "._", "format_", "(_", "key_", ",_", "value", "\\u", "str_", ",_", "proj", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "unset_", "(_", "proj", "\\u", "dir_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "delete", " ", "a", " ", "settings", " ", "value", " ", "from", " ", "the", " ", "project", "-", "local", " ", "settings", " ", "file", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "proj", "\\u", "dir", ":", " ", " ", " ", " ", "abs", "olute", " ", "project", " ", "director", "y", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "key", ":", " ", " ", " ", " ", " ", "settings", " ", "key", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "util_", "._", "ensure", "\\u", "valid", "\\u", "project", "\\u", "dir_", "(_", "proj", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "=_", "load_", "(_", "proj", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "in_", "settings_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "settings_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "save_", "(_", "proj", "\\u", "dir_", ",_", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proj", "\\u", "name_", "=_", "util_", "._", "get", "\\u", "project", "\\u", "name", "\\u", "from", "\\u", "dir_", "(_", "proj", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "info_", "(_", "\"'{", "}'", " ", "unse", "t", " ", "in", " ", "project", " ", "'{}'\"_", "._", "format_", "(_",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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, 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 ]
Imprecise assert
cenk/kuyruk/tests/unit/test_config.py
[ { "content": " def test_from_object(self):\n user_config.WORKER_MAX_LOAD = 21\n config = Config()\n config.from_object(user_config)\n self.assertEqual(config.WORKER_MAX_LOAD, 21)", "metadata": "root.ConfigTestCase.test_from_object", "header": "['class', 'ConfigTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 24 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Config", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "from", "\\u", "object_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "config_", "._", "WORKER", "\\u", "MAX", "\\u", "LOAD", "_", "=_", "21_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "._", "from", "\\u", "object_", "(_", "user", "\\u", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "config_", "._", "WORKER", "\\u", "MAX", "\\u", "LOAD", "_", ",_", "21_", ")_" ]
[ 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 ]
Unused local variable
gkno/gkno_launcher/src/networkx/readwrite/tests/test_pajek.py
[ { "content": " def test_read_pajek(self):\n G=parse_pajek(self.data)\n Gin=read_pajek(self.fname)\n assert_equal(sorted(G.nodes()), sorted(Gin.nodes()))\n assert_edges_equal(G.edges(), Gin.edges())\n assert_equal(self.G.graph,Gin.graph)\n for n in G.node:\n assert_equal(G.node[n],Gin.node[n])", "metadata": "root.TestPajek.test_read_pajek", "header": "['class', 'TestPajek', '(', 'object', ')', ':', '___EOS___']", "index": 43 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Pa", "je", "k_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "read", "\\u", "pa", "je", "k_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "G_", "=_", "parse", "\\u", "pa", "je", "k_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Gi", "n_", "=_", "read", "\\u", "pa", "je", "k_", "(_", "self_", "._", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "sorted_", "(_", "G_", "._", "nodes_", "(_", ")_", ")_", ",_", "sorted_", "(_", "Gi", "n_", "._", "nodes_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "edge", "s", "\\u", "equal_", "(_", "G_", "._", "edges_", "(_", ")_", ",_", "Gi", "n_", "._", "edges_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "self_", "._", "G_", "._", "graph_", ",_", "Gi", "n_", "._", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "G_", "._", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "equal_", "(_", "G_", "._", "node_", "[_", "n_", "]_", ",_", "Gi", "n_", "._", "node_", "[_", "n_", "]_", ")_" ]
[ 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 ]
Redundant assignment
paluh/django-tz/django_tz/forms.py
[ { "content": " def compress(self, *args, **kwargs):\n result = super(LocalizedDateTimeField, self).compress(*args, **kwargs)\n if result:\n result = adjust_datetime_to_timezone(result, result.tzinfo,\n pytz.timezone(settings.TIME_ZONE)).replace(tzinfo=None)\n return result", "metadata": "root.LocalizedDateTimeField.compress", "header": "['class', 'LocalizedDateTimeField', '(', 'TimeZoneDateTimeField', ')', ':', '___EOS___']", "index": 99 } ]
[]
[]
0
true
[ "[CLS]_", "Redu", "ndan", "t_", "assignment_", "[SEP]_", "class_", "Locali", "zed", "Date", "Time", "Field_", "(_", "Time", "Zon", "e", "Date", "Time", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compress_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "super_", "(_", "Locali", "zed", "Date", "Time", "Field_", ",_", "self_", ")_", "._", "compress_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "adjust", "\\u", "datetime", "\\u", "to", "\\u", "timezone_", "(_", "result_", ",_", "result_", "._", "tzinfo_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pytz_", "._", "timezone_", "(_", "settings_", "._", "TIME", "\\u", "ZONE_", ")_", ")_", "._", "replace_", "(_", "tzinfo_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
tony/tmuxp/tmuxp/server.py
[ { "content": "# -*- coding: utf-8 -*-\n\"\"\"Pythonization of the :term:`tmux(1)` server.\n\ntmuxp.server\n~~~~~~~~~~~~\n\n\"\"\"\nfrom __future__ import absolute_import, division, print_function, \\\n with_statement, unicode_literals\n\nimport logging\nimport os\n\nfrom . import formats, exc\nfrom .session import Session\nfrom .util import tmux_cmd, TmuxRelationalObject\nfrom .common import EnvironmentMixin\n\nlogger = logging.getLogger(__name__)\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Server(TmuxRelationalObject, EnvironmentMixin):\n\n \"\"\"The :term:`tmux(1)` server.\n\n - :attr:`Server._sessions` [:class:`Session`, ...]\n\n - :attr:`Session._windows` [:class:`Window`, ...]\n\n - :attr:`Window._panes` [:class:`Pane`, ...]\n\n - :class:`Pane`\n\n When instantiated, provides the ``t`` global. stores information on live,\n running tmux server.\n\n \"\"\"\n\n #: ``[-L socket-name]``\n socket_name = None\n #: ``[-S socket-path]``\n socket_path = None\n #: ``[-f file]``\n config_file = None\n #: ``-2`` or ``-8``\n colors = None\n #: unique child ID key\n childIdAttribute = 'session_id'\n\n\n\n\n\n\n #: Alias of :attr:`sessions`.\n children = sessions\n\n\n\n\n\n\n\n\n\n\n ", "metadata": "root.Server", "header": "['module', '___EOS___']", "index": 21 }, { "content": " def __init__(\n self,\n socket_name=None,\n socket_path=None,\n config_file=None,\n colors=None,\n **kwargs\n ):\n EnvironmentMixin.__init__(self, '-g')\n self._windows = []\n self._panes = []\n\n if socket_name:\n self.socket_name = socket_name\n\n if socket_path:\n self.socket_path = socket_path\n\n if config_file:\n self.config_file = config_file\n\n if colors:\n self.colors = colors", "metadata": "root.Server.__init__", "header": "['class', 'Server', '(', 'TmuxRelationalObject', ',', 'EnvironmentMixin', ')', ':', '___EOS___']", "index": 49 }, { "content": " def cmd(self, *args, **kwargs):\n \"\"\"Return :class:`util.tmux_cmd` send tmux commands with sockets, colors.\n\n :rtype: :class:`util.tmux_cmd`\n\n :versionchanged: 0.8\n Renamed from ``.tmux`` to ``.cmd``.\n\n \"\"\"\n\n args = list(args)\n if self.socket_name:\n args.insert(0, '-L{0}'.format(self.socket_name))\n if self.socket_path:\n args.insert(0, '-S{0}'.format(self.socket_path))\n if self.config_file:\n args.insert(0, '-f{0}'.format(self.config_file))\n if self.colors:\n if self.colors == 256:\n args.insert(0, '-2')\n elif self.colors == 88:\n args.insert(0, '-8')\n else:\n raise ValueError('Server.colors must equal 88 or 256')\n\n return tmux_cmd(*args, **kwargs)", "metadata": "root.Server.cmd", "header": "['class', 'Server', '(', 'TmuxRelationalObject', ',', 'EnvironmentMixin', ')', ':', '___EOS___']", "index": 73 }, { "content": " def _list_sessions(self):\n \"\"\"Return list of sessions in :py:obj:`dict` form.\n\n Retrieved from ``$ tmux(1) list-sessions`` stdout.\n\n The :py:obj:`list` is derived from ``stdout`` in :class:`util.tmux_cmd`\n which wraps :py:class:`subprocess.Popen`.\n\n :rtype: :py:obj:`list` of :py:obj:`dict`\n\n \"\"\"\n\n sformats = formats.SESSION_FORMATS\n tmux_formats = ['#{%s}' % f for f in sformats]\n\n tmux_args = (\n '-F%s' % '\\t'.join(tmux_formats), # output\n )\n\n proc = self.cmd(\n 'list-sessions',\n *tmux_args\n )\n\n if proc.stderr:\n raise exc.TmuxpException(proc.stderr)\n else:\n session_info = proc.stdout[0]\n\n if proc.stderr:\n raise exc.TmuxpException(proc.stderr)\n\n sformats = formats.SESSION_FORMATS\n tmux_formats = ['#{%s}' % format for format in sformats]\n sessions = proc.stdout\n\n # combine format keys with values returned from ``tmux list-windows``\n sessions = [dict(zip(\n sformats, session.split('\\t'))) for session in sessions]\n\n # clear up empty dict\n sessions = [\n dict((k, v) for k, v in session.items() if v)\n for session in sessions\n ]\n\n return sessions", "metadata": "root.Server._list_sessions", "header": "['class', 'Server', '(', 'TmuxRelationalObject', ',', 'EnvironmentMixin', ')', ':', '___EOS___']", "index": 100 }, { "content": " @property\n def _sessions(self):\n \"\"\"Property / alias to return :meth:`~._list_sessions`.\"\"\"\n\n return self._list_sessions()", "metadata": "root.Server._sessions", "header": "['class', 'Server', '(', 'TmuxRelationalObject', ',', 'EnvironmentMixin', ')', ':', '___EOS___']", "index": 148 }, { "content": " def list_sessions(self):\n \"\"\"Return list of :class:`Session` from the ``tmux(1)`` session.\n\n :rtype: :py:obj:`list` of :class:`Session`\n\n \"\"\"\n return [\n Session(server=self, **s) for s in self._sessions\n ]", "metadata": "root.Server.list_sessions", "header": "['class', 'Server', '(', 'TmuxRelationalObject', ',', 'EnvironmentMixin', ')', ':', '___EOS___']", "index": 154 }, { "content": " @property\n def sessions(self):\n \"\"\"Property / alias to return :meth:`~.list_sessions`.\"\"\"\n return self.list_sessions()", "metadata": "root.Server.sessions", "header": "['class', 'Server', '(', 'TmuxRelationalObject', ',', 'EnvironmentMixin', ')', ':', '___EOS___']", "index": 164 }, { "content": " def _list_windows(self):\n \"\"\"Return list of windows in :py:obj:`dict` form.\n\n Retrieved from ``$ tmux(1) list-windows`` stdout.\n\n The :py:obj:`list` is derived from ``stdout`` in :class:`util.tmux_cmd`\n which wraps :py:class:`subprocess.Popen`.\n\n :rtype: list\n\n \"\"\"\n\n wformats = ['session_name', 'session_id'] + formats.WINDOW_FORMATS\n tmux_formats = ['#{%s}' % format for format in wformats]\n\n proc = self.cmd(\n 'list-windows', # ``tmux list-windows``\n '-a',\n '-F%s' % '\\t'.join(tmux_formats), # output\n )\n\n if proc.stderr:\n raise exc.TmuxpException(proc.stderr)\n\n windows = proc.stdout\n\n wformats = ['session_name', 'session_id'] + formats.WINDOW_FORMATS\n\n # combine format keys with values returned from ``tmux list-windows``\n windows = [dict(zip(\n wformats, window.split('\\t'))) for window in windows]\n\n # clear up empty dict\n windows = [\n dict((k, v) for k, v in window.items() if v) for window in windows\n ]\n\n # tmux < 1.8 doesn't have window_id, use window_name\n for w in windows:\n if not 'window_id' in w:\n w['window_id'] = w['window_name']\n\n if self._windows:\n self._windows[:] = []\n\n self._windows.extend(windows)\n\n return self._windows", "metadata": "root.Server._list_windows", "header": "['class', 'Server', '(', 'TmuxRelationalObject', ',', 'EnvironmentMixin', ')', ':', '___EOS___']", "index": 171 }, { "content": " def _update_windows(self):\n \"\"\"Update internal window data and return ``self`` for chainability.\n\n :rtype: :class:`Server`\n\n \"\"\"\n self._list_windows()\n return self", "metadata": "root.Server._update_windows", "header": "['class', 'Server', '(', 'TmuxRelationalObject', ',', 'EnvironmentMixin', ')', ':', '___EOS___']", "index": 220 }, { "content": " def _list_panes(self):\n \"\"\"Return list of panes in :py:obj:`dict` form.\n\n Retrieved from ``$ tmux(1) list-panes`` stdout.\n\n The :py:obj:`list` is derived from ``stdout`` in :class:`util.tmux_cmd`\n which wraps :py:class:`subprocess.Popen`.\n\n :rtype: list\n\n \"\"\"\n\n pformats = [\n 'session_name', 'session_id',\n 'window_index', 'window_id',\n 'window_name'\n ] + formats.PANE_FORMATS\n tmux_formats = ['#{%s}\\t' % f for f in pformats]\n\n proc = self.cmd(\n 'list-panes',\n '-a',\n '-F%s' % ''.join(tmux_formats), # output\n )\n\n if proc.stderr:\n raise exc.TmuxpException(proc.stderr)\n\n panes = proc.stdout\n\n pformats = [\n 'session_name', 'session_id',\n 'window_index', 'window_id', 'window_name'\n ] + formats.PANE_FORMATS\n\n # combine format keys with values returned from ``tmux list-panes``\n panes = [dict(zip(\n pformats, window.split('\\t'))) for window in panes]\n\n # clear up empty dict\n panes = [\n dict((k, v) for k, v in window.items() if v) for window in panes\n ]\n\n if self._panes:\n self._panes[:] = []\n\n self._panes.extend(panes)\n\n return self._panes", "metadata": "root.Server._list_panes", "header": "['class', 'Server', '(', 'TmuxRelationalObject', ',', 'EnvironmentMixin', ')', ':', '___EOS___']", "index": 229 }, { "content": " def _update_panes(self):\n \"\"\"Update internal pane data and return ``self`` for chainability.\n\n :rtype: :class:`Server`\n\n \"\"\"\n self._list_panes()\n return self", "metadata": "root.Server._update_panes", "header": "['class', 'Server', '(', 'TmuxRelationalObject', ',', 'EnvironmentMixin', ')', ':', '___EOS___']", "index": 280 }, { "content": " def attached_sessions(self):\n \"\"\"Return active :class:`Session` objects.\n\n This will not work where multiple tmux sessions are attached.\n\n :rtype: :py:obj:`list` of :class:`Session`\n\n \"\"\"\n\n sessions = self._sessions\n attached_sessions = list()\n\n for session in sessions:\n if 'session_attached' in session:\n # for now session_active is a unicode\n if session.get('session_attached') == '1':\n logger.debug('session %s attached', session.get(\n 'session_name'))\n attached_sessions.append(session)\n else:\n continue\n\n return [\n Session(server=self, **s) for s in attached_sessions\n ] or None", "metadata": "root.Server.attached_sessions", "header": "['class', 'Server', '(', 'TmuxRelationalObject', ',', 'EnvironmentMixin', ')', ':', '___EOS___']", "index": 289 }, { "content": " def has_session(self, target_session):\n \"\"\"Return True if session exists. ``$ tmux has-session``.\n\n :param: target_session: str of session name.\n :rtype: bool\n\n \"\"\"\n\n proc = self.cmd('has-session', '-t%s' % target_session)\n\n if proc.stdout == []:\n return True\n if any(\n x in proc.stdout for x in\n ['failed to connect to server', 'error connecting to']\n ):\n return False\n elif 'no server running' in proc.stdout: # tmux 2.0\n return False\n elif 'can\\'t find session' in proc.stdout: # tmux 2.1\n return False\n elif 'session not found' in proc.stdout:\n return False\n else:\n return True", "metadata": "root.Server.has_session", "header": "['class', 'Server', '(', 'TmuxRelationalObject', ',', 'EnvironmentMixin', ')', ':', '___EOS___']", "index": 315 }, { "content": " def kill_server(self):\n \"\"\"``$ tmux kill-server``.\"\"\"\n self.cmd('kill-server')", "metadata": "root.Server.kill_server", "header": "['class', 'Server', '(', 'TmuxRelationalObject', ',', 'EnvironmentMixin', ')', ':', '___EOS___']", "index": 341 }, { "content": " def kill_session(self, target_session=None):\n \"\"\"Kill the tmux session with ``$ tmux kill-session``, return ``self``.\n\n :param: target_session: str. note this accepts ``fnmatch(3)``. 'asdf'\n will kill 'asdfasd'.\n\n :rtype: :class:`Server`\n\n \"\"\"\n proc = self.cmd('kill-session', '-t%s' % target_session)\n\n if proc.stderr:\n raise exc.TmuxpException(proc.stderr)\n\n return self", "metadata": "root.Server.kill_session", "header": "['class', 'Server', '(', 'TmuxRelationalObject', ',', 'EnvironmentMixin', ')', ':', '___EOS___']", "index": 345 }, { "content": " def switch_client(self, target_session):\n \"\"\"``$ tmux switch-client``.\n\n :param: target_session: str. name of the session. fnmatch(3) works.\n\n \"\"\"\n\n proc = self.cmd('switch-client', '-t%s' % target_session)\n\n if proc.stderr:\n raise exc.TmuxpException(proc.stderr)", "metadata": "root.Server.switch_client", "header": "['class', 'Server', '(', 'TmuxRelationalObject', ',', 'EnvironmentMixin', ')', ':', '___EOS___']", "index": 361 }, { "content": " def attach_session(self, target_session=None):\n \"\"\"``$ tmux attach-session`` aka alias: ``$ tmux attach``.\n\n :param: target_session: str. name of the session. fnmatch(3) works.\n\n \"\"\"\n tmux_args = tuple()\n if target_session:\n tmux_args += ('-t%s' % target_session,)\n\n proc = self.cmd('attach-session', *tmux_args)\n\n if proc.stderr:\n raise exc.TmuxpException(proc.stderr)", "metadata": "root.Server.attach_session", "header": "['class', 'Server', '(', 'TmuxRelationalObject', ',', 'EnvironmentMixin', ')', ':', '___EOS___']", "index": 373 }, { "content": " def new_session(self,\n session_name=None,\n kill_session=False,\n attach=False,\n *args,\n **kwargs):\n \"\"\"Return :class:`Session` from ``$ tmux new-session``.\n\n Uses ``-P`` flag to print session info, ``-F`` for return formatting\n returns new Session object.\n\n ``$ tmux new-session -d`` will create the session in the background\n ``$ tmux new-session -Ad`` will move to the session name if it already\n exists. todo: make an option to handle this.\n\n :param session_name: session name::\n\n $ tmux new-session -s <session_name>\n :type session_name: string\n\n :param attach: create session in the foreground. ``attach=False`` is\n equivalent to::\n\n $ tmux new-session -d\n :type attach: bool\n\n :param kill_session: Kill current session if ``$ tmux has-session``\n Useful for testing workspaces.\n :type kill_session: bool\n :rtype: :class:`Session`\n\n \"\"\"\n\n if self.has_session(session_name):\n if kill_session:\n self.cmd('kill-session', '-t%s' % session_name)\n logger.info('session %s exists. killed it.' % session_name)\n else:\n raise exc.TmuxSessionExists(\n 'Session named %s exists' % session_name\n )\n\n logger.debug('creating session %s' % session_name)\n\n sformats = formats.SESSION_FORMATS\n tmux_formats = ['#{%s}' % f for f in sformats]\n\n env = os.environ.get('TMUX')\n\n if env:\n del os.environ['TMUX']\n\n tmux_args = (\n '-s%s' % session_name,\n '-P', '-F%s' % '\\t'.join(tmux_formats), # output\n )\n\n if not attach:\n tmux_args += ('-d',)\n\n proc = self.cmd(\n 'new-session',\n *tmux_args\n )\n\n if proc.stderr:\n raise exc.TmuxpException(proc.stderr)\n\n session = proc.stdout[0]\n\n if env:\n os.environ['TMUX'] = env\n\n # combine format keys with values returned from ``tmux list-windows``\n session = dict(zip(sformats, session.split('\\t')))\n\n # clear up empty dict\n session = dict((k, v) for k, v in session.items() if v)\n\n session = Session(server=self, **session)\n\n return session", "metadata": "root.Server.new_session", "header": "['class', 'Server', '(', 'TmuxRelationalObject', ',', 'EnvironmentMixin', ')', ':', '___EOS___']", "index": 388 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Pyth", "oni", "zatio", "n", " ", "of", " ", "the", " ", ":", "term", ":`", "tm", "ux", "(", "1", ")`", " ", "server", ".", "\\", "10", ";", "\\", "10", ";", "tm", "ux", "p", ".", "server", "\\", "10", ";", "~~~~~~~~~~~", "~", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "division_", ",_", "print", "\\u", "function_", ",_", "with", "\\u", "statement_", ",_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "import_", "formats_", ",_", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "session_", "import_", "Session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "util_", "import_", "tm", "ux", "\\u", "cmd_", ",_", "Tm", "ux", "Relation", "al", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "common_", "import_", "Environ", "ment", "Mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Server_", "(_", "Tm", "ux", "Relation", "al", "Object_", ",_", "Environ", "ment", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", ":", "term", ":`", "tm", "ux", "(", "1", ")`", " ", "server", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", ":", "attr", ":`", "Server", ".\\u", "session", "s", "`", " ", "[:", "class", ":`", "Sess", "ion", "`", ",", " ", "...]", "\\", "10", ";", "\\", "10", ";", " ", " ", "-", " ", ":", "attr", ":`", "Sess", "ion", ".\\u", "windows", "`", " ", "[:", "class", ":`", "Window", "`", ",", " ", "...]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", ":", "attr", ":`", "Window", ".\\u", "pane", "s", "`", " ", "[:", "class", ":`", "Pane", "`", ",", " ", "...]", "\\", "10", ";", "\\", "10", ";", " ", " ", "-", " ", ":", "class", ":`", "Pane", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "instantiate", "d", ",", " ", "provide", "s", " ", "the", " ", "``", "t", "``", " ", "global", ".", " ", "store", "s", " ", "informati", "on", " ", "on", " ", "live", ",", "\\", "10", ";", " ", " ", " ", " ", "runn", "ing", " ", "tm", "ux", " ", "server", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", ":", " ", "``[", "-", "L", " ", "socket", "-", "name", "]``", "_", "\\u\\u\\uNL\\u\\u\\u_", "socket", "\\u", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", " ", "``[", "-", "S", " ", "socket", "-", "path", "]``", "_", "\\u\\u\\uNL\\u\\u\\u_", "socket", "\\u", "path_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", " ", "``[", "-", "f", " ", "file", "]``", "_", "\\u\\u\\uNL\\u\\u\\u_", "config", "\\u", "file_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", " ", "``-", "2", "``", " ", "or", " ", "``-", "8", "``", "_", "\\u\\u\\uNL\\u\\u\\u_", "colors_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", " ", "unique", " ", "child", " ", "ID", " ", "key_", "\\u\\u\\uNL\\u\\u\\u_", "child", "Id", "Attribute_", "=_", "'", "session", "\\u", "id", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", ":", " ", "Ali", "as", " ", "of", " ", ":", "attr", ":`", "session", "s", "`.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "children_", "=_", "sessions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Server_", "(_", "Tm", "ux", "Relation", "al", "Object_", ",_", "Environ", "ment", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "socket", "\\u", "name_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "socket", "\\u", "path_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config", "\\u", "file_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "colors_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Environ", "ment", "Mixin_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "'-", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "windows_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "pane", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "socket", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "socket", "\\u", "name_", "=_", "socket", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "socket", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "socket", "\\u", "path_", "=_", "socket", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "config", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "config", "\\u", "file_", "=_", "config", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "colors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "colors_", "=_", "colors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server_", "(_", "Tm", "ux", "Relation", "al", "Object_", ",_", "Environ", "ment", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cmd_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", ":", "class", ":`", "util", ".", "tm", "ux", "\\u", "cmd", "`", " ", "send", " ", "tm", "ux", " ", "command", "s", " ", "with", " ", "socket", "s", ",", " ", "colors", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "class", ":`", "util", ".", "tm", "ux", "\\u", "cmd", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "version", "change", "d", ":", " ", "0.", "8", "\\", "10", ";", " ", " ", " ", " ", "Rename", "d", " ", "from", " ", "``.", "tm", "ux", "``", " ", "to", " ", "``.", "cmd", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "list_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "socket", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "insert_", "(_", "0_", ",_", "'-", "L", "{", "0", "}'_", "._", "format_", "(_", "self_", "._", "socket", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "socket", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "insert_", "(_", "0_", ",_", "'-", "S", "{", "0", "}'_", "._", "format_", "(_", "self_", "._", "socket", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "config", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "insert_", "(_", "0_", ",_", "'-", "f", "{", "0", "}'_", "._", "format_", "(_", "self_", "._", "config", "\\u", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "colors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "colors_", "==_", "256_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "insert_", "(_", "0_", ",_", "'-", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "colors_", "==_", "88_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "insert_", "(_", "0_", ",_", "'-", "8", "'_", ")_", "\\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_", "Value", "Error_", "(_", "'", "Server", ".", "colors", " ", "must", " ", "equal", " ", "88", " ", "or", " ", "256", "'_", ")_", "\\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_", "tm", "ux", "\\u", "cmd_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server_", "(_", "Tm", "ux", "Relation", "al", "Object_", ",_", "Environ", "ment", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "list", "\\u", "sessions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "list", " ", "of", " ", "session", "s", " ", "in", " ", ":", "py", ":", "obj", ":`", "dict", "`", " ", "form", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Retrieve", "d", " ", "from", " ", "``", "$", " ", "tm", "ux", "(", "1", ")", " ", "list", "-", "session", "s", "``", " ", "stdout", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", ":", "py", ":", "obj", ":`", "list", "`", " ", "is", " ", "derive", "d", " ", "from", " ", "``", "stdout", "``", " ", "in", " ", ":", "class", ":`", "util", ".", "tm", "ux", "\\u", "cmd", "`", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "wrap", "s", " ", ":", "py", ":", "class", ":`", "subproc", "ess", ".", "Pop", "en", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "py", ":", "obj", ":`", "list", "`", " ", "of", " ", ":", "py", ":", "obj", ":`", "dict", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sfo", "rmat", "s_", "=_", "formats_", "._", "SES", "SION", "\\u", "FORMATS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tm", "ux", "\\u", "formats_", "=_", "[_", "'#", "{%", "s", "}'_", "%_", "f_", "for_", "f_", "in_", "sfo", "rmat", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tm", "ux", "\\u", "args_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "F", "%", "s", "'_", "%_", "'\\\\", "t", "'_", "._", "join_", "(_", "tm", "ux", "\\u", "formats_", ")_", ",_", "#", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proc_", "=_", "self_", "._", "cmd_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "list", "-", "session", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "tm", "ux", "\\u", "args_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "proc_", "._", "stderr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Tm", "ux", "p", "Exception_", "(_", "proc_", "._", "stderr_", ")_", "\\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 ", " _", "session", "\\u", "info_", "=_", "proc_", "._", "stdout_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "proc_", "._", "stderr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Tm", "ux", "p", "Exception_", "(_", "proc_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sfo", "rmat", "s_", "=_", "formats_", "._", "SES", "SION", "\\u", "FORMATS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tm", "ux", "\\u", "formats_", "=_", "[_", "'#", "{%", "s", "}'_", "%_", "format_", "for_", "format_", "in_", "sfo", "rmat", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sessions_", "=_", "proc_", "._", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "combin", "e", " ", "format", " ", "keys", " ", "with", " ", "values", " ", "return", "ed", " ", "from", " ", "``", "tm", "ux", " ", "list", "-", "windows", "``", "_", "\\u\\u\\uNL\\u\\u\\u_", "sessions_", "=_", "[_", "dict_", "(_", "zip_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "sfo", "rmat", "s_", ",_", "session_", "._", "split_", "(_", "'\\\\", "t", "'_", ")_", ")_", ")_", "for_", "session_", "in_", "sessions_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "clear", " ", "up", " ", "empty", " ", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "sessions_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "(_", "k_", ",_", "v_", ")_", "for_", "k_", ",_", "v_", "in_", "session_", "._", "items_", "(_", ")_", "if_", "v_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "session_", "in_", "sessions_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "sessions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server_", "(_", "Tm", "ux", "Relation", "al", "Object_", ",_", "Environ", "ment", "Mixin_", ")_", ":_", "\\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_", "\\u", "sessions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Proper", "ty", " ", "/", " ", "alias", " ", "to", " ", "return", " ", ":", "meth", ":`", "~", ".\\u", "list", "\\u", "session", "s", "`.\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "list", "\\u", "sessions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server_", "(_", "Tm", "ux", "Relation", "al", "Object_", ",_", "Environ", "ment", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "list", "\\u", "sessions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "list", " ", "of", " ", ":", "class", ":`", "Sess", "ion", "`", " ", "from", " ", "the", " ", "``", "tm", "ux", "(", "1", ")`", "`", " ", "session", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "py", ":", "obj", ":`", "list", "`", " ", "of", " ", ":", "class", ":`", "Sess", "ion", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Session_", "(_", "server_", "=_", "self_", ",_", "**_", "s_", ")_", "for_", "s_", "in_", "self_", "._", "\\u", "sessions_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server_", "(_", "Tm", "ux", "Relation", "al", "Object_", ",_", "Environ", "ment", "Mixin_", ")_", ":_", "\\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_", "sessions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Proper", "ty", " ", "/", " ", "alias", " ", "to", " ", "return", " ", ":", "meth", ":`", "~", ".", "list", "\\u", "session", "s", "`.\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "list", "\\u", "sessions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server_", "(_", "Tm", "ux", "Relation", "al", "Object_", ",_", "Environ", "ment", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "list", "\\u", "windows_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "list", " ", "of", " ", "windows", " ", "in", " ", ":", "py", ":", "obj", ":`", "dict", "`", " ", "form", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Retrieve", "d", " ", "from", " ", "``", "$", " ", "tm", "ux", "(", "1", ")", " ", "list", "-", "windows", "``", " ", "stdout", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", ":", "py", ":", "obj", ":`", "list", "`", " ", "is", " ", "derive", "d", " ", "from", " ", "``", "stdout", "``", " ", "in", " ", ":", "class", ":`", "util", ".", "tm", "ux", "\\u", "cmd", "`", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "wrap", "s", " ", ":", "py", ":", "class", ":`", "subproc", "ess", ".", "Pop", "en", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "list", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wf", "ormat", "s_", "=_", "[_", "'", "session", "\\u", "name", "'_", ",_", "'", "session", "\\u", "id", "'_", "]_", "+_", "formats_", "._", "WIND", "OW", "\\u", "FORMATS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tm", "ux", "\\u", "formats_", "=_", "[_", "'#", "{%", "s", "}'_", "%_", "format_", "for_", "format_", "in_", "wf", "ormat", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proc_", "=_", "self_", "._", "cmd_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "list", "-", "windows", "'_", ",_", "#", " ", "``", "tm", "ux", " ", "list", "-", "windows", "``", "_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "F", "%", "s", "'_", "%_", "'\\\\", "t", "'_", "._", "join_", "(_", "tm", "ux", "\\u", "formats_", ")_", ",_", "#", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "proc_", "._", "stderr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Tm", "ux", "p", "Exception_", "(_", "proc_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "windows_", "=_", "proc_", "._", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wf", "ormat", "s_", "=_", "[_", "'", "session", "\\u", "name", "'_", ",_", "'", "session", "\\u", "id", "'_", "]_", "+_", "formats_", "._", "WIND", "OW", "\\u", "FORMATS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "combin", "e", " ", "format", " ", "keys", " ", "with", " ", "values", " ", "return", "ed", " ", "from", " ", "``", "tm", "ux", " ", "list", "-", "windows", "``", "_", "\\u\\u\\uNL\\u\\u\\u_", "windows_", "=_", "[_", "dict_", "(_", "zip_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "wf", "ormat", "s_", ",_", "window_", "._", "split_", "(_", "'\\\\", "t", "'_", ")_", ")_", ")_", "for_", "window_", "in_", "windows_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "clear", " ", "up", " ", "empty", " ", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "windows_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "(_", "k_", ",_", "v_", ")_", "for_", "k_", ",_", "v_", "in_", "window_", "._", "items_", "(_", ")_", "if_", "v_", ")_", "for_", "window_", "in_", "windows_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tm", "ux", " ", "<", " ", "1.8", " ", "doe", "sn", "'", "t", " ", "have", " ", "window", "\\u", "id", ",", " ", "use", " ", "window", "\\u", "name_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "w_", "in_", "windows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "'", "window", "\\u", "id", "'_", "in_", "w_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w_", "[_", "'", "window", "\\u", "id", "'_", "]_", "=_", "w_", "[_", "'", "window", "\\u", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "windows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "windows_", "[_", ":_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "windows_", "._", "extend_", "(_", "windows_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "windows_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server_", "(_", "Tm", "ux", "Relation", "al", "Object_", ",_", "Environ", "ment", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "update", "\\u", "windows_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", " ", "internal", " ", "window", " ", "data", " ", "and", " ", "return", " ", "``", "self", "``", " ", "for", " ", "chain", "abilit", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "class", ":`", "Server", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "list", "\\u", "windows_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server_", "(_", "Tm", "ux", "Relation", "al", "Object_", ",_", "Environ", "ment", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "list", "\\u", "pane", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "list", " ", "of", " ", "pane", "s", " ", "in", " ", ":", "py", ":", "obj", ":`", "dict", "`", " ", "form", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Retrieve", "d", " ", "from", " ", "``", "$", " ", "tm", "ux", "(", "1", ")", " ", "list", "-", "pane", "s", "``", " ", "stdout", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", ":", "py", ":", "obj", ":`", "list", "`", " ", "is", " ", "derive", "d", " ", "from", " ", "``", "stdout", "``", " ", "in", " ", ":", "class", ":`", "util", ".", "tm", "ux", "\\u", "cmd", "`", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "wrap", "s", " ", ":", "py", ":", "class", ":`", "subproc", "ess", ".", "Pop", "en", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "list", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pfo", "rmat", "s_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "session", "\\u", "name", "'_", ",_", "'", "session", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "window", "\\u", "index", "'_", ",_", "'", "window", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "window", "\\u", "name", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "+_", "formats_", "._", "PAN", "E", "\\u", "FORMATS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tm", "ux", "\\u", "formats_", "=_", "[_", "'#", "{%", "s", "}\\\\", "t", "'_", "%_", "f_", "for_", "f_", "in_", "pfo", "rmat", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proc_", "=_", "self_", "._", "cmd_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "list", "-", "pane", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "F", "%", "s", "'_", "%_", "''_", "._", "join_", "(_", "tm", "ux", "\\u", "formats_", ")_", ",_", "#", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "proc_", "._", "stderr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Tm", "ux", "p", "Exception_", "(_", "proc_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pane", "s_", "=_", "proc_", "._", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pfo", "rmat", "s_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "session", "\\u", "name", "'_", ",_", "'", "session", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "window", "\\u", "index", "'_", ",_", "'", "window", "\\u", "id", "'_", ",_", "'", "window", "\\u", "name", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "+_", "formats_", "._", "PAN", "E", "\\u", "FORMATS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "combin", "e", " ", "format", " ", "keys", " ", "with", " ", "values", " ", "return", "ed", " ", "from", " ", "``", "tm", "ux", " ", "list", "-", "pane", "s", "``", "_", "\\u\\u\\uNL\\u\\u\\u_", "pane", "s_", "=_", "[_", "dict_", "(_", "zip_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pfo", "rmat", "s_", ",_", "window_", "._", "split_", "(_", "'\\\\", "t", "'_", ")_", ")_", ")_", "for_", "window_", "in_", "pane", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "clear", " ", "up", " ", "empty", " ", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "pane", "s_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "(_", "k_", ",_", "v_", ")_", "for_", "k_", ",_", "v_", "in_", "window_", "._", "items_", "(_", ")_", "if_", "v_", ")_", "for_", "window_", "in_", "pane", "s_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "pane", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "pane", "s_", "[_", ":_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "pane", "s_", "._", "extend_", "(_", "pane", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "\\u", "pane", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server_", "(_", "Tm", "ux", "Relation", "al", "Object_", ",_", "Environ", "ment", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "update", "\\u", "pane", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", " ", "internal", " ", "pane", " ", "data", " ", "and", " ", "return", " ", "``", "self", "``", " ", "for", " ", "chain", "abilit", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "class", ":`", "Server", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "list", "\\u", "pane", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server_", "(_", "Tm", "ux", "Relation", "al", "Object_", ",_", "Environ", "ment", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "attache", "d\\u", "sessions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "active", " ", ":", "class", ":`", "Sess", "ion", "`", " ", "object", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "will", " ", "not", " ", "work", " ", "where", " ", "multiple", " ", "tm", "ux", " ", "session", "s", " ", "are", " ", "attache", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "py", ":", "obj", ":`", "list", "`", " ", "of", " ", ":", "class", ":`", "Sess", "ion", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sessions_", "=_", "self_", "._", "\\u", "sessions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attache", "d\\u", "sessions_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "session_", "in_", "sessions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "session", "\\u", "attache", "d", "'_", "in_", "session_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "now", " ", "session", "\\u", "active", " ", "is", " ", "a", " ", "unicode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "session_", "._", "get_", "(_", "'", "session", "\\u", "attache", "d", "'_", ")_", "==_", "'", "1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logger_", "._", "debug_", "(_", "'", "session", " ", "%", "s", " ", "attache", "d", "'_", ",_", "session_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "session", "\\u", "name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attache", "d\\u", "sessions_", "._", "append_", "(_", "session_", ")_", "\\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_", "return_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Session_", "(_", "server_", "=_", "self_", ",_", "**_", "s_", ")_", "for_", "s_", "in_", "attache", "d\\u", "sessions_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "or_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server_", "(_", "Tm", "ux", "Relation", "al", "Object_", ",_", "Environ", "ment", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "has", "\\u", "session_", "(_", "self_", ",_", "target", "\\u", "session_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "Tru", "e", " ", "if", " ", "session", " ", "exist", "s", ".", " ", "``", "$", " ", "tm", "ux", " ", "has", "-", "session", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", ":", " ", "target", "\\u", "session", ":", " ", "str", " ", "of", " ", "session", " ", "name", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", "bool", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proc_", "=_", "self_", "._", "cmd_", "(_", "'", "has", "-", "session", "'_", ",_", "'-", "t", "%", "s", "'_", "%_", "target", "\\u", "session_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "proc_", "._", "stdout_", "==_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "any_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "in_", "proc_", "._", "stdout_", "for_", "x_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "fail", "ed", " ", "to", " ", "connect", " ", "to", " ", "server", "'_", ",_", "'", "error", " ", "connecti", "ng", " ", "to", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\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_", "elif_", "'", "no", " ", "server", " ", "runn", "ing", "'_", "in_", "proc_", "._", "stdout_", ":_", "#", " ", "tm", "ux", " ", "2.0_", "\\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_", "elif_", "'", "can", "\\\\'", "t", " ", "find", " ", "session", "'_", "in_", "proc_", "._", "stdout_", ":_", "#", " ", "tm", "ux", " ", "2.1_", "\\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_", "elif_", "'", "session", " ", "not", " ", "found", "'_", "in_", "proc_", "._", "stdout_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server_", "(_", "Tm", "ux", "Relation", "al", "Object_", ",_", "Environ", "ment", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "kill", "\\u", "server_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "``", "$", " ", "tm", "ux", " ", "kill", "-", "server", "``.", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cmd_", "(_", "'", "kill", "-", "server", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server_", "(_", "Tm", "ux", "Relation", "al", "Object_", ",_", "Environ", "ment", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "kill", "\\u", "session_", "(_", "self_", ",_", "target", "\\u", "session_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Kill", " ", "the", " ", "tm", "ux", " ", "session", " ", "with", " ", "``", "$", " ", "tm", "ux", " ", "kill", "-", "session", "``", ",", " ", "return", " ", "``", "self", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", ":", " ", "target", "\\u", "session", ":", " ", "str", ".", " ", "note", " ", "this", " ", "accepts", " ", "``", "fnmatch", "(", "3", ")``.", " ", "'", "asd", "f", "'", "\\", "10", ";", " ", " ", " ", " ", "will", " ", "kill", " ", "'", "asd", "fas", "d", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "class", ":`", "Server", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "=_", "self_", "._", "cmd_", "(_", "'", "kill", "-", "session", "'_", ",_", "'-", "t", "%", "s", "'_", "%_", "target", "\\u", "session_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "proc_", "._", "stderr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Tm", "ux", "p", "Exception_", "(_", "proc_", "._", "stderr_", ")_", "\\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_", "Server_", "(_", "Tm", "ux", "Relation", "al", "Object_", ",_", "Environ", "ment", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "switch", "\\u", "client_", "(_", "self_", ",_", "target", "\\u", "session_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "``", "$", " ", "tm", "ux", " ", "switch", "-", "client", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", ":", " ", "target", "\\u", "session", ":", " ", "str", ".", " ", "name", " ", "of", " ", "the", " ", "session", ".", " ", "fnmatch", "(", "3", ")", " ", "works", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proc_", "=_", "self_", "._", "cmd_", "(_", "'", "switch", "-", "client", "'_", ",_", "'-", "t", "%", "s", "'_", "%_", "target", "\\u", "session_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "proc_", "._", "stderr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Tm", "ux", "p", "Exception_", "(_", "proc_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server_", "(_", "Tm", "ux", "Relation", "al", "Object_", ",_", "Environ", "ment", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "attach", "\\u", "session_", "(_", "self_", ",_", "target", "\\u", "session_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "``", "$", " ", "tm", "ux", " ", "attach", "-", "session", "``", " ", "aka", " ", "alias", ":", " ", "``", "$", " ", "tm", "ux", " ", "attach", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", ":", " ", "target", "\\u", "session", ":", " ", "str", ".", " ", "name", " ", "of", " ", "the", " ", "session", ".", " ", "fnmatch", "(", "3", ")", " ", "works", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tm", "ux", "\\u", "args_", "=_", "tuple_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "target", "\\u", "session_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tm", "ux", "\\u", "args_", "+=_", "(_", "'-", "t", "%", "s", "'_", "%_", "target", "\\u", "session_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "proc_", "=_", "self_", "._", "cmd_", "(_", "'", "attach", "-", "session", "'_", ",_", "*_", "tm", "ux", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "proc_", "._", "stderr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Tm", "ux", "p", "Exception_", "(_", "proc_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server_", "(_", "Tm", "ux", "Relation", "al", "Object_", ",_", "Environ", "ment", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "new", "\\u", "session_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "session", "\\u", "name_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kill", "\\u", "session_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attach_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "args_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", ":", "class", ":`", "Sess", "ion", "`", " ", "from", " ", " ", "``", "$", " ", "tm", "ux", " ", "new", "-", "session", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Us", "es", " ", "``-", "P", "``", " ", "flag", " ", "to", " ", "print", " ", "session", " ", "info", ",", " ", "``-", "F", "``", " ", "for", " ", "return", " ", "format", "ting", "\\", "10", ";", " ", " ", " ", " ", "return", "s", " ", "new", " ", "Sess", "ion", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "``", "$", " ", "tm", "ux", " ", "new", "-", "session", " ", "-", "d", "``", " ", "will", " ", "create", " ", "the", " ", "session", " ", "in", " ", "the", " ", "background", "\\", "10", ";", " ", " ", " ", " ", "``", "$", " ", "tm", "ux", " ", "new", "-", "session", " ", "-", "Ad", "``", " ", "will", " ", "move", " ", "to", " ", "the", " ", "session", " ", "name", " ", "if", " ", "it", " ", "alr", "ead", "y", "\\", "10", ";", " ", " ", " ", " ", "exist", "s", ".", " ", "todo", ":", " ", "make", " ", "an", " ", "option", " ", "to", " ", "handle", " ", "this", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "session", "\\u", "name", ":", " ", "session", " ", "name", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "$", " ", "tm", "ux", " ", "new", "-", "session", " ", "-", "s", " ", "<", "session", "\\u", "name", ">", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "session", "\\u", "name", ":", " ", "string", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "attach", ":", " ", "create", " ", "session", " ", "in", " ", "the", " ", "fore", "ground", ".", " ", "``", "attach", "=", "Fal", "se", "``", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "equivalent", " ", "to", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "$", " ", "tm", "ux", " ", "new", "-", "session", " ", "-", "d", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "attach", ":", " ", "bool", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "kill", "\\u", "session", ":", " ", "Kill", " ", "current", " ", "session", " ", "if", " ", "``", "$", " ", "tm", "ux", " ", "has", "-", "session", "``", "\\", "10", ";", " ", " ", " ", "Us", "efu", "l", " ", "for", " ", "testi", "ng", " ", "workspaces", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "kill", "\\u", "session", ":", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", ":", "rty", "pe", ":", " ", ":", "class", ":`", "Sess", "ion", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "session_", "(_", "session", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "kill", "\\u", "session_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cmd_", "(_", "'", "kill", "-", "session", "'_", ",_", "'-", "t", "%", "s", "'_", "%_", "session", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "info_", "(_", "'", "session", " ", "%", "s", " ", "exist", "s", ".", " ", "kille", "d", " ", "it", ".'_", "%_", "session", "\\u", "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 ", " _", "raise_", "exc_", "._", "Tm", "ux", "Sess", "ion", "Exists_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Sess", "ion", " ", "named", " ", "%", "s", " ", "exist", "s", "'_", "%_", "session", "\\u", "name_", "\\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_", "logger_", "._", "debug_", "(_", "'", "creati", "ng", " ", "session", " ", "%", "s", "'_", "%_", "session", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sfo", "rmat", "s_", "=_", "formats_", "._", "SES", "SION", "\\u", "FORMATS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tm", "ux", "\\u", "formats_", "=_", "[_", "'#", "{%", "s", "}'_", "%_", "f_", "for_", "f_", "in_", "sfo", "rmat", "s_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "TM", "UX", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "env_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "os_", "._", "environ_", "[_", "'", "TM", "UX", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tm", "ux", "\\u", "args_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "s", "%", "s", "'_", "%_", "session", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "P", "'_", ",_", "'-", "F", "%", "s", "'_", "%_", "'\\\\", "t", "'_", "._", "join_", "(_", "tm", "ux", "\\u", "formats_", ")_", ",_", "#", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "attach_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tm", "ux", "\\u", "args_", "+=_", "(_", "'-", "d", "'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "proc_", "=_", "self_", "._", "cmd_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "new", "-", "session", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "tm", "ux", "\\u", "args_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "proc_", "._", "stderr_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "Tm", "ux", "p", "Exception_", "(_", "proc_", "._", "stderr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "session_", "=_", "proc_", "._", "stdout_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "env_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "environ_", "[_", "'", "TM", "UX", "'_", "]_", "=_", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "combin", "e", " ", "format", " ", "keys", " ", "with", " ", "values", " ", "return", "ed", " ", "from", " ", "``", "tm", "ux", " ", "list", "-", "windows", "``", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "session_", "=_", "dict_", "(_", "zip_", "(_", "sfo", "rmat", "s_", ",_", "session_", "._", "split_", "(_", "'\\\\", "t", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "clear", " ", "up", " ", "empty", " ", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "session_", "=_", "dict_", "(_", "(_", "k_", ",_", "v_", ")_", "for_", "k_", ",_", "v_", "in_", "session_", "._", "items_", "(_", ")_", "if_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "session_", "=_", "Session_", "(_", "server_", "=_", "self_", ",_", "**_", "session_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "session_" ]
[ 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 ]
Unused local variable
google/simian/src/tests/simian/auth/util_test.py
[ { "content": " def tearDown(self):\n self.mox.UnsetStubs()\n self.stubs.UnsetAll()", "metadata": "root.SettingsModuleTest.tearDown", "header": "['class', 'SettingsModuleTest', '(', 'mox', '.', 'MoxTestBase', ')', ':', '___EOS___']", "index": 38 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Sett", "ings", "Modul", "e", "Test_", "(_", "mox_", "._", "Mo", "x", "Test", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mox_", "._", "Unse", "t", "Stu", "bs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stubs_", "._", "Unse", "t", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
AppScale/appscale/AppServer/google/appengine/ext/endpoints/users_id_token.py
[ { "content": "def _verify_signed_jwt_with_certs(\n jwt, time_now, cache,\n cert_uri=_DEFAULT_CERT_URI):\n \"\"\"Verify a JWT against public certs.\n\n See http://self-issued.info/docs/draft-jones-json-web-token.html.\n\n The PyCrypto library included with Google App Engine is severely limited and\n so you have to use it very carefully to verify JWT signatures. The first\n issue is that the library can't read X.509 files, so we make a call to a\n special URI that has the public cert in modulus/exponent form in JSON.\n\n The second issue is that the RSA.verify method doesn't work, at least for\n how the JWT tokens are signed, so we have to manually verify the signature\n of the JWT, which means hashing the signed part of the JWT and comparing\n that to the signature that's been encrypted with the public key.\n\n Args:\n jwt: string, A JWT.\n time_now: The current time, as a long (eg. long(time.time())).\n cache: Cache to use (eg. the memcache module).\n cert_uri: string, URI to get cert modulus and exponent in JSON format.\n\n Returns:\n dict, The deserialized JSON payload in the JWT.\n\n Raises:\n _AppIdentityError: if any checks are failed.\n \"\"\"\n\n segments = jwt.split('.')\n\n if len(segments) != 3:\n raise _AppIdentityError('Wrong number of segments in token: %s' % jwt)\n signed = '%s.%s' % (segments[0], segments[1])\n\n signature = _urlsafe_b64decode(segments[2])\n\n\n\n lsignature = long(signature.encode('hex'), 16)\n\n\n header_body = _urlsafe_b64decode(segments[0])\n try:\n header = json.loads(header_body)\n except:\n raise _AppIdentityError('Can\\'t parse header: %s' % header_body)\n if header.get('alg') != 'RS256':\n raise _AppIdentityError('Unexpected encryption algorithm: %s' %\n header.get('alg'))\n\n\n json_body = _urlsafe_b64decode(segments[1])\n try:\n parsed = json.loads(json_body)\n except:\n raise _AppIdentityError('Can\\'t parse token: %s' % json_body)\n\n certs = _get_cached_certs(cert_uri, cache)\n if certs is None:\n raise _AppIdentityError(\n 'Unable to retrieve certs needed to verify the signed JWT: %s' % jwt)\n\n\n\n if not _CRYPTO_LOADED:\n raise _AppIdentityError('Unable to load pycrypto library. Can\\'t verify '\n 'id_token signature. See http://www.pycrypto.org '\n 'for more information on pycrypto.')\n\n\n verified = False\n for keyvalue in certs['keyvalues']:\n modulus = _b64_to_long(keyvalue['modulus'])\n exponent = _b64_to_long(keyvalue['exponent'])\n key = RSA.construct((modulus, exponent))\n\n\n\n local_hash = SHA256.new(signed).hexdigest()\n local_hash = local_hash.zfill(64)\n\n\n hexsig = '%064x' % key.encrypt(lsignature, '')[0]\n\n verified = (hexsig[-64:] == local_hash)\n if verified:\n break\n if not verified:\n raise _AppIdentityError('Invalid token signature: %s' % jwt)\n\n\n iat = parsed.get('iat')\n if iat is None:\n raise _AppIdentityError('No iat field in token: %s' % json_body)\n earliest = iat - _CLOCK_SKEW_SECS\n\n\n exp = parsed.get('exp')\n if exp is None:\n raise _AppIdentityError('No exp field in token: %s' % json_body)\n if exp >= time_now + _MAX_TOKEN_LIFETIME_SECS:\n raise _AppIdentityError('exp field too far in future: %s' % json_body)\n latest = exp + _CLOCK_SKEW_SECS\n\n if time_now < earliest:\n raise _AppIdentityError('Token used too early, %d < %d: %s' %\n (time_now, earliest, json_body))\n if time_now > latest:\n raise _AppIdentityError('Token used too late, %d > %d: %s' %\n (time_now, latest, json_body))\n\n return parsed", "metadata": "root._verify_signed_jwt_with_certs", "header": "['module', '___EOS___']", "index": 438 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "verify", "\\u", "sign", "ed", "\\u", "jw", "t", "\\u", "with", "\\u", "certs_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "jwt_", ",_", "time", "\\u", "now_", ",_", "cache_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cert", "\\u", "uri_", "=_", "\\u", "DEF", "AUL", "T", "\\u", "CERT", "\\u", "URI_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Verify", " ", "a", " ", "JW", "T", " ", "against", " ", "public", " ", "cert", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "See", " ", "http", "://", "self", "-", "issue", "d", ".", "info", "/", "docs", "/", "draft", "-", "jon", "es", "-", "json", "-", "web", "-", "token", ".", "html", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", " ", "Py", "Crypto", " ", "librar", "y", " ", "include", "d", " ", "with", " ", "Goo", "gle", " ", "App", " ", "Engine", " ", "is", " ", "sever", "el", "y", " ", "limited", " ", "and", "\\", "10", ";", " ", " ", "so", " ", "you", " ", "have", " ", "to", " ", "use", " ", "it", " ", "very", " ", "care", "full", "y", " ", "to", " ", "verify", " ", "JW", "T", " ", "signa", "tures", ".", " ", "The", " ", "first", "\\", "10", ";", " ", " ", "issue", " ", "is", " ", "tha", "t", " ", "the", " ", "librar", "y", " ", "can", "'", "t", " ", "read", " ", "X", ".5", "09", " ", "files", ",", " ", "so", " ", "we", " ", "make", " ", "a", " ", "call", " ", "to", " ", "a", "\\", "10", ";", " ", " ", "special", " ", "URI", " ", "tha", "t", " ", "has", " ", "the", " ", "public", " ", "cert", " ", "in", " ", "modulus", "/", "expon", "ent", " ", "form", " ", "in", " ", "JSO", "N", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", " ", "second", " ", "issue", " ", "is", " ", "tha", "t", " ", "the", " ", "RSA", ".", "verify", " ", "method", " ", "doe", "sn", "'", "t", " ", "work", ",", " ", "at", " ", "leas", "t", " ", "for", "\\", "10", ";", " ", " ", "how", " ", "the", " ", "JW", "T", " ", "token", "s", " ", "are", " ", "sign", "ed", ",", " ", "so", " ", "we", " ", "have", " ", "to", " ", "manu", "ally", " ", "verify", " ", "the", " ", "signa", "ture", "\\", "10", ";", " ", " ", "of", " ", "the", " ", "JW", "T", ",", " ", "whi", "ch", " ", "means", " ", "hashin", "g", " ", "the", " ", "sign", "ed", " ", "part", " ", "of", " ", "the", " ", "JW", "T", " ", "and", " ", "compa", "ring", "\\", "10", ";", " ", " ", "tha", "t", " ", "to", " ", "the", " ", "signa", "ture", " ", "tha", "t", "'", "s", " ", "bee", "n", " ", "encrypt", "ed", " ", "with", " ", "the", " ", "public", " ", "key", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "jw", "t", ":", " ", "string", ",", " ", "A", " ", "JW", "T", ".", "\\", "10", ";", " ", " ", " ", " ", "time", "\\u", "now", ":", " ", "The", " ", "current", " ", "time", ",", " ", "as", " ", "a", " ", "long", " ", "(", "eg", ".", " ", "long", "(", "time", ".", "time", "())", ").", "\\", "10", ";", " ", " ", " ", " ", "cache", ":", " ", "Cache", " ", "to", " ", "use", " ", "(", "eg", ".", " ", "the", " ", "memc", "ache", " ", "module", ").", "\\", "10", ";", " ", " ", " ", " ", "cert", "\\u", "uri", ":", " ", "string", ",", " ", "URI", " ", "to", " ", "get", " ", "cert", " ", "modulus", " ", "and", " ", "expon", "ent", " ", "in", " ", "JSO", "N", " ", "format", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "dict", ",", " ", "The", " ", "deserialized", " ", "JSO", "N", " ", "payload", " ", "in", " ", "the", " ", "JW", "T", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "\\u", "App", "Ident", "it", "y", "Error", ":", " ", "if", " ", "any", " ", "checks", " ", "are", " ", "fail", "ed", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "segments_", "=_", "jwt_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "segments_", ")_", "!=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u", "App", "Ident", "it", "y", "Error_", "(_", "'", "Wro", "ng", " ", "number", " ", "of", " ", "segments", " ", "in", " ", "token", ":", " ", "%", "s", "'_", "%_", "jwt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "signed_", "=_", "'%", "s", ".", "%", "s", "'_", "%_", "(_", "segments_", "[_", "0_", "]_", ",_", "segments_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "signature_", "=_", "\\u", "urlsafe", "\\u", "b64decode_", "(_", "segments_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lsi", "gna", "ture_", "=_", "long_", "(_", "signature_", "._", "encode_", "(_", "'", "hex", "'_", ")_", ",_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "header", "\\u", "body_", "=_", "\\u", "urlsafe", "\\u", "b64decode_", "(_", "segments_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "header_", "=_", "json_", "._", "loads_", "(_", "header", "\\u", "body_", ")_", "\\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 ", " _", "raise_", "\\u", "App", "Ident", "it", "y", "Error_", "(_", "'", "Can", "\\\\'", "t", " ", "parse", " ", "header", ":", " ", "%", "s", "'_", "%_", "header", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "header_", "._", "get_", "(_", "'", "alg", "'_", ")_", "!=_", "'", "RS", "256", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u", "App", "Ident", "it", "y", "Error_", "(_", "'", "Une", "xpe", "cte", "d", " ", "encrypt", "ion", " ", "algo", "rit", "hm", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "header_", "._", "get_", "(_", "'", "alg", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "json", "\\u", "body_", "=_", "\\u", "urlsafe", "\\u", "b64decode_", "(_", "segments_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parsed_", "=_", "json_", "._", "loads_", "(_", "json", "\\u", "body_", ")_", "\\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 ", " _", "raise_", "\\u", "App", "Ident", "it", "y", "Error_", "(_", "'", "Can", "\\\\'", "t", " ", "parse", " ", "token", ":", " ", "%", "s", "'_", "%_", "json", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "certs_", "=_", "\\u", "get", "\\u", "cache", "d\\u", "certs_", "(_", "cert", "\\u", "uri_", ",_", "cache_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "certs_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u", "App", "Ident", "it", "y", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Una", "ble", " ", "to", " ", "retrieve", " ", "cert", "s", " ", "need", "ed", " ", "to", " ", "verify", " ", "the", " ", "sign", "ed", " ", "JW", "T", ":", " ", "%", "s", "'_", "%_", "jwt_", ")_", "\\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_", "not_", "\\u", "CRYPT", "O", "\\u", "LOAD", "ED_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u", "App", "Ident", "it", "y", "Error_", "(_", "'", "Una", "ble", " ", "to", " ", "load", " ", "pyc", "rypt", "o", " ", "librar", "y", ".", " ", " ", "Can", "\\\\'", "t", " ", "verify", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "\\u", "token", " ", "signa", "ture", ".", " ", " ", "See", " ", "http", "://", "www", ".", "pyc", "rypt", "o", ".", "org", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "for", " ", "more", " ", "informati", "on", " ", "on", " ", "pyc", "rypt", "o", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "verified_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "keyval", "ue_", "in_", "certs_", "[_", "'", "keyval", "ues", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "modulus", "_", "=_", "\\u", "b64", "\\u", "to", "\\u", "long_", "(_", "keyval", "ue_", "[_", "'", "modulus", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exponent_", "=_", "\\u", "b64", "\\u", "to", "\\u", "long_", "(_", "keyval", "ue_", "[_", "'", "expon", "ent", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "RSA", "_", "._", "construct_", "(_", "(_", "modulus", "_", ",_", "exponent_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "local", "\\u", "hash_", "=_", "SHA", "256_", "._", "new_", "(_", "signed_", ")_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "hash_", "=_", "local", "\\u", "hash_", "._", "zfill_", "(_", "64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hexs", "ig_", "=_", "'%", "064", "x", "'_", "%_", "key_", "._", "encrypt_", "(_", "lsi", "gna", "ture_", ",_", "''_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "verified_", "=_", "(_", "hexs", "ig_", "[_", "-_", "64_", ":_", "]_", "==_", "local", "\\u", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "verified_", ":_", "\\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_", "if_", "not_", "verified_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u", "App", "Ident", "it", "y", "Error_", "(_", "'", "Inva", "lid", " ", "token", " ", "signa", "ture", ":", " ", "%", "s", "'_", "%_", "jwt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "iat", "_", "=_", "parsed_", "._", "get_", "(_", "'", "iat", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "iat", "_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u", "App", "Ident", "it", "y", "Error_", "(_", "'", "No", " ", "iat", " ", "field", " ", "in", " ", "token", ":", " ", "%", "s", "'_", "%_", "json", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "earliest", "_", "=_", "iat", "_", "-_", "\\u", "CLOCK", "\\u", "SK", "EW", "\\u", "SEC", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exp_", "=_", "parsed_", "._", "get_", "(_", "'", "exp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "exp_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u", "App", "Ident", "it", "y", "Error_", "(_", "'", "No", " ", "exp", " ", "field", " ", "in", " ", "token", ":", " ", "%", "s", "'_", "%_", "json", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "exp_", ">=_", "time", "\\u", "now_", "+_", "\\u", "MAX", "\\u", "TOKEN", "\\u", "LIF", "ETI", "ME", "\\u", "SEC", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u", "App", "Ident", "it", "y", "Error_", "(_", "'", "exp", " ", "field", " ", "too", " ", "far", " ", "in", " ", "future", ":", " ", "%", "s", "'_", "%_", "json", "\\u", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "latest_", "=_", "exp_", "+_", "\\u", "CLOCK", "\\u", "SK", "EW", "\\u", "SEC", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "time", "\\u", "now_", "<_", "earliest", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u", "App", "Ident", "it", "y", "Error_", "(_", "'", "Token", " ", "used", " ", "too", " ", "ear", "ly", ",", " ", "%", "d", " ", "<", " ", "%", "d", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "time", "\\u", "now_", ",_", "earliest", "_", ",_", "json", "\\u", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "time", "\\u", "now_", ">_", "latest_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u", "App", "Ident", "it", "y", "Error_", "(_", "'", "Token", " ", "used", " ", "too", " ", "late", ",", " ", "%", "d", " ", ">", " ", "%", "d", ":", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "time", "\\u", "now_", ",_", "latest_", ",_", "json", "\\u", "body_", ")_", ")_", "\\u\\u\\uNEWLINE\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Missing call to `__init__` during object initialization
Eforcers/gae-flask-todo/lib/werkzeug/useragents.py
[ { "content": "class UserAgent(object):\n \"\"\"Represents a user agent. Pass it a WSGI environment or a user agent\n string and you can inspect some of the details from the user agent\n string via the attributes. The following attributes exist:\n\n .. attribute:: string\n\n the raw user agent string\n\n .. attribute:: platform\n\n the browser platform. The following platforms are currently\n recognized:\n\n - `aix`\n - `amiga`\n - `android`\n - `bsd`\n - `hpux`\n - `iphone`\n - `ipad`\n - `irix`\n - `linux`\n - `macos`\n - `sco`\n - `solaris`\n - `wii`\n - `windows`\n\n .. attribute:: browser\n\n the name of the browser. The following browsers are currently\n recognized:\n\n - `aol` *\n - `ask` *\n - `camino`\n - `chrome`\n - `firefox`\n - `galeon`\n - `google` *\n - `kmeleon`\n - `konqueror`\n - `links`\n - `lynx`\n - `msie`\n - `msn`\n - `netscape`\n - `opera`\n - `safari`\n - `seamonkey`\n - `webkit`\n - `yahoo` *\n\n (Browsers maked with a star (``*``) are crawlers.)\n\n .. attribute:: version\n\n the version of the browser\n\n .. attribute:: language\n\n the language of the browser\n \"\"\"\n\n _parser = UserAgentParser()\n\n\n\n\n\n __bool__ = __nonzero__\n", "metadata": "root.UserAgent", "header": "['module', '___EOS___']", "index": 91 }, { "content": " def __init__(self, environ_or_string):\n if isinstance(environ_or_string, dict):\n environ_or_string = environ_or_string.get('HTTP_USER_AGENT', '')\n self.string = environ_or_string\n self.platform, self.browser, self.version, self.language = \\\n self._parser(environ_or_string)", "metadata": "root.UserAgent.__init__", "header": "['class', 'UserAgent', '(', 'object', ')', ':', '___EOS___']", "index": 158 } ]
[]
[]
0
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[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_", "User", "Agent_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Represent", "s", " ", "a", " ", "user", " ", "agent", ".", " ", " ", "Pass", " ", "it", " ", "a", " ", "WS", "GI", " ", "environ", "ment", " ", "or", " ", "a", " ", "user", " ", "agent", "\\", "10", ";", " ", " ", " ", " ", "string", " ", "and", " ", "you", " ", "can", " ", "inspect", " ", "some", " ", "of", " ", "the", " ", "deta", "il", "s", " ", "from", " ", "the", " ", "user", " ", "agent", "\\", "10", ";", " ", " ", " ", " ", "string", " ", "via", " ", "the", " ", "attribute", "s", ".", " ", " ", "The", " ", "follow", "ing", " ", "attribute", "s", " ", "exist", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "attribute", "::", " ", "string", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "the", " ", "raw", " ", "user", " ", "agent", " ", "string", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "attribute", "::", " ", "platform", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "the", " ", "browse", "r", " ", "platform", ".", " ", " ", "The", " ", "follow", "ing", " ", "platform", "s", " ", "are", " ", "currentl", "y", "\\", "10", ";", " ", " ", " ", "recognize", "d", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "-", " ", " ", " ", "`", "ai", "x", "`", "\\", "10", ";", " ", " ", " ", "-", " ", " ", " ", "`", "ami", "ga", "`", "\\", "10", ";", " ", " ", " ", "-", " ", " ", " ", "`", "android", "`", "\\", "10", ";", " ", " ", " ", "-", " ", " ", " ", "`", "bsd", "`", "\\", "10", ";", " ", " ", " ", "-", " ", " ", " ", "`", "hp", "ux", "`", "\\", "10", ";", " ", " ", " ", "-", " ", " ", " ", "`", "iph", "one", "`", "\\", "10", ";", " ", " ", " ", "-", " ", " ", " ", "`", "ipa", "d", "`", "\\", "10", ";", " ", " ", " ", "-", " ", " ", " ", "`", "iri", "x", "`", "\\", "10", ";", " ", " ", " ", "-", " ", " ", " ", "`", "linux", "`", "\\", "10", ";", " ", " ", " ", "-", " ", " ", " ", "`", "macos", "`", "\\", "10", ";", " ", " ", " ", "-", " ", " ", " ", "`", "sco", "`", "\\", "10", ";", " ", " ", " ", "-", " ", " ", " ", "`", "solar", "is", "`", "\\", "10", ";", " ", " ", " ", "-", " ", " ", " ", "`", "wi", "i", "`", "\\", "10", ";", " ", " ", " ", "-", " ", " ", " ", "`", "windows", "`", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "attribute", "::", " ", "browse", "r", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "name", " ", "of", " ", "the", " ", "browse", "r", ".", " ", " ", "The", " ", "follow", "ing", " ", "browsers", " ", "are", " ", "currentl", "y", "\\", "10", ";", " ", " ", " ", " ", "recognize", "d", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", " ", "`", "ao", "l", "`", " ", "*", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", " ", "`", "ask", "`", " ", "*", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", " ", "`", "cam", "ino", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", " ", "`", "chrome", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", " ", "`", "firefox", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", " ", "`", "gal", "eon", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", " ", "`", "google", "`", " ", "*", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", " ", "`", "km", "ele", "on", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", " ", "`", "kon", "quer", "or", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", " ", "`", "link", "s", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", " ", "`", "ly", "nx", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", " ", "`", "msi", "e", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", " ", "`", "ms", "n", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", " ", "`", "nets", "cap", "e", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", " ", "`", "opera", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", " ", "`", "saf", "ari", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", " ", "`", "seam", "onk", "ey", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", " ", "`", "webkit", "`", "\\", "10", ";", " ", " ", " ", " ", "-", " ", " ", " ", "`", "ya", "hoo", "`", " ", "*", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "(", "Brows", "ers", " ", "maked", " ", "with", " ", "a", " ", "star", " ", "(", "``", "*", "``)", " ", "are", " ", "crawle", "rs", ".)", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "attribute", "::", " ", "version", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "version", " ", "of", " ", "the", " ", "browse", "r", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "attribute", "::", " ", "language", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "language", " ", "of", " ", "the", " ", "browse", "r", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "parser_", "=_", "User", "Agent", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "bool\\u", "\\u_", "=_", "\\u\\u", "nonzero\\u", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "User", "Agent_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "environ", "\\u", "or", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "environ", "\\u", "or", "\\u", "string_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "environ", "\\u", "or", "\\u", "string_", "=_", "environ", "\\u", "or", "\\u", "string_", "._", "get_", "(_", "'", "HTTP", "\\u", "USER", "\\u", "AGE", "NT", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "string_", "=_", "environ", "\\u", "or", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "platform_", ",_", "self_", "._", "browser_", ",_", "self_", "._", "version_", ",_", "self_", "._", "language_", "=_", "self_", "._", "\\u", "parser_", "(_", "environ", "\\u", "or", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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, 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 ]
Modification of parameter with default
VisTrails/VisTrails/vistrails/core/interpreter/cached.py
[ { "content": " def execute_pipeline(self, pipeline, tmp_id_to_module_map, \n persistent_to_tmp_id_map, **kwargs):\n def fetch(name, default):\n return kwargs.pop(name, default)\n controller = fetch('controller', None)\n locator = fetch('locator', None)\n current_version = fetch('current_version', None)\n view = fetch('view', DummyView())\n vistrail_variables = fetch('vistrail_variables', None)\n aliases = fetch('aliases', None)\n params = fetch('params', None)\n extra_info = fetch('extra_info', None)\n logger = fetch('logger', DummyLogController)\n sinks = fetch('sinks', None)\n reason = fetch('reason', None)\n actions = fetch('actions', None)\n module_executed_hook = fetch('module_executed_hook', [])\n done_summon_hooks = fetch('done_summon_hooks', [])\n clean_pipeline = fetch('clean_pipeline', False)\n stop_on_error = fetch('stop_on_error', True)\n parent_exec = fetch('parent_exec', None)\n job_monitor = fetch('job_monitor', None)\n\n if len(kwargs) > 0:\n raise VistrailsInternalError('Wrong parameters passed '\n 'to execute_pipeline: %s' % kwargs)\n\n # LOGGING SETUP\n def get_remapped_id(id):\n return persistent_to_tmp_id_map[id]\n\n logging_obj = ViewUpdatingLogController(\n logger=logger,\n view=view,\n remap_id=get_remapped_id,\n ids=pipeline.modules.keys(),\n module_executed_hook=module_executed_hook)\n\n # PARAMETER CHANGES SETUP\n parameter_changes = []\n def change_parameter(obj, name, value):\n parameter_changes.append((get_remapped_id(obj.id),\n name, value))\n def make_change_parameter(obj):\n return lambda *args: change_parameter(obj, *args)\n\n # Update **all** modules in the current pipeline\n for i, obj in tmp_id_to_module_map.iteritems():\n obj.in_pipeline = True # set flag to indicate in pipeline\n obj.logging = logging_obj\n obj.change_parameter = make_change_parameter(obj)\n \n # Update object pipeline information\n obj.moduleInfo['locator'] = locator\n obj.moduleInfo['version'] = current_version\n obj.moduleInfo['moduleId'] = i\n obj.moduleInfo['pipeline'] = pipeline\n obj.moduleInfo['controller'] = controller\n # extract job monitor from controller if this is the top level\n if controller:\n obj.moduleInfo['job_monitor'] = controller.jobMonitor\n else:\n obj.moduleInfo['job_monitor'] = job_monitor\n\n if extra_info is not None:\n obj.moduleInfo['extra_info'] = extra_info\n if reason is not None:\n obj.moduleInfo['reason'] = reason\n if actions is not None:\n obj.moduleInfo['actions'] = actions\n\n ## Checking 'sinks' from kwargs to resolve only requested sinks\n # Note that we accept any module in 'sinks', even if it's not actually\n # a sink in the graph\n if sinks is not None:\n persistent_sinks = [tmp_id_to_module_map[sink]\n for sink in sinks\n if sink in tmp_id_to_module_map]\n else:\n persistent_sinks = [tmp_id_to_module_map[sink]\n for sink in pipeline.graph.sinks()]\n\n self._streams.append(Generator.generators)\n Generator.generators = []\n\n # Update new sinks\n for obj in persistent_sinks:\n abort = False\n try:\n obj.update()\n continue\n except ModuleWasSuspended:\n continue\n except ModuleHadError:\n pass\n except AbortExecution:\n break\n except ModuleSuspended, ms:\n ms.module.logging.end_update(ms.module, ms,\n was_suspended=True)\n continue\n except ModuleErrors, mes:\n for me in mes.module_errors:\n me.module.logging.end_update(me.module, me)\n logging_obj.signalError(me.module, me)\n abort = abort or me.abort\n except ModuleError, me:\n me.module.logging.end_update(me.module, me, me.errorTrace)\n logging_obj.signalError(me.module, me)\n abort = me.abort\n except ModuleBreakpoint, mb:\n mb.module.logging.end_update(mb.module)\n logging_obj.signalError(mb.module, mb)\n abort = True\n if stop_on_error or abort:\n break\n\n # execute all generators until inputs are exhausted\n # this makes sure branching and multiple sinks are executed correctly\n if not logging_obj.errors and not logging_obj.suspended and \\\n Generator.generators:\n result = True\n abort = False\n while result is not None:\n try:\n for m in Generator.generators:\n result = m.generator.next()\n continue\n except AbortExecution:\n break\n except ModuleErrors, mes:\n for me in mes.module_errors:\n me.module.logging.end_update(me.module, me)\n logging_obj.signalError(me.module, me)\n abort = abort or me.abort\n except ModuleError, me:\n me.module.logging.end_update(me.module, me, me.errorTrace)\n logging_obj.signalError(me.module, me)\n abort = me.abort\n except ModuleBreakpoint, mb:\n mb.module.logging.end_update(mb.module)\n logging_obj.signalError(mb.module, mb)\n abort = True\n except Exception, e:\n debug.unexpected_exception(e)\n debug.critical(\"Exception running generators: %s\" % e,\n debug.format_exc())\n abort = True\n if stop_on_error or abort:\n break\n\n Generator.generators = self._streams.pop()\n\n if self.done_update_hook:\n self.done_update_hook(self._persistent_pipeline, self._objects)\n \n # objs, errs, and execs are mappings that use the local ids as keys,\n # as opposed to the persistent ids.\n # They are thus ideal to external consumption.\n objs = {}\n # dict([(i, self._objects[tmp_to_persistent_module_map[i]])\n # for i in tmp_to_persistent_module_map.keys()])\n errs = {}\n execs = {}\n suspends = {}\n caches = {}\n\n to_delete = []\n for (tmp_id, obj) in tmp_id_to_module_map.iteritems():\n if clean_pipeline:\n to_delete.append(obj.id)\n objs[tmp_id] = obj\n if obj.id in logging_obj.errors:\n errs[tmp_id] = logging_obj.errors[obj.id]\n if not clean_pipeline:\n to_delete.append(obj.id)\n executed = False\n if obj.id in logging_obj.executed:\n execs[tmp_id] = logging_obj.executed[obj.id]\n executed = True\n if obj.id in logging_obj.suspended:\n suspends[tmp_id] = logging_obj.suspended[obj.id]\n if not clean_pipeline:\n to_delete.append(obj.id)\n executed = True\n if obj.id in logging_obj.cached:\n caches[tmp_id] = logging_obj.cached[obj.id]\n executed = True\n if not executed:\n # these modules didn't execute\n execs[tmp_id] = False\n\n return (to_delete, objs, errs, execs, suspends, caches, parameter_changes)", "metadata": "root.CachedInterpreter.execute_pipeline", "header": "['class', 'CachedInterpreter', '(', 'vistrails', '.', 'core', '.', 'interpreter', '.', 'base', '.', 'BaseInterpreter', ')', ':', '___EOS___']", "index": 437 } ]
[]
[]
0
true
[ "[CLS]_", "Modifica", "tion_", "of_", "parameter_", "with_", "default_", "[SEP]_", "class_", "Cache", "d", "Interpreter_", "(_", "vist", "rail", "s_", "._", "core_", "._", "interpreter_", "._", "base_", "._", "Base", "Interpreter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute", "\\u", "pipeline_", "(_", "self_", ",_", "pipeline_", ",_", "tmp", "\\u", "id", "\\u", "to", "\\u", "module", "\\u", "map_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "persiste", "nt", "\\u", "to", "\\u", "tmp", "\\u", "id", "\\u", "map_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "fetch_", "(_", "name_", ",_", "default_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "kwargs_", "._", "pop_", "(_", "name_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "controller_", "=_", "fetch_", "(_", "'", "controlle", "r", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "locator_", "=_", "fetch_", "(_", "'", "locator", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "version_", "=_", "fetch_", "(_", "'", "current", "\\u", "version", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view_", "=_", "fetch_", "(_", "'", "view", "'_", ",_", "Du", "mm", "y", "View_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vist", "rail", "\\u", "variables_", "=_", "fetch_", "(_", "'", "vist", "rail", "\\u", "variab", "les", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aliases_", "=_", "fetch_", "(_", "'", "alias", "es", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "fetch_", "(_", "'", "params", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "info_", "=_", "fetch_", "(_", "'", "extra", "\\u", "info", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "fetch_", "(_", "'", "logg", "er", "'_", ",_", "Du", "mm", "y", "Log", "Controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sink", "s_", "=_", "fetch_", "(_", "'", "sink", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reason_", "=_", "fetch_", "(_", "'", "reason", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actions_", "=_", "fetch_", "(_", "'", "action", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u", "executed", "\\u", "hook_", "=_", "fetch_", "(_", "'", "module", "\\u", "executed", "\\u", "hook", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "don", "e\\u", "summ", "on", "\\u", "hooks_", "=_", "fetch_", "(_", "'", "don", "e\\u", "summ", "on", "\\u", "hook", "s", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clean", "\\u", "pipeline_", "=_", "fetch_", "(_", "'", "clean", "\\u", "pipeline", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "\\u", "on", "\\u", "error_", "=_", "fetch_", "(_", "'", "stop", "\\u", "on", "\\u", "error", "'_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent", "\\u", "exec_", "=_", "fetch_", "(_", "'", "parent", "\\u", "exec", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "monitor_", "=_", "fetch_", "(_", "'", "job", "\\u", "monit", "or", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "kwargs_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Vis", "trail", "s", "Intern", "al", "Error_", "(_", "'", "Wro", "ng", " ", "parameter", "s", " ", "pass", "ed", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "to", " ", "execute", "\\u", "pipeline", ":", " ", "%", "s", "'_", "%_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LOGGING", " ", "SETUP", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "remap", "ped", "\\u", "id_", "(_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "persiste", "nt", "\\u", "to", "\\u", "tmp", "\\u", "id", "\\u", "map_", "[_", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logg", "ing", "\\u", "obj_", "=_", "View", "Up", "dati", "ng", "Log", "Controller_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logger_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "view_", "=_", "view_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "remap", "\\u", "id_", "=_", "get", "\\u", "remap", "ped", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ids_", "=_", "pipeline_", "._", "modules_", "._", "keys_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "module", "\\u", "executed", "\\u", "hook_", "=_", "module", "\\u", "executed", "\\u", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PARAMETER", " ", "CHANGE", "S", " ", "SETUP", "_", "\\u\\u\\uNL\\u\\u\\u_", "parameter", "\\u", "changes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "change", "\\u", "parameter_", "(_", "obj_", ",_", "name_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameter", "\\u", "changes_", "._", "append_", "(_", "(_", "get", "\\u", "remap", "ped", "\\u", "id_", "(_", "obj_", "._", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "\\u", "change", "\\u", "parameter_", "(_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "lambda_", "*_", "args_", ":_", "change", "\\u", "parameter_", "(_", "obj_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "**", "all", "**", " ", "module", "s", " ", "in", " ", "the", " ", "current", " ", "pipeline_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", ",_", "obj_", "in_", "tmp", "\\u", "id", "\\u", "to", "\\u", "module", "\\u", "map_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "in", "\\u", "pipeline_", "=_", "True_", "#", " ", "set", " ", "flag", " ", "to", " ", "indicat", "e", " ", "in", " ", "pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "logging_", "=_", "logg", "ing", "\\u", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "change", "\\u", "parameter_", "=_", "make", "\\u", "change", "\\u", "parameter_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "object", " ", "pipeline", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "module", "Info_", "[_", "'", "locator", "'_", "]_", "=_", "locator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "module", "Info_", "[_", "'", "version", "'_", "]_", "=_", "current", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "module", "Info_", "[_", "'", "module", "Id", "'_", "]_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "module", "Info_", "[_", "'", "pipeline", "'_", "]_", "=_", "pipeline_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "module", "Info_", "[_", "'", "controlle", "r", "'_", "]_", "=_", "controller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "extract", " ", "job", " ", "monit", "or", " ", "from", " ", "controlle", "r", " ", "if", " ", "this", " ", "is", " ", "the", " ", "top", " ", "level_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "controller_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "module", "Info_", "[_", "'", "job", "\\u", "monit", "or", "'_", "]_", "=_", "controller_", "._", "job", "Monitor_", "\\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 ", " _", "obj_", "._", "module", "Info_", "[_", "'", "job", "\\u", "monit", "or", "'_", "]_", "=_", "job", "\\u", "monitor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "extra", "\\u", "info_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "module", "Info_", "[_", "'", "extra", "\\u", "info", "'_", "]_", "=_", "extra", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "reason_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "module", "Info_", "[_", "'", "reason", "'_", "]_", "=_", "reason_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "actions_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "module", "Info_", "[_", "'", "action", "s", "'_", "]_", "=_", "actions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Check", "ing", " ", "'", "sink", "s", "'", " ", "from", " ", "kwarg", "s", " ", "to", " ", "resolve", " ", "only", " ", "request", "ed", " ", "sink", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "we", " ", "accept", " ", "any", " ", "module", " ", "in", " ", "'", "sink", "s", "',", " ", "even", " ", "if", " ", "it", "'", "s", " ", "not", " ", "actual", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "sink", " ", "in", " ", "the", " ", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sink", "s_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "persiste", "nt", "\\u", "sink", "s_", "=_", "[_", "tmp", "\\u", "id", "\\u", "to", "\\u", "module", "\\u", "map_", "[_", "sink_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "sink_", "in_", "sink", "s_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sink_", "in_", "tmp", "\\u", "id", "\\u", "to", "\\u", "module", "\\u", "map_", "]_", "\\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 ", " _", "persiste", "nt", "\\u", "sink", "s_", "=_", "[_", "tmp", "\\u", "id", "\\u", "to", "\\u", "module", "\\u", "map_", "[_", "sink_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "sink_", "in_", "pipeline_", "._", "graph_", "._", "sink", "s_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "streams_", "._", "append_", "(_", "Generator_", "._", "generators_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Generator_", "._", "generators_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "new", " ", "sink", "s_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "obj_", "in_", "persiste", "nt", "\\u", "sink", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "abort_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Modul", "e", "Wa", "s", "Suspend", "ed_", ":_", "\\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_", "except_", "Modul", "e", "Had", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Abo", "rt", "Execution_", ":_", "\\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_", "except_", "Modul", "e", "Suspend", "ed_", ",_", "ms_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ms_", "._", "module_", "._", "logging_", "._", "end", "\\u", "update_", "(_", "ms_", "._", "module_", ",_", "ms_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "was", "\\u", "suspended", "_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Modul", "e", "Errors_", ",_", "mes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "me_", "in_", "mes_", "._", "module", "\\u", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "me_", "._", "module_", "._", "logging_", "._", "end", "\\u", "update_", "(_", "me_", "._", "module_", ",_", "me_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "ing", "\\u", "obj_", "._", "signal", "Error_", "(_", "me_", "._", "module_", ",_", "me_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "=_", "abort_", "or_", "me_", "._", "abort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Modul", "e", "Error_", ",_", "me_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "me_", "._", "module_", "._", "logging_", "._", "end", "\\u", "update_", "(_", "me_", "._", "module_", ",_", "me_", ",_", "me_", "._", "error", "Trace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "ing", "\\u", "obj_", "._", "signal", "Error_", "(_", "me_", "._", "module_", ",_", "me_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "=_", "me_", "._", "abort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Modul", "e", "Breakpoint", "_", ",_", "mb_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mb_", "._", "module_", "._", "logging_", "._", "end", "\\u", "update_", "(_", "mb_", "._", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "ing", "\\u", "obj_", "._", "signal", "Error_", "(_", "mb_", "._", "module_", ",_", "mb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stop", "\\u", "on", "\\u", "error_", "or_", "abort_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "execute", " ", "all", " ", "generat", "ors", " ", "unti", "l", " ", "inputs", " ", "are", " ", "exhaust", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "make", "s", " ", "sure", " ", "branch", "ing", " ", "and", " ", "multiple", " ", "sink", "s", " ", "are", " ", "executed", " ", "correct", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "logg", "ing", "\\u", "obj_", "._", "errors_", "and_", "not_", "logg", "ing", "\\u", "obj_", "._", "suspended", "_", "and_", "Generator_", "._", "generators_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "result_", "is_", "not_", "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 ", " ", "_", "for_", "m_", "in_", "Generator_", "._", "generators_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "result_", "=_", "m_", "._", "generator_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Abo", "rt", "Execution_", ":_", "\\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_", "except_", "Modul", "e", "Errors_", ",_", "mes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "me_", "in_", "mes_", "._", "module", "\\u", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "me_", "._", "module_", "._", "logging_", "._", "end", "\\u", "update_", "(_", "me_", "._", "module_", ",_", "me_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "ing", "\\u", "obj_", "._", "signal", "Error_", "(_", "me_", "._", "module_", ",_", "me_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "=_", "abort_", "or_", "me_", "._", "abort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Modul", "e", "Error_", ",_", "me_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "me_", "._", "module_", "._", "logging_", "._", "end", "\\u", "update_", "(_", "me_", "._", "module_", ",_", "me_", ",_", "me_", "._", "error", "Trace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "ing", "\\u", "obj_", "._", "signal", "Error_", "(_", "me_", "._", "module_", ",_", "me_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "=_", "me_", "._", "abort_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Modul", "e", "Breakpoint", "_", ",_", "mb_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mb_", "._", "module_", "._", "logging_", "._", "end", "\\u", "update_", "(_", "mb_", "._", "module_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logg", "ing", "\\u", "obj_", "._", "signal", "Error_", "(_", "mb_", "._", "module_", ",_", "mb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "=_", "True_", "\\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 ", " ", "_", "debug_", "._", "unexpected", "\\u", "exception_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug_", "._", "critical_", "(_", "\"", "Except", "ion", " ", "runn", "ing", " ", "generat", "ors", ":", " ", "%", "s", "\"_", "%_", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "debug_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "abort_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "stop", "\\u", "on", "\\u", "error_", "or_", "abort_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Generator_", "._", "generators_", "=_", "self_", "._", "\\u", "streams_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "don", "e\\u", "update", "\\u", "hook_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "don", "e\\u", "update", "\\u", "hook_", "(_", "self_", "._", "\\u", "persiste", "nt", "\\u", "pipeline_", ",_", "self_", "._", "\\u", "objects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "objs", ",", " ", "err", "s", ",", " ", "and", " ", "exec", "s", " ", "are", " ", "mapping", "s", " ", "tha", "t", " ", "use", " ", "the", " ", "local", " ", "ids", " ", "as", " ", "keys", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "oppo", "sed", " ", "to", " ", "the", " ", "persiste", "nt", " ", "ids", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", "y", " ", "are", " ", "thu", "s", " ", "ideal", " ", "to", " ", "external", " ", "consum", "ption", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "objs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "dict", "([(", "i", ",", " ", "self", ".\\u", "object", "s", "[", "tmp", "\\u", "to", "\\u", "persiste", "nt", "\\u", "module", "\\u", "map", "[", "i", "]])", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "for", " ", "i", " ", "in", " ", "tmp", "\\u", "to", "\\u", "persiste", "nt", "\\u", "module", "\\u", "map", ".", "keys", "()]", ")_", "\\u\\u\\uNL\\u\\u\\u_", "errs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suspend", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "caches_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "to", "\\u", "delete_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "tmp", "\\u", "id_", ",_", "obj_", ")_", "in_", "tmp", "\\u", "id", "\\u", "to", "\\u", "module", "\\u", "map_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "clean", "\\u", "pipeline_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "delete_", "._", "append_", "(_", "obj_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "objs_", "[_", "tmp", "\\u", "id_", "]_", "=_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "._", "id_", "in_", "logg", "ing", "\\u", "obj_", "._", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errs_", "[_", "tmp", "\\u", "id_", "]_", "=_", "logg", "ing", "\\u", "obj_", "._", "errors_", "[_", "obj_", "._", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "clean", "\\u", "pipeline_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "to", "\\u", "delete_", "._", "append_", "(_", "obj_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "executed", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", "._", "id_", "in_", "logg", "ing", "\\u", "obj_", "._", "executed", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec", "s_", "[_", "tmp", "\\u", "id_", "]_", "=_", "logg", "ing", "\\u", "obj_", "._", "executed", "_", "[_", "obj_", "._", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "executed", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "obj_", "._", "id_", "in_", "logg", "ing", "\\u", "obj_", "._", "suspended", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suspend", "s_", "[_", "tmp", "\\u", "id_", "]_", "=_", "logg", "ing", "\\u", "obj_", "._", "suspended", "_", "[_", "obj_", "._", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "clean", "\\u", "pipeline_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "to", "\\u", "delete_", "._", "append_", "(_", "obj_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "executed", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "obj_", "._", "id_", "in_", "logg", "ing", "\\u", "obj_", "._", "cached_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "caches_", "[_", "tmp", "\\u", "id_", "]_", "=_", "logg", "ing", "\\u", "obj_", "._", "cached_", "[_", "obj_", "._", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "executed", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "executed", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "these", " ", "module", "s", " ", "did", "n", "'", "t", " ", "execute_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec", "s_", "[_", "tmp", "\\u", "id_", "]_", "=_", "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_", "return_", "(_", "to", "\\u", "delete_", ",_", "objs_", ",_", "errs_", ",_", "exec", "s_", ",_", "suspend", "s_", ",_", "caches_", ",_", "parameter", "\\u", "changes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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 ]
Unused local variable
scipy/scipy/scipy/weave/examples/ramp.py
[ { "content": "def Ramp_numeric1(result,start,end):\n code = \"\"\"\n const int size = Nresult[0];\n const double step = (end-start)/(size-1);\n double val = start;\n for (int i = 0; i < size; i++)\n *result++ = start + step*i;\n \"\"\"\n weave.inline(code,['result','start','end'],compiler='gcc')", "metadata": "root.Ramp_numeric1", "header": "['module', '___EOS___']", "index": 29 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Ramp", "\\u", "numeri", "c1_", "(_", "result_", ",_", "start_", ",_", "end_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "code_", "=_", "\"\"\"", "\\", "10", ";", " ", " ", " ", "const", " ", "int", " ", "size", " ", "=", " ", "Nr", "esult", "[", "0", "];", "\\", "10", ";", " ", " ", " ", "const", " ", "double", " ", "step", " ", "=", " ", "(", "end", "-", "start", ")/(", "size", "-1", ");", "\\", "10", ";", " ", " ", " ", "double", " ", "val", " ", "=", " ", "start", ";", "\\", "10", ";", " ", " ", " ", "for", " ", "(", "int", " ", "i", " ", "=", " ", "0", ";", " ", "i", " ", "<", " ", "size", ";", " ", "i", "++", ")", "\\", "10", ";", " ", " ", " ", "*", "result", "++", " ", "=", " ", "start", " ", "+", " ", "step", "*", "i", ";", "\\", "10", ";", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "weave", "_", "._", "inline_", "(_", "code_", ",_", "[_", "'", "result", "'_", ",_", "'", "start", "'_", ",_", "'", "end", "'_", "]_", ",_", "compiler_", "=_", "'", "gcc", "'_", ")_", "\\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 ]
Unused local variable
boto/boto3/boto3/docs/resource.py
[ { "content": " def _add_example(self, section, identifier_names):\n section.style.start_codeblock()\n section.style.new_line()\n section.write('import boto3')\n section.style.new_line()\n section.style.new_line()\n section.write(\n '%s = boto3.resource(\\'%s\\')' % (\n self._service_name, self._service_name)\n )\n section.style.new_line()\n example_values = get_identifier_values_for_example(identifier_names)\n section.write(\n '%s = %s.%s(%s)' % (\n xform_name(self._resource_name), self._service_name,\n self._resource_name, example_values))\n section.style.end_codeblock()", "metadata": "root.ResourceDocumenter._add_example", "header": "['class', 'ResourceDocumenter', '(', 'BaseDocumenter', ')', ':', '___EOS___']", "index": 81 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Reso", "urc", "e", "Document", "er_", "(_", "Base", "Document", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "add", "\\u", "example_", "(_", "self_", ",_", "section_", ",_", "identifi", "er", "\\u", "names_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "section_", "._", "style_", "._", "start", "\\u", "codeb", "lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section_", "._", "style_", "._", "new", "\\u", "line_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section_", "._", "write_", "(_", "'", "import", " ", "boto", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section_", "._", "style_", "._", "new", "\\u", "line_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section_", "._", "style_", "._", "new", "\\u", "line_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", " ", "=", " ", "boto", "3", ".", "resource", "(\\\\'", "%", "s", "\\\\')", "'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "service", "\\u", "name_", ",_", "self_", "._", "\\u", "service", "\\u", "name_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section_", "._", "style_", "._", "new", "\\u", "line_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "example", "\\u", "values_", "=_", "get", "\\u", "identifi", "er", "\\u", "values", "\\u", "for", "\\u", "example_", "(_", "identifi", "er", "\\u", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section_", "._", "write_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", " ", "=", " ", "%", "s", ".", "%", "s", "(%", "s", ")'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "xform", "\\u", "name_", "(_", "self_", "._", "\\u", "resource", "\\u", "name_", ")_", ",_", "self_", "._", "\\u", "service", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "resource", "\\u", "name_", ",_", "example", "\\u", "values_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section_", "._", "style_", "._", "end", "\\u", "codeb", "lock_", "(_", ")_", "\\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 ]
Comparison of constants
ntasfi/PyGame-Learning-Environment/ple/games/puckworld.py
[ { "content": "import pygame\nimport sys\nimport math\n\nimport base\n\nfrom pygame.constants import K_w, K_a, K_s, K_d\nfrom primitives import Player, Creep\nfrom utils.vec2d import vec2d\nfrom utils import percent_round_int\n\n\n\n\n\nif __name__ == \"__main__\":\n import numpy as np\n\n pygame.init()\n game = PuckWorld(width=256, height=256)\n game.screen = pygame.display.set_mode( game.getScreenDims(), 0, 32)\n game.clock = pygame.time.Clock()\n game.rng = np.random.RandomState(24)\n game.init()\n\n while True:\n dt = game.clock.tick_busy_loop(60)\n game.step(dt)\n pygame.display.update()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "pygame_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pygame_", "._", "constants_", "import_", "K", "\\u", "w_", ",_", "K", "\\u", "a_", ",_", "K", "\\u", "s_", ",_", "K", "\\u", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "primitives_", "import_", "Player_", ",_", "Cre", "ep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "utils_", "._", "vec2", "d_", "import_", "vec2", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "utils_", "import_", "percent", "\\u", "round", "\\u", "int_", "\\u\\u\\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_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pygame_", "._", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "game_", "=_", "Pu", "ck", "World_", "(_", "width_", "=_", "256_", ",_", "height_", "=_", "256_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "game_", "._", "screen_", "=_", "pygame_", "._", "display_", "._", "set\\u", "mode_", "(_", "game_", "._", "get", "Scr", "een", "Dims", "_", "(_", ")_", ",_", "0_", ",_", "32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "game_", "._", "clock_", "=_", "pygame_", "._", "time_", "._", "Clock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "game_", "._", "rng_", "=_", "np_", "._", "random_", "._", "Random", "State_", "(_", "24_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "game_", "._", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dt_", "=_", "game_", "._", "clock_", "._", "tick", "\\u", "bus", "y", "\\u", "loop_", "(_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "game_", "._", "step_", "(_", "dt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pygame_", "._", "display_", "._", "update_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
spatialaudio/nbsphinx/nbsphinx.py
[ { "content": "# Copyright (c) 2015-2016 Matthias Geier\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\n\"\"\"Jupyter Notebook Tools for Sphinx.\n\nhttp://nbsphinx.rtfd.org/\n\n\"\"\"\n__version__ = '0.2.6'\n\nimport copy\nimport docutils\nfrom docutils.parsers import rst\nimport jinja2\nimport json\nimport nbconvert\nimport nbformat\nimport os\nimport re\nimport sphinx\nimport subprocess\ntry:\n from urllib.parse import unquote # Python 3.x\nexcept ImportError:\n from urllib2 import unquote # Python 2.x\n\n_ipynbversion = 4\n\nRST_TEMPLATE = \"\"\"\n{% extends 'rst.tpl' %}\n\n\n{% macro insert_empty_lines(text) %}\n{%- set before, after = text | get_empty_lines %}\n{%- if before %}\n :empty-lines-before: {{ before }}\n{%- endif %}\n{%- if after %}\n :empty-lines-after: {{ after }}\n{%- endif %}\n{%- endmacro %}\n\n\n{% block any_cell %}\n{%- if cell.metadata.nbsphinx != 'hidden' %}\n{{ super() }}\n{% endif %}\n{%- endblock any_cell %}\n\n\n{% block input -%}\n.. nbinput:: {% if nb.metadata.language_info -%}\n{{ nb.metadata.language_info.pygments_lexer }}\n{%- else -%}\n{{ resources.codecell_lexer }}\n{%- endif -%}\n{{ insert_empty_lines(cell.source) }}\n{%- if cell.execution_count %}\n :execution-count: {{ cell.execution_count }}\n{%- endif %}\n{%- if not cell.outputs %}\n :no-output:\n{%- endif %}\n{%- if cell.source.strip() %}\n\n{{ cell.source.strip('\\n') | indent }}\n{%- endif %}\n{% endblock input %}\n\n\n{% block nboutput %}\n{%- if output.output_type == 'stream' %}\n {%- set datatype = 'ansi' %}\n {%- set outputdata = output.text[:-1] %}{# trailing \\n is stripped #}\n{%- elif output.output_type == 'error' %}\n {%- set datatype = 'ansi' %}\n {%- set outputdata = '\\n'.join(output.traceback) %}\n{%- else %}\n {%- set datatype = (output.data | filter_data_type)[0] %}\n {%- set outputdata = output.data[datatype] %}\n{%- endif -%}\n.. nboutput::\n{%- if datatype == 'text/plain' %}{# nothing #}\n{%- else %} rst\n{%- endif %}\n{%- if output.output_type == 'execute_result' and cell.execution_count %}\n :execution-count: {{ cell.execution_count }}\n{%- endif %}\n{%- if output != cell.outputs[-1] %}\n :more-to-come:\n{%- endif %}\n{%- if output.name == 'stderr' %}\n :class: stderr\n{%- endif %}\n{%- if datatype == 'text/plain' -%}\n{{ insert_empty_lines(outputdata) }}\n\n{{ outputdata.strip(\\n) | indent }}\n{%- elif datatype in ['image/svg+xml', 'image/png', 'image/jpeg', 'application/pdf'] %}\n\n .. image:: {{ output.metadata.filenames[datatype].rsplit('.', 1)[0] + '.*' | posix_path }}\n{%- elif datatype in ['text/markdown'] %}\n\n{{ output.data['text/markdown'] | markdown2rst | indent }}\n{%- elif datatype in ['text/latex'] %}\n\n .. math::\n\n{{ output.data['text/latex'] | strip_dollars | indent | indent }}\n{%- elif datatype == 'text/html' %}\n\n .. raw:: html\n\n{{ output.data['text/html'] | indent | indent }}\n{%- elif datatype == 'ansi' %}\n\n .. rst-class:: highlight\n\n .. raw:: html\n\n <pre>\n{{ outputdata | ansi2html | indent | indent }}\n </pre>\n\n .. raw:: latex\n\n % This comment is needed to force a line break for adjacent ANSI cells\n \\\\begin{OriginalVerbatim}[commandchars=\\\\\\\\\\\\{\\\\}]\n{{ outputdata | ansi2latex | indent | indent }}\n \\\\end{OriginalVerbatim}\n{% else %}\n\n WARNING! Data type not implemented: {{ datatype }}\n{%- endif %}\n{% endblock nboutput %}\n\n\n{% block execute_result %}{{ self.nboutput() }}{% endblock execute_result %}\n{% block display_data %}{{ self.nboutput() }}{% endblock display_data %}\n{% block stream %}{{ self.nboutput() }}{% endblock stream %}\n{% block error %}{{ self.nboutput() }}{% endblock error %}\n\n\n{% block markdowncell %}\n{%- if 'nbsphinx-toctree' in cell.metadata %}\n{{ cell | extract_toctree }}\n{%- else %}\n{{ super() }}\n{% endif %}\n{% endblock markdowncell %}\n\n\n{% block rawcell %}\n{%- set raw_mimetype = cell.metadata.get('raw_mimetype', '').lower() %}\n{%- if raw_mimetype == '' %}\n.. raw:: html\n\n{{ cell.source | indent }}\n\n.. raw:: latex\n\n{{ cell.source | indent }}\n{%- elif raw_mimetype == 'text/html' %}\n.. raw:: html\n\n{{ cell.source | indent }}\n{%- elif raw_mimetype == 'text/latex' %}\n.. raw:: latex\n\n{{ cell.source | indent }}\n{%- elif raw_mimetype == 'text/markdown' %}\n{{ cell.source | markdown2rst }}\n{%- elif raw_mimetype == 'text/restructuredtext' %}\n{{ cell.source }}\n{% endif %}\n{% endblock rawcell %}\n\"\"\"\n\n\nLATEX_PREAMBLE = r\"\"\"\n% Jupyter Notebook prompt colors\n\\definecolor{nbsphinxin}{HTML}{303F9F}\n\\definecolor{nbsphinxout}{HTML}{D84315}\n% ANSI colors for output streams and traceback highlighting\n\\definecolor{ansi-black}{HTML}{3E424D}\n\\definecolor{ansi-black-intense}{HTML}{282C36}\n\\definecolor{ansi-red}{HTML}{E75C58}\n\\definecolor{ansi-red-intense}{HTML}{B22B31}\n\\definecolor{ansi-green}{HTML}{00A250}\n\\definecolor{ansi-green-intense}{HTML}{007427}\n\\definecolor{ansi-yellow}{HTML}{DDB62B}\n\\definecolor{ansi-yellow-intense}{HTML}{B27D12}\n\\definecolor{ansi-blue}{HTML}{208FFB}\n\\definecolor{ansi-blue-intense}{HTML}{0065CA}\n\\definecolor{ansi-magenta}{HTML}{D160C4}\n\\definecolor{ansi-magenta-intense}{HTML}{A03196}\n\\definecolor{ansi-cyan}{HTML}{60C6C8}\n\\definecolor{ansi-cyan-intense}{HTML}{258F8F}\n\\definecolor{ansi-white}{HTML}{C5C1B4}\n\\definecolor{ansi-white-intense}{HTML}{A1A6B2}\n\"\"\"\n\n\nCSS_STRING = \"\"\"\n/* CSS for nbsphinx extension */\n\n/* remove conflicting styling from Sphinx themes */\ndiv.nbinput,\ndiv.nbinput > div,\ndiv.nbinput div[class^=highlight],\ndiv.nbinput div[class^=highlight] pre,\ndiv.nboutput,\ndiv.nboutput > div,\ndiv.nboutput div[class^=highlight],\ndiv.nboutput div[class^=highlight] pre {\n background: none;\n border: none;\n padding: 0 0;\n margin: 0;\n box-shadow: none;\n}\n\n/* avoid gaps between output lines */\ndiv.nboutput div[class^=highlight] pre {\n line-height: normal;\n}\n\n/* input/output containers */\ndiv.nbinput,\ndiv.nboutput {\n display: -webkit-flex;\n display: flex;\n align-items: flex-start;\n margin: 0;\n}\n\n/* input container */\ndiv.nbinput {\n padding-top: 5px;\n}\n\n/* last container */\ndiv.nblast {\n padding-bottom: 5px;\n}\n\n/* input prompt */\ndiv.nbinput > :first-child pre {\n color: #303F9F;\n}\n\n/* output prompt */\ndiv.nboutput > :first-child pre {\n color: #D84315;\n}\n\n/* all prompts */\ndiv.nbinput > :first-child[class^=highlight],\ndiv.nboutput > :first-child[class^=highlight],\ndiv.nboutput > :first-child {\n min-width: 11ex;\n padding-top: 0.4em;\n padding-right: 0.4em;\n text-align: right;\n flex: 0;\n}\n\n/* input/output area */\ndiv.nbinput > :nth-child(2)[class^=highlight],\ndiv.nboutput > :nth-child(2),\ndiv.nboutput > :nth-child(2)[class^=highlight] {\n padding: 0.4em;\n -webkit-flex: 1;\n flex: 1;\n overflow: auto;\n}\n\n/* input area */\ndiv.nbinput > :nth-child(2)[class^=highlight] {\n border: 1px solid #cfcfcf;\n border-radius: 2px;\n background: #f7f7f7;\n}\n\n/* override MathJax center alignment in output cells */\ndiv.nboutput div[class*=MathJax] {\n text-align: left !important;\n}\n\n/* override sphinx.ext.pngmath center alignment in output cells */\ndiv.nboutput div.math p {\n text-align: left;\n}\n\n/* standard error */\ndiv.nboutput > :nth-child(2).stderr {\n background: #fdd;\n}\n\n/* ANSI colors */\n.ansi-black-fg { color: #3E424D; }\n.ansi-black-bg { background-color: #3E424D; }\n.ansi-black-intense-fg { color: #282C36; }\n.ansi-black-intense-bg { background-color: #282C36; }\n.ansi-red-fg { color: #E75C58; }\n.ansi-red-bg { background-color: #E75C58; }\n.ansi-red-intense-fg { color: #B22B31; }\n.ansi-red-intense-bg { background-color: #B22B31; }\n.ansi-green-fg { color: #00A250; }\n.ansi-green-bg { background-color: #00A250; }\n.ansi-green-intense-fg { color: #007427; }\n.ansi-green-intense-bg { background-color: #007427; }\n.ansi-yellow-fg { color: #DDB62B; }\n.ansi-yellow-bg { background-color: #DDB62B; }\n.ansi-yellow-intense-fg { color: #B27D12; }\n.ansi-yellow-intense-bg { background-color: #B27D12; }\n.ansi-blue-fg { color: #208FFB; }\n.ansi-blue-bg { background-color: #208FFB; }\n.ansi-blue-intense-fg { color: #0065CA; }\n.ansi-blue-intense-bg { background-color: #0065CA; }\n.ansi-magenta-fg { color: #D160C4; }\n.ansi-magenta-bg { background-color: #D160C4; }\n.ansi-magenta-intense-fg { color: #A03196; }\n.ansi-magenta-intense-bg { background-color: #A03196; }\n.ansi-cyan-fg { color: #60C6C8; }\n.ansi-cyan-bg { background-color: #60C6C8; }\n.ansi-cyan-intense-fg { color: #258F8F; }\n.ansi-cyan-intense-bg { background-color: #258F8F; }\n.ansi-white-fg { color: #C5C1B4; }\n.ansi-white-bg { background-color: #C5C1B4; }\n.ansi-white-intense-fg { color: #A1A6B2; }\n.ansi-white-intense-bg { background-color: #A1A6B2; }\n\n.ansi-bold { font-weight: bold; }\n\"\"\"\n\nCSS_STRING_READTHEDOCS = \"\"\"\n/* CSS overrides for sphinx_rtd_theme */\n\n/* 24px margin */\n.nbinput.nblast,\n.nboutput.nblast {\n margin-bottom: 19px; /* padding has already 5px */\n}\n\n/* ... except between code cells! */\n.nblast + .nbinput {\n margin-top: -19px;\n}\n\n/* nice headers on first paragraph of info/warning boxes */\n.admonition .first {\n margin: -12px;\n padding: 6px 12px;\n margin-bottom: 12px;\n color: #fff;\n line-height: 1;\n display: block;\n}\n.admonition.warning .first {\n background: #f0b37e;\n}\n.admonition.note .first {\n background: #6ab0de;\n}\n.admonition > p:before {\n margin-right: 4px; /* make room for the exclamation icon */\n}\n\"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n# See http://docutils.sourceforge.net/docs/howto/rst-directives.html\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 Exporter(nbconvert.RSTExporter):\n \"\"\"Convert Jupyter notebooks to reStructuredText.\n\n Uses nbconvert to convert Jupyter notebooks to a reStructuredText\n string with custom reST directives for input and output cells.\n\n Notebooks without output cells are automatically executed before\n conversion.\n\n \"\"\"\n\n", "metadata": "root.Exporter", "header": "['module', '___EOS___']", "index": 388 }, { "content": " def __init__(self, allow_errors=False, timeout=30, codecell_lexer='none'):\n \"\"\"Initialize the Exporter.\"\"\"\n self._allow_errors = allow_errors\n self._timeout = timeout\n self._codecell_lexer = codecell_lexer\n loader = jinja2.DictLoader({'nbsphinx-rst.tpl': RST_TEMPLATE})\n super(Exporter, self).__init__(\n template_file='nbsphinx-rst', extra_loaders=[loader],\n filters={\n 'markdown2rst': markdown2rst,\n 'get_empty_lines': _get_empty_lines,\n 'extract_toctree': _extract_toctree,\n })", "metadata": "root.Exporter.__init__", "header": "['class', 'Exporter', '(', 'nbconvert', '.', 'RSTExporter', ')', ':', '___EOS___']", "index": 399 }, { "content": " def from_notebook_node(self, nb, resources=None, **kw):\n nb = copy.deepcopy(nb)\n if resources is None:\n resources = {}\n else:\n resources = copy.deepcopy(resources)\n # Set default codecell lexer\n resources['codecell_lexer'] = self._codecell_lexer\n\n nbsphinx_metadata = nb.metadata.get('nbsphinx', {})\n\n # Execute notebook only if there are code cells and no outputs:\n if (any(c.source for c in nb.cells if c.cell_type == 'code') and\n not any(c.outputs for c in nb.cells if 'outputs' in c)):\n allow_errors = nbsphinx_metadata.get(\n 'allow_errors', self._allow_errors)\n timeout = nbsphinx_metadata.get('timeout', self._timeout)\n pp = nbconvert.preprocessors.ExecutePreprocessor(\n allow_errors=allow_errors, timeout=timeout)\n nb, resources = pp.preprocess(nb, resources)\n\n # Call into RSTExporter\n rststr, resources = super(Exporter, self).from_notebook_node(\n nb, resources, **kw)\n\n orphan = nbsphinx_metadata.get('orphan', False)\n if orphan is True:\n rststr = ':orphan:\\n\\n' + rststr\n elif orphan is not False:\n raise NotebookError('invalid orphan option: {!r}'.format(orphan))\n\n return rststr, resources", "metadata": "root.Exporter.from_notebook_node", "header": "['class', 'Exporter', '(', 'nbconvert', '.', 'RSTExporter', ')', ':', '___EOS___']", "index": 413 }, { "content": "class NotebookParser(rst.Parser):\n \"\"\"Sphinx source parser for Jupyter notebooks.\n\n Uses nbsphinx.Exporter to convert notebook content to a\n reStructuredText string, which is then parsed by Sphinx's built-in\n reST parser.\n\n \"\"\"\n\n", "metadata": "root.NotebookParser", "header": "['module', '___EOS___']", "index": 447 }, { "content": " def get_transforms(self):\n \"\"\"List of transforms for documents parsed by this parser.\"\"\"\n return rst.Parser.get_transforms(self) + [\n ProcessLocalLinks, CreateSectionLabels, ReplaceAlertDivs]", "metadata": "root.NotebookParser.get_transforms", "header": "['class', 'NotebookParser', '(', 'rst', '.', 'Parser', ')', ':', '___EOS___']", "index": 456 }, { "content": " def parse(self, inputstring, document):\n \"\"\"Parse `inputstring`, write results to `document`.\"\"\"\n nb = nbformat.reads(inputstring, as_version=_ipynbversion)\n env = document.settings.env\n srcdir = os.path.dirname(env.doc2path(env.docname))\n auxdir = os.path.join(env.doctreedir, 'nbsphinx')\n sphinx.util.ensuredir(auxdir)\n\n resources = {}\n # Working directory for ExecutePreprocessor\n resources['metadata'] = {'path': srcdir}\n # Sphinx doesn't accept absolute paths in images etc.\n resources['output_files_dir'] = os.path.relpath(auxdir, srcdir)\n resources['unique_key'] = env.docname.replace('/', '_')\n\n exporter = Exporter(allow_errors=env.config.nbsphinx_allow_errors,\n timeout=env.config.nbsphinx_timeout,\n codecell_lexer=env.config.nbsphinx_codecell_lexer)\n\n try:\n rststring, resources = exporter.from_notebook_node(nb, resources)\n except NotebookError as e:\n env.warn(env.docname, str(e))\n return # document is unchanged (i.e. empty)\n\n # Create additional output files (figures etc.),\n # see nbconvert.writers.FilesWriter.write()\n for filename, data in resources.get('outputs', {}).items():\n dest = os.path.normpath(os.path.join(srcdir, filename))\n with open(dest, 'wb') as f:\n f.write(data)\n\n rst.Parser.parse(self, rststring, document)", "metadata": "root.NotebookParser.parse", "header": "['class', 'NotebookParser', '(', 'rst', '.', 'Parser', ')', ':', '___EOS___']", "index": 461 }, { "content": "class NotebookError(Exception):\n \"\"\"Error during notebook parsing.\"\"\"", "metadata": "root.NotebookError", "header": "['module', '___EOS___']", "index": 496 }, { "content": "class CodeNode(docutils.nodes.Element):\n \"\"\"A custom node that contains a literal_block node.\"\"\"\n", "metadata": "root.CodeNode", "header": "['module', '___EOS___']", "index": 500 }, { "content": " @classmethod\n def create(cls, text, language='none'):\n \"\"\"Create a new CodeNode containing a literal_block node.\n\n Apparently, this cannot be done in CodeNode.__init__(), see:\n https://groups.google.com/forum/#!topic/sphinx-dev/0chv7BsYuW0\n\n \"\"\"\n node = docutils.nodes.literal_block(text, text, language=language)\n return cls(text, node)", "metadata": "root.CodeNode.create", "header": "['class', 'CodeNode', '(', 'docutils', '.', 'nodes', '.', 'Element', ')', ':', '___EOS___']", "index": 503 }, { "content": "class AdmonitionNode(docutils.nodes.Element):\n \"\"\"A custom node for info and warning boxes.\"\"\"", "metadata": "root.AdmonitionNode", "header": "['module', '___EOS___']", "index": 515 }, { "content": "class NbInput(rst.Directive):\n \"\"\"A notebook input cell with prompt and code area.\"\"\"\n\n required_arguments = 0\n optional_arguments = 1 # lexer name\n final_argument_whitespace = False\n option_spec = {\n 'execution-count': rst.directives.positive_int,\n 'empty-lines-before': rst.directives.nonnegative_int,\n 'empty-lines-after': rst.directives.nonnegative_int,\n 'no-output': rst.directives.flag,\n }\n has_content = True\n", "metadata": "root.NbInput", "header": "['module', '___EOS___']", "index": 521 }, { "content": " def run(self):\n \"\"\"This is called by the reST parser.\"\"\"\n execution_count = self.options.get('execution-count')\n classes = ['nbinput']\n if 'no-output' in self.options:\n classes.append('nblast')\n container = docutils.nodes.container(classes=classes)\n\n # Input prompt\n text = 'In [{}]:'.format(execution_count if execution_count else ' ')\n container += CodeNode.create(text)\n latex_prompt = text + ' '\n\n # Input code area\n text = '\\n'.join(self.content.data)\n node = CodeNode.create(\n text, language=self.arguments[0] if self.arguments else 'none')\n _set_empty_lines(node, self.options)\n node.attributes['latex_prompt'] = latex_prompt\n container += node\n self.state.document['nbsphinx_include_css'] = True\n return [container]", "metadata": "root.NbInput.run", "header": "['class', 'NbInput', '(', 'rst', '.', 'Directive', ')', ':', '___EOS___']", "index": 535 }, { "content": "class NbOutput(rst.Directive):\n \"\"\"A notebook output cell with optional prompt.\"\"\"\n\n required_arguments = 0\n optional_arguments = 1 # 'rst' or nothing (which means literal text)\n final_argument_whitespace = False\n option_spec = {\n 'execution-count': rst.directives.positive_int,\n 'more-to-come': rst.directives.flag,\n 'empty-lines-before': rst.directives.nonnegative_int,\n 'empty-lines-after': rst.directives.nonnegative_int,\n 'class': rst.directives.unchanged,\n }\n has_content = True\n", "metadata": "root.NbOutput", "header": "['module', '___EOS___']", "index": 559 }, { "content": " def run(self):\n \"\"\"This is called by the reST parser.\"\"\"\n outputtype = self.arguments[0] if self.arguments else ''\n execution_count = self.options.get('execution-count')\n classes = ['nboutput']\n if 'more-to-come' not in self.options:\n classes.append('nblast')\n container = docutils.nodes.container(classes=classes)\n\n # Optional output prompt\n if execution_count:\n text = 'Out[{}]:'.format(execution_count)\n container += CodeNode.create(text)\n latex_prompt = text + ' '\n else:\n container += rst.nodes.container() # empty container for HTML\n latex_prompt = ''\n\n # Output area\n if outputtype == 'rst':\n classes = [self.options.get('class', '')]\n output_area = docutils.nodes.container(classes=classes)\n self.state.nested_parse(self.content, self.content_offset,\n output_area)\n container += output_area\n else:\n text = '\\n'.join(self.content.data)\n node = CodeNode.create(text)\n _set_empty_lines(node, self.options)\n node.attributes['latex_prompt'] = latex_prompt\n container += node\n self.state.document['nbsphinx_include_css'] = True\n return [container]", "metadata": "root.NbOutput.run", "header": "['class', 'NbOutput', '(', 'rst', '.', 'Directive', ')', ':', '___EOS___']", "index": 574 }, { "content": "class _NbAdmonition(rst.Directive):\n \"\"\"Base class for NbInfo and NbWarning.\"\"\"\n\n required_arguments = 0\n optional_arguments = 0\n option_spec = {}\n has_content = True\n", "metadata": "root._NbAdmonition", "header": "['module', '___EOS___']", "index": 609 }, { "content": " def run(self):\n \"\"\"This is called by the reST parser.\"\"\"\n node = AdmonitionNode(classes=['admonition', self._class])\n self.state.nested_parse(self.content, self.content_offset, node)\n return [node]", "metadata": "root._NbAdmonition.run", "header": "['class', '_NbAdmonition', '(', 'rst', '.', 'Directive', ')', ':', '___EOS___']", "index": 617 }, { "content": "class NbInfo(_NbAdmonition):\n \"\"\"An information box.\"\"\"\n\n _class = 'note'", "metadata": "root.NbInfo", "header": "['module', '___EOS___']", "index": 624 }, { "content": "class NbWarning(_NbAdmonition):\n \"\"\"A warning box.\"\"\"\n\n _class = 'warning'", "metadata": "root.NbWarning", "header": "['module', '___EOS___']", "index": 630 }, { "content": "def markdown2rst(text):\n \"\"\"Convert a Markdown string to reST via pandoc.\n\n This is very similar to nbconvert.filters.markdown.markdown2rst(),\n except that it uses a pandoc filter to convert raw LaTeX blocks to\n \"math\" directives (instead of \"raw:: latex\" directives).\n\n \"\"\"\n\n def rawlatex2math_hook(obj):\n if obj.get('t') == 'RawBlock' and obj['c'][0] == 'latex':\n obj['t'] = 'Para'\n obj['c'] = [{\n 't': 'Math',\n 'c': [\n {'t': 'DisplayMath', 'c': []},\n obj['c'][1],\n ]\n }]\n return obj\n\n def rawlatex2math(text):\n json_data = json.loads(text, object_hook=rawlatex2math_hook)\n return json.dumps(json_data)\n\n rststring = pandoc(text, 'markdown', 'rst', filter_func=rawlatex2math)\n return re.sub(r'^(\\s*)\\.\\. math::$',\n r'\\1.. math::\\1 :nowrap:',\n rststring,\n flags=re.MULTILINE)", "metadata": "root.markdown2rst", "header": "['module', '___EOS___']", "index": 636 }, { "content": "def pandoc(source, fmt, to, filter_func=None):\n \"\"\"Convert a string in format `from` to format `to` via pandoc.\n\n This is based on nbconvert.utils.pandoc.pandoc() and extended to\n allow passing a filter function.\n\n \"\"\"\n def encode(text):\n return text if isinstance(text, bytes) else text.encode('utf-8')\n\n def decode(data):\n return data.decode('utf-8') if isinstance(data, bytes) else data\n\n cmd1 = ['pandoc', '--from', fmt, '--to', 'json']\n cmd2 = ['pandoc', '--from', 'json', '--to', to]\n\n nbconvert.utils.pandoc.check_pandoc_version()\n\n p = subprocess.Popen(cmd1, stdin=subprocess.PIPE, stdout=subprocess.PIPE)\n json_data, _ = p.communicate(encode(source))\n\n if filter_func:\n json_data = encode(filter_func(decode(json_data)))\n\n p = subprocess.Popen(cmd2, stdin=subprocess.PIPE, stdout=subprocess.PIPE)\n out, _ = p.communicate(json_data)\n return decode(out).rstrip('\\n')", "metadata": "root.pandoc", "header": "['module', '___EOS___']", "index": 668 }, { "content": "def _extract_toctree(cell):\n \"\"\"Extract links from Markdown cell and create toctree.\"\"\"\n lines = ['.. toctree::']\n options = cell.metadata['nbsphinx-toctree']\n try:\n for option, value in options.items():\n if value is True:\n lines.append(':{}:'.format(option))\n elif value is False:\n pass\n else:\n lines.append(':{}: {}'.format(option, value))\n except AttributeError:\n raise NotebookError(\n 'invalid nbsphinx-toctree option: {!r}'.format(options))\n\n text = nbconvert.filters.markdown2rst(cell.source)\n settings = docutils.frontend.OptionParser(\n components=(rst.Parser,)).get_default_values()\n toctree_node = docutils.utils.new_document('extract_toctree', settings)\n parser = rst.Parser()\n parser.parse(text, toctree_node)\n\n if 'caption' not in options:\n for sec in toctree_node.traverse(docutils.nodes.section):\n assert sec.children\n assert isinstance(sec.children[0], docutils.nodes.title)\n title = sec.children[0].astext()\n lines.append(':caption: ' + title)\n break\n lines.append('') # empty line\n for ref in toctree_node.traverse(docutils.nodes.reference):\n lines.append(ref.astext().replace('\\n', '') +\n ' <' + unquote(ref.get('refuri')) + '>')\n return '\\n '.join(lines)", "metadata": "root._extract_toctree", "header": "['module', '___EOS___']", "index": 697 }, { "content": "def _get_empty_lines(text):\n \"\"\"Get number of empty lines before and after code.\"\"\"\n before = len(text) - len(text.lstrip('\\n'))\n after = len(text) - len(text.strip('\\n')) - before\n return before, after", "metadata": "root._get_empty_lines", "header": "['module', '___EOS___']", "index": 734 }, { "content": "def _set_empty_lines(node, options):\n \"\"\"Set \"empty lines\" attributes on a CodeNode.\n\n See http://stackoverflow.com/q/34050044/500098.\n\n \"\"\"\n for attr in 'empty-lines-before', 'empty-lines-after':\n value = options.get(attr, 0)\n if value:\n node.attributes[attr] = value", "metadata": "root._set_empty_lines", "header": "['module', '___EOS___']", "index": 741 }, { "content": "class ProcessLocalLinks(docutils.transforms.Transform):\n \"\"\"Process links to local files.\n\n Marks local files to be copied to the HTML output directory and\n turns links to local notebooks into ``:doc:``/``:ref:`` links.\n\n Links to subsections are possible with ``...#Subsection-Title``.\n These links use the labels created by CreateSectionLabels.\n\n Links to subsections use ``:ref:``, links to whole notebooks use\n ``:doc:``. Latter can be useful if you have an ``index.rst`` but\n also want a distinct ``index.ipynb`` for use with Jupyter.\n In this case you can use such a link in a notebook::\n\n [Back to main page](index.ipynb)\n\n In Jupyter, this will create a \"normal\" link to ``index.ipynb``, but\n in the files generated by Sphinx, this will become a link to the\n main page created from ``index.rst``.\n\n \"\"\"\n\n default_priority = 400 # Should probably be adjusted?\n", "metadata": "root.ProcessLocalLinks", "header": "['module', '___EOS___']", "index": 753 }, { "content": " def apply(self):\n env = self.document.settings.env\n for node in self.document.traverse(docutils.nodes.reference):\n uri = node.get('refuri', '')\n if not uri:\n continue # No URI (e.g. named reference)\n elif '://' in uri:\n continue # Not a local link\n elif uri.startswith('#') or uri.startswith('mailto:'):\n continue # Nothing to be done\n\n for suffix in env.config.source_suffix:\n if uri.lower().endswith(suffix.lower()):\n target = uri[:-len(suffix)]\n break\n else:\n target = ''\n\n if target:\n target_ext = ''\n reftype = 'doc'\n refdomain = None\n elif '.ipynb#' in uri.lower():\n idx = uri.lower().find('.ipynb#')\n target = uri[:idx]\n target_ext = uri[idx:]\n reftype = 'ref'\n refdomain = 'std'\n else:\n file = os.path.normpath(\n os.path.join(os.path.dirname(env.docname), uri))\n if not os.path.isfile(os.path.join(env.srcdir, file)):\n env.app.warn('file not found: {!r}'.format(file),\n env.doc2path(env.docname))\n continue # Link is ignored\n elif file.startswith('..'):\n env.app.warn(\n 'link outside of source directory: {!r}'.format(file),\n env.doc2path(env.docname))\n continue # Link is ignored\n if not hasattr(env, 'nbsphinx_files'):\n env.nbsphinx_files = {}\n env.nbsphinx_files.setdefault(env.docname, []).append(file)\n continue # We're done here\n\n target_docname = os.path.normpath(\n os.path.join(os.path.dirname(env.docname), target))\n if target_docname in env.found_docs:\n if target_ext:\n target = target_docname + target_ext\n target = target.lower()\n linktext = node.astext()\n xref = sphinx.addnodes.pending_xref(\n reftype=reftype, reftarget=target, refdomain=refdomain,\n refwarn=True, refexplicit=True, refdoc=env.docname)\n xref += docutils.nodes.Text(linktext, linktext)\n node.replace_self(xref)", "metadata": "root.ProcessLocalLinks.apply", "header": "['class', 'ProcessLocalLinks', '(', 'docutils', '.', 'transforms', '.', 'Transform', ')', ':', '___EOS___']", "index": 777 }, { "content": "class CreateSectionLabels(docutils.transforms.Transform):\n \"\"\"Make labels for each notebook and each section thereof.\n\n These labels are referenced in ProcessLocalLinks.\n Note: Sphinx lower-cases the HTML section IDs, Jupyter doesn't.\n\n \"\"\"\n\n default_priority = 250 # Before references.PropagateTargets (260)\n", "metadata": "root.CreateSectionLabels", "header": "['module', '___EOS___']", "index": 836 }, { "content": " def apply(self):\n env = self.document.settings.env\n i_still_have_to_create_the_notebook_label = True\n for section in self.document.traverse(docutils.nodes.section):\n assert section.children\n assert isinstance(section.children[0], docutils.nodes.title)\n title = section.children[0].astext()\n link_id = title.replace(' ', '-')\n section['ids'] = [link_id]\n label = env.docname + '.ipynb#' + link_id\n label = label.lower()\n env.domaindata['std']['labels'][label] = (\n env.docname, link_id, title)\n env.domaindata['std']['anonlabels'][label] = (\n env.docname, link_id)\n\n # Create a label for the whole notebook using the first section:\n if i_still_have_to_create_the_notebook_label:\n label = env.docname.lower() + '.ipynb'\n env.domaindata['std']['labels'][label] = (\n env.docname, '', title)\n env.domaindata['std']['anonlabels'][label] = (\n env.docname, '')\n i_still_have_to_create_the_notebook_label = False", "metadata": "root.CreateSectionLabels.apply", "header": "['class', 'CreateSectionLabels', '(', 'docutils', '.', 'transforms', '.', 'Transform', ')', ':', '___EOS___']", "index": 846 }, { "content": "class ReplaceAlertDivs(docutils.transforms.Transform):\n \"\"\"Replace certain <div> elements with AdmonitionNode containers.\n\n This is a quick-and-dirty work-around until a proper\n Mardown/CommonMark extension for note/warning boxes is available.\n\n \"\"\"\n\n default_priority = 500 # Doesn't really matter\n\n _start_re = re.compile(\n r'\\s*<div\\s*class\\s*=\\s*(?P<q>\"|\\')([a-z\\s-]*)(?P=q)\\s*>\\s*\\Z',\n flags=re.IGNORECASE)\n _class_re = re.compile(r'\\s*alert\\s*alert-(info|warning)\\s*\\Z')\n _end_re = re.compile(r'\\s*</div\\s*>\\s*\\Z', flags=re.IGNORECASE)\n", "metadata": "root.ReplaceAlertDivs", "header": "['module', '___EOS___']", "index": 872 }, { "content": " def apply(self):\n start_tags = []\n for node in self.document.traverse(docutils.nodes.raw):\n if node['format'] != 'html':\n continue\n start_match = self._start_re.match(node.astext())\n if not start_match:\n continue\n class_match = self._class_re.match(start_match.group(2))\n if not class_match:\n continue\n admonition_class = class_match.group(1)\n if admonition_class == 'info':\n admonition_class = 'note'\n start_tags.append((node, admonition_class))\n\n # Reversed order to allow nested <div> elements:\n for node, admonition_class in reversed(start_tags):\n content = []\n for sibling in node.traverse(include_self=False, descend=False,\n siblings=True, ascend=False):\n end_tag = (isinstance(sibling, docutils.nodes.raw) and\n sibling['format'] == 'html' and\n self._end_re.match(sibling.astext()))\n if end_tag:\n admonition_node = AdmonitionNode(\n classes=['admonition', admonition_class])\n admonition_node.extend(content)\n parent = node.parent\n parent.replace(node, admonition_node)\n for n in content:\n parent.remove(n)\n parent.remove(sibling)\n break\n else:\n content.append(sibling)", "metadata": "root.ReplaceAlertDivs.apply", "header": "['class', 'ReplaceAlertDivs', '(', 'docutils', '.', 'transforms', '.', 'Transform', ')', ':', '___EOS___']", "index": 888 }, { "content": "def builder_inited(app):\n \"\"\"Add color definitions to LaTeX preamble.\"\"\"\n latex_elements = app.builder.config.latex_elements\n latex_elements['preamble'] = '\\n'.join([\n LATEX_PREAMBLE,\n latex_elements.get('preamble', ''),\n ])", "metadata": "root.builder_inited", "header": "['module', '___EOS___']", "index": 926 }, { "content": "def html_page_context(app, pagename, templatename, context, doctree):\n \"\"\"Add CSS string to HTML pages that contain code cells.\"\"\"\n style = ''\n if doctree and doctree.get('nbsphinx_include_css'):\n style += CSS_STRING\n if doctree and app.config.html_theme == 'sphinx_rtd_theme':\n style += CSS_STRING_READTHEDOCS\n if style:\n context['body'] = '\\n<style>' + style + '</style>\\n' + context['body']", "metadata": "root.html_page_context", "header": "['module', '___EOS___']", "index": 935 }, { "content": "def html_collect_pages(app):\n \"\"\"This event handler is abused to copy local files around.\"\"\"\n files = set()\n for file_list in getattr(app.env, 'nbsphinx_files', {}).values():\n files.update(file_list)\n for file in app.status_iterator(files, 'copying linked files... ',\n sphinx.util.console.brown, len(files)):\n target = os.path.join(app.builder.outdir, file)\n sphinx.util.ensuredir(os.path.dirname(target))\n try:\n sphinx.util.copyfile(os.path.join(app.env.srcdir, file), target)\n except OSError as err:\n app.warn('cannot copy local file {!r}: {}'.format(file, err))\n return [] # No new HTML pages are created", "metadata": "root.html_collect_pages", "header": "['module', '___EOS___']", "index": 946 }, { "content": "def env_purge_doc(app, env, docname):\n \"\"\"Remove list of local files for a given document.\"\"\"\n try:\n del env.nbsphinx_files[docname]\n except (AttributeError, KeyError):\n pass", "metadata": "root.env_purge_doc", "header": "['module', '___EOS___']", "index": 962 }, { "content": "def depart_code_html(self, node):\n \"\"\"Add empty lines before and after the code.\"\"\"\n text = self.body[-1]\n text = text.replace('<pre>',\n '<pre>\\n' + '\\n' * node.get('empty-lines-before', 0))\n text = text.replace('</pre>',\n '\\n' * node.get('empty-lines-after', 0) + '</pre>')\n self.body[-1] = text", "metadata": "root.depart_code_html", "header": "['module', '___EOS___']", "index": 970 }, { "content": "def visit_code_latex(self, node):\n \"\"\"Avoid creating a separate prompt node.\n\n The prompt will be pre-pended in the main code node.\n\n \"\"\"\n if 'latex_prompt' not in node.attributes:\n raise docutils.nodes.SkipNode()", "metadata": "root.visit_code_latex", "header": "['module', '___EOS___']", "index": 980 }, { "content": "def depart_code_latex(self, node):\n \"\"\"Some changes to code blocks.\n\n * Remove the frame (by changing Verbatim -> OriginalVerbatim)\n * Add empty lines before and after the code\n * Add prompt to the first line, empty space to the following lines\n\n \"\"\"\n lines = self.body[-1].split('\\n')\n out = []\n assert lines[0] == ''\n out.append(lines[0])\n assert lines[1].startswith(r'\\begin{Verbatim}')\n out.append(lines[1].replace('Verbatim', 'OriginalVerbatim'))\n code_lines = (\n [''] * node.get('empty-lines-before', 0) +\n lines[2:-2] +\n [''] * node.get('empty-lines-after', 0)\n )\n prompt = node.get('latex_prompt')\n color = 'nbsphinxin' if prompt.startswith('In') else 'nbsphinxout'\n prefix = r'\\textcolor{' + color + '}{' + prompt + '}' if prompt else ''\n for line in code_lines[:1]:\n out.append(prefix + line)\n prefix = ' ' * len(prompt)\n for line in code_lines[1:]:\n out.append(prefix + line)\n assert lines[-2].startswith(r'\\end{Verbatim}')\n out.append(lines[-2].replace('Verbatim', 'OriginalVerbatim'))\n assert lines[-1] == ''\n out.append(lines[-1])\n self.body[-1] = '\\n'.join(out)", "metadata": "root.depart_code_latex", "header": "['module', '___EOS___']", "index": 990 }, { "content": "def visit_admonition_html(self, node):\n self.body.append(self.starttag(node, 'div'))\n self.set_first_last(node)\n if self.settings.env.config.html_theme == 'sphinx_rtd_theme':\n if node.children:\n classes = node.children[0]['classes']\n if 'last' not in classes:\n classes.extend(['fa', 'fa-exclamation-circle'])", "metadata": "root.visit_admonition_html", "header": "['module', '___EOS___']", "index": 1024 }, { "content": "def depart_admonition_html(self, node):\n self.body.append('</div>\\n')", "metadata": "root.depart_admonition_html", "header": "['module', '___EOS___']", "index": 1034 }, { "content": "def visit_admonition_latex(self, node):\n # See http://tex.stackexchange.com/q/305898/13684:\n self.body.append('\\n\\\\begin{notice}{' + node['classes'][1] + '}{}\\\\unskip')", "metadata": "root.visit_admonition_latex", "header": "['module', '___EOS___']", "index": 1038 }, { "content": "def depart_admonition_latex(self, node):\n self.body.append('\\\\end{notice}\\n')", "metadata": "root.depart_admonition_latex", "header": "['module', '___EOS___']", "index": 1043 }, { "content": "def do_nothing(self, node):\n pass", "metadata": "root.do_nothing", "header": "['module', '___EOS___']", "index": 1047 }, { "content": "def _add_notebook_parser(app):\n \"\"\"Ugly hack to modify source_suffix and source_parsers.\n\n Once https://github.com/sphinx-doc/sphinx/pull/2209 is merged (and\n some additional time has passed), this should be replaced by ::\n\n app.add_source_parser('.ipynb', NotebookParser)\n\n See also https://github.com/sphinx-doc/sphinx/issues/2162.\n\n \"\"\"\n source_suffix = app.config._raw_config.get('source_suffix', ['.rst'])\n if isinstance(source_suffix, sphinx.config.string_types):\n source_suffix = [source_suffix]\n if '.ipynb' not in source_suffix:\n source_suffix.append('.ipynb')\n app.config._raw_config['source_suffix'] = source_suffix\n source_parsers = app.config._raw_config.get('source_parsers', {})\n if '.ipynb' not in source_parsers and 'ipynb' not in source_parsers:\n source_parsers['.ipynb'] = NotebookParser\n app.config._raw_config['source_parsers'] = source_parsers", "metadata": "root._add_notebook_parser", "header": "['module', '___EOS___']", "index": 1051 }, { "content": "def setup(app):\n \"\"\"Initialize Sphinx extension.\"\"\"\n _add_notebook_parser(app)\n\n app.add_config_value('nbsphinx_allow_errors', False, rebuild='')\n app.add_config_value('nbsphinx_timeout', 30, rebuild='')\n app.add_config_value('nbsphinx_codecell_lexer', 'none', rebuild='env')\n\n app.add_directive('nbinput', NbInput)\n app.add_directive('nboutput', NbOutput)\n app.add_directive('nbinfo', NbInfo)\n app.add_directive('nbwarning', NbWarning)\n app.add_node(CodeNode,\n html=(do_nothing, depart_code_html),\n latex=(visit_code_latex, depart_code_latex))\n app.add_node(AdmonitionNode,\n html=(visit_admonition_html, depart_admonition_html),\n latex=(visit_admonition_latex, depart_admonition_latex))\n app.connect('builder-inited', builder_inited)\n app.connect('html-page-context', html_page_context)\n app.connect('html-collect-pages', html_collect_pages)\n app.connect('env-purge-doc', env_purge_doc)\n\n # Make docutils' \"code\" directive (generated by markdown2rst/pandoc)\n # behave like Sphinx's \"code-block\",\n # see https://github.com/sphinx-doc/sphinx/issues/2155:\n rst.directives.register_directive('code', sphinx.directives.code.CodeBlock)\n\n return {'version': __version__, 'parallel_read_safe': True}", "metadata": "root.setup", "header": "['module', '___EOS___']", "index": 1074 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "201", "5", "-", "2016", " ", "Matt", "hia", "s", " ", "Ge", "ier_", "\\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_", "\"\"\"", "Ju", "pyt", "er", " ", "Notebook", " ", "Tool", "s", " ", "for", " ", "Sph", "inx", ".", "\\", "10", ";", "\\", "10", ";", "http", "://", "nb", "sphinx", ".", "rt", "fd", ".", "org", "/", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'", "0.", "2.6", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "docutils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "docutils_", "._", "parsers_", "import_", "rst_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "jinja2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nbc", "onv", "ert_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nb", "format_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sphinx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urllib_", "._", "parse_", "import_", "unquote_", "#", " ", "Pyth", "on", " ", "3", ".", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "urllib2_", "import_", "unquote_", "#", " ", "Pyth", "on", " ", "2", ".", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "ipynb", "version_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "RST", "\\u", "TEMPLATE_", "=_", "\"\"\"", "\\", "10", ";", "{%", " ", "extend", "s", " ", "'", "rst", ".", "tpl", "'", " ", "%}", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "{%", " ", "macro", " ", "insert", "\\u", "empty", "\\u", "lines", "(", "text", ")", " ", "%}", "\\", "10", ";", "{%", "-", " ", "set", " ", "bef", "ore", ",", " ", "after", " ", "=", " ", "text", " ", "|", " ", "get", "\\u", "empty", "\\u", "lines", " ", "%}", "\\", "10", ";", "{%", "-", " ", "if", " ", "bef", "ore", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", ":", "empty", "-", "lines", "-", "bef", "ore", ":", " ", "{{", " ", "bef", "ore", " ", "}}\\", "10", ";", "{%", "-", " ", "endi", "f", " ", "%}", "\\", "10", ";", "{%", "-", " ", "if", " ", "after", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", ":", "empty", "-", "lines", "-", "after", ":", " ", "{{", " ", "after", " ", "}}\\", "10", ";", "{%", "-", " ", "endi", "f", " ", "%}", "\\", "10", ";", "{%", "-", " ", "end", "macro", " ", "%}", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "{%", " ", "block", " ", "any", "\\u", "cell", " ", "%}", "\\", "10", ";", "{%", "-", " ", "if", " ", "cell", ".", "metadata", ".", "nb", "sphinx", " ", "!=", " ", "'", "hidden", "'", " ", "%}", "\\", "10", ";", "{{", " ", "super", "()", " ", "}}\\", "10", ";", "{%", " ", "endi", "f", " ", "%}", "\\", "10", ";", "{%", "-", " ", "end", "block", " ", "any", "\\u", "cell", " ", "%}", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "{%", " ", "block", " ", "input", " ", "-%", "}", "\\", "10", ";", "..", " ", "nbin", "put", "::", " ", "{%", " ", "if", " ", "nb", ".", "metadata", ".", "language", "\\u", "info", " ", "-%", "}", "\\", "10", ";", "{{", " ", "nb", ".", "metadata", ".", "language", "\\u", "info", ".", "pyg", "ment", "s", "\\u", "lexer", " ", "}}\\", "10", ";", "{%", "-", " ", "else", " ", "-%", "}", "\\", "10", ";", "{{", " ", "resource", "s", ".", "codec", "ell", "\\u", "lexer", " ", "}}\\", "10", ";", "{%", "-", " ", "endi", "f", " ", "-%", "}", "\\", "10", ";", "{{", " ", "insert", "\\u", "empty", "\\u", "lines", "(", "cell", ".", "source", ")", " ", "}}\\", "10", ";", "{%", "-", " ", "if", " ", "cell", ".", "executi", "on", "\\u", "count", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", ":", "executi", "on", "-", "count", ":", " ", "{{", " ", "cell", ".", "executi", "on", "\\u", "count", " ", "}}\\", "10", ";", "{%", "-", " ", "endi", "f", " ", "%}", "\\", "10", ";", "{%", "-", " ", "if", " ", "not", " ", "cell", ".", "output", "s", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", ":", "no", "-", "output", ":", "\\", "10", ";", "{%", "-", " ", "endi", "f", " ", "%}", "\\", "10", ";", "{%", "-", " ", "if", " ", "cell", ".", "source", ".", "strip", "()", " ", "%}", "\\", "10", ";", "\\", "10", ";", "{{", " ", "cell", ".", "source", ".", "strip", "('\\", "\\", "n", "')", " ", "|", " ", "indent", " ", "}}\\", "10", ";", "{%", "-", " ", "endi", "f", " ", "%}", "\\", "10", ";", "{%", " ", "end", "block", " ", "input", " ", "%}", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "{%", " ", "block", " ", "nbo", "ut", "put", " ", "%}", "\\", "10", ";", "{%", "-", " ", "if", " ", "output", ".", "output", "\\u", "type", " ", "==", " ", "'", "stream", "'", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "{%", "-", " ", "set", " ", "datatype", " ", "=", " ", "'", "ansi", "'", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "{%", "-", " ", "set", " ", "output", "data", " ", "=", " ", "output", ".", "text", "[:", "-1", "]", " ", "%}", "{", "#", " ", "trail", "ing", " ", "\\\\", "n", " ", "is", " ", "strip", "ped", " ", "#}", "\\", "10", ";", "{%", "-", " ", "eli", "f", " ", "output", ".", "output", "\\u", "type", " ", "==", " ", "'", "error", "'", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "{%", "-", " ", "set", " ", "datatype", " ", "=", " ", "'", "ansi", "'", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "{%", "-", " ", "set", " ", "output", "data", " ", "=", " ", "'\\\\", "n", "'.", "join", "(", "output", ".", "traceback", ")", " ", "%}", "\\", "10", ";", "{%", "-", " ", "else", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "{%", "-", " ", "set", " ", "datatype", " ", "=", " ", "(", "output", ".", "data", " ", "|", " ", "filter", "\\u", "data\\u", "type", ")[", "0", "]", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "{%", "-", " ", "set", " ", "output", "data", " ", "=", " ", "output", ".", "data", "[", "datatype", "]", " ", "%}", "\\", "10", ";", "{%", "-", " ", "endi", "f", " ", "-%", "}", "\\", "10", ";", "..", " ", "nbo", "ut", "put", "::", "\\", "10", ";", "{%", "-", " ", "if", " ", "datatype", " ", "==", " ", "'", "text", "/", "plain", "'", " ", "%}", "{", "#", " ", "not", "hing", " ", "#}", "\\", "10", ";", "{%", "-", " ", "else", " ", "%}", " ", "rst", "\\", "10", ";", "{%", "-", " ", "endi", "f", " ", "%}", "\\", "10", ";", "{%", "-", " ", "if", " ", "output", ".", "output", "\\u", "type", " ", "==", " ", "'", "execute", "\\u", "result", "'", " ", "and", " ", "cell", ".", "executi", "on", "\\u", "count", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", ":", "executi", "on", "-", "count", ":", " ", "{{", " ", "cell", ".", "executi", "on", "\\u", "count", " ", "}}\\", "10", ";", "{%", "-", " ", "endi", "f", " ", "%}", "\\", "10", ";", "{%", "-", " ", "if", " ", "output", " ", "!=", " ", "cell", ".", "output", "s", "[-", "1", "]", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", ":", "more", "-", "to", "-", "come", ":", "\\", "10", ";", "{%", "-", " ", "endi", "f", " ", "%}", "\\", "10", ";", "{%", "-", " ", "if", " ", "output", ".", "name", " ", "==", " ", "'", "std", "err", "'", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", ":", "class", ":", " ", "std", "err", "\\", "10", ";", "{%", "-", " ", "endi", "f", " ", "%}", "\\", "10", ";", "{%", "-", " ", "if", " ", "datatype", " ", "==", " ", "'", "text", "/", "plain", "'", " ", "-%", "}", "\\", "10", ";", "{{", " ", "insert", "\\u", "empty", "\\u", "lines", "(", "output", "data", ")", " ", "}}\\", "10", ";", "\\", "10", ";", "{{", " ", "output", "data", ".", "strip", "(\\\\", "n", ")", " ", "|", " ", "indent", " ", "}}\\", "10", ";", "{%", "-", " ", "eli", "f", " ", "datatype", " ", "in", " ", "['", "image", "/", "svg", "+", "xml", "',", " ", "'", "image", "/", "png", "',", " ", "'", "image", "/", "jpeg", "',", " ", "'", "applica", "tion", "/", "pdf", "']", " ", "%}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "image", "::", " ", "{{", " ", "output", ".", "metadata", ".", "filename", "s", "[", "datatype", "].", "rsp", "lit", "('.", "',", " ", "1", ")[", "0", "]", " ", "+", " ", "'.*", "'", " ", "|", " ", "posix", "\\u", "path", " ", "}}\\", "10", ";", "{%", "-", " ", "eli", "f", " ", "datatype", " ", "in", " ", "['", "text", "/", "mark", "down", "']", " ", "%}", "\\", "10", ";", "\\", "10", ";", "{{", " ", "output", ".", "data", "['", "text", "/", "mark", "down", "']", " ", "|", " ", "mark", "down", "2r", "st", " ", "|", " ", "indent", " ", "}}\\", "10", ";", "{%", "-", " ", "eli", "f", " ", "datatype", " ", "in", " ", "['", "text", "/", "late", "x", "']", " ", "%}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "math", "::", "\\", "10", ";", "\\", "10", ";", "{{", " ", "output", ".", "data", "['", "text", "/", "late", "x", "']", " ", "|", " ", "strip", "\\u", "dollar", "s", " ", "|", " ", "indent", " ", "|", " ", "indent", " ", "}}\\", "10", ";", "{%", "-", " ", "eli", "f", " ", "datatype", " ", "==", " ", "'", "text", "/", "html", "'", " ", "%}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "raw", "::", " ", "html", "\\", "10", ";", "\\", "10", ";", "{{", " ", "output", ".", "data", "['", "text", "/", "html", "']", " ", "|", " ", "indent", " ", "|", " ", "indent", " ", "}}\\", "10", ";", "{%", "-", " ", "eli", "f", " ", "datatype", " ", "==", " ", "'", "ansi", "'", " ", "%}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "rst", "-", "class", "::", " ", "highlight", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "raw", "::", " ", "html", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "<", "pre", ">", "\\", "10", ";", "{{", " ", "output", "data", " ", "|", " ", "ansi", "2h", "tml", " ", "|", " ", "indent", " ", "|", " ", "indent", " ", "}}\\", "10", ";", " ", " ", " ", " ", "</", "pre", ">", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "raw", "::", " ", "late", "x", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "%", " ", "Thi", "s", " ", "comment", " ", "is", " ", "need", "ed", " ", "to", " ", "force", " ", "a", " ", "line", " ", "break", " ", "for", " ", "adjacent", " ", "ANSI", " ", "cells", "\\", "10", ";", " ", " ", " ", " ", "\\\\\\\\", "begin", "{", "Origina", "l", "Verb", "ati", "m", "}[", "command", "char", "s", "=\\\\", "\\\\\\\\\\\\\\\\", "\\\\{", "\\\\\\\\", "}]", "\\", "10", ";", "{{", " ", "output", "data", " ", "|", " ", "ansi", "2l", "ate", "x", " ", "|", " ", "indent", " ", "|", " ", "indent", " ", "}}\\", "10", ";", " ", " ", " ", " ", "\\\\\\\\", "end", "{", "Origina", "l", "Verb", "ati", "m", "}", "\\", "10", ";", "{%", " ", "else", " ", "%}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "WARN", "ING", "!", " ", "Data", " ", "type", " ", "not", " ", "implemented", ":", " ", "{{", " ", "datatype", " ", "}}\\", "10", ";", "{%", "-", " ", "endi", "f", " ", "%}", "\\", "10", ";", "{%", " ", "end", "block", " ", "nbo", "ut", "put", " ", "%}", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "{%", " ", "block", " ", "execute", "\\u", "result", " ", "%}", "{{", " ", "self", ".", "nbo", "ut", "put", "()", " ", "}}{", "%", " ", "end", "block", " ", "execute", "\\u", "result", " ", "%}", "\\", "10", ";", "{%", " ", "block", " ", "display", "\\u", "data", " ", "%}", "{{", " ", "self", ".", "nbo", "ut", "put", "()", " ", "}}{", "%", " ", "end", "block", " ", "display", "\\u", "data", " ", "%}", "\\", "10", ";", "{%", " ", "block", " ", "stream", " ", "%}", "{{", " ", "self", ".", "nbo", "ut", "put", "()", " ", "}}{", "%", " ", "end", "block", " ", "stream", " ", "%}", "\\", "10", ";", "{%", " ", "block", " ", "error", " ", "%}", "{{", " ", "self", ".", "nbo", "ut", "put", "()", " ", "}}{", "%", " ", "end", "block", " ", "error", " ", "%}", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "{%", " ", "block", " ", "mark", "down", "cell", " ", "%}", "\\", "10", ";", "{%", "-", " ", "if", " ", "'", "nb", "sphinx", "-", "toc", "tree", "'", " ", "in", " ", "cell", ".", "metadata", " ", "%}", "\\", "10", ";", "{{", " ", "cell", " ", "|", " ", "extract", "\\u", "toc", "tree", " ", "}}\\", "10", ";", "{%", "-", " ", "else", " ", "%}", "\\", "10", ";", "{{", " ", "super", "()", " ", "}}\\", "10", ";", "{%", " ", "endi", "f", " ", "%}", "\\", "10", ";", "{%", " ", "end", "block", " ", "mark", "down", "cell", " ", "%}", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "{%", " ", "block", " ", "raw", "cell", " ", "%}", "\\", "10", ";", "{%", "-", " ", "set", " ", "raw", "\\u", "mime", "type", " ", "=", " ", "cell", ".", "metadata", ".", "get", "('", "raw", "\\u", "mime", "type", "',", " ", "''", ").", "lower", "()", " ", "%}", "\\", "10", ";", "{%", "-", " ", "if", " ", "raw", "\\u", "mime", "type", " ", "==", " ", "''", " ", "%}", "\\", "10", ";", "..", " ", "raw", "::", " ", "html", "\\", "10", ";", "\\", "10", ";", "{{", " ", "cell", ".", "source", " ", "|", " ", "indent", " ", "}}\\", "10", ";", "\\", "10", ";", "..", " ", "raw", "::", " ", "late", "x", "\\", "10", ";", "\\", "10", ";", "{{", " ", "cell", ".", "source", " ", "|", " ", "indent", " ", "}}\\", "10", ";", "{%", "-", " ", "eli", "f", " ", "raw", "\\u", "mime", "type", " ", "==", " ", "'", "text", "/", "html", "'", " ", "%}", "\\", "10", ";", "..", " ", "raw", "::", " ", "html", "\\", "10", ";", "\\", "10", ";", "{{", " ", "cell", ".", "source", " ", "|", " ", "indent", " ", "}}\\", "10", ";", "{%", "-", " ", "eli", "f", " ", "raw", "\\u", "mime", "type", " ", "==", " ", "'", "text", "/", "late", "x", "'", " ", "%}", "\\", "10", ";", "..", " ", "raw", "::", " ", "late", "x", "\\", "10", ";", "\\", "10", ";", "{{", " ", "cell", ".", "source", " ", "|", " ", "indent", " ", "}}\\", "10", ";", "{%", "-", " ", "eli", "f", " ", "raw", "\\u", "mime", "type", " ", "==", " ", "'", "text", "/", "mark", "down", "'", " ", "%}", "\\", "10", ";", "{{", " ", "cell", ".", "source", " ", "|", " ", "mark", "down", "2r", "st", " ", "}}\\", "10", ";", "{%", "-", " ", "eli", "f", " ", "raw", "\\u", "mime", "type", " ", "==", " ", "'", "text", "/", "restructur", "edt", "ext", "'", " ", "%}", "\\", "10", ";", "{{", " ", "cell", ".", "source", " ", "}}\\", "10", ";", "{%", " ", "endi", "f", " ", "%}", "\\", "10", ";", "{%", " ", "end", "block", " ", "raw", "cell", " ", "%}", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LATE", "X", "\\u", "PRE", "AMB", "LE_", "=_", "r", "\"\"\"", "\\", "10", ";", "%", " ", "Ju", "pyt", "er", " ", "Notebook", " ", "prompt", " ", "colors", "\\", "10", ";\\\\", "defin", "ecol", "or", "{", "nb", "sphinx", "in", "}{", "HTM", "L", "}{", "303", "F", "9", "F", "}", "\\", "10", ";\\\\", "defin", "ecol", "or", "{", "nb", "sphinx", "out", "}{", "HTM", "L", "}{", "D8", "431", "5", "}", "\\", "10", ";", "%", " ", "ANSI", " ", "colors", " ", "for", " ", "output", " ", "stream", "s", " ", "and", " ", "traceback", " ", "highlight", "ing", "\\", "10", ";\\\\", "defin", "ecol", "or", "{", "ansi", "-", "black", "}{", "HTM", "L", "}{", "3", "E4", "24", "D", "}", "\\", "10", ";\\\\", "defin", "ecol", "or", "{", "ansi", "-", "black", "-", "inten", "se", "}{", "HTM", "L", "}{", "282", "C3", "6", "}", "\\", "10", ";\\\\", "defin", "ecol", "or", "{", "ansi", "-", "red", "}{", "HTM", "L", "}{", "E", "7", "5", "C5", "8", "}", "\\", "10", ";\\\\", "defin", "ecol", "or", "{", "ansi", "-", "red", "-", "inten", "se", "}{", "HTM", "L", "}{", "B2", "2", "B3", "1", "}", "\\", "10", ";\\\\", "defin", "ecol", "or", "{", "ansi", "-", "green", "}{", "HTM", "L", "}{", "00", "A2", "50", "}", "\\", "10", ";\\\\", "defin", "ecol", "or", "{", "ansi", "-", "green", "-", "inten", "se", "}{", "HTM", "L", "}{", "007", "427", "}", "\\", "10", ";\\\\", "defin", "ecol", "or", "{", "ansi", "-", "yell", "ow", "}{", "HTM", "L", "}{", "DD", "B6", "2", "B", "}", "\\", "10", ";\\\\", "defin", "ecol", "or", "{", "ansi", "-", "yell", "ow", "-", "inten", "se", "}{", "HTM", "L", "}{", "B2", "7", "D1", "2", "}", "\\", "10", ";\\\\", "defin", "ecol", "or", "{", "ansi", "-", "blue", "}{", "HTM", "L", "}{", "208", "FF", "B", "}", "\\", "10", ";\\\\", "defin", "ecol", "or", "{", "ansi", "-", "blue", "-", "inten", "se", "}{", "HTM", "L", "}{", "006", "5", "CA", "}", "\\", "10", ";\\\\", "defin", "ecol", "or", "{", "ansi", "-", "mage", "nta", "}{", "HTM", "L", "}{", "D1", "60", "C4", "}", "\\", "10", ";\\\\", "defin", "ecol", "or", "{", "ansi", "-", "mage", "nta", "-", "inten", "se", "}{", "HTM", "L", "}{", "A0", "319", "6", "}", "\\", "10", ";\\\\", "defin", "ecol", "or", "{", "ansi", "-", "cya", "n", "}{", "HTM", "L", "}{", "60", "C6", "C8", "}", "\\", "10", ";\\\\", "defin", "ecol", "or", "{", "ansi", "-", "cya", "n", "-", "inten", "se", "}{", "HTM", "L", "}{", "258", "F8", "F", "}", "\\", "10", ";\\\\", "defin", "ecol", "or", "{", "ansi", "-", "white", "}{", "HTM", "L", "}{", "C5", "C1", "B4", "}", "\\", "10", ";\\\\", "defin", "ecol", "or", "{", "ansi", "-", "white", "-", "inten", "se", "}{", "HTM", "L", "}{", "A1", "A6", "B2", "}", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CS", "S", "\\u", "STRING_", "=_", "\"\"\"", "\\", "10", ";", "/*", " ", "CS", "S", " ", "for", " ", "nb", "sphinx", " ", "extensi", "on", " ", "*/", "\\", "10", ";", "\\", "10", ";", "/*", " ", "remove", " ", "conflicting", " ", "sty", "ling", " ", "from", " ", "Sph", "inx", " ", "themes", " ", "*/", "\\", "10", ";", "div", ".", "nbin", "put", ",", "\\", "10", ";", "div", ".", "nbin", "put", " ", ">", " ", "div", ",", "\\", "10", ";", "div", ".", "nbin", "put", " ", "div", "[", "class", "^", "=", "highlight", "],", "\\", "10", ";", "div", ".", "nbin", "put", " ", "div", "[", "class", "^", "=", "highlight", "]", " ", "pre", ",", "\\", "10", ";", "div", ".", "nbo", "ut", "put", ",", "\\", "10", ";", "div", ".", "nbo", "ut", "put", " ", ">", " ", "div", ",", "\\", "10", ";", "div", ".", "nbo", "ut", "put", " ", "div", "[", "class", "^", "=", "highlight", "],", "\\", "10", ";", "div", ".", "nbo", "ut", "put", " ", "div", "[", "class", "^", "=", "highlight", "]", " ", "pre", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "background", ":", " ", "none", ";", "\\", "10", ";", " ", " ", " ", " ", "border", ":", " ", "none", ";", "\\", "10", ";", " ", " ", " ", " ", "padd", "ing", ":", " ", "0", " ", "0", ";", "\\", "10", ";", " ", " ", " ", " ", "marg", "in", ":", " ", "0", ";", "\\", "10", ";", " ", " ", " ", " ", "box", "-", "shadow", ":", " ", "none", ";", "\\", "10", ";}", "\\", "10", ";", "\\", "10", ";", "/*", " ", "avoid", " ", "gap", "s", " ", "bet", "ween", " ", "output", " ", "lines", " ", "*/", "\\", "10", ";", "div", ".", "nbo", "ut", "put", " ", "div", "[", "class", "^", "=", "highlight", "]", " ", "pre", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "line", "-", "height", ":", " ", "normal", ";", "\\", "10", ";}", "\\", "10", ";", "\\", "10", ";", "/*", " ", "input", "/", "output", " ", "container", "s", " ", "*/", "\\", "10", ";", "div", ".", "nbin", "put", ",", "\\", "10", ";", "div", ".", "nbo", "ut", "put", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "display", ":", " ", "-", "webkit", "-", "flex", ";", "\\", "10", ";", " ", " ", " ", " ", "display", ":", " ", "flex", ";", "\\", "10", ";", " ", " ", " ", " ", "align", "-", "items", ":", " ", "flex", "-", "start", ";", "\\", "10", ";", " ", " ", " ", " ", "marg", "in", ":", " ", "0", ";", "\\", "10", ";}", "\\", "10", ";", "\\", "10", ";", "/*", " ", "input", " ", "container", " ", "*/", "\\", "10", ";", "div", ".", "nbin", "put", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "padd", "ing", "-", "top", ":", " ", "5", "px", ";", "\\", "10", ";}", "\\", "10", ";", "\\", "10", ";", "/*", " ", "last", " ", "container", " ", "*/", "\\", "10", ";", "div", ".", "nbl", "ast", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "padd", "ing", "-", "bottom", ":", " ", "5", "px", ";", "\\", "10", ";}", "\\", "10", ";", "\\", "10", ";", "/*", " ", "input", " ", "prompt", " ", "*/", "\\", "10", ";", "div", ".", "nbin", "put", " ", ">", " ", ":", "first", "-", "child", " ", "pre", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "color", ":", " ", "#", "303", "F", "9", "F", ";", "\\", "10", ";}", "\\", "10", ";", "\\", "10", ";", "/*", " ", "output", " ", "prompt", " ", "*/", "\\", "10", ";", "div", ".", "nbo", "ut", "put", " ", ">", " ", ":", "first", "-", "child", " ", "pre", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "color", ":", " ", "#", "D8", "431", "5", ";", "\\", "10", ";}", "\\", "10", ";", "\\", "10", ";", "/*", " ", "all", " ", "prompt", "s", " ", "*/", "\\", "10", ";", "div", ".", "nbin", "put", " ", ">", " ", ":", "first", "-", "child", "[", "class", "^", "=", "highlight", "],", "\\", "10", ";", "div", ".", "nbo", "ut", "put", " ", ">", " ", ":", "first", "-", "child", "[", "class", "^", "=", "highlight", "],", "\\", "10", ";", "div", ".", "nbo", "ut", "put", " ", ">", " ", ":", "first", "-", "child", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "min", "-", "widt", "h", ":", " ", "11", "ex", ";", "\\", "10", ";", " ", " ", " ", " ", "padd", "ing", "-", "top", ":", " ", "0.", "4e", "m", ";", "\\", "10", ";", " ", " ", " ", " ", "padd", "ing", "-", "right", ":", " ", "0.", "4e", "m", ";", "\\", "10", ";", " ", " ", " ", " ", "text", "-", "align", ":", " ", "right", ";", "\\", "10", ";", " ", " ", " ", " ", "flex", ":", " ", "0", ";", "\\", "10", ";}", "\\", "10", ";", "\\", "10", ";", "/*", " ", "input", "/", "output", " ", "area", " ", "*/", "\\", "10", ";", "div", ".", "nbin", "put", " ", ">", " ", ":", "nth", "-", "child", "(", "2", ")[", "class", "^", "=", "highlight", "],", "\\", "10", ";", "div", ".", "nbo", "ut", "put", " ", ">", " ", ":", "nth", "-", "child", "(", "2", "),", "\\", "10", ";", "div", ".", "nbo", "ut", "put", " ", ">", " ", ":", "nth", "-", "child", "(", "2", ")[", "class", "^", "=", "highlight", "]", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "padd", "ing", ":", " ", "0.", "4e", "m", ";", "\\", "10", ";", " ", " ", " ", " ", "-", "webkit", "-", "flex", ":", " ", "1", ";", "\\", "10", ";", " ", " ", " ", " ", "flex", ":", " ", "1", ";", "\\", "10", ";", " ", " ", " ", " ", "overflow", ":", " ", "auto", ";", "\\", "10", ";}", "\\", "10", ";", "\\", "10", ";", "/*", " ", "input", " ", "area", " ", "*/", "\\", "10", ";", "div", ".", "nbin", "put", " ", ">", " ", ":", "nth", "-", "child", "(", "2", ")[", "class", "^", "=", "highlight", "]", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "border", ":", " ", "1p", "x", " ", "solid", " ", "#", "cfc", "fcf", ";", "\\", "10", ";", " ", " ", " ", " ", "border", "-", "radi", "us", ":", " ", "2p", "x", ";", "\\", "10", ";", " ", " ", " ", " ", "background", ":", " ", "#", "f7", "f7", "f7", ";", "\\", "10", ";}", "\\", "10", ";", "\\", "10", ";", "/*", " ", "override", " ", "Math", "Ja", "x", " ", "center", " ", "alignme", "nt", " ", "in", " ", "output", " ", "cells", " ", "*/", "\\", "10", ";", "div", ".", "nbo", "ut", "put", " ", "div", "[", "class", "*=", "Math", "Ja", "x", "]", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "text", "-", "align", ":", " ", "left", " ", "!", "importa", "nt", ";", "\\", "10", ";}", "\\", "10", ";", "\\", "10", ";", "/*", " ", "override", " ", "sphinx", ".", "ext", ".", "png", "math", " ", "center", " ", "alignme", "nt", " ", "in", " ", "output", " ", "cells", " ", "*/", "\\", "10", ";", "div", ".", "nbo", "ut", "put", " ", "div", ".", "math", " ", "p", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "text", "-", "align", ":", " ", "left", ";", "\\", "10", ";}", "\\", "10", ";", "\\", "10", ";", "/*", " ", "standard", " ", "error", " ", "*/", "\\", "10", ";", "div", ".", "nbo", "ut", "put", " ", " ", ">", " ", ":", "nth", "-", "child", "(", "2", ").", "std", "err", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "background", ":", " ", "#", "fdd", ";", "\\", "10", ";}", "\\", "10", ";", "\\", "10", ";", "/*", " ", "ANSI", " ", "colors", " ", "*/", "\\", "10", ";", ".", "ansi", "-", "black", "-", "fg", " ", "{", " ", "color", ":", " ", "#", "3", "E4", "24", "D", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "black", "-", "bg", " ", "{", " ", "background", "-", "color", ":", " ", "#", "3", "E4", "24", "D", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "black", "-", "inten", "se", "-", "fg", " ", "{", " ", "color", ":", " ", "#", "282", "C3", "6", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "black", "-", "inten", "se", "-", "bg", " ", "{", " ", "background", "-", "color", ":", " ", "#", "282", "C3", "6", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "red", "-", "fg", " ", "{", " ", "color", ":", " ", "#", "E", "7", "5", "C5", "8", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "red", "-", "bg", " ", "{", " ", "background", "-", "color", ":", " ", "#", "E", "7", "5", "C5", "8", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "red", "-", "inten", "se", "-", "fg", " ", "{", " ", "color", ":", " ", "#", "B2", "2", "B3", "1", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "red", "-", "inten", "se", "-", "bg", " ", "{", " ", "background", "-", "color", ":", " ", "#", "B2", "2", "B3", "1", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "green", "-", "fg", " ", "{", " ", "color", ":", " ", "#", "00", "A2", "50", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "green", "-", "bg", " ", "{", " ", "background", "-", "color", ":", " ", "#", "00", "A2", "50", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "green", "-", "inten", "se", "-", "fg", " ", "{", " ", "color", ":", " ", "#", "007", "427", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "green", "-", "inten", "se", "-", "bg", " ", "{", " ", "background", "-", "color", ":", " ", "#", "007", "427", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "yell", "ow", "-", "fg", " ", "{", " ", "color", ":", " ", "#", "DD", "B6", "2", "B", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "yell", "ow", "-", "bg", " ", "{", " ", "background", "-", "color", ":", " ", "#", "DD", "B6", "2", "B", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "yell", "ow", "-", "inten", "se", "-", "fg", " ", "{", " ", "color", ":", " ", "#", "B2", "7", "D1", "2", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "yell", "ow", "-", "inten", "se", "-", "bg", " ", "{", " ", "background", "-", "color", ":", " ", "#", "B2", "7", "D1", "2", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "blue", "-", "fg", " ", "{", " ", "color", ":", " ", "#", "208", "FF", "B", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "blue", "-", "bg", " ", "{", " ", "background", "-", "color", ":", " ", "#", "208", "FF", "B", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "blue", "-", "inten", "se", "-", "fg", " ", "{", " ", "color", ":", " ", "#", "006", "5", "CA", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "blue", "-", "inten", "se", "-", "bg", " ", "{", " ", "background", "-", "color", ":", " ", "#", "006", "5", "CA", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "mage", "nta", "-", "fg", " ", "{", " ", "color", ":", " ", "#", "D1", "60", "C4", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "mage", "nta", "-", "bg", " ", "{", " ", "background", "-", "color", ":", " ", "#", "D1", "60", "C4", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "mage", "nta", "-", "inten", "se", "-", "fg", " ", "{", " ", "color", ":", " ", "#", "A0", "319", "6", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "mage", "nta", "-", "inten", "se", "-", "bg", " ", "{", " ", "background", "-", "color", ":", " ", "#", "A0", "319", "6", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "cya", "n", "-", "fg", " ", "{", " ", "color", ":", " ", "#", "60", "C6", "C8", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "cya", "n", "-", "bg", " ", "{", " ", "background", "-", "color", ":", " ", "#", "60", "C6", "C8", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "cya", "n", "-", "inten", "se", "-", "fg", " ", "{", " ", "color", ":", " ", "#", "258", "F8", "F", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "cya", "n", "-", "inten", "se", "-", "bg", " ", "{", " ", "background", "-", "color", ":", " ", "#", "258", "F8", "F", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "white", "-", "fg", " ", "{", " ", "color", ":", " ", "#", "C5", "C1", "B4", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "white", "-", "bg", " ", "{", " ", "background", "-", "color", ":", " ", "#", "C5", "C1", "B4", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "white", "-", "inten", "se", "-", "fg", " ", "{", " ", "color", ":", " ", "#", "A1", "A6", "B2", ";", " ", "}", "\\", "10", ";", ".", "ansi", "-", "white", "-", "inten", "se", "-", "bg", " ", "{", " ", "background", "-", "color", ":", " ", "#", "A1", "A6", "B2", ";", " ", "}", "\\", "10", ";", "\\", "10", ";", ".", "ansi", "-", "bold", " ", "{", " ", "font", "-", "weight", ":", " ", "bold", ";", " ", "}", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CS", "S", "\\u", "STRING", "\\u", "READ", "THE", "DOCS", "_", "=_", "\"\"\"", "\\", "10", ";", "/*", " ", "CS", "S", " ", "override", "s", " ", "for", " ", "sphinx", "\\u", "rtd", "\\u", "them", "e", " ", "*/", "\\", "10", ";", "\\", "10", ";", "/*", " ", "24", "px", " ", "marg", "in", " ", "*/", "\\", "10", ";", ".", "nbin", "put", ".", "nbl", "ast", ",", "\\", "10", ";", ".", "nbo", "ut", "put", ".", "nbl", "ast", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "marg", "in", "-", "bottom", ":", " ", "1", "9", "px", ";", " ", " ", "/*", " ", "padd", "ing", " ", "has", " ", "alr", "ead", "y", " ", "5", "px", " ", "*/", "\\", "10", ";}", "\\", "10", ";", "\\", "10", ";", "/*", " ", "...", " ", "except", " ", "bet", "ween", " ", "code", " ", "cells", "!", " ", "*/", "\\", "10", ";", ".", "nbl", "ast", " ", "+", " ", ".", "nbin", "put", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "marg", "in", "-", "top", ":", " ", "-1", "9", "px", ";", "\\", "10", ";}", "\\", "10", ";", "\\", "10", ";", "/*", " ", "nice", " ", "header", "s", " ", "on", " ", "first", " ", "paragraph", " ", "of", " ", "info", "/", "warn", "ing", " ", "box", "es", " ", "*/", "\\", "10", ";", ".", "adm", "oni", "tion", " ", ".", "first", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "marg", "in", ":", " ", "-1", "2p", "x", ";", "\\", "10", ";", " ", " ", " ", " ", "padd", "ing", ":", " ", "6", "px", " ", "1", "2p", "x", ";", "\\", "10", ";", " ", " ", " ", " ", "marg", "in", "-", "bottom", ":", " ", "1", "2p", "x", ";", "\\", "10", ";", " ", " ", " ", " ", "color", ":", " ", "#", "fff", ";", "\\", "10", ";", " ", " ", " ", " ", "line", "-", "height", ":", " ", "1", ";", "\\", "10", ";", " ", " ", " ", " ", "display", ":", " ", "block", ";", "\\", "10", ";}", "\\", "10", ";", ".", "adm", "oni", "tion", ".", "warn", "ing", " ", ".", "first", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "background", ":", " ", "#", "f0", "b3", "7e", ";", "\\", "10", ";}", "\\", "10", ";", ".", "adm", "oni", "tion", ".", "note", " ", ".", "first", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "background", ":", " ", "#", "6a", "b0", "de", ";", "\\", "10", ";}", "\\", "10", ";", ".", "adm", "oni", "tion", " ", ">", " ", "p", ":", "bef", "ore", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "marg", "in", "-", "right", ":", " ", "4", "px", ";", " ", " ", "/*", " ", "make", " ", "room", " ", "for", " ", "the", " ", "excl", "amat", "ion", " ", "icon", " ", "*/", "\\", "10", ";}", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "#", " ", "See", " ", "http", "://", "docu", "til", "s", ".", "sourcef", "org", "e", ".", "net", "/", "docs", "/", "how", "to", "/", "rst", "-", "directive", "s", ".", "html_", "\\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_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\\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_", "Exporter_", "(_", "nbc", "onv", "ert_", "._", "RST", "Exporter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "Ju", "pyt", "er", " ", "notebook", "s", " ", "to", " ", "re", "Structur", "ed", "Text", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Us", "es", " ", "nbc", "onv", "ert", " ", "to", " ", "convert", " ", "Ju", "pyt", "er", " ", "notebook", "s", " ", "to", " ", "a", " ", "re", "Structur", "ed", "Text", "\\", "10", ";", " ", " ", " ", " ", "string", " ", "with", " ", "custom", " ", "re", "ST", " ", "directive", "s", " ", "for", " ", "input", " ", "and", " ", "output", " ", "cells", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Notebook", "s", " ", "with", "out", " ", "output", " ", "cells", " ", "are", " ", "automati", "call", "y", " ", "executed", " ", "bef", "ore", "\\", "10", ";", " ", " ", " ", " ", "conve", "rsi", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Exporter_", "(_", "nbc", "onv", "ert_", "._", "RST", "Exporter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "allow", "\\u", "errors_", "=_", "False_", ",_", "timeout_", "=_", "30_", ",_", "codec", "ell", "\\u", "lexer_", "=_", "'", "none", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", " ", "the", " ", "Exporte", "r", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "allow", "\\u", "errors_", "=_", "allow", "\\u", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "timeout_", "=_", "timeout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "codec", "ell", "\\u", "lexer_", "=_", "codec", "ell", "\\u", "lexer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loader_", "=_", "jinja2_", "._", "Dict", "Loader_", "(_", "{_", "'", "nb", "sphinx", "-", "rst", ".", "tpl", "'_", ":_", "RST", "\\u", "TEMPLATE_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Exporter_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "template", "\\u", "file_", "=_", "'", "nb", "sphinx", "-", "rst", "'_", ",_", "extra", "\\u", "loaders_", "=_", "[_", "loader_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "filters_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mark", "down", "2r", "st", "'_", ":_", "mark", "down", "2r", "st_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "get", "\\u", "empty", "\\u", "lines", "'_", ":_", "\\u", "get", "\\u", "empty", "\\u", "lines_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extract", "\\u", "toc", "tree", "'_", ":_", "\\u", "extract", "\\u", "toc", "tree_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Exporter_", "(_", "nbc", "onv", "ert_", "._", "RST", "Exporter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "from", "\\u", "notebook", "\\u", "node_", "(_", "self_", ",_", "nb_", ",_", "resources_", "=_", "None_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nb_", "=_", "copy_", "._", "deepcopy_", "(_", "nb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "resources_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resources_", "=_", "{_", "}_", "\\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 ", " _", "resources_", "=_", "copy_", "._", "deepcopy_", "(_", "resources_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "default", " ", "codec", "ell", " ", "lexer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resources_", "[_", "'", "codec", "ell", "\\u", "lexer", "'_", "]_", "=_", "self_", "._", "\\u", "codec", "ell", "\\u", "lexer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nb", "sphinx", "\\u", "metadata_", "=_", "nb_", "._", "metadata_", "._", "get_", "(_", "'", "nb", "sphinx", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Execut", "e", " ", "notebook", " ", "only", " ", "if", " ", "there", " ", "are", " ", "code", " ", "cells", " ", "and", " ", "no", " ", "output", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "any_", "(_", "c_", "._", "source_", "for_", "c_", "in_", "nb_", "._", "cells_", "if_", "c_", "._", "cell", "\\u", "type_", "==_", "'", "code", "'_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "any_", "(_", "c_", "._", "outputs_", "for_", "c_", "in_", "nb_", "._", "cells_", "if_", "'", "output", "s", "'_", "in_", "c_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "allow", "\\u", "errors_", "=_", "nb", "sphinx", "\\u", "metadata_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "allow", "\\u", "error", "s", "'_", ",_", "self_", "._", "\\u", "allow", "\\u", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timeout_", "=_", "nb", "sphinx", "\\u", "metadata_", "._", "get_", "(_", "'", "timeo", "ut", "'_", ",_", "self_", "._", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pp_", "=_", "nbc", "onv", "ert_", "._", "preprocessor", "s_", "._", "Execut", "e", "Preprocessor", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "allow", "\\u", "errors_", "=_", "allow", "\\u", "errors_", ",_", "timeout_", "=_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nb_", ",_", "resources_", "=_", "pp_", "._", "preprocess_", "(_", "nb_", ",_", "resources_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Call", " ", "int", "o", " ", "RST", "Exporter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rst", "str_", ",_", "resources_", "=_", "super_", "(_", "Exporter_", ",_", "self_", ")_", "._", "from", "\\u", "notebook", "\\u", "node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "nb_", ",_", "resources_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "orphan", "_", "=_", "nb", "sphinx", "\\u", "metadata_", "._", "get_", "(_", "'", "orphan", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "orphan", "_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rst", "str_", "=_", "':", "orphan", ":\\\\", "n", "\\\\", "n", "'_", "+_", "rst", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "orphan", "_", "is_", "not_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Notebook", "Error_", "(_", "'", "invalid", " ", "orphan", " ", "option", ":", " ", "{", "!", "r", "}'_", "._", "format_", "(_", "orphan", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "rst", "str_", ",_", "resources_", "\\u\\u\\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_", "Notebook", "Parser_", "(_", "rst_", "._", "Parser_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sph", "inx", " ", "source", " ", "parser", " ", "for", " ", "Ju", "pyt", "er", " ", "notebook", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Us", "es", " ", "nb", "sphinx", ".", "Exporte", "r", " ", "to", " ", "convert", " ", "notebook", " ", "content", " ", "to", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "re", "Structur", "ed", "Text", " ", "string", ",", " ", "whi", "ch", " ", "is", " ", "then", " ", "parsed", " ", "by", " ", "Sph", "inx", "'", "s", " ", "bui", "lt", "-", "in", "\\", "10", ";", " ", " ", " ", " ", "re", "ST", " ", "parser", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Notebook", "Parser_", "(_", "rst_", "._", "Parser_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "transforms_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "List", " ", "of", " ", "transform", "s", " ", "for", " ", "document", "s", " ", "parsed", " ", "by", " ", "this", " ", "parser", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rst_", "._", "Parser_", "._", "get", "\\u", "transforms_", "(_", "self_", ")_", "+_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Process", "Local", "Links_", ",_", "Creat", "e", "Sect", "ion", "Labels_", ",_", "Replace", "Alert", "Di", "vs_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Notebook", "Parser_", "(_", "rst_", "._", "Parser_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "inputs", "tring_", ",_", "document_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "e", " ", "`", "inputs", "tring", "`", ",", " ", "write", " ", "results", " ", "to", " ", "`", "document", "`.\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nb_", "=_", "nb", "format_", "._", "reads_", "(_", "inputs", "tring_", ",_", "as", "\\u", "version_", "=_", "\\u", "ipynb", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "=_", "document_", "._", "settings_", "._", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srcdir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "env_", "._", "doc2", "path_", "(_", "env_", "._", "docname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aux", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "env_", "._", "doct", "ree", "dir_", ",_", "'", "nb", "sphinx", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sphinx_", "._", "util_", "._", "ensure", "dir_", "(_", "aux", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resources_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Work", "ing", " ", "director", "y", " ", "for", " ", "Execut", "e", "Preprocessor", "_", "\\u\\u\\uNL\\u\\u\\u_", "resources_", "[_", "'", "metadata", "'_", "]_", "=_", "{_", "'", "path", "'_", ":_", "srcdir_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sph", "inx", " ", "doe", "sn", "'", "t", " ", "accept", " ", "abs", "olute", " ", "path", "s", " ", "in", " ", "images", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "resources_", "[_", "'", "output", "\\u", "files", "\\u", "dir", "'_", "]_", "=_", "os_", "._", "path_", "._", "relpath_", "(_", "aux", "dir_", ",_", "srcdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resources_", "[_", "'", "unique", "\\u", "key", "'_", "]_", "=_", "env_", "._", "docname_", "._", "replace_", "(_", "'/'_", ",_", "'\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "exporter_", "=_", "Exporter_", "(_", "allow", "\\u", "errors_", "=_", "env_", "._", "config_", "._", "nb", "sphinx", "\\u", "allow", "\\u", "errors_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "timeout_", "=_", "env_", "._", "config_", "._", "nb", "sphinx", "\\u", "timeout_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "codec", "ell", "\\u", "lexer_", "=_", "env_", "._", "config_", "._", "nb", "sphinx", "\\u", "codec", "ell", "\\u", "lexer_", ")_", "\\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 ", " _", "rst", "string_", ",_", "resources_", "=_", "exporter_", "._", "from", "\\u", "notebook", "\\u", "node_", "(_", "nb_", ",_", "resources_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Notebook", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "._", "warn_", "(_", "env_", "._", "docname_", ",_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "#", " ", "document", " ", "is", " ", "unchanged", " ", "(", "i", ".", "e", ".", " ", "empty", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "addition", "al", " ", "output", " ", "files", " ", "(", "figure", "s", " ", "etc", ".)", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "see", " ", "nbc", "onv", "ert", ".", "writer", "s", ".", "Files", "Write", "r", ".", "write", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "filename_", ",_", "data_", "in_", "resources_", "._", "get_", "(_", "'", "output", "s", "'_", ",_", "{_", "}_", ")_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dest_", "=_", "os_", "._", "path_", "._", "normpath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "srcdir_", ",_", "filename_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "dest_", ",_", "'", "wb", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rst_", "._", "Parser_", "._", "parse_", "(_", "self_", ",_", "rst", "string_", ",_", "document_", ")_", "\\u\\u\\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_", "Notebook", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Error", " ", "dur", "ing", " ", "notebook", " ", "pars", "ing", ".\"\"\"_", "\\u\\u\\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_", "Code", "Node_", "(_", "docutils_", "._", "nodes_", "._", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "custom", " ", "node", " ", "tha", "t", " ", "contain", "s", " ", "a", " ", "literal", "\\u", "block", " ", "node", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Code", "Node_", "(_", "docutils_", "._", "nodes_", "._", "Element_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "create_", "(_", "cls_", ",_", "text_", ",_", "language_", "=_", "'", "none", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "new", " ", "Code", "Node", " ", "contain", "ing", " ", "a", " ", "literal", "\\u", "block", " ", "node", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "App", "arent", "ly", ",", " ", "this", " ", "cann", "ot", " ", "be", " ", "don", "e", " ", "in", " ", "Code", "Node", ".\\u", "\\u", "init", "\\u\\u()", ",", " ", "see", ":", "\\", "10", ";", " ", " ", " ", " ", "https", "://", "group", "s", ".", "google", ".", "com", "/", "forum", "/", "#!", "topic", "/", "sphinx", "-", "dev", "/", "0c", "hv", "7", "Bs", "Yu", "W", "0", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "docutils_", "._", "nodes_", "._", "literal", "\\u", "block_", "(_", "text_", ",_", "text_", ",_", "language_", "=_", "language_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "(_", "text_", ",_", "node_", ")_", "\\u\\u\\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_", "Ad", "monit", "ion", "Node_", "(_", "docutils_", "._", "nodes_", "._", "Element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "custom", " ", "node", " ", "for", " ", "info", " ", "and", " ", "warn", "ing", " ", "box", "es", ".\"\"\"_", "\\u\\u\\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_", "Nb", "Input_", "(_", "rst_", "._", "Directive", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "notebook", " ", "input", " ", "cell", " ", "with", " ", "prompt", " ", "and", " ", "code", " ", "area", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "require", "d\\u", "arguments_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "al", "\\u", "arguments_", "=_", "1_", "#", " ", "lexer", " ", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "\\u", "argu", "ment", "\\u", "whitespace_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "spec_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "executi", "on", "-", "count", "'_", ":_", "rst_", "._", "directives_", "._", "posit", "ive", "\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "empty", "-", "lines", "-", "bef", "ore", "'_", ":_", "rst_", "._", "directives_", "._", "nonn", "egat", "ive", "\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "empty", "-", "lines", "-", "after", "'_", ":_", "rst_", "._", "directives_", "._", "nonn", "egat", "ive", "\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "no", "-", "output", "'_", ":_", "rst_", "._", "directives_", "._", "flag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "content_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Nb", "Input_", "(_", "rst_", "._", "Directive", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "is", " ", "call", "ed", " ", "by", " ", "the", " ", "re", "ST", " ", "parser", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "executi", "on", "\\u", "count_", "=_", "self_", "._", "options_", "._", "get_", "(_", "'", "executi", "on", "-", "count", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classes_", "=_", "[_", "'", "nbin", "put", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "no", "-", "output", "'_", "in_", "self_", "._", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "classes_", "._", "append_", "(_", "'", "nbl", "ast", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "container_", "=_", "docutils_", "._", "nodes_", "._", "container_", "(_", "classes_", "=_", "classes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inp", "ut", " ", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "=_", "'", "In", " ", "[{}]", ":'_", "._", "format_", "(_", "executi", "on", "\\u", "count_", "if_", "executi", "on", "\\u", "count_", "else_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "container_", "+=_", "Code", "Node_", "._", "create_", "(_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "late", "x", "\\u", "prompt_", "=_", "text_", "+_", "'", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inp", "ut", " ", "code", " ", "area_", "\\u\\u\\uNL\\u\\u\\u_", "text_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "self_", "._", "content_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "Code", "Node_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "text_", ",_", "language_", "=_", "self_", "._", "arguments_", "[_", "0_", "]_", "if_", "self_", "._", "arguments_", "else_", "'", "none", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "set\\u", "empty", "\\u", "lines_", "(_", "node_", ",_", "self_", "._", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "attributes_", "[_", "'", "late", "x", "\\u", "prompt", "'_", "]_", "=_", "late", "x", "\\u", "prompt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "container_", "+=_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state_", "._", "document_", "[_", "'", "nb", "sphinx", "\\u", "include", "\\u", "css", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "container_", "]_", "\\u\\u\\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_", "Nb", "Output_", "(_", "rst_", "._", "Directive", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "notebook", " ", "output", " ", "cell", " ", "with", " ", "option", "al", " ", "prompt", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "require", "d\\u", "arguments_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "al", "\\u", "arguments_", "=_", "1_", "#", " ", "'", "rst", "'", " ", "or", " ", "not", "hing", " ", "(", "whi", "ch", " ", "means", " ", "literal", " ", "text", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "final", "\\u", "argu", "ment", "\\u", "whitespace_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "spec_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "executi", "on", "-", "count", "'_", ":_", "rst_", "._", "directives_", "._", "posit", "ive", "\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "more", "-", "to", "-", "come", "'_", ":_", "rst_", "._", "directives_", "._", "flag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "empty", "-", "lines", "-", "bef", "ore", "'_", ":_", "rst_", "._", "directives_", "._", "nonn", "egat", "ive", "\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "empty", "-", "lines", "-", "after", "'_", ":_", "rst_", "._", "directives_", "._", "nonn", "egat", "ive", "\\u", "int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "class", "'_", ":_", "rst_", "._", "directives_", "._", "unchanged", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "content_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Nb", "Output_", "(_", "rst_", "._", "Directive", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "is", " ", "call", "ed", " ", "by", " ", "the", " ", "re", "ST", " ", "parser", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "type_", "=_", "self_", "._", "arguments_", "[_", "0_", "]_", "if_", "self_", "._", "arguments_", "else_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "executi", "on", "\\u", "count_", "=_", "self_", "._", "options_", "._", "get_", "(_", "'", "executi", "on", "-", "count", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classes_", "=_", "[_", "'", "nbo", "ut", "put", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "more", "-", "to", "-", "come", "'_", "not_", "in_", "self_", "._", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "classes_", "._", "append_", "(_", "'", "nbl", "ast", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "container_", "=_", "docutils_", "._", "nodes_", "._", "container_", "(_", "classes_", "=_", "classes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Optio", "nal", " ", "output", " ", "prompt_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "executi", "on", "\\u", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "'", "Out", "[{}]", ":'_", "._", "format_", "(_", "executi", "on", "\\u", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "container_", "+=_", "Code", "Node_", "._", "create_", "(_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "late", "x", "\\u", "prompt_", "=_", "text_", "+_", "'", " ", "'_", "\\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_", "+=_", "rst_", "._", "nodes_", "._", "container_", "(_", ")_", "#", " ", "empty", " ", "container", " ", "for", " ", "HTML_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "late", "x", "\\u", "prompt_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", "area_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "output", "type_", "==_", "'", "rst", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "classes_", "=_", "[_", "self_", "._", "options_", "._", "get_", "(_", "'", "class", "'_", ",_", "''_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "area_", "=_", "docutils_", "._", "nodes_", "._", "container_", "(_", "classes_", "=_", "classes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state_", "._", "nest", "ed", "\\u", "parse_", "(_", "self_", "._", "content_", ",_", "self_", "._", "content", "\\u", "offset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "area_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "container_", "+=_", "output", "\\u", "area_", "\\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 ", " _", "text_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "self_", "._", "content_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "Code", "Node_", "._", "create_", "(_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "set\\u", "empty", "\\u", "lines_", "(_", "node_", ",_", "self_", "._", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "attributes_", "[_", "'", "late", "x", "\\u", "prompt", "'_", "]_", "=_", "late", "x", "\\u", "prompt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "container_", "+=_", "node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "state_", "._", "document_", "[_", "'", "nb", "sphinx", "\\u", "include", "\\u", "css", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "container_", "]_", "\\u\\u\\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", "Nb", "Ad", "monit", "ion_", "(_", "rst_", "._", "Directive", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", " ", "class", " ", "for", " ", "Nb", "Info", " ", "and", " ", "Nb", "Warn", "ing", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "require", "d\\u", "arguments_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "al", "\\u", "arguments_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option", "\\u", "spec_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "content_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Nb", "Ad", "monit", "ion_", "(_", "rst_", "._", "Directive", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "is", " ", "call", "ed", " ", "by", " ", "the", " ", "re", "ST", " ", "parser", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "Ad", "monit", "ion", "Node_", "(_", "classes_", "=_", "[_", "'", "adm", "oni", "tion", "'_", ",_", "self_", "._", "\\u", "class_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "state_", "._", "nest", "ed", "\\u", "parse_", "(_", "self_", "._", "content_", ",_", "self_", "._", "content", "\\u", "offset_", ",_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "node_", "]_", "\\u\\u\\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_", "Nb", "Info_", "(_", "\\u", "Nb", "Ad", "monit", "ion_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "An", " ", "informati", "on", " ", "box", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "'", "note", "'_", "\\u\\u\\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_", "Nb", "Warning_", "(_", "\\u", "Nb", "Ad", "monit", "ion_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "warn", "ing", " ", "box", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "'", "warn", "ing", "'_", "\\u\\u\\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_", "mark", "down", "2r", "st_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "a", " ", "Markdown", " ", "string", " ", "to", " ", "re", "ST", " ", "via", " ", "pand", "oc", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "very", " ", "similar", " ", "to", " ", "nbc", "onv", "ert", ".", "filter", "s", ".", "mark", "down", ".", "mark", "down", "2r", "st", "()", ",", "\\", "10", ";", " ", " ", " ", " ", "except", " ", "tha", "t", " ", "it", " ", "use", "s", " ", "a", " ", "pand", "oc", " ", "filter", " ", "to", " ", "convert", " ", "raw", " ", "La", "Te", "X", " ", "blocks", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "\"", "math", "\"", " ", "directive", "s", " ", "(", "inst", "ead", " ", "of", " ", "\"", "raw", "::", " ", "late", "x", "\"", " ", "directive", "s", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "raw", "late", "x2", "math", "\\u", "hook_", "(_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "obj_", "._", "get_", "(_", "'", "t", "'_", ")_", "==_", "'", "Ra", "w", "Block", "'_", "and_", "obj_", "[_", "'", "c", "'_", "]_", "[_", "0_", "]_", "==_", "'", "late", "x", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "[_", "'", "t", "'_", "]_", "=_", "'", "Para", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "[_", "'", "c", "'_", "]_", "=_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "t", "'_", ":_", "'", "Math", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "c", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "t", "'_", ":_", "'", "Display", "Math", "'_", ",_", "'", "c", "'_", ":_", "[_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "[_", "'", "c", "'_", "]_", "[_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "raw", "late", "x2", "math_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json", "\\u", "data_", "=_", "json_", "._", "loads_", "(_", "text_", ",_", "object\\u", "hook_", "=_", "raw", "late", "x2", "math", "\\u", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json_", "._", "dumps_", "(_", "json", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rst", "string_", "=_", "pand", "oc_", "(_", "text_", ",_", "'", "mark", "down", "'_", ",_", "'", "rst", "'_", ",_", "filter", "\\u", "func_", "=_", "raw", "late", "x2", "math_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "re_", "._", "sub_", "(_", "r", "'", "^", "(\\\\", "s", "*)\\\\", ".\\\\", ".", " ", "math", "::", "$'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\", "1", "..", " ", "math", "::", "\\\\", "1", " ", " ", " ", ":", "now", "rap", ":'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rst", "string_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flags_", "=_", "re_", "._", "MULTILINE_", ")_", "\\u\\u\\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_", "pand", "oc_", "(_", "source_", ",_", "fmt_", ",_", "to_", ",_", "filter", "\\u", "func_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "a", " ", "string", " ", "in", " ", "format", " ", "`", "from", "`", " ", "to", " ", "format", " ", "`", "to", "`", " ", "via", " ", "pand", "oc", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "based", " ", "on", " ", "nbc", "onv", "ert", ".", "util", "s", ".", "pand", "oc", ".", "pand", "oc", "()", " ", "and", " ", "extend", "ed", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "allow", " ", "passi", "ng", " ", "a", " ", "filter", " ", "function", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "encode_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "text_", "if_", "isinstance_", "(_", "text_", ",_", "bytes_", ")_", "else_", "text_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "decode_", "(_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "data_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "if_", "isinstance_", "(_", "data_", ",_", "bytes_", ")_", "else_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd", "1_", "=_", "[_", "'", "pand", "oc", "'_", ",_", "'--", "from", "'_", ",_", "fmt_", ",_", "'--", "to", "'_", ",_", "'", "json", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd", "2_", "=_", "[_", "'", "pand", "oc", "'_", ",_", "'--", "from", "'_", ",_", "'", "json", "'_", ",_", "'--", "to", "'_", ",_", "to_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nbc", "onv", "ert_", "._", "utils_", "._", "pand", "oc_", "._", "check", "\\u", "pand", "oc", "\\u", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "cmd", "1_", ",_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json", "\\u", "data_", ",_", "\\u_", "=_", "p_", "._", "communicate_", "(_", "encode_", "(_", "source_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "filter", "\\u", "func_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json", "\\u", "data_", "=_", "encode_", "(_", "filter", "\\u", "func_", "(_", "decode_", "(_", "json", "\\u", "data_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "cmd", "2_", ",_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", ",_", "\\u_", "=_", "p_", "._", "communicate_", "(_", "json", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "decode_", "(_", "out_", ")_", "._", "rstrip_", "(_", "'\\\\", "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_", "def_", "\\u", "extract", "\\u", "toc", "tree_", "(_", "cell_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Extract", " ", "link", "s", " ", "from", " ", "Markdown", " ", "cell", " ", "and", " ", "create", " ", "toc", "tree", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "'..", " ", "toc", "tree", "::'", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "=_", "cell_", "._", "metadata_", "[_", "'", "nb", "sphinx", "-", "toc", "tree", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "option_", ",_", "value_", "in_", "options_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "._", "append_", "(_", "':", "{}:", "'_", "._", "format_", "(_", "option_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "value_", "is_", "False_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "._", "append_", "(_", "':", "{}:", " ", "{}'_", "._", "format_", "(_", "option_", ",_", "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_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Notebook", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "invalid", " ", "nb", "sphinx", "-", "toc", "tree", " ", "option", ":", " ", "{", "!", "r", "}'_", "._", "format_", "(_", "options_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "text_", "=_", "nbc", "onv", "ert_", "._", "filters_", "._", "mark", "down", "2r", "st_", "(_", "cell_", "._", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "settings_", "=_", "docutils_", "._", "frontend_", "._", "Optio", "n", "Parser_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "components_", "=_", "(_", "rst_", "._", "Parser_", ",_", ")_", ")_", "._", "get", "\\u", "default", "\\u", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "toc", "tree", "\\u", "node_", "=_", "docutils_", "._", "utils_", "._", "new", "\\u", "document_", "(_", "'", "extract", "\\u", "toc", "tree", "'_", ",_", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "=_", "rst_", "._", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "parse_", "(_", "text_", ",_", "toc", "tree", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "caption", "'_", "not_", "in_", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sec_", "in_", "toc", "tree", "\\u", "node_", "._", "traverse_", "(_", "docutils_", "._", "nodes_", "._", "section_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "sec_", "._", "children_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "sec_", "._", "children_", "[_", "0_", "]_", ",_", "docutils_", "._", "nodes_", "._", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title_", "=_", "sec_", "._", "children_", "[_", "0_", "]_", "._", "ast", "ext_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "._", "append_", "(_", "':", "caption", ":", " ", "'_", "+_", "title_", ")_", "\\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_", "lines_", "._", "append_", "(_", "''_", ")_", "#", " ", "empty", " ", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ref_", "in_", "toc", "tree", "\\u", "node_", "._", "traverse_", "(_", "docutils_", "._", "nodes_", "._", "reference_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lines_", "._", "append_", "(_", "ref_", "._", "ast", "ext_", "(_", ")_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "''_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "<'_", "+_", "unquote_", "(_", "ref_", "._", "get_", "(_", "'", "ref", "uri", "'_", ")_", ")_", "+_", "'>'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "'\\\\", "n", " ", " ", " ", " ", "'_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\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", "get", "\\u", "empty", "\\u", "lines_", "(_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "number", " ", "of", " ", "empty", " ", "lines", " ", "bef", "ore", " ", "and", " ", "after", " ", "code", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "before_", "=_", "len_", "(_", "text_", ")_", "-_", "len_", "(_", "text_", "._", "lstrip_", "(_", "'\\\\", "n", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "after_", "=_", "len_", "(_", "text_", ")_", "-_", "len_", "(_", "text_", "._", "strip_", "(_", "'\\\\", "n", "'_", ")_", ")_", "-_", "before_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "before_", ",_", "after_", "\\u\\u\\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", "set\\u", "empty", "\\u", "lines_", "(_", "node_", ",_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "\"", "empty", " ", "lines", "\"", " ", "attribute", "s", " ", "on", " ", "a", " ", "Code", "Node", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "http", "://", "stack", "overflow", ".", "com", "/", "q", "/", "340", "500", "4", "4", "/", "5000", "98", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "attr_", "in_", "'", "empty", "-", "lines", "-", "bef", "ore", "'_", ",_", "'", "empty", "-", "lines", "-", "after", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "options_", "._", "get_", "(_", "attr_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "._", "attributes_", "[_", "attr_", "]_", "=_", "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_", "Process", "Local", "Links_", "(_", "docutils_", "._", "transforms_", "._", "Transform_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Process", " ", "link", "s", " ", "to", " ", "local", " ", "files", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Mark", "s", " ", "local", " ", "files", " ", "to", " ", "be", " ", "copie", "d", " ", "to", " ", "the", " ", "HTM", "L", " ", "output", " ", "director", "y", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "turns", " ", "link", "s", " ", "to", " ", "local", " ", "notebook", "s", " ", "int", "o", " ", "``", ":", "doc", ":`", "`", "/", "``", ":", "ref", ":`", "`", " ", "link", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Link", "s", " ", "to", " ", "subsection", "s", " ", "are", " ", "possib", "le", " ", "with", " ", "``.", "..", "#", "Subsect", "ion", "-", "Tit", "le", "``.", "\\", "10", ";", " ", " ", " ", " ", "The", "se", " ", "link", "s", " ", "use", " ", "the", " ", "labels", " ", "created", " ", "by", " ", "Creat", "e", "Sect", "ion", "Label", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Link", "s", " ", "to", " ", "subsection", "s", " ", "use", " ", "``", ":", "ref", ":`", "`", ",", " ", "link", "s", " ", "to", " ", "whole", " ", "notebook", "s", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "``", ":", "doc", ":`", "`.", " ", " ", "Lat", "ter", " ", "can", " ", "be", " ", "usef", "ul", " ", "if", " ", "you", " ", "have", " ", "an", " ", "``", "index", ".", "rst", "``", " ", "but", "\\", "10", ";", " ", " ", " ", " ", "als", "o", " ", "want", " ", "a", " ", "distinct", " ", "``", "index", ".", "ipynb", "``", " ", "for", " ", "use", " ", "with", " ", "Ju", "pyt", "er", ".", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "this", " ", "case", " ", "you", " ", "can", " ", "use", " ", "suc", "h", " ", "a", " ", "link", " ", "in", " ", "a", " ", "notebook", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "[", "Back", " ", "to", " ", "main", " ", "page", "](", "index", ".", "ipynb", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "Ju", "pyt", "er", ",", " ", "this", " ", "will", " ", "create", " ", "a", " ", "\"", "normal", "\"", " ", "link", " ", "to", " ", "``", "index", ".", "ipynb", "``", ",", " ", "but", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "files", " ", "generat", "ed", " ", "by", " ", "Sph", "inx", ",", " ", "this", " ", "will", " ", "bec", "ome", " ", "a", " ", "link", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "main", " ", "page", " ", "created", " ", "from", " ", "``", "index", ".", "rst", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "priority_", "=_", "400_", "#", " ", "Sho", "ul", "d", " ", "probab", "ly", " ", "be", " ", "adjusted", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Process", "Local", "Links_", "(_", "docutils_", "._", "transforms_", "._", "Transform_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "apply_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "=_", "self_", "._", "document_", "._", "settings_", "._", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "document_", "._", "traverse_", "(_", "docutils_", "._", "nodes_", "._", "reference_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uri_", "=_", "node_", "._", "get_", "(_", "'", "ref", "uri", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "uri_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "#", " ", "No", " ", "URI", " ", "(", "e", ".", "g", ".", " ", "named", " ", "reference", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "':/", "/'_", "in_", "uri_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "#", " ", "Not", " ", "a", " ", "local", " ", "link_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "uri_", "._", "startswith_", "(_", "'#'_", ")_", "or_", "uri_", "._", "startswith_", "(_", "'", "mail", "to", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "#", " ", "Not", "hing", " ", "to", " ", "be", " ", "done_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "suffix_", "in_", "env_", "._", "config_", "._", "source", "\\u", "suffix_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "uri_", "._", "lower_", "(_", ")_", "._", "endswith_", "(_", "suffix_", "._", "lower_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "target_", "=_", "uri_", "[_", ":_", "-_", "len_", "(_", "suffix_", ")_", "]_", "\\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 ", " _", "target_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "target_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "ext_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reft", "ype_", "=_", "'", "doc", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "domain_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'.", "ipynb", "#'_", "in_", "uri_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "idx_", "=_", "uri_", "._", "lower_", "(_", ")_", "._", "find_", "(_", "'.", "ipynb", "#'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "uri_", "[_", ":_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "ext_", "=_", "uri_", "[_", "idx_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reft", "ype_", "=_", "'", "ref", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ref", "domain_", "=_", "'", "std", "'_", "\\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 ", " _", "file_", "=_", "os_", "._", "path_", "._", "normpath_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "env_", "._", "docname_", ")_", ",_", "uri_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "os_", "._", "path_", "._", "join_", "(_", "env_", "._", "srcdir_", ",_", "file_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "env_", "._", "app_", "._", "warn_", "(_", "'", "file", " ", "not", " ", "found", ":", " ", "{", "!", "r", "}'_", "._", "format_", "(_", "file_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "._", "doc2", "path_", "(_", "env_", "._", "docname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "#", " ", "Link", " ", "is", " ", "ignored_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "file_", "._", "startswith_", "(_", "'..'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "env_", "._", "app_", "._", "warn_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", " ", "outsi", "de", " ", "of", " ", "source", " ", "director", "y", ":", " ", "{", "!", "r", "}'_", "._", "format_", "(_", "file_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "._", "doc2", "path_", "(_", "env_", "._", "docname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "#", " ", "Link", " ", "is", " ", "ignored_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "env_", ",_", "'", "nb", "sphinx", "\\u", "files", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "env_", "._", "nb", "sphinx", "\\u", "files_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "env_", "._", "nb", "sphinx", "\\u", "files_", "._", "setdefault_", "(_", "env_", "._", "docname_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "#", " ", "We", "'", "re", " ", "don", "e", " ", "here_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "target", "\\u", "docname_", "=_", "os_", "._", "path_", "._", "normpath_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "env_", "._", "docname_", ")_", ",_", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "target", "\\u", "docname_", "in_", "env_", "._", "found", "\\u", "docs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "target", "\\u", "ext_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "target_", "=_", "target", "\\u", "docname_", "+_", "target", "\\u", "ext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target_", "=_", "target_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "linkt", "ext_", "=_", "node_", "._", "ast", "ext_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xref", "_", "=_", "sphinx_", "._", "addn", "odes_", "._", "pend", "ing", "\\u", "xref", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "reft", "ype_", "=_", "reft", "ype_", ",_", "reft", "arget", "_", "=_", "target_", ",_", "ref", "domain_", "=_", "ref", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ref", "warn_", "=_", "True_", ",_", "ref", "explicit", "_", "=_", "True_", ",_", "ref", "doc_", "=_", "env_", "._", "docname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xref", "_", "+=_", "docutils_", "._", "nodes_", "._", "Text_", "(_", "linkt", "ext_", ",_", "linkt", "ext_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "replace", "\\u", "self_", "(_", "xref", "_", ")_", "\\u\\u\\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_", "Creat", "e", "Sect", "ion", "Labels_", "(_", "docutils_", "._", "transforms_", "._", "Transform_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Make", " ", "labels", " ", "for", " ", "each", " ", "notebook", " ", "and", " ", "each", " ", "section", " ", "there", "of", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", "se", " ", "labels", " ", "are", " ", "referenced", " ", "in", " ", "Process", "Local", "Link", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ":", " ", "Sph", "inx", " ", "lower", "-", "case", "s", " ", "the", " ", "HTM", "L", " ", "section", " ", "ID", "s", ",", " ", "Ju", "pyt", "er", " ", "doe", "sn", "'", "t", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "priority_", "=_", "250_", "#", " ", "Be", "fore", " ", "reference", "s", ".", "Propag", "ate", "Target", "s", " ", "(", "260", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Sect", "ion", "Labels_", "(_", "docutils_", "._", "transforms_", "._", "Transform_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "apply_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "=_", "self_", "._", "document_", "._", "settings_", "._", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "still", "\\u", "have", "\\u", "to", "\\u", "create", "\\u", "the", "\\u", "notebook", "\\u", "label_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "section_", "in_", "self_", "._", "document_", "._", "traverse_", "(_", "docutils_", "._", "nodes_", "._", "section_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "section_", "._", "children_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "section_", "._", "children_", "[_", "0_", "]_", ",_", "docutils_", "._", "nodes_", "._", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title_", "=_", "section_", "._", "children_", "[_", "0_", "]_", "._", "ast", "ext_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link", "\\u", "id_", "=_", "title_", "._", "replace_", "(_", "'", " ", "'_", ",_", "'-'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "section_", "[_", "'", "ids", "'_", "]_", "=_", "[_", "link", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label_", "=_", "env_", "._", "docname_", "+_", "'.", "ipynb", "#'_", "+_", "link", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label_", "=_", "label_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "domain", "data_", "[_", "'", "std", "'_", "]_", "[_", "'", "labels", "'_", "]_", "[_", "label_", "]_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "._", "docname_", ",_", "link", "\\u", "id_", ",_", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "domain", "data_", "[_", "'", "std", "'_", "]_", "[_", "'", "anon", "labels", "'_", "]_", "[_", "label_", "]_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "._", "docname_", ",_", "link", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "label", " ", "for", " ", "the", " ", "whole", " ", "notebook", " ", "usi", "ng", " ", "the", " ", "first", " ", "section", ":_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "i", "\\u", "still", "\\u", "have", "\\u", "to", "\\u", "create", "\\u", "the", "\\u", "notebook", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "label_", "=_", "env_", "._", "docname_", "._", "lower_", "(_", ")_", "+_", "'.", "ipynb", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "domain", "data_", "[_", "'", "std", "'_", "]_", "[_", "'", "labels", "'_", "]_", "[_", "label_", "]_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "._", "docname_", ",_", "''_", ",_", "title_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "._", "domain", "data_", "[_", "'", "std", "'_", "]_", "[_", "'", "anon", "labels", "'_", "]_", "[_", "label_", "]_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "env_", "._", "docname_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "still", "\\u", "have", "\\u", "to", "\\u", "create", "\\u", "the", "\\u", "notebook", "\\u", "label_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Replace", "Alert", "Di", "vs_", "(_", "docutils_", "._", "transforms_", "._", "Transform_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Replace", " ", "cert", "ain", " ", "<", "div", ">", " ", "element", "s", " ", "with", " ", "Ad", "monit", "ion", "Node", " ", "container", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "a", " ", "quick", "-", "and", "-", "dir", "ty", " ", "work", "-", "aro", "und", " ", "unti", "l", " ", "a", " ", "proper", "\\", "10", ";", " ", " ", " ", " ", "Mar", "down", "/", "Common", "Mark", " ", "extensi", "on", " ", "for", " ", "note", "/", "warn", "ing", " ", "box", "es", " ", "is", " ", "avail", "able", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "priority_", "=_", "500_", "#", " ", "Do", "esn", "'", "t", " ", "reall", "y", " ", "matte", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "start", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "r", "'\\\\", "s", "*<", "div", "\\\\", "s", "*", "class", "\\\\", "s", "*=", "\\\\", "s", "*(", "?", "P", "<", "q", ">\"", "|\\\\", "')", "([", "a", "-", "z", "\\\\", "s", "-]", "*)(", "?", "P", "=", "q", ")\\\\", "s", "*>", "\\\\", "s", "*\\\\", "Z", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flags_", "=_", "re_", "._", "IGNORECASE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "class", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "r", "'\\\\", "s", "*", "alert", "\\\\", "s", "*", "alert", "-(", "info", "|", "warn", "ing", ")\\\\", "s", "*\\\\", "Z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "end", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "r", "'\\\\", "s", "*<", "/", "div", "\\\\", "s", "*>", "\\\\", "s", "*\\\\", "Z", "'_", ",_", "flags_", "=_", "re_", "._", "IGNORECASE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Replace", "Alert", "Di", "vs_", "(_", "docutils_", "._", "transforms_", "._", "Transform_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "apply_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "tags_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "document_", "._", "traverse_", "(_", "docutils_", "._", "nodes_", "._", "raw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "node_", "[_", "'", "format", "'_", "]_", "!=_", "'", "html", "'_", ":_", "\\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_", "start", "\\u", "match_", "=_", "self_", "._", "\\u", "start", "\\u", "re_", "._", "match_", "(_", "node_", "._", "ast", "ext_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "start", "\\u", "match_", ":_", "\\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_", "class", "\\u", "match_", "=_", "self_", "._", "\\u", "class", "\\u", "re_", "._", "match_", "(_", "start", "\\u", "match_", "._", "group_", "(_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "class", "\\u", "match_", ":_", "\\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_", "adm", "oni", "tion", "\\u", "class_", "=_", "class", "\\u", "match_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "adm", "oni", "tion", "\\u", "class_", "==_", "'", "info", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "adm", "oni", "tion", "\\u", "class_", "=_", "'", "note", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start", "\\u", "tags_", "._", "append_", "(_", "(_", "node_", ",_", "adm", "oni", "tion", "\\u", "class_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Revers", "ed", " ", "order", " ", "to", " ", "allow", " ", "nest", "ed", " ", "<", "div", ">", " ", "element", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "node_", ",_", "adm", "oni", "tion", "\\u", "class_", "in_", "reversed_", "(_", "start", "\\u", "tags_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "content_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sibling_", "in_", "node_", "._", "traverse_", "(_", "include", "\\u", "self_", "=_", "False_", ",_", "descend", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "siblings", "_", "=_", "True_", ",_", "ascen", "d_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "\\u", "tag_", "=_", "(_", "isinstance_", "(_", "sibling_", ",_", "docutils_", "._", "nodes_", "._", "raw_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "sibling_", "[_", "'", "format", "'_", "]_", "==_", "'", "html", "'_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "end", "\\u", "re_", "._", "match_", "(_", "sibling_", "._", "ast", "ext_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "end", "\\u", "tag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "adm", "oni", "tion", "\\u", "node_", "=_", "Ad", "monit", "ion", "Node_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "classes_", "=_", "[_", "'", "adm", "oni", "tion", "'_", ",_", "adm", "oni", "tion", "\\u", "class_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adm", "oni", "tion", "\\u", "node_", "._", "extend_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "=_", "node_", "._", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "._", "replace_", "(_", "node_", ",_", "adm", "oni", "tion", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "n_", "in_", "content_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "parent_", "._", "remove_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parent_", "._", "remove_", "(_", "sibling_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\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 ", " ", "_", "content_", "._", "append_", "(_", "sibling_", ")_", "\\u\\u\\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_", "builde", "r", "\\u", "init", "ed_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "color", " ", "definit", "ion", "s", " ", "to", " ", "La", "Te", "X", " ", "preamble", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "late", "x", "\\u", "elements_", "=_", "app_", "._", "builder_", "._", "config_", "._", "late", "x", "\\u", "elements_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "late", "x", "\\u", "elements_", "[_", "'", "preamble", "'_", "]_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "LATE", "X", "\\u", "PRE", "AMB", "LE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "elements_", "._", "get_", "(_", "'", "preamble", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "html", "\\u", "page", "\\u", "context_", "(_", "app_", ",_", "pagename", "_", ",_", "template", "name_", ",_", "context_", ",_", "doct", "ree_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "CS", "S", " ", "string", " ", "to", " ", "HTM", "L", " ", "page", "s", " ", "tha", "t", " ", "contain", " ", "code", " ", "cells", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "style_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "doct", "ree_", "and_", "doct", "ree_", "._", "get_", "(_", "'", "nb", "sphinx", "\\u", "include", "\\u", "css", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "style_", "+=_", "CS", "S", "\\u", "STRING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "doct", "ree_", "and_", "app_", "._", "config_", "._", "html", "\\u", "theme_", "==_", "'", "sphinx", "\\u", "rtd", "\\u", "them", "e", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "style_", "+=_", "CS", "S", "\\u", "STRING", "\\u", "READ", "THE", "DOCS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "style_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "'", "body", "'_", "]_", "=_", "'\\\\", "n", "<", "style", ">'_", "+_", "style_", "+_", "'<", "/", "style", ">\\\\", "n", "'_", "+_", "context_", "[_", "'", "body", "'_", "]_", "\\u\\u\\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_", "html", "\\u", "collect", "\\u", "pages_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "event", " ", "handler", " ", "is", " ", "abu", "sed", " ", "to", " ", "copy", " ", "local", " ", "files", " ", "aro", "und", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "file", "\\u", "list_", "in_", "getattr_", "(_", "app_", "._", "env_", ",_", "'", "nb", "sphinx", "\\u", "files", "'_", ",_", "{_", "}_", ")_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "files_", "._", "update_", "(_", "file", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "file_", "in_", "app_", "._", "status", "\\u", "iterator_", "(_", "files_", ",_", "'", "copy", "ing", " ", "linked", " ", "files", "...", " ", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sphinx_", "._", "util_", "._", "console_", "._", "brow", "n_", ",_", "len_", "(_", "files_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target_", "=_", "os_", "._", "path_", "._", "join_", "(_", "app_", "._", "builder_", "._", "outdir_", ",_", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sphinx_", "._", "util_", "._", "ensure", "dir_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "target_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sphinx_", "._", "util_", "._", "copyfile_", "(_", "os_", "._", "path_", "._", "join_", "(_", "app_", "._", "env_", "._", "srcdir_", ",_", "file_", ")_", ",_", "target_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "._", "warn_", "(_", "'", "cann", "ot", " ", "copy", " ", "local", " ", "file", " ", "{", "!", "r", "}:", " ", "{}'_", "._", "format_", "(_", "file_", ",_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "]_", "#", " ", "No", " ", "new", " ", "HTM", "L", " ", "page", "s", " ", "are", " ", "created_", "\\u\\u\\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_", "env", "\\u", "pur", "ge", "\\u", "doc_", "(_", "app_", ",_", "env_", ",_", "docname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Remove", " ", "list", " ", "of", " ", "local", " ", "files", " ", "for", " ", "a", " ", "give", "n", " ", "document", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "env_", "._", "nb", "sphinx", "\\u", "files_", "[_", "docname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Attribute", "Error_", ",_", "Key", "Error_", ")_", ":_", "\\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_", "def_", "depart", "\\u", "code", "\\u", "html_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "empty", " ", "lines", " ", "bef", "ore", " ", "and", " ", "after", " ", "the", " ", "code", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "self_", "._", "body_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "text_", "._", "replace_", "(_", "'<", "pre", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "pre", ">\\\\", "n", "'_", "+_", "'\\\\", "n", "'_", "*_", "node_", "._", "get_", "(_", "'", "empty", "-", "lines", "-", "bef", "ore", "'_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "text_", "._", "replace_", "(_", "'<", "/", "pre", ">'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "n", "'_", "*_", "node_", "._", "get_", "(_", "'", "empty", "-", "lines", "-", "after", "'_", ",_", "0_", ")_", "+_", "'<", "/", "pre", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "body_", "[_", "-_", "1_", "]_", "=_", "text_", "\\u\\u\\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_", "visit", "\\u", "code", "\\u", "latex_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Av", "oid", " ", "creati", "ng", " ", "a", " ", "separate", " ", "prompt", " ", "node", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "prompt", " ", "will", " ", "be", " ", "pre", "-", "pend", "ed", " ", "in", " ", "the", " ", "main", " ", "code", " ", "node", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "late", "x", "\\u", "prompt", "'_", "not_", "in_", "node_", "._", "attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "docutils_", "._", "nodes_", "._", "Ski", "p", "Node_", "(_", ")_", "\\u\\u\\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_", "depart", "\\u", "code", "\\u", "latex_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Some", " ", "change", "s", " ", "to", " ", "code", " ", "blocks", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "Remove", " ", "the", " ", "frame", " ", "(", "by", " ", "chang", "ing", " ", "Verb", "ati", "m", " ", "->", " ", "Origina", "l", "Verb", "ati", "m", ")", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "Add", " ", "empty", " ", "lines", " ", "bef", "ore", " ", "and", " ", "after", " ", "the", " ", "code", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "Add", " ", "prompt", " ", "to", " ", "the", " ", "first", " ", "line", ",", " ", "empty", " ", "space", " ", "to", " ", "the", " ", "follow", "ing", " ", "lines", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "self_", "._", "body_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "lines_", "[_", "0_", "]_", "==_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "append_", "(_", "lines_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "lines_", "[_", "1_", "]_", "._", "startswith_", "(_", "r", "'\\\\", "begin", "{", "Verb", "ati", "m", "}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "append_", "(_", "lines_", "[_", "1_", "]_", "._", "replace_", "(_", "'", "Verb", "ati", "m", "'_", ",_", "'", "Origina", "l", "Verb", "ati", "m", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code", "\\u", "lines_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "''_", "]_", "*_", "node_", "._", "get_", "(_", "'", "empty", "-", "lines", "-", "bef", "ore", "'_", ",_", "0_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "[_", "2_", ":_", "-_", "2_", "]_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "''_", "]_", "*_", "node_", "._", "get_", "(_", "'", "empty", "-", "lines", "-", "after", "'_", ",_", "0_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prompt_", "=_", "node_", "._", "get_", "(_", "'", "late", "x", "\\u", "prompt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "color_", "=_", "'", "nb", "sphinx", "in", "'_", "if_", "prompt_", "._", "startswith_", "(_", "'", "In", "'_", ")_", "else_", "'", "nb", "sphinx", "out", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix_", "=_", "r", "'\\\\", "textco", "lor", "{'_", "+_", "color_", "+_", "'}", "{'_", "+_", "prompt_", "+_", "'}'_", "if_", "prompt_", "else_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "code", "\\u", "lines_", "[_", ":_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "append_", "(_", "prefix_", "+_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prefix_", "=_", "'", " ", "'_", "*_", "len_", "(_", "prompt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "code", "\\u", "lines_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "._", "append_", "(_", "prefix_", "+_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "lines_", "[_", "-_", "2_", "]_", "._", "startswith_", "(_", "r", "'\\\\", "end", "{", "Verb", "ati", "m", "}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "append_", "(_", "lines_", "[_", "-_", "2_", "]_", "._", "replace_", "(_", "'", "Verb", "ati", "m", "'_", ",_", "'", "Origina", "l", "Verb", "ati", "m", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "lines_", "[_", "-_", "1_", "]_", "==_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "._", "append_", "(_", "lines_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "body_", "[_", "-_", "1_", "]_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "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_", "def_", "visit", "\\u", "adm", "oni", "tion", "\\u", "html_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "body_", "._", "append_", "(_", "self_", "._", "startt", "ag_", "(_", "node_", ",_", "'", "div", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "first", "\\u", "last_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "settings_", "._", "env_", "._", "config_", "._", "html", "\\u", "theme_", "==_", "'", "sphinx", "\\u", "rtd", "\\u", "them", "e", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "node_", "._", "children_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "classes_", "=_", "node_", "._", "children_", "[_", "0_", "]_", "[_", "'", "classe", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "last", "'_", "not_", "in_", "classes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "classes_", "._", "extend_", "(_", "[_", "'", "fa", "'_", ",_", "'", "fa", "-", "excl", "amat", "ion", "-", "circle", "'_", "]_", ")_", "\\u\\u\\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_", "depart", "\\u", "adm", "oni", "tion", "\\u", "html_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "body_", "._", "append_", "(_", "'<", "/", "div", ">\\\\", "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_", "def_", "visit", "\\u", "adm", "oni", "tion", "\\u", "latex_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "http", "://", "tex", ".", "stack", "exchange", ".", "com", "/", "q", "/", "305", "898", "/", "136", "84", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "body_", "._", "append_", "(_", "'\\\\", "n", "\\\\\\\\", "begin", "{", "notice", "}{", "'_", "+_", "node_", "[_", "'", "classe", "s", "'_", "]_", "[_", "1_", "]_", "+_", "'}", "{}", "\\\\\\\\", "uns", "kip", "'_", ")_", "\\u\\u\\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_", "depart", "\\u", "adm", "oni", "tion", "\\u", "latex_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "body_", "._", "append_", "(_", "'\\\\\\\\", "end", "{", "notice", "}\\\\", "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_", "def_", "do", "\\u", "nothing_", "(_", "self_", ",_", "node_", ")_", ":_", "\\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_", "def_", "\\u", "add", "\\u", "notebook", "\\u", "parser_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ug", "ly", " ", "hack", " ", "to", " ", "modif", "y", " ", "source", "\\u", "suff", "ix", " ", "and", " ", "source", "\\u", "parser", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "On", "ce", " ", "https", "://", "git", "hub", ".", "com", "/", "sphinx", "-", "doc", "/", "sphinx", "/", "pull", "/", "220", "9", " ", "is", " ", "merge", "d", " ", "(", "and", "\\", "10", ";", " ", " ", " ", " ", "some", " ", "addition", "al", " ", "time", " ", "has", " ", "pass", "ed", "),", " ", "this", " ", "shou", "ld", " ", "be", " ", "replaced", " ", "by", " ", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "app", ".", "add", "\\u", "source", "\\u", "parser", "('.", "ipynb", "',", " ", "Notebook", "Parser", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "als", "o", " ", "https", "://", "git", "hub", ".", "com", "/", "sphinx", "-", "doc", "/", "sphinx", "/", "issue", "s", "/", "216", "2", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source", "\\u", "suffix_", "=_", "app_", "._", "config_", "._", "\\u", "raw", "\\u", "config_", "._", "get_", "(_", "'", "source", "\\u", "suff", "ix", "'_", ",_", "[_", "'.", "rst", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "source", "\\u", "suffix_", ",_", "sphinx_", "._", "config_", "._", "string", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "\\u", "suffix_", "=_", "[_", "source", "\\u", "suffix_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'.", "ipynb", "'_", "not_", "in_", "source", "\\u", "suffix_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "\\u", "suffix_", "._", "append_", "(_", "'.", "ipynb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "config_", "._", "\\u", "raw", "\\u", "config_", "[_", "'", "source", "\\u", "suff", "ix", "'_", "]_", "=_", "source", "\\u", "suffix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "source", "\\u", "parsers_", "=_", "app_", "._", "config_", "._", "\\u", "raw", "\\u", "config_", "._", "get_", "(_", "'", "source", "\\u", "parser", "s", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'.", "ipynb", "'_", "not_", "in_", "source", "\\u", "parsers_", "and_", "'", "ipynb", "'_", "not_", "in_", "source", "\\u", "parsers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source", "\\u", "parsers_", "[_", "'.", "ipynb", "'_", "]_", "=_", "Notebook", "Parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "config_", "._", "\\u", "raw", "\\u", "config_", "[_", "'", "source", "\\u", "parser", "s", "'_", "]_", "=_", "source", "\\u", "parsers_", "\\u\\u\\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_", "setup_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", " ", "Sph", "inx", " ", "extensi", "on", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "add", "\\u", "notebook", "\\u", "parser_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "._", "add", "\\u", "config", "\\u", "value_", "(_", "'", "nb", "sphinx", "\\u", "allow", "\\u", "error", "s", "'_", ",_", "False_", ",_", "rebuild_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "add", "\\u", "config", "\\u", "value_", "(_", "'", "nb", "sphinx", "\\u", "timeo", "ut", "'_", ",_", "30_", ",_", "rebuild_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "add", "\\u", "config", "\\u", "value_", "(_", "'", "nb", "sphinx", "\\u", "codec", "ell", "\\u", "lexer", "'_", ",_", "'", "none", "'_", ",_", "rebuild_", "=_", "'", "env", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "._", "add", "\\u", "directive_", "(_", "'", "nbin", "put", "'_", ",_", "Nb", "Input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "add", "\\u", "directive_", "(_", "'", "nbo", "ut", "put", "'_", ",_", "Nb", "Output_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "add", "\\u", "directive_", "(_", "'", "nbin", "fo", "'_", ",_", "Nb", "Info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "add", "\\u", "directive_", "(_", "'", "nb", "warn", "ing", "'_", ",_", "Nb", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "add", "\\u", "node_", "(_", "Code", "Node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "html_", "=_", "(_", "do", "\\u", "nothing_", ",_", "depart", "\\u", "code", "\\u", "html_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "latex_", "=_", "(_", "visit", "\\u", "code", "\\u", "latex_", ",_", "depart", "\\u", "code", "\\u", "latex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "add", "\\u", "node_", "(_", "Ad", "monit", "ion", "Node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "html_", "=_", "(_", "visit", "\\u", "adm", "oni", "tion", "\\u", "html_", ",_", "depart", "\\u", "adm", "oni", "tion", "\\u", "html_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "latex_", "=_", "(_", "visit", "\\u", "adm", "oni", "tion", "\\u", "latex_", ",_", "depart", "\\u", "adm", "oni", "tion", "\\u", "latex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "connect_", "(_", "'", "builde", "r", "-", "init", "ed", "'_", ",_", "builde", "r", "\\u", "init", "ed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "connect_", "(_", "'", "html", "-", "page", "-", "context", "'_", ",_", "html", "\\u", "page", "\\u", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "connect_", "(_", "'", "html", "-", "collect", "-", "page", "s", "'_", ",_", "html", "\\u", "collect", "\\u", "pages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "connect_", "(_", "'", "env", "-", "pur", "ge", "-", "doc", "'_", ",_", "env", "\\u", "pur", "ge", "\\u", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "docu", "til", "s", "'", " ", "\"", "code", "\"", " ", "directive", " ", "(", "generat", "ed", " ", "by", " ", "mark", "down", "2r", "st", "/", "pand", "oc", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "behave", " ", "like", " ", "Sph", "inx", "'", "s", " ", "\"", "code", "-", "block", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "see", " ", "https", "://", "git", "hub", ".", "com", "/", "sphinx", "-", "doc", "/", "sphinx", "/", "issue", "s", "/", "215", "5", ":_", "\\u\\u\\uNL\\u\\u\\u_", "rst_", "._", "directives_", "._", "register", "\\u", "directive_", "(_", "'", "code", "'_", ",_", "sphinx_", "._", "directives_", "._", "code_", "._", "Code", "Block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "'", "version", "'_", ":_", "\\u\\u", "version\\u\\u_", ",_", "'", "parall", "el", "\\u", "read", "\\u", "safe", "'_", ":_", "True_", "}_" ]
[ 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,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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 ]
Unused local variable
kennethreitz/tablib/tablib/packages/xlwt3/Column.py
[ { "content": " def __init__(self, colx, parent_sheet):\n if not(isinstance(colx, int) and 0 <= colx <= 255):\n raise ValueError(\"column index (%r) not an int in range(256)\" % colx)\n self._index = colx\n self._parent = parent_sheet\n self._parent_wb = parent_sheet.get_parent()\n self._xf_index = 0x0F\n\n self.width = 0x0B92\n self.hidden = 0\n self.level = 0\n self.collapse = 0", "metadata": "root.Column.__init__", "header": "['class', 'Column', '(', 'object', ')', ':', '___EOS___']", "index": 5 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Column_", "(_", "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_", ",_", "col", "x_", ",_", "parent", "\\u", "sheet_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "(_", "isinstance_", "(_", "col", "x_", ",_", "int_", ")_", "and_", "0_", "<=_", "col", "x_", "<=_", "255_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "column", " ", "index", " ", "(%", "r", ")", " ", "not", " ", "an", " ", "int", " ", "in", " ", "range", "(", "256", ")\"_", "%_", "col", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "index_", "=_", "col", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "parent_", "=_", "parent", "\\u", "sheet_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "parent", "\\u", "wb_", "=_", "parent", "\\u", "sheet_", "._", "get", "\\u", "parent_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "xf", "\\u", "index_", "=_", "0x0F_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "width_", "=_", "0x0", "B", "92_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hidden_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "level_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "collapse", "_", "=_", "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 ]
Except block handles 'BaseException'
nylas/nylas-python/nylas/client/client.py
[ { "content": "def _validate(response):\n status_code_to_exc = {400: InvalidRequestError,\n 401: NotAuthorizedError,\n 402: MessageRejectedError,\n 403: NotAuthorizedError,\n 404: NotFoundError,\n 405: MethodNotSupportedError,\n 409: ConflictError,\n 429: SendingQuotaExceededError,\n 500: ServerError,\n 503: ServiceUnavailableError,\n 504: ServerTimeoutError}\n request = response.request\n url = request.url\n status_code = response.status_code\n data = request.body\n\n if DEBUG:\n print(\"{} {} ({}) => {}: {}\".format(request.method, url, data,\n status_code, response.text))\n\n try:\n data = json.loads(data) if data else None\n except (ValueError, TypeError):\n pass\n\n if status_code == 200:\n return response\n elif status_code in status_code_to_exc:\n cls = status_code_to_exc[status_code]\n try:\n response = json.loads(response.text)\n kwargs = dict(url=url, status_code=status_code,\n data=data)\n\n for key in ['message', 'server_error']:\n if key in response:\n kwargs[key] = response[key]\n\n raise cls(**kwargs)\n\n except (ValueError, TypeError):\n raise cls(url=url, status_code=status_code,\n data=data, message=\"Malformed\")\n else:\n raise APIClientError(url=url, status_code=status_code,\n data=data, message=\"Unknown status code.\")", "metadata": "root._validate", "header": "['module', '___EOS___']", "index": 26 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "validate_", "(_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "code", "\\u", "to", "\\u", "exc_", "=_", "{_", "400_", ":_", "Inva", "lid", "Request", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "401_", ":_", "Not", "Authorized", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "402", "_", ":_", "Messag", "e", "Reject", "ed", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "403_", ":_", "Not", "Authorized", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "404_", ":_", "Not", "Foun", "d", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "405_", ":_", "Meth", "od", "Not", "Supp", "orte", "d", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "409_", ":_", "Confl", "ict", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "429", "_", ":_", "Sen", "ding", "Quota", "Exce", "eded", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "500_", ":_", "Server", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "503_", ":_", "Service", "Una", "vail", "able", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "504_", ":_", "Server", "Time", "out", "Error_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "response_", "._", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "request_", "._", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status", "\\u", "code_", "=_", "response_", "._", "status", "\\u", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "request_", "._", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"{}", " ", "{}", " ", "({})", " ", "=>", " ", "{}:", " ", "{}\"_", "._", "format_", "(_", "request_", "._", "method_", ",_", "url_", ",_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status", "\\u", "code_", ",_", "response_", "._", "text_", ")_", ")_", "\\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 ", " _", "data_", "=_", "json_", "._", "loads_", "(_", "data_", ")_", "if_", "data_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Type", "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_", "if_", "status", "\\u", "code_", "==_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "status", "\\u", "code_", "in_", "status", "\\u", "code", "\\u", "to", "\\u", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls_", "=_", "status", "\\u", "code", "\\u", "to", "\\u", "exc_", "[_", "status", "\\u", "code_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "dict_", "(_", "url_", "=_", "url_", ",_", "status", "\\u", "code_", "=_", "status", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", "in_", "[_", "'", "message", "'_", ",_", "'", "server", "\\u", "error", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "in_", "response_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "kwargs_", "[_", "key_", "]_", "=_", "response_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "cls_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "cls_", "(_", "url_", "=_", "url_", ",_", "status", "\\u", "code_", "=_", "status", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "data_", ",_", "message_", "=_", "\"", "Mal", "formed", "\"_", ")_", "\\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_", "API", "Client", "Error_", "(_", "url_", "=_", "url_", ",_", "status", "\\u", "code_", "=_", "status", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "data_", ",_", "message_", "=_", "\"", "Un", "know", "n", " ", "status", " ", "code", ".\"_", ")_", "\\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, 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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 ]
Unused import
django/django/django/contrib/gis/db/models/aggregates.py
[ { "content": "from django.contrib.gis.db.models.fields import ExtentField\nfrom django.db.models.aggregates import Aggregate\n\n__all__ = ['Collect', 'Extent', 'Extent3D', 'MakeLine', 'Union']\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class GeoAggregate(Aggregate):\n function = None\n is_extent = False\n\n\n\n", "metadata": "root.GeoAggregate", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def as_sql(self, compiler, connection):\n # this will be called again in parent, but it's needed now - before\n # we get the spatial_aggregate_name\n connection.ops.check_expression_support(self)\n self.function = connection.ops.spatial_aggregate_name(self.name)\n return super(GeoAggregate, self).as_sql(compiler, connection)", "metadata": "root.GeoAggregate.as_sql", "header": "['class', 'GeoAggregate', '(', 'Aggregate', ')', ':', '___EOS___']", "index": 10 }, { "content": " def as_oracle(self, compiler, connection):\n if not hasattr(self, 'tolerance'):\n self.tolerance = 0.05\n self.extra['tolerance'] = self.tolerance\n if not self.is_extent:\n self.template = '%(function)s(SDOAGGRTYPE(%(expressions)s,%(tolerance)s))'\n return self.as_sql(compiler, connection)", "metadata": "root.GeoAggregate.as_oracle", "header": "['class', 'GeoAggregate', '(', 'Aggregate', ')', ':', '___EOS___']", "index": 17 }, { "content": " def resolve_expression(self, query=None, allow_joins=True, reuse=None, summarize=False, for_save=False):\n c = super(GeoAggregate, self).resolve_expression(query, allow_joins, reuse, summarize, for_save)\n for expr in c.get_source_expressions():\n if not hasattr(expr.field, 'geom_type'):\n raise ValueError('Geospatial aggregates only allowed on geometry fields.')\n return c", "metadata": "root.GeoAggregate.resolve_expression", "header": "['class', 'GeoAggregate', '(', 'Aggregate', ')', ':', '___EOS___']", "index": 25 }, { "content": " def convert_value(self, value, expression, connection, context):\n return connection.ops.convert_geom(value, self.output_field)", "metadata": "root.GeoAggregate.convert_value", "header": "['class', 'GeoAggregate', '(', 'Aggregate', ')', ':', '___EOS___']", "index": 32 }, { "content": "class Collect(GeoAggregate):\n name = 'Collect'", "metadata": "root.Collect", "header": "['module', '___EOS___']", "index": 36 }, { "content": "class Extent(GeoAggregate):\n name = 'Extent'\n is_extent = '2D'\n\n", "metadata": "root.Extent", "header": "['module', '___EOS___']", "index": 40 }, { "content": " def __init__(self, expression, **extra):\n super(Extent, self).__init__(expression, output_field=ExtentField(), **extra)", "metadata": "root.Extent.__init__", "header": "['class', 'Extent', '(', 'GeoAggregate', ')', ':', '___EOS___']", "index": 44 }, { "content": " def convert_value(self, value, expression, connection, context):\n return connection.ops.convert_extent(value, context.get('transformed_srid'))", "metadata": "root.Extent.convert_value", "header": "['class', 'Extent', '(', 'GeoAggregate', ')', ':', '___EOS___']", "index": 47 }, { "content": "class Extent3D(GeoAggregate):\n name = 'Extent3D'\n is_extent = '3D'\n\n", "metadata": "root.Extent3D", "header": "['module', '___EOS___']", "index": 51 }, { "content": " def __init__(self, expression, **extra):\n super(Extent3D, self).__init__(expression, output_field=ExtentField(), **extra)", "metadata": "root.Extent3D.__init__", "header": "['class', 'Extent3D', '(', 'GeoAggregate', ')', ':', '___EOS___']", "index": 55 }, { "content": " def convert_value(self, value, expression, connection, context):\n return connection.ops.convert_extent3d(value, context.get('transformed_srid'))", "metadata": "root.Extent3D.convert_value", "header": "['class', 'Extent3D', '(', 'GeoAggregate', ')', ':', '___EOS___']", "index": 58 }, { "content": "class MakeLine(GeoAggregate):\n name = 'MakeLine'", "metadata": "root.MakeLine", "header": "['module', '___EOS___']", "index": 62 }, { "content": "class Union(GeoAggregate):\n name = 'Union'", "metadata": "root.Union", "header": "['module', '___EOS___']", "index": 66 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "gis_", "._", "db_", "._", "models_", "._", "fields_", "import_", "Extent", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "._", "aggregates", "_", "import_", "Aggregate", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "Collect", "'_", ",_", "'", "Extent", "'_", ",_", "'", "Extent", "3", "D", "'_", ",_", "'", "Make", "Line", "'_", ",_", "'", "Uni", "on", "'_", "]_", "\\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_", "Geo", "Aggregate", "_", "(_", "Aggregate", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "function_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "extent_", "=_", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Geo", "Aggregate", "_", "(_", "Aggregate", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "as", "\\u", "sql_", "(_", "self_", ",_", "compiler_", ",_", "connection_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "will", " ", "be", " ", "call", "ed", " ", "again", " ", "in", " ", "parent", ",", " ", "but", " ", "it", "'", "s", " ", "need", "ed", " ", "now", " ", "-", " ", "before_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "get", " ", "the", " ", "spat", "ial", "\\u", "aggre", "gate", "\\u", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connection_", "._", "ops_", "._", "check", "\\u", "express", "ion", "\\u", "support_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "function_", "=_", "connection_", "._", "ops_", "._", "spat", "ial", "\\u", "aggre", "gate", "\\u", "name_", "(_", "self_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Geo", "Aggregate", "_", ",_", "self_", ")_", "._", "as", "\\u", "sql_", "(_", "compiler_", ",_", "connection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Geo", "Aggregate", "_", "(_", "Aggregate", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "as", "\\u", "oracle", "_", "(_", "self_", ",_", "compiler_", ",_", "connection_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "self_", ",_", "'", "tolera", "nce", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tolerance_", "=_", "0.05_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "extra_", "[_", "'", "tolera", "nce", "'_", "]_", "=_", "self_", "._", "tolerance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "is", "\\u", "extent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "template_", "=_", "'%", "(", "function", ")", "s", "(", "SD", "OA", "GG", "RT", "YP", "E", "(%", "(", "express", "ion", "s", ")", "s", ",%", "(", "tolera", "nce", ")", "s", "))'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "as", "\\u", "sql_", "(_", "compiler_", ",_", "connection_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Geo", "Aggregate", "_", "(_", "Aggregate", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "resolve", "\\u", "expression_", "(_", "self_", ",_", "query_", "=_", "None_", ",_", "allow", "\\u", "joins", "_", "=_", "True_", ",_", "reuse_", "=_", "None_", ",_", "summarize", "_", "=_", "False_", ",_", "for", "\\u", "save_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "super_", "(_", "Geo", "Aggregate", "_", ",_", "self_", ")_", "._", "resolve", "\\u", "expression_", "(_", "query_", ",_", "allow", "\\u", "joins", "_", ",_", "reuse_", ",_", "summarize", "_", ",_", "for", "\\u", "save_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "expr_", "in_", "c_", "._", "get", "\\u", "source", "\\u", "expressions_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "hasattr_", "(_", "expr_", "._", "field_", ",_", "'", "geom", "\\u", "type", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Geos", "pati", "al", " ", "aggregates", " ", "only", " ", "allow", "ed", " ", "on", " ", "geom", "etry", " ", "fields", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Geo", "Aggregate", "_", "(_", "Aggregate", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "convert", "\\u", "value_", "(_", "self_", ",_", "value_", ",_", "expression_", ",_", "connection_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "connection_", "._", "ops_", "._", "convert", "\\u", "geom_", "(_", "value_", ",_", "self_", "._", "output", "\\u", "field_", ")_", "\\u\\u\\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_", "Collect", "_", "(_", "Geo", "Aggregate", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "Collect", "'_", "\\u\\u\\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_", "Extent_", "(_", "Geo", "Aggregate", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "Extent", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "extent_", "=_", "'", "2", "D", "'_", "\\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_", "Extent_", "(_", "Geo", "Aggregate", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "expression_", ",_", "**_", "extra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Extent_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "expression_", ",_", "output", "\\u", "field_", "=_", "Extent", "Field_", "(_", ")_", ",_", "**_", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Extent_", "(_", "Geo", "Aggregate", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "convert", "\\u", "value_", "(_", "self_", ",_", "value_", ",_", "expression_", ",_", "connection_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "connection_", "._", "ops_", "._", "convert", "\\u", "extent_", "(_", "value_", ",_", "context_", "._", "get_", "(_", "'", "transforme", "d\\u", "sri", "d", "'_", ")_", ")_", "\\u\\u\\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_", "Extent", "3", "D_", "(_", "Geo", "Aggregate", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "Extent", "3", "D", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "extent_", "=_", "'", "3", "D", "'_", "\\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_", "Extent", "3", "D_", "(_", "Geo", "Aggregate", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "expression_", ",_", "**_", "extra_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Extent", "3", "D_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "expression_", ",_", "output", "\\u", "field_", "=_", "Extent", "Field_", "(_", ")_", ",_", "**_", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Extent", "3", "D_", "(_", "Geo", "Aggregate", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "convert", "\\u", "value_", "(_", "self_", ",_", "value_", ",_", "expression_", ",_", "connection_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "connection_", "._", "ops_", "._", "convert", "\\u", "extent", "3d_", "(_", "value_", ",_", "context_", "._", "get_", "(_", "'", "transforme", "d\\u", "sri", "d", "'_", ")_", ")_", "\\u\\u\\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_", "Make", "Line_", "(_", "Geo", "Aggregate", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "Make", "Line", "'_", "\\u\\u\\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_", "Union_", "(_", "Geo", "Aggregate", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "'", "Uni", "on", "'_" ]
[ 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, 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, 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 ]
Unused import
skoczen/django-seo-js/django_seo_js/tests/backends/test_base.py
[ { "content": "from django.test import TestCase\n\nfrom django_seo_js.tests.utils import override_settings\nfrom django_seo_js.backends import PrerenderIO, SelectedBackend, SEOBackendBase, TestBackend\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SEOBackendBaseTest(TestCase):\n\n", "metadata": "root.SEOBackendBaseTest", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def setUp(self):\n self.backend = SEOBackendBase()", "metadata": "root.SEOBackendBaseTest.setUp", "header": "['class', 'SEOBackendBaseTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 7 }, { "content": " def test_get_response_for_url(self):\n self.assertRaises(NotImplementedError, self.backend.get_response_for_url, \"http://www.example.com\")", "metadata": "root.SEOBackendBaseTest.test_get_response_for_url", "header": "['class', 'SEOBackendBaseTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 10 }, { "content": " def test_update_url(self):\n self.assertRaises(NotImplementedError, self.backend.update_url, \"http://www.example.com\")", "metadata": "root.SEOBackendBaseTest.test_update_url", "header": "['class', 'SEOBackendBaseTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 13 }, { "content": "class SelectedBackendTest(TestCase):\n\n", "metadata": "root.SelectedBackendTest", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def test_default_backend(self):\n s = SelectedBackend()\n self.assertTrue(isinstance(s.backend, PrerenderIO))", "metadata": "root.SelectedBackendTest.test_default_backend", "header": "['class', 'SelectedBackendTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 19 }, { "content": " @override_settings(BACKEND='django_seo_js.backends.TestBackend')\n def test_override_backend(self):\n s = SelectedBackend()\n self.assertTrue(isinstance(s.backend, TestBackend))", "metadata": "root.SelectedBackendTest.test_override_backend", "header": "['class', 'SelectedBackendTest', '(', 'TestCase', ')', ':', '___EOS___']", "index": 23 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "test_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django", "\\u", "se", "o", "\\u", "js_", "._", "tests_", "._", "utils_", "import_", "override", "\\u", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django", "\\u", "se", "o", "\\u", "js_", "._", "backends_", "import_", "Pre", "render", "IO_", ",_", "Select", "ed", "Backend_", ",_", "SE", "OB", "acke", "nd", "Base_", ",_", "Test", "Backend_", "\\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_", "SE", "OB", "acke", "nd", "Base", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "SE", "OB", "acke", "nd", "Base", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "backend_", "=_", "SE", "OB", "acke", "nd", "Base_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SE", "OB", "acke", "nd", "Base", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "get", "\\u", "response", "\\u", "for", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Not", "Impl", "ement", "ed", "Error_", ",_", "self_", "._", "backend_", "._", "get", "\\u", "response", "\\u", "for", "\\u", "url_", ",_", "\"", "http", "://", "www", ".", "example", ".", "com", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SE", "OB", "acke", "nd", "Base", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Not", "Impl", "ement", "ed", "Error_", ",_", "self_", "._", "backend_", "._", "update", "\\u", "url_", ",_", "\"", "http", "://", "www", ".", "example", ".", "com", "\"_", ")_", "\\u\\u\\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_", "Select", "ed", "Back", "end", "Test_", "(_", "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_", "Select", "ed", "Back", "end", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "default", "\\u", "backend_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "Select", "ed", "Backend_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "s_", "._", "backend_", ",_", "Pre", "render", "IO_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Select", "ed", "Back", "end", "Test_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "override", "\\u", "settings_", "(_", "BACKEND_", "=_", "'", "django", "\\u", "se", "o", "\\u", "js", ".", "back", "ends", ".", "Test", "Back", "end", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "override", "\\u", "backend_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "Select", "ed", "Backend_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "s_", "._", "backend_", ",_", "Test", "Backend_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
dropbox/changes/tests/changes/api/test_project_build_index.py
[ { "content": "from uuid import uuid4\nfrom urllib import quote\n\nfrom changes.constants import Cause, Result\nfrom changes.testutils import APITestCase\n\n# flake8: noqa\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ProjectBuildListTest(APITestCase):\n\n\n\n\n\n", "metadata": "root.ProjectBuildListTest", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def test_simple(self):\n\n fake_project_id = uuid4()\n\n project = self.create_project()\n self.create_build(project)\n\n project1 = self.create_project()\n build1 = self.create_build(project1, label='test', target='D1234',\n result=Result.passed)\n project2 = self.create_project()\n build2 = self.create_build(project2, label='test', target='D1234', tags=['foo'],\n result=Result.failed)\n\n path = '/api/0/projects/{0}/builds/'.format(fake_project_id.hex)\n\n resp = self.client.get(path)\n assert resp.status_code == 404\n\n path = '/api/0/projects/{0}/builds/'.format(project1.id.hex)\n\n resp = self.client.get(path)\n assert resp.status_code == 200\n data = self.unserialize(resp)\n assert len(data) == 1\n assert data[0]['id'] == build1.id.hex\n\n resp = self.client.get(path + '?source=D1234')\n assert resp.status_code == 200\n data = self.unserialize(resp)\n assert len(data) == 1\n assert data[0]['id'] == build1.id.hex\n\n resp = self.client.get(path + '?query=D1234')\n assert resp.status_code == 200\n data = self.unserialize(resp)\n assert len(data) == 1\n assert data[0]['id'] == build1.id.hex\n\n resp = self.client.get(path + '?query=test')\n assert resp.status_code == 200\n data = self.unserialize(resp)\n assert len(data) == 1\n assert data[0]['id'] == build1.id.hex\n\n resp = self.client.get(path + '?query=something_impossible')\n assert resp.status_code == 200\n data = self.unserialize(resp)\n assert len(data) == 0\n\n resp = self.client.get(path)\n assert resp.status_code == 200\n data = self.unserialize(resp)\n assert len(data) == 1\n assert data[0]['id'] == build1.id.hex\n\n path = '/api/0/projects/{0}/builds/'.format(project2.id.hex)\n\n resp = self.client.get(path + '?result=failed')\n assert resp.status_code == 200\n data = self.unserialize(resp)\n assert len(data) == 1\n assert data[0]['id'] == build2.id.hex\n\n resp = self.client.get(path + '?result=aborted')\n assert resp.status_code == 200\n data = self.unserialize(resp)\n assert len(data) == 0\n\n build3 = self.create_build(project2, label='test', target='D12345', tags=['bar'],\n result=Result.failed)\n\n resp = self.client.get(path + '?tag=foo')\n assert resp.status_code == 200\n data = self.unserialize(resp)\n assert len(data) == 1\n assert data[0]['id'] == build2.id.hex\n\n resp = self.client.get(path + '?tag=bar')\n assert resp.status_code == 200\n data = self.unserialize(resp)\n assert len(data) == 1\n assert data[0]['id'] == build3.id.hex", "metadata": "root.ProjectBuildListTest.test_simple", "header": "['class', 'ProjectBuildListTest', '(', 'APITestCase', ')', ':', '___EOS___']", "index": 11 }, { "content": " def test_more_searches(self):\n project1 = self.create_project()\n\n # all hashes are 8 characters, followed by abcd\n build1 = self.create_build(project1, label='First commit!',\n target='deadbeefabcd')\n build2 = self.create_build(project1, label='Second commit!',\n target='dabbad00abcd')\n build3 = self.create_build(project1, label='rThird commit!',\n target='facefeedabcd')\n\n path = '/api/0/projects/{0}/builds/'.format(project1.id.hex)\n\n queries_to_results = [\n # search by label\n (\"First\", [build1]),\n (\"rThird\", [build3]),\n (\"Fifth\", []),\n (\"commit\", [build1, build2, build3]),\n\n # search by hex, the first few hex characters, and a longer hex\n # phrase\n (\"deadbeefabcd\", [build1]),\n (\"dabba\", [build2]),\n (\"facefeedabcdef\", [build3]),\n\n # only prefix matches\n (\"abcd\", []),\n\n # phabricator test\n (\"rREPOdeadbeefabcd\", [build1]),\n (\"rMEPOdabbad00\", [build2]),\n (\"rZEPOfacefeedabcdef\", [build3]),\n ]\n\n errmsg = \"test_more_searches failed with search term %s\"\n\n for term, expected_builds in queries_to_results:\n resp = self.client.get(path + '?query=' + term)\n assert resp.status_code == 200, errmsg % term\n data = self.unserialize(resp)\n assert len(data) == len(expected_builds), errmsg.format(term)\n assert set([d['id'] for d in data]) == \\\n set([b.id.hex for b in expected_builds]), errmsg % term", "metadata": "root.ProjectBuildListTest.test_more_searches", "header": "['class', 'ProjectBuildListTest', '(', 'APITestCase', ')', ':', '___EOS___']", "index": 95 }, { "content": " def test_include_patches(self):\n project = self.create_project()\n patch = self.create_patch(repository=project.repository)\n source = self.create_source(project, patch=patch)\n build = self.create_build(project)\n self.create_build(project, source=source)\n\n # ensure include_patches correctly references Source.patch\n path = '/api/0/projects/{0}/builds/?include_patches=0'.format(\n project.id.hex)\n\n resp = self.client.get(path)\n assert resp.status_code == 200\n data = self.unserialize(resp)\n assert len(data) == 1\n assert data[0]['id'] == build.id.hex\n\n path = '/api/0/projects/{0}/builds/?include_patches=1'.format(\n project.id.hex)\n\n resp = self.client.get(path)\n assert resp.status_code == 200\n data = self.unserialize(resp)\n assert len(data) == 2", "metadata": "root.ProjectBuildListTest.test_include_patches", "header": "['class', 'ProjectBuildListTest', '(', 'APITestCase', ')', ':', '___EOS___']", "index": 140 }, { "content": " def test_patches_only(self):\n project = self.create_project()\n patch = self.create_patch(repository=project.repository)\n source = self.create_source(project, patch=patch)\n self.create_build(project)\n patch_build = self.create_build(project, source=source)\n\n path = '/api/0/projects/{0}/builds/?patches_only=1'.format(\n project.id.hex)\n\n resp = self.client.get(path)\n assert resp.status_code == 200\n data = self.unserialize(resp)\n assert len(data) == 1\n assert data[0]['id'] == patch_build.id.hex", "metadata": "root.ProjectBuildListTest.test_patches_only", "header": "['class', 'ProjectBuildListTest', '(', 'APITestCase', ')', ':', '___EOS___']", "index": 165 }, { "content": " def test_by_cause(self):\n project = self.create_project()\n patch = self.create_patch(repository=project.repository)\n source = self.create_source(project, patch=patch)\n self.create_build(project)\n push_build = self.create_build(project, source=source, cause=Cause.push)\n push_build2 = self.create_build(project, source=source, cause=Cause.push)\n snapshot_build = self.create_build(project, source=source, cause=Cause.snapshot)\n\n snapshot_path = '/api/0/projects/{0}/builds/?cause=snapshot'.format(\n project.id.hex)\n push_path = '/api/0/projects/{0}/builds/?cause=push'.format(\n project.id.hex)\n\n resp = self.client.get(snapshot_path)\n assert resp.status_code == 200\n data = self.unserialize(resp)\n assert len(data) == 1\n assert data[0]['id'] == snapshot_build.id.hex\n\n resp = self.client.get(push_path)\n assert resp.status_code == 200\n data = self.unserialize(resp)\n assert len(data) == 2\n push_build_ids = [push_build.id.hex, push_build2.id.hex]\n assert data[0]['id'] in push_build_ids\n assert data[1]['id'] in push_build_ids", "metadata": "root.ProjectBuildListTest.test_by_cause", "header": "['class', 'ProjectBuildListTest', '(', 'APITestCase', ')', ':', '___EOS___']", "index": 181 }, { "content": " def test_author(self):\n project = self.create_project()\n patch = self.create_patch(repository=project.repository)\n source = self.create_source(project, patch=patch)\n author = self.create_author(email=self.default_user.email)\n build = self.create_build(project, author=author)\n self.create_build(project, source=source)\n\n # ensure include_patches correctly references Source.patch\n path = '/api/0/projects/{0}/builds/'.format(project.id.hex)\n\n resp = self.client.get(path + '?author=bizbaz@example.com')\n assert resp.status_code == 200, resp.data\n data = self.unserialize(resp)\n assert len(data) == 0\n\n resp = self.client.get(\n path + '?author=' + quote(self.default_user.email))\n assert resp.status_code == 200, resp.data\n data = self.unserialize(resp)\n assert len(data) == 1\n assert data[0]['id'] == build.id.hex\n\n resp = self.client.get(path + '?author=me')\n assert resp.status_code == 400, resp.data\n\n self.login_default()\n\n resp = self.client.get(path + '?author=me')\n assert resp.status_code == 200, resp.data\n data = self.unserialize(resp)\n assert len(data) == 1\n assert data[0]['id'] == build.id.hex", "metadata": "root.ProjectBuildListTest.test_author", "header": "['class', 'ProjectBuildListTest', '(', 'APITestCase', ')', ':', '___EOS___']", "index": 209 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "uuid_", "import_", "uuid4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "import_", "quote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "changes_", "._", "constants_", "import_", "Cause", "_", ",_", "Result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "changes_", "._", "testutils_", "import_", "API", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "flake", "8", ":", " ", "no", "qa_", "\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Project", "Build", "List", "Test_", "(_", "API", "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_", "Project", "Build", "List", "Test_", "(_", "API", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "simple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fake", "\\u", "project", "\\u", "id_", "=_", "uuid4_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "self_", "._", "create", "\\u", "project_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "create", "\\u", "build_", "(_", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "project", "1_", "=_", "self_", "._", "create", "\\u", "project_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "build", "1_", "=_", "self_", "._", "create", "\\u", "build_", "(_", "project", "1_", ",_", "label_", "=_", "'", "test", "'_", ",_", "target_", "=_", "'", "D1", "234", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "Result_", "._", "passed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "2_", "=_", "self_", "._", "create", "\\u", "project_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "build", "2_", "=_", "self_", "._", "create", "\\u", "build_", "(_", "project", "2_", ",_", "label_", "=_", "'", "test", "'_", ",_", "target_", "=_", "'", "D1", "234", "'_", ",_", "tags_", "=_", "[_", "'", "foo", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "Result_", "._", "failed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "'/", "api", "/", "0", "/", "project", "s", "/{", "0", "}/", "builds", "/'_", "._", "format_", "(_", "fake", "\\u", "project", "\\u", "id_", "._", "hex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "'/", "api", "/", "0", "/", "project", "s", "/{", "0", "}/", "builds", "/'_", "._", "format_", "(_", "project", "1_", "._", "id_", "._", "hex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "unse", "rial", "ize_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "data_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", "==_", "build", "1_", "._", "id_", "._", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "path_", "+_", "'?", "source", "=", "D1", "234", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "unse", "rial", "ize_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "data_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", "==_", "build", "1_", "._", "id_", "._", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "path_", "+_", "'?", "query", "=", "D1", "234", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "unse", "rial", "ize_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "data_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", "==_", "build", "1_", "._", "id_", "._", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "path_", "+_", "'?", "query", "=", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "unse", "rial", "ize_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "data_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", "==_", "build", "1_", "._", "id_", "._", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "path_", "+_", "'?", "query", "=", "somet", "hing", "\\u", "impossible", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "unse", "rial", "ize_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "unse", "rial", "ize_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "data_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", "==_", "build", "1_", "._", "id_", "._", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "'/", "api", "/", "0", "/", "project", "s", "/{", "0", "}/", "builds", "/'_", "._", "format_", "(_", "project", "2_", "._", "id_", "._", "hex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "path_", "+_", "'?", "result", "=", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "unse", "rial", "ize_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "data_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", "==_", "build", "2_", "._", "id_", "._", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "path_", "+_", "'?", "result", "=", "abort", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "unse", "rial", "ize_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "build", "3_", "=_", "self_", "._", "create", "\\u", "build_", "(_", "project", "2_", ",_", "label_", "=_", "'", "test", "'_", ",_", "target_", "=_", "'", "D1", "2345", "'_", ",_", "tags_", "=_", "[_", "'", "bar", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "Result_", "._", "failed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "path_", "+_", "'?", "tag", "=", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "unse", "rial", "ize_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "data_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", "==_", "build", "2_", "._", "id_", "._", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "path_", "+_", "'?", "tag", "=", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "unse", "rial", "ize_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "data_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", "==_", "build", "3_", "._", "id_", "._", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Project", "Build", "List", "Test_", "(_", "API", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "more", "\\u", "searche", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project", "1_", "=_", "self_", "._", "create", "\\u", "project_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "hashe", "s", " ", "are", " ", "8", " ", "character", "s", ",", " ", "followe", "d", " ", "by", " ", "abc", "d_", "\\u\\u\\uNL\\u\\u\\u_", "build", "1_", "=_", "self_", "._", "create", "\\u", "build_", "(_", "project", "1_", ",_", "label_", "=_", "'", "Fi", "rst", " ", "commit", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target_", "=_", "'", "dead", "beef", "abc", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "build", "2_", "=_", "self_", "._", "create", "\\u", "build_", "(_", "project", "1_", ",_", "label_", "=_", "'", "Second", " ", "commit", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target_", "=_", "'", "dab", "bad", "00", "abc", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "build", "3_", "=_", "self_", "._", "create", "\\u", "build_", "(_", "project", "1_", ",_", "label_", "=_", "'", "r", "Thi", "rd", " ", "commit", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "target_", "=_", "'", "face", "feed", "abc", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "'/", "api", "/", "0", "/", "project", "s", "/{", "0", "}/", "builds", "/'_", "._", "format_", "(_", "project", "1_", "._", "id_", "._", "hex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "querie", "s", "\\u", "to", "\\u", "results_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "search", " ", "by", " ", "label_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Fi", "rst", "\"_", ",_", "[_", "build", "1_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "r", "Thi", "rd", "\"_", ",_", "[_", "build", "3_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "Fifth", "\"_", ",_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "commit", "\"_", ",_", "[_", "build", "1_", ",_", "build", "2_", ",_", "build", "3_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "search", " ", "by", " ", "hex", ",", " ", "the", " ", "first", " ", "few", " ", "hex", " ", "character", "s", ",", " ", "and", " ", "a", " ", "long", "er", " ", "hex_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "phrase_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "dead", "beef", "abc", "d", "\"_", ",_", "[_", "build", "1_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "dab", "ba", "\"_", ",_", "[_", "build", "2_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "face", "feed", "abcde", "f", "\"_", ",_", "[_", "build", "3_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "prefix", " ", "matches_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "abc", "d", "\"_", ",_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pha", "bri", "cator", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "r", "REPO", "dead", "beef", "abc", "d", "\"_", ",_", "[_", "build", "1_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "r", "ME", "PO", "dab", "bad", "00", "\"_", ",_", "[_", "build", "2_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "r", "ZE", "PO", "face", "feed", "abcde", "f", "\"_", ",_", "[_", "build", "3_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "errmsg_", "=_", "\"", "test\\u", "more", "\\u", "searche", "s", " ", "fail", "ed", " ", "with", " ", "search", " ", "term", " ", "%", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "term_", ",_", "expected", "\\u", "builds_", "in_", "querie", "s", "\\u", "to", "\\u", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "path_", "+_", "'?", "query", "='_", "+_", "term_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "200_", ",_", "errmsg_", "%_", "term_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "unse", "rial", "ize_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "len_", "(_", "expected", "\\u", "builds_", ")_", ",_", "errmsg_", "._", "format_", "(_", "term_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "set_", "(_", "[_", "d_", "[_", "'", "id", "'_", "]_", "for_", "d_", "in_", "data_", "]_", ")_", "==_", "set_", "(_", "[_", "b_", "._", "id_", "._", "hex_", "for_", "b_", "in_", "expected", "\\u", "builds_", "]_", ")_", ",_", "errmsg_", "%_", "term_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Project", "Build", "List", "Test_", "(_", "API", "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", "include", "\\u", "patches_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project_", "=_", "self_", "._", "create", "\\u", "project_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch_", "=_", "self_", "._", "create", "\\u", "patch_", "(_", "repository_", "=_", "project_", "._", "repository_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "self_", "._", "create", "\\u", "source_", "(_", "project_", ",_", "patch_", "=_", "patch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "build_", "=_", "self_", "._", "create", "\\u", "build_", "(_", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "create", "\\u", "build_", "(_", "project_", ",_", "source_", "=_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ensure", " ", "include", "\\u", "patche", "s", " ", "correct", "ly", " ", "reference", "s", " ", "Sou", "rce", ".", "patch_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "'/", "api", "/", "0", "/", "project", "s", "/{", "0", "}/", "builds", "/?", "include", "\\u", "patche", "s", "=", "0", "'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "project_", "._", "id_", "._", "hex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "unse", "rial", "ize_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "data_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", "==_", "build_", "._", "id_", "._", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "'/", "api", "/", "0", "/", "project", "s", "/{", "0", "}/", "builds", "/?", "include", "\\u", "patche", "s", "=", "1", "'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "project_", "._", "id_", "._", "hex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "unse", "rial", "ize_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Project", "Build", "List", "Test_", "(_", "API", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "patche", "s", "\\u", "only_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project_", "=_", "self_", "._", "create", "\\u", "project_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch_", "=_", "self_", "._", "create", "\\u", "patch_", "(_", "repository_", "=_", "project_", "._", "repository_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "self_", "._", "create", "\\u", "source_", "(_", "project_", ",_", "patch_", "=_", "patch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "create", "\\u", "build_", "(_", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch", "\\u", "build_", "=_", "self_", "._", "create", "\\u", "build_", "(_", "project_", ",_", "source_", "=_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "'/", "api", "/", "0", "/", "project", "s", "/{", "0", "}/", "builds", "/?", "patche", "s", "\\u", "only", "=", "1", "'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "project_", "._", "id_", "._", "hex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "unse", "rial", "ize_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "data_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", "==_", "patch", "\\u", "build_", "._", "id_", "._", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Project", "Build", "List", "Test_", "(_", "API", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "by", "\\u", "cause_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project_", "=_", "self_", "._", "create", "\\u", "project_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch_", "=_", "self_", "._", "create", "\\u", "patch_", "(_", "repository_", "=_", "project_", "._", "repository_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "self_", "._", "create", "\\u", "source_", "(_", "project_", ",_", "patch_", "=_", "patch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "create", "\\u", "build_", "(_", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "push", "\\u", "build_", "=_", "self_", "._", "create", "\\u", "build_", "(_", "project_", ",_", "source_", "=_", "source_", ",_", "cause_", "=_", "Cause", "_", "._", "push_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "push", "\\u", "build", "2_", "=_", "self_", "._", "create", "\\u", "build_", "(_", "project_", ",_", "source_", "=_", "source_", ",_", "cause_", "=_", "Cause", "_", "._", "push_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "snapshot", "\\u", "build_", "=_", "self_", "._", "create", "\\u", "build_", "(_", "project_", ",_", "source_", "=_", "source_", ",_", "cause_", "=_", "Cause", "_", "._", "snapshot_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "snapshot", "\\u", "path_", "=_", "'/", "api", "/", "0", "/", "project", "s", "/{", "0", "}/", "builds", "/?", "caus", "e", "=", "snapshot", "'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "project_", "._", "id_", "._", "hex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "push", "\\u", "path_", "=_", "'/", "api", "/", "0", "/", "project", "s", "/{", "0", "}/", "builds", "/?", "caus", "e", "=", "push", "'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "project_", "._", "id_", "._", "hex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "snapshot", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "unse", "rial", "ize_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "data_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", "==_", "snapshot", "\\u", "build_", "._", "id_", "._", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "push", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "unse", "rial", "ize_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "push", "\\u", "build", "\\u", "ids_", "=_", "[_", "push", "\\u", "build_", "._", "id_", "._", "hex_", ",_", "push", "\\u", "build", "2_", "._", "id_", "._", "hex_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "data_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", "in_", "push", "\\u", "build", "\\u", "ids_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "data_", "[_", "1_", "]_", "[_", "'", "id", "'_", "]_", "in_", "push", "\\u", "build", "\\u", "ids_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Project", "Build", "List", "Test_", "(_", "API", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "author_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "project_", "=_", "self_", "._", "create", "\\u", "project_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patch_", "=_", "self_", "._", "create", "\\u", "patch_", "(_", "repository_", "=_", "project_", "._", "repository_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "self_", "._", "create", "\\u", "source_", "(_", "project_", ",_", "patch_", "=_", "patch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "author_", "=_", "self_", "._", "create", "\\u", "author_", "(_", "email_", "=_", "self_", "._", "default", "\\u", "user_", "._", "email_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "build_", "=_", "self_", "._", "create", "\\u", "build_", "(_", "project_", ",_", "author_", "=_", "author_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "create", "\\u", "build_", "(_", "project_", ",_", "source_", "=_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ensure", " ", "include", "\\u", "patche", "s", " ", "correct", "ly", " ", "reference", "s", " ", "Sou", "rce", ".", "patch_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "'/", "api", "/", "0", "/", "project", "s", "/{", "0", "}/", "builds", "/'_", "._", "format_", "(_", "project_", "._", "id_", "._", "hex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "path_", "+_", "'?", "author", "=", "biz", "ba", "z", "@", "example", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "200_", ",_", "resp_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "unse", "rial", "ize_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "+_", "'?", "author", "='_", "+_", "quote_", "(_", "self_", "._", "default", "\\u", "user_", "._", "email_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "200_", ",_", "resp_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "unse", "rial", "ize_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "data_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", "==_", "build_", "._", "id_", "._", "hex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "path_", "+_", "'?", "author", "=", "me", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "400_", ",_", "resp_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "login", "\\u", "default_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "._", "get_", "(_", "path_", "+_", "'?", "author", "=", "me", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "resp_", "._", "status", "\\u", "code_", "==_", "200_", ",_", "resp_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "unse", "rial", "ize_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "data_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "data_", "[_", "0_", "]_", "[_", "'", "id", "'_", "]_", "==_", "build_", "._", "id_", "._", "hex_" ]
[ 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, 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,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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 ]
Testing equality to None
ganeti/ganeti/lib/rpc/node.py
[ { "content": " def __init__(self, _context, address_list):\n \"\"\"Initializes this class.\n\n \"\"\"\n if address_list is None:\n resolver = compat.partial(_SsconfResolver, True)\n else:\n # Caller provided an address list\n resolver = _StaticResolver(address_list)\n\n _RpcClientBase.__init__(self, resolver, _ENCODERS.get,\n lock_monitor_cb=lambda _: None)\n _generated_rpc.RpcClientJobQueue.__init__(self)", "metadata": "root.JobQueueRunner.__init__", "header": "['class', 'JobQueueRunner', '(', '_RpcClientBase', ',', '_generated_rpc', '.', 'RpcClientJobQueue', ')', ':', '___EOS___']", "index": 984 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Jo", "b", "Queue", "Runner_", "(_", "\\u", "Rp", "c", "Client", "Base_", ",_", "\\u", "generat", "ed", "\\u", "rpc_", "._", "Rp", "c", "Client", "Jo", "b", "Queue_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "\\u", "context_", ",_", "address", "\\u", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "es", " ", "this", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "address", "\\u", "list_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resolver_", "=_", "compat_", "._", "partial_", "(_", "\\u", "Ss", "conf", "Resolver_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Caller", " ", "provided", " ", "an", " ", "address", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resolver_", "=_", "\\u", "Static", "Resolver_", "(_", "address", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "Rp", "c", "Client", "Base_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "resolver_", ",_", "\\u", "ENCODE", "RS_", "._", "get_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "lock", "\\u", "monit", "or", "\\u", "cb_", "=_", "lambda_", "\\u_", ":_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "generat", "ed", "\\u", "rpc_", "._", "Rp", "c", "Client", "Jo", "b", "Queue_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
pydanny/django-admin2/djadmin2/types.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom __future__ import division, absolute_import, unicode_literals\n\nfrom collections import namedtuple\nimport logging\nimport os\nimport sys\n\nfrom django.core.urlresolvers import reverse\nfrom django.conf.urls import patterns, url\nfrom django.utils.six import with_metaclass\n\nimport extra_views\n\nfrom . import apiviews\nfrom . import settings\nfrom . import views\nfrom . import actions\nfrom . import utils\nfrom .forms import modelform_factory\n\n\nlogger = logging.getLogger('djadmin2')\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ModelAdminBase2(type):\n", "metadata": "root.ModelAdminBase2", "header": "['module', '___EOS___']", "index": 25 }, { "content": " def __new__(cls, name, bases, attrs):\n new_class = super(ModelAdminBase2, cls).__new__(cls, name,\n bases, attrs)\n view_list = []\n for key, value in attrs.items():\n if isinstance(value, views.AdminView):\n if not value.name:\n value.name = key\n view_list.append(value)\n\n view_list.extend(getattr(new_class, 'views', []))\n new_class.views = view_list\n return new_class", "metadata": "root.ModelAdminBase2.__new__", "header": "['class', 'ModelAdminBase2', '(', 'type', ')', ':', '___EOS___']", "index": 27 }, { "content": "class ModelAdmin2(with_metaclass(ModelAdminBase2)):\n \"\"\"\n Adding new ModelAdmin2 attributes:\n\n Step 1: Add the attribute to this class\n Step 2: Add the attribute to djadmin2.settings.MODEL_ADMIN_ATTRS\n\n Reasoning:\n\n Changing values on ModelAdmin2 objects or their attributes from\n within a view results in leaky scoping issues. Therefore, we use\n the immutable_admin_factory to render the ModelAdmin2 class\n practically immutable before passing it to the view. To constrain\n things further (in order to protect ourselves from causing\n hard-to-find security problems), we also restrict which attrs are\n passed to the final ImmutableAdmin object (i.e. a namedtuple).\n This prevents us from easily implementing methods/setters which\n bypass the blocking features of the ImmutableAdmin.\n \"\"\"\n actions_selection_counter = True\n date_hierarchy = False\n list_display = ('__str__',)\n list_display_links = ()\n list_filter = ()\n list_select_related = False\n list_per_page = 100\n list_max_show_all = 200\n list_editable = ()\n search_fields = ()\n save_as = False\n save_on_top = False\n verbose_name = None\n verbose_name_plural = None\n model_admin_attributes = settings.MODEL_ADMIN_ATTRS\n ordering = False\n save_on_top = False\n save_on_bottom = True\n\n # Not yet implemented. See #267 and #268\n actions_on_bottom = False\n actions_on_top = True\n\n search_fields = []\n\n # Show the fields to be displayed as columns\n # TODO: Confirm that this is what the Django admin uses\n list_fields = []\n\n # This shows up on the DocumentListView of the Posts\n list_actions = [actions.DeleteSelectedAction]\n\n # This shows up in the DocumentDetailView of the Posts.\n document_actions = []\n\n # Shows up on a particular field\n field_actions = {}\n\n # Defines custom field renderers\n field_renderers = {}\n\n fields = None\n exclude = None\n fieldsets = None\n form_class = None\n filter_vertical = ()\n filter_horizontal = ()\n radio_fields = {}\n prepopulated_fields = {}\n formfield_overrides = {}\n readonly_fields = ()\n ordering = None\n\n create_form_class = None\n update_form_class = None\n\n inlines = []\n\n # Views\n index_view = views.AdminView(r'^$', views.ModelListView, name='index')\n create_view = views.AdminView(r'^create/$', views.ModelAddFormView, name='create')\n update_view = views.AdminView(r'^(?P<pk>[0-9]+)/$', views.ModelEditFormView, name='update')\n detail_view = views.AdminView(r'^(?P<pk>[0-9]+)/update/$', views.ModelDetailView, name='detail')\n delete_view = views.AdminView(r'^(?P<pk>[0-9]+)/delete/$', views.ModelDeleteView, name='delete')\n history_view = views.AdminView(r'^(?P<pk>[0-9]+)/history/$', views.ModelHistoryView, name='history')\n views = []\n\n # API configuration\n api_serializer_class = None\n\n # API Views\n api_list_view = apiviews.ListCreateAPIView\n api_detail_view = apiviews.RetrieveUpdateDestroyAPIView\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.ModelAdmin2", "header": "['module', '___EOS___']", "index": 42 }, { "content": " def __init__(self, model, admin, name=None, **kwargs):\n self.name = name\n self.model = model\n self.admin = admin\n model_options = utils.model_options(model)\n self.app_label = model_options.app_label\n self.model_name = model_options.object_name.lower()\n\n if self.name is None:\n self.name = '{}_{}'.format(self.app_label, self.model_name)\n\n if self.verbose_name is None:\n self.verbose_name = model_options.verbose_name\n if self.verbose_name_plural is None:\n self.verbose_name_plural = model_options.verbose_name_plural", "metadata": "root.ModelAdmin2.__init__", "header": "['class', 'ModelAdmin2', '(', 'with_metaclass', '(', 'ModelAdminBase2', ')', ')', ':', '___EOS___']", "index": 135 }, { "content": " def get_default_view_kwargs(self):\n return {\n 'app_label': self.app_label,\n 'model': self.model,\n 'model_name': self.model_name,\n 'model_admin': immutable_admin_factory(self),\n }", "metadata": "root.ModelAdmin2.get_default_view_kwargs", "header": "['class', 'ModelAdmin2', '(', 'with_metaclass', '(', 'ModelAdminBase2', ')', ')', ':', '___EOS___']", "index": 151 }, { "content": " def get_index_kwargs(self):\n kwargs = self.get_default_view_kwargs()\n kwargs.update({\n 'paginate_by': self.list_per_page,\n })\n return kwargs", "metadata": "root.ModelAdmin2.get_index_kwargs", "header": "['class', 'ModelAdmin2', '(', 'with_metaclass', '(', 'ModelAdminBase2', ')', ')', ':', '___EOS___']", "index": 159 }, { "content": " def get_default_api_view_kwargs(self):\n kwargs = self.get_default_view_kwargs()\n kwargs.update({\n 'serializer_class': self.api_serializer_class,\n })\n return kwargs", "metadata": "root.ModelAdmin2.get_default_api_view_kwargs", "header": "['class', 'ModelAdmin2', '(', 'with_metaclass', '(', 'ModelAdminBase2', ')', ')', ':', '___EOS___']", "index": 166 }, { "content": " def get_prefixed_view_name(self, view_name):\n return '{}_{}'.format(self.name, view_name)", "metadata": "root.ModelAdmin2.get_prefixed_view_name", "header": "['class', 'ModelAdmin2', '(', 'with_metaclass', '(', 'ModelAdminBase2', ')', ')', ':', '___EOS___']", "index": 173 }, { "content": " def get_create_kwargs(self):\n kwargs = self.get_default_view_kwargs()\n kwargs.update({\n 'inlines': self.inlines,\n 'form_class': (self.create_form_class if\n self.create_form_class else self.form_class),\n })\n return kwargs", "metadata": "root.ModelAdmin2.get_create_kwargs", "header": "['class', 'ModelAdmin2', '(', 'with_metaclass', '(', 'ModelAdminBase2', ')', ')', ':', '___EOS___']", "index": 176 }, { "content": " def get_update_kwargs(self):\n kwargs = self.get_default_view_kwargs()\n form_class = (self.update_form_class if\n self.update_form_class else self.form_class)\n if form_class is None:\n form_class = modelform_factory(self.model, fields='__all__')\n kwargs.update({\n 'inlines': self.inlines,\n 'form_class': form_class,\n })\n return kwargs", "metadata": "root.ModelAdmin2.get_update_kwargs", "header": "['class', 'ModelAdmin2', '(', 'with_metaclass', '(', 'ModelAdminBase2', ')', ')', ':', '___EOS___']", "index": 185 }, { "content": " def get_index_url(self):\n return reverse('admin2:{}'.format(\n self.get_prefixed_view_name('index')))", "metadata": "root.ModelAdmin2.get_index_url", "header": "['class', 'ModelAdmin2', '(', 'with_metaclass', '(', 'ModelAdminBase2', ')', ')', ':', '___EOS___']", "index": 197 }, { "content": " def get_api_list_kwargs(self):\n kwargs = self.get_default_api_view_kwargs()\n kwargs.update({\n 'paginate_by': self.list_per_page,\n })\n return kwargs", "metadata": "root.ModelAdmin2.get_api_list_kwargs", "header": "['class', 'ModelAdmin2', '(', 'with_metaclass', '(', 'ModelAdminBase2', ')', ')', ':', '___EOS___']", "index": 201 }, { "content": " def get_api_detail_kwargs(self):\n return self.get_default_api_view_kwargs()", "metadata": "root.ModelAdmin2.get_api_detail_kwargs", "header": "['class', 'ModelAdmin2', '(', 'with_metaclass', '(', 'ModelAdminBase2', ')', ')', ':', '___EOS___']", "index": 208 }, { "content": " def get_urls(self):\n pattern_list = []\n for admin_view in self.views:\n admin_view.model_admin = self\n get_kwargs = getattr(self, \"get_%s_kwargs\" % admin_view.name, None)\n if not get_kwargs:\n get_kwargs = admin_view.get_view_kwargs\n try:\n view_instance = admin_view.view.as_view(**get_kwargs())\n except Exception as e:\n trace = sys.exc_info()[2]\n new_exception = TypeError(\n 'Cannot instantiate admin view \"{}.{}\". '\n 'The error that got raised was: {}'.format(\n self.__class__.__name__, admin_view.name, e))\n try:\n raise new_exception.with_traceback(trace)\n except AttributeError:\n raise (new_exception, None, trace)\n\n pattern_list.append(\n url(\n regex=admin_view.url,\n view=view_instance,\n name=self.get_prefixed_view_name(admin_view.name)\n )\n )\n return patterns('', *pattern_list)", "metadata": "root.ModelAdmin2.get_urls", "header": "['class', 'ModelAdmin2', '(', 'with_metaclass', '(', 'ModelAdminBase2', ')', ')', ':', '___EOS___']", "index": 211 }, { "content": " def get_api_urls(self):\n return patterns(\n '',\n url(\n regex=r'^$',\n view=self.api_list_view.as_view(**self.get_api_list_kwargs()),\n name=self.get_prefixed_view_name('api_list'),\n ),\n url(\n regex=r'^(?P<pk>[0-9]+)/$',\n view=self.api_detail_view.as_view(\n **self.get_api_detail_kwargs()),\n name=self.get_prefixed_view_name('api_detail'),\n ),\n )", "metadata": "root.ModelAdmin2.get_api_urls", "header": "['class', 'ModelAdmin2', '(', 'with_metaclass', '(', 'ModelAdminBase2', ')', ')', ':', '___EOS___']", "index": 240 }, { "content": " @property\n def urls(self):\n # We set the application and instance namespace here\n return self.get_urls(), None, None", "metadata": "root.ModelAdmin2.urls", "header": "['class', 'ModelAdmin2', '(', 'with_metaclass', '(', 'ModelAdminBase2', ')', ')', ':', '___EOS___']", "index": 256 }, { "content": " @property\n def api_urls(self):\n return self.get_api_urls(), None, None", "metadata": "root.ModelAdmin2.api_urls", "header": "['class', 'ModelAdmin2', '(', 'with_metaclass', '(', 'ModelAdminBase2', ')', ')', ':', '___EOS___']", "index": 261 }, { "content": " def get_list_actions(self):\n actions_dict = {}\n\n for cls in type(self).mro()[::-1]:\n class_actions = getattr(cls, 'list_actions', [])\n for action in class_actions:\n actions_dict[action.__name__] = {\n 'name': action.__name__,\n 'description': actions.get_description(action),\n 'action_callable': action\n }\n return actions_dict", "metadata": "root.ModelAdmin2.get_list_actions", "header": "['class', 'ModelAdmin2', '(', 'with_metaclass', '(', 'ModelAdminBase2', ')', ')', ':', '___EOS___']", "index": 265 }, { "content": " def get_ordering(self, request):\n return self.ordering", "metadata": "root.ModelAdmin2.get_ordering", "header": "['class', 'ModelAdmin2', '(', 'with_metaclass', '(', 'ModelAdminBase2', ')', ')', ':', '___EOS___']", "index": 278 }, { "content": "class Admin2Inline(extra_views.InlineFormSet):\n \"\"\"\n A simple extension of django-extra-view's InlineFormSet that\n adds some useful functionality.\n \"\"\"\n template = None\n", "metadata": "root.Admin2Inline", "header": "['module', '___EOS___']", "index": 282 }, { "content": " def construct_formset(self):\n \"\"\"\n Overrides construct_formset to attach the model class as\n an attribute of the returned formset instance.\n \"\"\"\n formset = super(Admin2Inline, self).construct_formset()\n formset.model = self.inline_model\n formset.template = self.template\n return formset", "metadata": "root.Admin2Inline.construct_formset", "header": "['class', 'Admin2Inline', '(', 'extra_views', '.', 'InlineFormSet', ')', ':', '___EOS___']", "index": 289 }, { "content": "class Admin2TabularInline(Admin2Inline):\n template = os.path.join(\n settings.ADMIN2_THEME_DIRECTORY, 'edit_inlines/tabular.html')", "metadata": "root.Admin2TabularInline", "header": "['module', '___EOS___']", "index": 300 }, { "content": "class Admin2StackedInline(Admin2Inline):\n template = os.path.join(\n settings.ADMIN2_THEME_DIRECTORY, 'edit_inlines/stacked.html')", "metadata": "root.Admin2StackedInline", "header": "['module', '___EOS___']", "index": 305 }, { "content": "def immutable_admin_factory(model_admin):\n \"\"\"\n Provide an ImmutableAdmin to make it harder for developers to\n dig themselves into holes.\n See https://github.com/twoscoops/django-admin2/issues/99\n Frozen class implementation as namedtuple suggested by Audrey Roy\n\n Note: This won't stop developers from saving mutable objects to\n the result, but hopefully developers attempting that\n 'workaround/hack' will read our documentation.\n \"\"\"\n ImmutableAdmin = namedtuple('ImmutableAdmin',\n model_admin.model_admin_attributes,\n verbose=False)\n return ImmutableAdmin(*[getattr(\n model_admin, x) for x in model_admin.model_admin_attributes])", "metadata": "root.immutable_admin_factory", "header": "['module', '___EOS___']", "index": 310 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", ",_", "abs", "olute", "\\u", "import_", ",_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "collections_", "import_", "namedtuple_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\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_", "._", "conf_", "._", "urls_", "import_", "patterns_", ",_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "six_", "import_", "with", "\\u", "metaclass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "extra", "\\u", "views_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "import_", "api", "views_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "views_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "actions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "forms_", "import_", "modelf", "orm", "\\u", "factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "dj", "admin", "2", "'_", ")_", "\\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_", "Model", "Admi", "n", "Base", "2_", "(_", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Model", "Admi", "n", "Base", "2_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "name_", ",_", "bases_", ",_", "attrs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "class_", "=_", "super_", "(_", "Model", "Admi", "n", "Base", "2_", ",_", "cls_", ")_", "._", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bases_", ",_", "attrs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "attrs_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "views_", "._", "Admi", "n", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "value_", "._", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "value_", "._", "name_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "view", "\\u", "list_", "._", "append_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "view", "\\u", "list_", "._", "extend_", "(_", "getattr_", "(_", "new", "\\u", "class_", ",_", "'", "views", "'_", ",_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "class_", "._", "views_", "=_", "view", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "new", "\\u", "class_", "\\u\\u\\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_", "Model", "Admi", "n2_", "(_", "with", "\\u", "metaclass_", "(_", "Model", "Admi", "n", "Base", "2_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Add", "ing", " ", "new", " ", "Model", "Admi", "n2", " ", "attribute", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Step", " ", "1", ":", " ", "Add", " ", "the", " ", "attribute", " ", "to", " ", "this", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "Step", " ", "2", ":", " ", "Add", " ", "the", " ", "attribute", " ", "to", " ", "dj", "admin", "2", ".", "settings", ".", "MODEL", "\\u", "ADM", "IN", "\\u", "ATTRS", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rea", "son", "ing", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Chang", "ing", " ", "values", " ", "on", " ", "Model", "Admi", "n2", " ", "object", "s", " ", "or", " ", "thei", "r", " ", "attribute", "s", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "within", " ", "a", " ", "view", " ", "results", " ", "in", " ", "leak", "y", " ", "scop", "ing", " ", "issue", "s", ".", " ", "There", "fore", ",", " ", "we", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "immutable", "\\u", "admin", "\\u", "factor", "y", " ", "to", " ", "render", " ", "the", " ", "Model", "Admi", "n2", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "practic", "ally", " ", "immutable", " ", "bef", "ore", " ", "passi", "ng", " ", "it", " ", "to", " ", "the", " ", "view", ".", " ", "To", " ", "constrain", "\\", "10", ";", " ", " ", " ", " ", "thing", "s", " ", "fur", "ther", " ", "(", "in", " ", "order", " ", "to", " ", "protect", " ", "ours", "elv", "es", " ", "from", " ", "caus", "ing", "\\", "10", ";", " ", " ", " ", " ", "hard", "-", "to", "-", "find", " ", "security", " ", "problem", "s", "),", " ", "we", " ", "als", "o", " ", "restrict", " ", "whi", "ch", " ", "attr", "s", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "pass", "ed", " ", "to", " ", "the", " ", "final", " ", "Immu", "table", "Admi", "n", " ", "object", " ", "(", "i", ".", "e", ".", " ", "a", " ", "namedtupl", "e", ").", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "prevent", "s", " ", "us", " ", "from", " ", "easi", "ly", " ", "implement", "ing", " ", "method", "s", "/", "sette", "rs", " ", "whi", "ch", "\\", "10", ";", " ", " ", " ", " ", "bypass", " ", "the", " ", "blockin", "g", " ", "features", " ", "of", " ", "the", " ", "Immu", "table", "Admi", "n", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "s", "\\u", "selection", "\\u", "counter_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date", "\\u", "hierarchy_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display_", "=_", "(_", "'\\u", "\\u", "str", "\\u\\u'_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "display", "\\u", "links_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "filter_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "select", "\\u", "related_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "per", "\\u", "page_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "max", "\\u", "show", "\\u", "all_", "=_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "\\u", "editable_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "search", "\\u", "fields_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "\\u", "as_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "\\u", "on", "\\u", "top_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "admin", "\\u", "attributes_", "=_", "settings_", "._", "MODEL", "\\u", "ADM", "IN", "\\u", "ATTRS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ordering_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "\\u", "on", "\\u", "top_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "save", "\\u", "on", "\\u", "bottom_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", " ", "ye", "t", " ", "implemented", ".", " ", "See", " ", "#", "267", " ", "and", " ", "#", "268", "_", "\\u\\u\\uNL\\u\\u\\u_", "action", "s", "\\u", "on", "\\u", "bottom_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "s", "\\u", "on", "\\u", "top_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "search", "\\u", "fields_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Show", " ", "the", " ", "fields", " ", "to", " ", "be", " ", "displaye", "d", " ", "as", " ", "columns_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Confirm", " ", "tha", "t", " ", "this", " ", "is", " ", "what", " ", "the", " ", "Dj", "ang", "o", " ", "admin", " ", "uses_", "\\u\\u\\uNL\\u\\u\\u_", "list", "\\u", "fields_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "show", "s", " ", "up", " ", "on", " ", "the", " ", "Document", "List", "View", " ", "of", " ", "the", " ", "Posts", "_", "\\u\\u\\uNL\\u\\u\\u_", "list", "\\u", "actions_", "=_", "[_", "actions_", "._", "Delete", "Select", "ed", "Action_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "show", "s", " ", "up", " ", "in", " ", "the", " ", "Document", "Det", "ail", "View", " ", "of", " ", "the", " ", "Posts", "._", "\\u\\u\\uNL\\u\\u\\u_", "document", "\\u", "actions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Show", "s", " ", "up", " ", "on", " ", "a", " ", "partic", "ular", " ", "field_", "\\u\\u\\uNL\\u\\u\\u_", "field", "\\u", "actions_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Define", "s", " ", "custom", " ", "field", " ", "renderers_", "\\u\\u\\uNL\\u\\u\\u_", "field", "\\u", "renderers_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fields_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exclude_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fieldsets_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "class_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "\\u", "vertical_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "\\u", "horizontal_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "radio", "\\u", "fields_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prepo", "pulat", "ed", "\\u", "fields_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formfi", "eld", "\\u", "overrides_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "read", "only", "\\u", "fields_", "=_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ordering_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "form", "\\u", "class_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "form", "\\u", "class_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "inlines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Views_", "\\u\\u\\uNL\\u\\u\\u_", "index", "\\u", "view_", "=_", "views_", "._", "Admi", "n", "View_", "(_", "r", "'", "^", "$'_", ",_", "views_", "._", "Model", "List", "View_", ",_", "name_", "=_", "'", "index", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "view_", "=_", "views_", "._", "Admi", "n", "View_", "(_", "r", "'", "^", "create", "/$'_", ",_", "views_", "._", "Model", "Add", "Form", "View_", ",_", "name_", "=_", "'", "create", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "view_", "=_", "views_", "._", "Admi", "n", "View_", "(_", "r", "'", "^", "(?", "P", "<", "pk", ">[", "0", "-", "9", "]+)/$'_", ",_", "views_", "._", "Model", "Edit", "Form", "View_", ",_", "name_", "=_", "'", "update", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deta", "il", "\\u", "view_", "=_", "views_", "._", "Admi", "n", "View_", "(_", "r", "'", "^", "(?", "P", "<", "pk", ">[", "0", "-", "9", "]+)", "/", "update", "/$'_", ",_", "views_", "._", "Model", "Det", "ail", "View_", ",_", "name_", "=_", "'", "deta", "il", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "\\u", "view_", "=_", "views_", "._", "Admi", "n", "View_", "(_", "r", "'", "^", "(?", "P", "<", "pk", ">[", "0", "-", "9", "]+)", "/", "delete", "/$'_", ",_", "views_", "._", "Model", "Delete", "View_", ",_", "name_", "=_", "'", "delete", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "histo", "ry", "\\u", "view_", "=_", "views_", "._", "Admi", "n", "View_", "(_", "r", "'", "^", "(?", "P", "<", "pk", ">[", "0", "-", "9", "]+)", "/", "histo", "ry", "/$'_", ",_", "views_", "._", "Model", "Hist", "ory", "View_", ",_", "name_", "=_", "'", "histo", "ry", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "views_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "API", " ", "configuration_", "\\u\\u\\uNL\\u\\u\\u_", "api", "\\u", "serialize", "r", "\\u", "class_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "API", " ", "Views_", "\\u\\u\\uNL\\u\\u\\u_", "api", "\\u", "list", "\\u", "view_", "=_", "api", "views_", "._", "List", "Creat", "e", "API", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api", "\\u", "deta", "il", "\\u", "view_", "=_", "api", "views_", "._", "Retrieve", "Update", "Destr", "oy", "API", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Model", "Admi", "n2_", "(_", "with", "\\u", "metaclass_", "(_", "Model", "Admi", "n", "Base", "2_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "model_", ",_", "admin_", ",_", "name_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "model_", "=_", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "admin_", "=_", "admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model", "\\u", "options_", "=_", "utils_", "._", "model", "\\u", "options_", "(_", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app", "\\u", "label_", "=_", "model", "\\u", "options_", "._", "app", "\\u", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "model", "\\u", "name_", "=_", "model", "\\u", "options_", "._", "object\\u", "name_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "name_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "'{}\\u", "{}'_", "._", "format_", "(_", "self_", "._", "app", "\\u", "label_", ",_", "self_", "._", "model", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "verbo", "se", "\\u", "name_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "verbo", "se", "\\u", "name_", "=_", "model", "\\u", "options_", "._", "verbo", "se", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "verbo", "se", "\\u", "name", "\\u", "plural_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "model", "\\u", "options_", "._", "verbo", "se", "\\u", "name", "\\u", "plural_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Admi", "n2_", "(_", "with", "\\u", "metaclass_", "(_", "Model", "Admi", "n", "Base", "2_", ")_", ")_", ":_", "\\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", "default", "\\u", "view", "\\u", "kwargs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "label", "'_", ":_", "self_", "._", "app", "\\u", "label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "self_", "._", "model_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "\\u", "name", "'_", ":_", "self_", "._", "model", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "\\u", "admin", "'_", ":_", "immutable", "\\u", "admin", "\\u", "factory_", "(_", "self_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Admi", "n2_", "(_", "with", "\\u", "metaclass_", "(_", "Model", "Admi", "n", "Base", "2_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "index", "\\u", "kwargs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "self_", "._", "get", "\\u", "default", "\\u", "view", "\\u", "kwargs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "paginate", "\\u", "by", "'_", ":_", "self_", "._", "list", "\\u", "per", "\\u", "page_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Admi", "n2_", "(_", "with", "\\u", "metaclass_", "(_", "Model", "Admi", "n", "Base", "2_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "default", "\\u", "api", "\\u", "view", "\\u", "kwargs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "self_", "._", "get", "\\u", "default", "\\u", "view", "\\u", "kwargs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "serialize", "r", "\\u", "class", "'_", ":_", "self_", "._", "api", "\\u", "serialize", "r", "\\u", "class_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Admi", "n2_", "(_", "with", "\\u", "metaclass_", "(_", "Model", "Admi", "n", "Base", "2_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "prefixed", "\\u", "view", "\\u", "name_", "(_", "self_", ",_", "view", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'{}\\u", "{}'_", "._", "format_", "(_", "self_", "._", "name_", ",_", "view", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Admi", "n2_", "(_", "with", "\\u", "metaclass_", "(_", "Model", "Admi", "n", "Base", "2_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "create", "\\u", "kwargs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "self_", "._", "get", "\\u", "default", "\\u", "view", "\\u", "kwargs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "inline", "s", "'_", ":_", "self_", "._", "inlines_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "class", "'_", ":_", "(_", "self_", "._", "create", "\\u", "form", "\\u", "class_", "if_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "create", "\\u", "form", "\\u", "class_", "else_", "self_", "._", "form", "\\u", "class_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Admi", "n2_", "(_", "with", "\\u", "metaclass_", "(_", "Model", "Admi", "n", "Base", "2_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "update", "\\u", "kwargs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "self_", "._", "get", "\\u", "default", "\\u", "view", "\\u", "kwargs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "class_", "=_", "(_", "self_", "._", "update", "\\u", "form", "\\u", "class_", "if_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "update", "\\u", "form", "\\u", "class_", "else_", "self_", "._", "form", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "form", "\\u", "class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form", "\\u", "class_", "=_", "modelf", "orm", "\\u", "factory_", "(_", "self_", "._", "model_", ",_", "fields_", "=_", "'\\u", "\\u", "all", "\\u\\u'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kwargs_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "inline", "s", "'_", ":_", "self_", "._", "inlines_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "form", "\\u", "class", "'_", ":_", "form", "\\u", "class_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Admi", "n2_", "(_", "with", "\\u", "metaclass_", "(_", "Model", "Admi", "n", "Base", "2_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "index", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "reverse_", "(_", "'", "admin", "2", ":{}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "get", "\\u", "prefixed", "\\u", "view", "\\u", "name_", "(_", "'", "index", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Admi", "n2_", "(_", "with", "\\u", "metaclass_", "(_", "Model", "Admi", "n", "Base", "2_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "api", "\\u", "list", "\\u", "kwargs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "self_", "._", "get", "\\u", "default", "\\u", "api", "\\u", "view", "\\u", "kwargs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "paginate", "\\u", "by", "'_", ":_", "self_", "._", "list", "\\u", "per", "\\u", "page_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Admi", "n2_", "(_", "with", "\\u", "metaclass_", "(_", "Model", "Admi", "n", "Base", "2_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "api", "\\u", "deta", "il", "\\u", "kwargs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "\\u", "default", "\\u", "api", "\\u", "view", "\\u", "kwargs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Admi", "n2_", "(_", "with", "\\u", "metaclass_", "(_", "Model", "Admi", "n", "Base", "2_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "urls_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pattern", "\\u", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "admin", "\\u", "view_", "in_", "self_", "._", "views_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "admin", "\\u", "view_", "._", "model", "\\u", "admin_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "get", "\\u", "kwargs_", "=_", "getattr_", "(_", "self_", ",_", "\"", "get", "\\u", "%", "s", "\\u", "kwarg", "s", "\"_", "%_", "admin", "\\u", "view_", "._", "name_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "get", "\\u", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "\\u", "kwargs_", "=_", "admin", "\\u", "view_", "._", "get", "\\u", "view", "\\u", "kwargs_", "\\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 ", " _", "view", "\\u", "instance_", "=_", "admin", "\\u", "view_", "._", "view_", "._", "as", "\\u", "view_", "(_", "**_", "get", "\\u", "kwargs_", "(_", ")_", ")_", "\\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 ", " _", "trace_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "exception_", "=_", "Type", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Cann", "ot", " ", "instantiate", " ", "admin", " ", "view", " ", "\"{}", ".{}", "\".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "error", " ", "tha", "t", " ", "got", " ", "raise", "d", " ", "was", ":", " ", "{}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "admin", "\\u", "view_", "._", "name_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "new", "\\u", "exception_", "._", "with", "\\u", "traceback_", "(_", "trace_", ")_", "\\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 ", " ", "_", "raise_", "(_", "new", "\\u", "exception_", ",_", "None_", ",_", "trace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pattern", "\\u", "list_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "regex_", "=_", "admin", "\\u", "view_", "._", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "view_", "=_", "view", "\\u", "instance_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "self_", "._", "get", "\\u", "prefixed", "\\u", "view", "\\u", "name_", "(_", "admin", "\\u", "view_", "._", "name_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "patterns_", "(_", "''_", ",_", "*_", "pattern", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Admi", "n2_", "(_", "with", "\\u", "metaclass_", "(_", "Model", "Admi", "n", "Base", "2_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "api", "\\u", "urls_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "patterns_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "regex_", "=_", "r", "'", "^", "$'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "view_", "=_", "self_", "._", "api", "\\u", "list", "\\u", "view_", "._", "as", "\\u", "view_", "(_", "**_", "self_", "._", "get", "\\u", "api", "\\u", "list", "\\u", "kwargs_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "self_", "._", "get", "\\u", "prefixed", "\\u", "view", "\\u", "name_", "(_", "'", "api", "\\u", "list", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "regex_", "=_", "r", "'", "^", "(?", "P", "<", "pk", ">[", "0", "-", "9", "]+)/$'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "view_", "=_", "self_", "._", "api", "\\u", "deta", "il", "\\u", "view_", "._", "as", "\\u", "view_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "self_", "._", "get", "\\u", "api", "\\u", "deta", "il", "\\u", "kwargs_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "self_", "._", "get", "\\u", "prefixed", "\\u", "view", "\\u", "name_", "(_", "'", "api", "\\u", "deta", "il", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Admi", "n2_", "(_", "with", "\\u", "metaclass_", "(_", "Model", "Admi", "n", "Base", "2_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "urls_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "set", " ", "the", " ", "applica", "tion", " ", "and", " ", "instance", " ", "namespace", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "\\u", "urls_", "(_", ")_", ",_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Admi", "n2_", "(_", "with", "\\u", "metaclass_", "(_", "Model", "Admi", "n", "Base", "2_", ")_", ")_", ":_", "\\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_", "api", "\\u", "urls_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "get", "\\u", "api", "\\u", "urls_", "(_", ")_", ",_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Admi", "n2_", "(_", "with", "\\u", "metaclass_", "(_", "Model", "Admi", "n", "Base", "2_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "list", "\\u", "actions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action", "s", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "cls_", "in_", "type_", "(_", "self_", ")_", "._", "mro", "_", "(_", ")_", "[_", ":_", ":_", "-_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class", "\\u", "actions_", "=_", "getattr_", "(_", "cls_", ",_", "'", "list", "\\u", "action", "s", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "action_", "in_", "class", "\\u", "actions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action", "s", "\\u", "dict_", "[_", "action_", "._", "\\u\\u", "name\\u\\u_", "]_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "action_", "._", "\\u\\u", "name\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "actions_", "._", "get", "\\u", "description_", "(_", "action_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "action", "\\u", "calla", "ble", "'_", ":_", "action_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "action", "s", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Model", "Admi", "n2_", "(_", "with", "\\u", "metaclass_", "(_", "Model", "Admi", "n", "Base", "2_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "ordering_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "ordering_", "\\u\\u\\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_", "Admi", "n2", "Inline_", "(_", "extra", "\\u", "views_", "._", "In", "line", "Form", "Set_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "simple", " ", "extensi", "on", " ", "of", " ", "django", "-", "extra", "-", "view", "'", "s", " ", "In", "line", "Form", "Set", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "adds", " ", "some", " ", "usef", "ul", " ", "functional", "it", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Admi", "n2", "Inline_", "(_", "extra", "\\u", "views_", "._", "In", "line", "Form", "Set_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "construct", "\\u", "formset_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Override", "s", " ", "construct", "\\u", "formset", " ", "to", " ", "attach", " ", "the", " ", "model", " ", "class", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "attribute", " ", "of", " ", "the", " ", "return", "ed", " ", "formset", " ", "instance", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formset_", "=_", "super_", "(_", "Admi", "n2", "Inline_", ",_", "self_", ")_", "._", "construct", "\\u", "formset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formset_", "._", "model_", "=_", "self_", "._", "inline", "\\u", "model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formset_", "._", "template_", "=_", "self_", "._", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "formset_", "\\u\\u\\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_", "Admi", "n2", "Tab", "ular", "Inline_", "(_", "Admi", "n2", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "ADM", "IN", "2", "\\u", "THEME", "\\u", "DIRECTORY_", ",_", "'", "edit", "\\u", "inline", "s", "/", "tabular", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Admi", "n2", "Stack", "ed", "Inline_", "(_", "Admi", "n2", "Inline_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "settings_", "._", "ADM", "IN", "2", "\\u", "THEME", "\\u", "DIRECTORY_", ",_", "'", "edit", "\\u", "inline", "s", "/", "stacked", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "immutable", "\\u", "admin", "\\u", "factory_", "(_", "model", "\\u", "admin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Prov", "ide", " ", "an", " ", "Immu", "table", "Admi", "n", " ", "to", " ", "make", " ", "it", " ", "hard", "er", " ", "for", " ", "developer", "s", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "dig", " ", "them", "sel", "ves", " ", "int", "o", " ", "hole", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "https", "://", "git", "hub", ".", "com", "/", "two", "sco", "ops", "/", "django", "-", "admin", "2", "/", "issue", "s", "/", "9", "9", "\\", "10", ";", " ", " ", " ", " ", "Fro", "zen", " ", "class", " ", "implementation", " ", "as", " ", "namedtupl", "e", " ", "suggested", " ", "by", " ", "Au", "dre", "y", " ", "Ro", "y", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ":", " ", "Thi", "s", " ", "won", "'", "t", " ", "stop", " ", "developer", "s", " ", "from", " ", "saving", " ", "mutable", " ", "object", "s", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "result", ",", " ", "but", " ", "hop", "efu", "ll", "y", " ", "developer", "s", " ", "atte", "mpt", "ing", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "'", "workar", "ound", "/", "hack", "'", " ", "will", " ", "read", " ", "our", " ", "documentation", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Immu", "table", "Admin_", "=_", "namedtuple_", "(_", "'", "Immu", "table", "Admi", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "admin_", "._", "model", "\\u", "admin", "\\u", "attributes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "verbose_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Immu", "table", "Admin_", "(_", "*_", "[_", "getattr_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "admin_", ",_", "x_", ")_", "for_", "x_", "in_", "model", "\\u", "admin_", "._", "model", "\\u", "admin", "\\u", "attributes_", "]_", ")_" ]
[ 4, 4, 4, 4, 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 ]
Variable defined multiple times
lbryio/lbry/tests/functional_tests.py
[ { "content": " def test_live_transfer(self):\n\n sd_hash_queue = Queue()\n kill_event = Event()\n dead_event = Event()\n server_args = (sd_hash_queue, kill_event, dead_event)\n server = Process(target=start_live_server, args=server_args)\n server.start()\n self.server_processes.append(server)\n\n wallet = FakeWallet()\n peer_manager = PeerManager()\n peer_finder = FakePeerFinder(5553, peer_manager, 1)\n hash_announcer = FakeAnnouncer()\n rate_limiter = DummyRateLimiter()\n sd_identifier = StreamDescriptorIdentifier()\n\n db_dir = \"client\"\n os.mkdir(db_dir)\n\n self.session = LBRYSession(MIN_BLOB_DATA_PAYMENT_RATE, db_dir=db_dir, lbryid=\"abcd\",\n peer_finder=peer_finder, hash_announcer=hash_announcer, blob_dir=None,\n peer_port=5553, use_upnp=False, rate_limiter=rate_limiter, wallet=wallet)\n\n self.stream_info_manager = TempLiveStreamMetadataManager(hash_announcer)\n\n d = self.wait_for_hash_from_queue(sd_hash_queue)\n\n def create_downloader(metadata, prm):\n info_validator = metadata.validator\n options = metadata.options\n factories = metadata.factories\n chosen_options = [o.default_value for o in options.get_downloader_options(info_validator, prm)]\n return factories[0].make_downloader(metadata, chosen_options, prm)\n\n def start_lbry_file(lbry_file):\n lbry_file = lbry_file\n logging.debug(\"Calling lbry_file.start()\")\n return lbry_file.start()\n\n def download_stream(sd_blob_hash):\n logging.debug(\"Downloaded the sd blob. Reading it now\")\n prm = PaymentRateManager(self.session.base_payment_rate_manager)\n d = download_sd_blob(self.session, sd_blob_hash, prm)\n d.addCallback(sd_identifier.get_metadata_for_sd_blob)\n d.addCallback(create_downloader, prm)\n d.addCallback(start_lbry_file)\n return d\n\n def do_download(sd_blob_hash):\n logging.debug(\"Starting the download\")\n d = self.session.setup()\n d.addCallback(lambda _: enable_live_stream())\n d.addCallback(lambda _: download_stream(sd_blob_hash))\n return d\n\n def enable_live_stream():\n base_live_stream_payment_rate_manager = BaseLiveStreamPaymentRateManager(\n MIN_BLOB_INFO_PAYMENT_RATE\n )\n add_live_stream_to_sd_identifier(sd_identifier,\n base_live_stream_payment_rate_manager)\n add_full_live_stream_downloader_to_sd_identifier(self.session, self.stream_info_manager,\n sd_identifier,\n base_live_stream_payment_rate_manager)\n\n d.addCallback(do_download)\n\n def check_md5_sum():\n f = open('test_file')\n hashsum = MD5.new()\n hashsum.update(f.read())\n self.assertEqual(hashsum.hexdigest(), \"215b177db8eed86d028b37e5cbad55c7\")\n\n d.addCallback(lambda _: check_md5_sum())\n\n def stop(arg):\n if isinstance(arg, Failure):\n logging.debug(\"Client is stopping due to an error. Error: %s\", arg.getTraceback())\n else:\n logging.debug(\"Client is stopping normally.\")\n kill_event.set()\n logging.debug(\"Set the kill event\")\n d = self.wait_for_event(dead_event, 15)\n\n def print_shutting_down():\n logging.info(\"Client is shutting down\")\n\n d.addCallback(lambda _: print_shutting_down())\n d.addCallback(lambda _: arg)\n return d\n\n d.addBoth(stop)\n return d", "metadata": "root.TestTransfer.test_live_transfer", "header": "['class', 'TestTransfer', '(', 'TestCase', ')', ':', '___EOS___']", "index": 841 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Transfer", "_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "live", "\\u", "transfer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sd", "\\u", "hash", "\\u", "queue_", "=_", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kill", "\\u", "event_", "=_", "Event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dead", "\\u", "event_", "=_", "Event_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "\\u", "args_", "=_", "(_", "sd", "\\u", "hash", "\\u", "queue_", ",_", "kill", "\\u", "event_", ",_", "dead", "\\u", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "=_", "Process_", "(_", "target_", "=_", "start", "\\u", "live", "\\u", "server_", ",_", "args_", "=_", "server", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "server", "\\u", "processes_", "._", "append_", "(_", "server_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "wallet_", "=_", "Fake", "Wallet_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "peer", "\\u", "manager_", "=_", "Peer", "Manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "peer", "\\u", "finder_", "=_", "Fake", "Peer", "Finder_", "(_", "555", "3_", ",_", "peer", "\\u", "manager_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hash", "\\u", "announce", "r_", "=_", "Fake", "Announce", "r_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rate", "\\u", "limiter", "_", "=_", "Du", "mm", "y", "Rat", "e", "Limit", "er_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sd", "\\u", "identifier_", "=_", "Stream", "Descrip", "tor", "Identifier_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "dir_", "=_", "\"", "client", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "db", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session_", "=_", "LB", "RY", "Session_", "(_", "MIN", "\\u", "BLOB", "\\u", "DATA", "\\u", "PAY", "MENT", "\\u", "RATE_", ",_", "db", "\\u", "dir_", "=_", "db", "\\u", "dir_", ",_", "lbr", "yi", "d_", "=_", "\"", "abc", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "peer", "\\u", "finder_", "=_", "peer", "\\u", "finder_", ",_", "hash", "\\u", "announce", "r_", "=_", "hash", "\\u", "announce", "r_", ",_", "blob", "\\u", "dir_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "peer", "\\u", "port_", "=_", "555", "3_", ",_", "use", "\\u", "upnp", "_", "=_", "False_", ",_", "rate", "\\u", "limiter", "_", "=_", "rate", "\\u", "limiter", "_", ",_", "wallet_", "=_", "wallet_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "stream", "\\u", "info", "\\u", "manager_", "=_", "Temp", "Live", "Stream", "Meta", "data", "Manager_", "(_", "hash", "\\u", "announce", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "self_", "._", "wait", "\\u", "for", "\\u", "hash", "\\u", "from", "\\u", "queue_", "(_", "sd", "\\u", "hash", "\\u", "queue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create", "\\u", "downloader_", "(_", "metadata_", ",_", "prm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info", "\\u", "validator_", "=_", "metadata_", "._", "validator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "=_", "metadata_", "._", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "factories_", "=_", "metadata_", "._", "factories_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chosen", "\\u", "options_", "=_", "[_", "o_", "._", "default", "\\u", "value_", "for_", "o_", "in_", "options_", "._", "get", "\\u", "downloader", "\\u", "options_", "(_", "info", "\\u", "validator_", ",_", "prm_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "factories_", "[_", "0_", "]_", "._", "make", "\\u", "downloader_", "(_", "metadata_", ",_", "chosen", "\\u", "options_", ",_", "prm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "\\u", "lbr", "y", "\\u", "file_", "(_", "lbr", "y", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lbr", "y", "\\u", "file_", "=_", "lbr", "y", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "debug_", "(_", "\"", "Call", "ing", " ", "lbr", "y", "\\u", "file", ".", "start", "()\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "lbr", "y", "\\u", "file_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "download", "\\u", "stream_", "(_", "sd", "\\u", "blob", "\\u", "hash_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "\"", "Downloade", "d", " ", "the", " ", "sd", " ", "blob", ".", " ", "Reading", " ", "it", " ", "now", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prm_", "=_", "Payment", "Rat", "e", "Manager_", "(_", "self_", "._", "session_", "._", "base", "\\u", "pay", "ment", "\\u", "rate", "\\u", "manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "download", "\\u", "sd", "\\u", "blob_", "(_", "self_", "._", "session_", ",_", "sd", "\\u", "blob", "\\u", "hash_", ",_", "prm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "sd", "\\u", "identifier_", "._", "get", "\\u", "metadata", "\\u", "for", "\\u", "sd", "\\u", "blob_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "create", "\\u", "downloader_", ",_", "prm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "start", "\\u", "lbr", "y", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "download_", "(_", "sd", "\\u", "blob", "\\u", "hash_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "\"", "Start", "ing", " ", "the", " ", "download", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "self_", "._", "session_", "._", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "lambda_", "\\u_", ":_", "enable", "\\u", "live", "\\u", "stream_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "lambda_", "\\u_", ":_", "download", "\\u", "stream_", "(_", "sd", "\\u", "blob", "\\u", "hash_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "enable", "\\u", "live", "\\u", "stream_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base", "\\u", "live", "\\u", "stream", "\\u", "pay", "ment", "\\u", "rate", "\\u", "manager_", "=_", "Base", "Live", "Stream", "Payment", "Rat", "e", "Manager_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "MIN", "\\u", "BLOB", "\\u", "INFO", "\\u", "PAY", "MENT", "\\u", "RATE_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "live", "\\u", "stream", "\\u", "to", "\\u", "sd", "\\u", "identifier_", "(_", "sd", "\\u", "identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "live", "\\u", "stream", "\\u", "pay", "ment", "\\u", "rate", "\\u", "manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "full", "\\u", "live", "\\u", "stream", "\\u", "downloader", "\\u", "to", "\\u", "sd", "\\u", "identifier_", "(_", "self_", "._", "session_", ",_", "self_", "._", "stream", "\\u", "info", "\\u", "manager_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sd", "\\u", "identifier_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "live", "\\u", "stream", "\\u", "pay", "ment", "\\u", "rate", "\\u", "manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "do", "\\u", "download_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "check", "\\u", "md5", "\\u", "sum_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "'", "test\\u", "file", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hash", "sum_", "=_", "MD", "5_", "._", "new_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hash", "sum_", "._", "update_", "(_", "f_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hash", "sum_", "._", "hexdigest_", "(_", ")_", ",_", "\"", "215", "b1", "7", "7d", "b8", "eed", "86", "d0", "2", "8b", "3", "7e", "5c", "bad", "5", "5c", "7", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "lambda_", "\\u_", ":_", "check", "\\u", "md5", "\\u", "sum_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "stop_", "(_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "arg_", ",_", "Failure_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "\"", "Client", " ", "is", " ", "stopping", " ", "due", " ", "to", " ", "an", " ", "error", ".", " ", "Error", ":", " ", "%", "s", "\"_", ",_", "arg_", "._", "get", "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 ", " _", "logging_", "._", "debug_", "(_", "\"", "Client", " ", "is", " ", "stopping", " ", "normal", "ly", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kill", "\\u", "event_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "debug_", "(_", "\"", "Set", " ", "the", " ", "kill", " ", "event", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "self_", "._", "wait", "\\u", "for", "\\u", "event_", "(_", "dead", "\\u", "event_", ",_", "15_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "print", "\\u", "shutt", "ing", "\\u", "down_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "\"", "Client", " ", "is", " ", "shutt", "ing", " ", "down", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "lambda_", "\\u_", ":_", "print", "\\u", "shutt", "ing", "\\u", "down_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "._", "add", "Callback_", "(_", "lambda_", "\\u_", ":_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "._", "add", "Bot", "h_", "(_", "stop_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 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 ]
Unused import
jfsantos/ift6266h14/gen_phone_sparse.py
[ { "content": "import cPickle as pickle\nimport numpy as np\nimport theano\nfrom sparse_coding.sparse_coding_gammatone import gammatone_matrix, erb_space\n\n\nif __name__ == \"__main__\":\n from sys import argv\n from scipy.io import wavfile\n mdl = pickle.load(open(argv[1]))\n x0a = gen_phone(mdl)\n wavfile.write(argv[2], 16000, out_scaled)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def gen_phone(mdl):\n X = theano.tensor.dmatrix('X')\n P = theano.tensor.dmatrix('P')\n y = mdl.fprop([X,P])\n predict = theano.function([X, P], y)\n\n resolution = 1600\n step = 64\n b = 1.019\n n_channels = 64\n\n D_multi = np.r_[tuple(gammatone_matrix(b, fc, resolution, step) for\n fc in erb_space(150, 8000, n_channels))]\n\n phones = np.load('test_phones_1600.npy')\n X = np.asmatrix((len(phones),np.zeros(1536)))\n\n phone_code = np.asmatrix((len(phones),np.zeros(3*62)))\n\n for pi, p in enumerate(phones):\n phone_code[pi,[p[0], p[1]+62, p[2]+2*62]] = 1 # one-hot encoding\n\n out = np.zeros(1600 + 200*(len(phones)-1))\n step = 200\n for k in range(1,len(phones)):\n idx = range(k*step, k*step+1600)\n X[k] = predict(X[k-1], phone_code[k])\n out[idx] += np.dot(X[k], D_multi)\n \n out_scaled = np.asarray(out/max(abs(out)), dtype='float32')\n return out_scaled", "metadata": "root.gen_phone", "header": "['module', '___EOS___']", "index": 5 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "c", "Pickle_", "as_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "theano_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "spars", "e\\u", "coding_", "._", "spars", "e\\u", "codi", "ng", "\\u", "gamma", "tone_", "import_", "gamma", "tone", "\\u", "matrix_", ",_", "erb", "\\u", "space_", "\\u\\u\\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 ", " _", "from_", "sys_", "import_", "argv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "._", "io_", "import_", "wav", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mdl_", "=_", "pickle_", "._", "load_", "(_", "open_", "(_", "argv_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x0", "a_", "=_", "gen", "\\u", "phone_", "(_", "mdl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wav", "file_", "._", "write_", "(_", "argv_", "[_", "2_", "]_", ",_", "16000", "_", ",_", "out", "\\u", "scaled_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "gen", "\\u", "phone_", "(_", "mdl_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "X_", "=_", "theano_", "._", "tensor_", "._", "dma", "trix_", "(_", "'", "X", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "=_", "theano_", "._", "tensor_", "._", "dma", "trix_", "(_", "'", "P", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "mdl_", "._", "fpro", "p_", "(_", "[_", "X_", ",_", "P_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "predict_", "=_", "theano_", "._", "function_", "(_", "[_", "X_", ",_", "P_", "]_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resolution_", "=_", "1600", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "=_", "64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "1.01", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n", "\\u", "channels_", "=_", "64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "D", "\\u", "multi_", "=_", "np_", "._", "r\\u_", "[_", "tuple_", "(_", "gamma", "tone", "\\u", "matrix_", "(_", "b_", ",_", "fc_", ",_", "resolution_", ",_", "step_", ")_", "for_", "\\u\\u\\uNL\\u\\u\\u_", "fc_", "in_", "erb", "\\u", "space_", "(_", "150_", ",_", "8000_", ",_", "n", "\\u", "channels_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "phones_", "=_", "np_", "._", "load_", "(_", "'", "test\\u", "phone", "s", "\\u", "1600", ".", "npy", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "np_", "._", "asm", "atrix", "_", "(_", "(_", "len_", "(_", "phones_", ")_", ",_", "np_", "._", "zeros_", "(_", "153", "6_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "phone", "\\u", "code_", "=_", "np_", "._", "asm", "atrix", "_", "(_", "(_", "len_", "(_", "phones_", ")_", ",_", "np_", "._", "zeros_", "(_", "3_", "*_", "62_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "pi_", ",_", "p_", "in_", "enumerate_", "(_", "phones_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "phone", "\\u", "code_", "[_", "pi_", ",_", "[_", "p_", "[_", "0_", "]_", ",_", "p_", "[_", "1_", "]_", "+_", "62_", ",_", "p_", "[_", "2_", "]_", "+_", "2_", "*_", "62_", "]_", "]_", "=_", "1_", "#", " ", "one", "-", "hot", " ", "encoding_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out_", "=_", "np_", "._", "zeros_", "(_", "1600", "_", "+_", "200_", "*_", "(_", "len_", "(_", "phones_", ")_", "-_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "step_", "=_", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "range_", "(_", "1_", ",_", "len_", "(_", "phones_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "idx_", "=_", "range_", "(_", "k_", "*_", "step_", ",_", "k_", "*_", "step_", "+_", "1600", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "[_", "k_", "]_", "=_", "predict_", "(_", "X_", "[_", "k_", "-_", "1_", "]_", ",_", "phone", "\\u", "code_", "[_", "k_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "[_", "idx_", "]_", "+=_", "np_", "._", "dot_", "(_", "X_", "[_", "k_", "]_", ",_", "D", "\\u", "multi_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "out", "\\u", "scaled_", "=_", "np_", "._", "asarray_", "(_", "out_", "/_", "max_", "(_", "abs_", "(_", "out_", ")_", ")_", ",_", "dtype_", "=_", "'", "float", "32", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "out", "\\u", "scaled_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
scikit-beam/scikit-beam/skbeam/core/roi.py
[ { "content": "def extract_label_indices(labels):\n \"\"\"\n This will find the label's required region of interests (roi's),\n number of roi's count the number of pixels in each roi's and pixels\n list for the required roi's.\n\n Parameters\n ----------\n labels : array\n labeled array; 0 is background.\n Each ROI is represented by a distinct label (i.e., integer).\n\n Returns\n -------\n label_mask : array\n 1D array labeling each foreground pixel\n e.g., [1, 1, 1, 1, 2, 2, 1, 1]\n\n indices : array\n 1D array of indices into the raveled image for all\n foreground pixels (labeled nonzero)\n e.g., [5, 6, 7, 8, 14, 15, 21, 22]\n \"\"\"\n img_dim = labels.shape\n\n # TODO Make this tighter.\n w = np.where(np.ravel(labels) > 0)\n grid = np.indices((img_dim[0], img_dim[1]))\n pixel_list = np.ravel((grid[0] * img_dim[1] + grid[1]))[w]\n\n # discard the zeros\n label_mask = labels[labels > 0]\n\n return label_mask, pixel_list", "metadata": "root.extract_label_indices", "header": "['module', '___EOS___']", "index": 474 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "extract", "\\u", "label", "\\u", "indices_", "(_", "labels_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "will", " ", "find", " ", "the", " ", "label", "'", "s", " ", "require", "d", " ", "region", " ", "of", " ", "interest", "s", " ", "(", "roi", "'", "s", "),", "\\", "10", ";", " ", " ", " ", " ", "number", " ", "of", " ", "roi", "'", "s", " ", "count", " ", "the", " ", "number", " ", "of", " ", "pixel", "s", " ", "in", " ", "each", " ", "roi", "'", "s", " ", "and", " ", "pixel", "s", "\\", "10", ";", " ", " ", " ", " ", "list", " ", "for", " ", "the", " ", "require", "d", " ", "roi", "'", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "labels", " ", ":", " ", "array", "\\", "10", ";", " ", " ", " ", " ", "label", "ed", " ", "array", ";", " ", "0", " ", "is", " ", "background", ".", "\\", "10", ";", " ", " ", " ", " ", "Ea", "ch", " ", "ROI", " ", "is", " ", "represent", "ed", " ", "by", " ", "a", " ", "distinct", " ", "label", " ", "(", "i", ".", "e", ".,", " ", "integ", "er", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "label", "\\u", "mask", " ", ":", " ", "array", "\\", "10", ";", " ", " ", " ", " ", "1", "D", " ", "array", " ", "labeling", " ", "each", " ", "fore", "ground", " ", "pixel", "\\", "10", ";", " ", " ", " ", " ", "e", ".", "g", ".,", " ", "[", "1", ",", " ", "1", ",", " ", "1", ",", " ", "1", ",", " ", "2", ",", " ", "2", ",", " ", "1", ",", " ", "1", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "indice", "s", " ", ":", " ", "array", "\\", "10", ";", " ", " ", " ", " ", "1", "D", " ", "array", " ", "of", " ", "indice", "s", " ", "int", "o", " ", "the", " ", "rave", "led", " ", "image", " ", "for", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "fore", "ground", " ", "pixel", "s", " ", "(", "label", "ed", " ", "nonzero", ")", "\\", "10", ";", " ", " ", " ", " ", "e", ".", "g", ".,", " ", "[", "5", ",", " ", "6", ",", " ", "7", ",", " ", "8", ",", " ", "14", ",", " ", "15", ",", " ", "21", ",", " ", "2", "2", "]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img", "\\u", "dim_", "=_", "labels_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "Make", " ", "this", " ", "tig", "hte", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "w_", "=_", "np_", "._", "where_", "(_", "np_", "._", "ravel_", "(_", "labels_", ")_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "grid_", "=_", "np_", "._", "indices_", "(_", "(_", "img", "\\u", "dim_", "[_", "0_", "]_", ",_", "img", "\\u", "dim_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pixel", "\\u", "list_", "=_", "np_", "._", "ravel_", "(_", "(_", "grid_", "[_", "0_", "]_", "*_", "img", "\\u", "dim_", "[_", "1_", "]_", "+_", "grid_", "[_", "1_", "]_", ")_", ")_", "[_", "w_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "discard", " ", "the", " ", "zeros_", "\\u\\u\\uNL\\u\\u\\u_", "label", "\\u", "mask_", "=_", "labels_", "[_", "labels_", ">_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "label", "\\u", "mask_", ",_", "pixel", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
allegro/ralph/src/ralph/data_center/models/virtual.py
[ { "content": "class BaseObjectCluster(models.Model):\n cluster = models.ForeignKey(Cluster)\n base_object = BaseObjectForeignKey(\n BaseObject,\n related_name='clusters',\n limit_models=[\n 'data_center.Database',\n 'data_center.DataCenterAsset',\n 'virtual.CloudHost',\n 'virtual.VirtualServer'\n ]\n )\n is_master = models.BooleanField(default=False)\n\n class Meta:\n unique_together = ('cluster', 'base_object')", "metadata": "root.BaseObjectCluster", "header": "['module', '___EOS___']", "index": 42 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Base", "Object", "Cluster_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cluster_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "Cluster_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "\\u", "object_", "=_", "Base", "Object", "Fore", "ign", "Key_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Base", "Object_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "relate", "d\\u", "name_", "=_", "'", "cluster", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit", "\\u", "models_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data\\u", "center", ".", "Databa", "se", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data\\u", "center", ".", "Data", "Center", "Asset", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "virtual", ".", "Cloud", "Host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "virtual", ".", "Virt", "ual", "Server", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "master_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "default_", "=_", "False_", ")_", "\\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_", "=_", "(_", "'", "cluster", "'_", ",_", "'", "base", "\\u", "object", "'_", ")_" ]
[ 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 ]
Unused import
glue-viz/glue/glue/tests/test_qglue.py
[ { "content": "from __future__ import absolute_import, division, print_function\n\nimport pytest\nimport numpy as np\nimport pandas as pd\nfrom mock import MagicMock\n\nfrom .. import qglue\nfrom ..core import Data\nfrom ..core.exceptions import IncompatibleAttribute\nfrom ..core.registry import Registry\nfrom .helpers import requires_astropy, requires_qt\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@requires_qt\n@requires_astropy\nclass TestQGlue(object):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestQGlue", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def setup_method(self, method):\n\n from glue.app.qt import GlueApplication\n\n from astropy.table import Table\n from astropy.io.fits import HDUList, ImageHDU\n\n Registry().clear()\n\n x = [1, 2, 3]\n y = [2, 3, 4]\n\n u = [10, 20, 30, 40]\n v = [20, 40, 60, 80]\n\n self.xy = {'x': x, 'y': y}\n self.dict_data = {'u': u, 'v': v}\n self.recarray_data = np.rec.array([(0, 1), (2, 3)],\n dtype=[(str('a'), int), (str('b'), int)])\n self.astropy_table = Table({'x': x, 'y': y})\n self.bad_data = {'x': x, 'u': u}\n self.hdulist = HDUList([ImageHDU(x, name='PRIMARY')])\n\n self.x = np.array(x)\n self.y = np.array(y)\n self.u = np.array(u)\n self.v = np.array(v)\n self._start = GlueApplication.start\n GlueApplication.start = MagicMock()", "metadata": "root.TestQGlue.setup_method", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 18 }, { "content": " def teardown_method(self, method):\n from glue.app.qt import GlueApplication\n GlueApplication.start = self._start", "metadata": "root.TestQGlue.teardown_method", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 48 }, { "content": " def check_setup(self, dc, expected):\n # assert that the assembled data collection returned\n # form qglue matches expected structure\n\n # test for expected data, components\n for data in dc:\n components = set(c.label for c in data.components)\n e = expected.pop(data.label)\n for component in e:\n assert component in components\n assert len(expected) == 0", "metadata": "root.TestQGlue.check_setup", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 52 }, { "content": " def test_qglue_starts_application(self):\n pandas_data = pd.DataFrame(self.xy)\n\n app = qglue(data1=pandas_data)\n app.start.assert_called_once_with()", "metadata": "root.TestQGlue.test_qglue_starts_application", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 64 }, { "content": " def test_single_pandas(self):\n dc = qglue(data1=self.xy).data_collection\n self.check_setup(dc, {'data1': ['x', 'y']})", "metadata": "root.TestQGlue.test_single_pandas", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 70 }, { "content": " def test_single_pandas_nonstring_column(self):\n dc = qglue(data1=pd.DataFrame({1: [1, 2, 3]})).data_collection\n self.check_setup(dc, {'data1': ['1']})", "metadata": "root.TestQGlue.test_single_pandas_nonstring_column", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 74 }, { "content": " def test_single_numpy(self):\n dc = qglue(data1=np.array([1, 2, 3])).data_collection\n self.check_setup(dc, {'data1': ['data1']})", "metadata": "root.TestQGlue.test_single_numpy", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 78 }, { "content": " def test_single_list(self):\n dc = qglue(data1=[1, 2, 3]).data_collection\n self.check_setup(dc, {'data1': ['data1']})", "metadata": "root.TestQGlue.test_single_list", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 82 }, { "content": " def test_single_dict(self):\n dc = qglue(data2=self.dict_data).data_collection\n self.check_setup(dc, {'data2': ['u', 'v']})", "metadata": "root.TestQGlue.test_single_dict", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 86 }, { "content": " def test_recarray(self):\n dc = qglue(data3=self.recarray_data).data_collection\n self.check_setup(dc, {'data3': ['a', 'b']})", "metadata": "root.TestQGlue.test_recarray", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 90 }, { "content": " def test_astropy_table(self):\n dc = qglue(data4=self.astropy_table).data_collection\n self.check_setup(dc, {'data4': ['x', 'y']})", "metadata": "root.TestQGlue.test_astropy_table", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 94 }, { "content": " def test_multi_data(self):\n dc = qglue(data1=self.dict_data, data2=self.xy).data_collection\n self.check_setup(dc, {'data1': ['u', 'v'],\n 'data2': ['x', 'y']})", "metadata": "root.TestQGlue.test_multi_data", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 98 }, { "content": " def test_hdulist(self):\n dc = qglue(data1=self.hdulist).data_collection\n self.check_setup(dc, {'data1[PRIMARY]': ['PRIMARY']})", "metadata": "root.TestQGlue.test_hdulist", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 103 }, { "content": " def test_glue_data(self):\n d = Data(x=[1, 2, 3])\n dc = qglue(x=d).data_collection\n assert d.label == 'x'", "metadata": "root.TestQGlue.test_glue_data", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 107 }, { "content": " def test_simple_link(self):\n using = lambda x: x * 2\n links = [['data1.x', 'data2.u', using]]\n dc = qglue(data1=self.xy, data2=self.dict_data,\n links=links).data_collection\n\n links = [[['x'], 'u', using]]\n self.check_setup(dc, {'data1': ['x', 'y'],\n 'data2': ['u', 'v']})\n\n d = dc[0] if dc[0].label == 'data1' else dc[1]\n np.testing.assert_array_equal(d['x'], self.x)\n np.testing.assert_array_equal(d['u'], self.x * 2)\n d = dc[0] if dc[0].label == 'data2' else dc[1]\n with pytest.raises(IncompatibleAttribute) as exc:\n d['x']", "metadata": "root.TestQGlue.test_simple_link", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 112 }, { "content": " def test_multi_link(self):\n forwards = lambda *args: (args[0] * 2, args[1] * 3)\n backwards = lambda *args: (args[0] / 2, args[1] / 3)\n\n links = [[['Data1.x', 'Data1.y'],\n ['Data2.u', 'Data2.v'], forwards, backwards]]\n dc = qglue(Data1=self.xy, Data2=self.dict_data,\n links=links).data_collection\n\n self.check_setup(dc, {'Data1': ['x', 'y'],\n 'Data2': ['u', 'v']})\n\n for d in dc:\n if d.label == 'Data1':\n np.testing.assert_array_equal(d['x'], self.x)\n np.testing.assert_array_equal(d['y'], self.y)\n np.testing.assert_array_equal(d['u'], self.x * 2)\n np.testing.assert_array_equal(d['v'], self.y * 3)\n else:\n np.testing.assert_array_equal(d['x'], self.u / 2)\n np.testing.assert_array_equal(d['y'], self.v / 3)\n np.testing.assert_array_equal(d['u'], self.u)\n np.testing.assert_array_equal(d['v'], self.v)", "metadata": "root.TestQGlue.test_multi_link", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 129 }, { "content": " def test_implicit_identity_link(self):\n links = [('Data1.x', 'Data2.v'),\n ('Data1.y', 'Data2.u')]\n dc = qglue(Data1=self.xy, Data2=self.dict_data,\n links=links).data_collection\n # currently, identity links rename the second link to first,\n # so u/v disappear\n for d in dc:\n if d.label == 'Data1':\n np.testing.assert_array_equal(d['x'], self.x)\n np.testing.assert_array_equal(d['y'], self.y)\n else:\n np.testing.assert_array_equal(d['y'], self.u)\n np.testing.assert_array_equal(d['x'], self.v)", "metadata": "root.TestQGlue.test_implicit_identity_link", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 153 }, { "content": " def test_bad_link(self):\n forwards = lambda *args: args\n links = [(['Data1.a'], ['Data2.b'], forwards)]\n with pytest.raises(ValueError) as exc:\n dc = qglue(Data1=self.xy, Data2=self.dict_data,\n links=links).data_collection\n assert exc.value.args[0] == \"Invalid link (no component named Data1.a)\"", "metadata": "root.TestQGlue.test_bad_link", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 168 }, { "content": " def test_bad_data_shape(self):\n with pytest.raises(ValueError) as exc:\n dc = qglue(d=self.bad_data).data_collection\n assert exc.value.args[0].startswith(\"Invalid format for data 'd'\")", "metadata": "root.TestQGlue.test_bad_data_shape", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 176 }, { "content": " def test_bad_data_format(self):\n with pytest.raises(TypeError) as exc:\n dc = qglue(d=5).data_collection\n assert exc.value.args[0].startswith(\"Invalid data description\")", "metadata": "root.TestQGlue.test_bad_data_format", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 181 }, { "content": " def test_malformed_data_dict(self):\n with pytest.raises(ValueError) as exc:\n dc = qglue(d={'x': 'bad'}).data_collection\n assert exc.value.args[0].startswith(\"Invalid format for data 'd'\")", "metadata": "root.TestQGlue.test_malformed_data_dict", "header": "['class', 'TestQGlue', '(', 'object', ')', ':', '___EOS___']", "index": 186 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "division_", ",_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pandas_", "as_", "pd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mock_", "import_", "Mag", "ic", "Mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "._", "import_", "qg", "lue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "core_", "import_", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "core_", "._", "exceptions_", "import_", "Incomp", "atible", "Attribute_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "core_", "._", "registry_", "import_", "Registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "helpers_", "import_", "require", "s", "\\u", "astropy_", ",_", "require", "s", "\\u", "qt_", "\\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_", "@_", "require", "s", "\\u", "qt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "s", "\\u", "astropy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Test", "QG", "lue_", "(_", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "setup", "\\u", "method_", "(_", "self_", ",_", "method_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "glue", "_", "._", "app_", "._", "qt_", "import_", "Glu", "e", "Application_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "astropy_", "._", "table_", "import_", "Table_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "astropy_", "._", "io_", "._", "fits_", "import_", "HDU", "List_", ",_", "Image", "HDU", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Registry_", "(_", ")_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "[_", "2_", ",_", "3_", ",_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "u_", "=_", "[_", "10_", ",_", "20_", ",_", "30_", ",_", "40_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "[_", "20_", ",_", "40_", ",_", "60_", ",_", "80_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "xy_", "=_", "{_", "'", "x", "'_", ":_", "x_", ",_", "'", "y", "'_", ":_", "y_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dict", "\\u", "data_", "=_", "{_", "'", "u", "'_", ":_", "u_", ",_", "'", "v", "'_", ":_", "v_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reca", "rray", "\\u", "data_", "=_", "np_", "._", "rec_", "._", "array_", "(_", "[_", "(_", "0_", ",_", "1_", ")_", ",_", "(_", "2_", ",_", "3_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "[_", "(_", "str_", "(_", "'", "a", "'_", ")_", ",_", "int_", ")_", ",_", "(_", "str_", "(_", "'", "b", "'_", ")_", ",_", "int_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "astro", "py", "\\u", "table_", "=_", "Table_", "(_", "{_", "'", "x", "'_", ":_", "x_", ",_", "'", "y", "'_", ":_", "y_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bad", "\\u", "data_", "=_", "{_", "'", "x", "'_", ":_", "x_", ",_", "'", "u", "'_", ":_", "u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hdulist_", "=_", "HDU", "List_", "(_", "[_", "Image", "HDU", "_", "(_", "x_", ",_", "name_", "=_", "'", "PRIMA", "RY", "'_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "x_", "=_", "np_", "._", "array_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "y_", "=_", "np_", "._", "array_", "(_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "u_", "=_", "np_", "._", "array_", "(_", "u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "v_", "=_", "np_", "._", "array_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "start_", "=_", "Glu", "e", "Application_", "._", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Glu", "e", "Application_", "._", "start_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "down", "\\u", "method_", "(_", "self_", ",_", "method_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "glue", "_", "._", "app_", "._", "qt_", "import_", "Glu", "e", "Application_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Glu", "e", "Application_", "._", "start_", "=_", "self_", "._", "\\u", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "setup_", "(_", "self_", ",_", "dc_", ",_", "expected_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "assert", " ", "tha", "t", " ", "the", " ", "assemble", "d", " ", "data", " ", "collection", " ", "returned_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "form", " ", "qg", "lue", " ", "matche", "s", " ", "expected", " ", "structure_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "for", " ", "expected", " ", "data", ",", " ", "components_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "data_", "in_", "dc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "components_", "=_", "set_", "(_", "c_", "._", "label_", "for_", "c_", "in_", "data_", "._", "components_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "expected_", "._", "pop_", "(_", "data_", "._", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "component_", "in_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "component_", "in_", "components_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "len_", "(_", "expected_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "qg", "lue", "\\u", "starts", "\\u", "application_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "panda", "s", "\\u", "data_", "=_", "pd_", "._", "Data", "Frame_", "(_", "self_", "._", "xy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "=_", "qg", "lue_", "(_", "data1_", "=_", "panda", "s", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "start_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "single", "\\u", "pandas_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dc_", "=_", "qg", "lue_", "(_", "data1_", "=_", "self_", "._", "xy_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "setup_", "(_", "dc_", ",_", "{_", "'", "data", "1", "'_", ":_", "[_", "'", "x", "'_", ",_", "'", "y", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "single", "\\u", "panda", "s", "\\u", "nons", "tring", "\\u", "column_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dc_", "=_", "qg", "lue_", "(_", "data1_", "=_", "pd_", "._", "Data", "Frame_", "(_", "{_", "1_", ":_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", "}_", ")_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "setup_", "(_", "dc_", ",_", "{_", "'", "data", "1", "'_", ":_", "[_", "'", "1", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "single", "\\u", "numpy_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dc_", "=_", "qg", "lue_", "(_", "data1_", "=_", "np_", "._", "array_", "(_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "setup_", "(_", "dc_", ",_", "{_", "'", "data", "1", "'_", ":_", "[_", "'", "data", "1", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "single", "\\u", "list_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dc_", "=_", "qg", "lue_", "(_", "data1_", "=_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "setup_", "(_", "dc_", ",_", "{_", "'", "data", "1", "'_", ":_", "[_", "'", "data", "1", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "single", "\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dc_", "=_", "qg", "lue_", "(_", "data2_", "=_", "self_", "._", "dict", "\\u", "data_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "setup_", "(_", "dc_", ",_", "{_", "'", "data", "2", "'_", ":_", "[_", "'", "u", "'_", ",_", "'", "v", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "reca", "rray_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dc_", "=_", "qg", "lue_", "(_", "data", "3_", "=_", "self_", "._", "reca", "rray", "\\u", "data_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "setup_", "(_", "dc_", ",_", "{_", "'", "data", "3", "'_", ":_", "[_", "'", "a", "'_", ",_", "'", "b", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "astro", "py", "\\u", "table_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dc_", "=_", "qg", "lue_", "(_", "data", "4_", "=_", "self_", "._", "astro", "py", "\\u", "table_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "setup_", "(_", "dc_", ",_", "{_", "'", "data", "4", "'_", ":_", "[_", "'", "x", "'_", ",_", "'", "y", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "multi", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dc_", "=_", "qg", "lue_", "(_", "data1_", "=_", "self_", "._", "dict", "\\u", "data_", ",_", "data2_", "=_", "self_", "._", "xy_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "setup_", "(_", "dc_", ",_", "{_", "'", "data", "1", "'_", ":_", "[_", "'", "u", "'_", ",_", "'", "v", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "2", "'_", ":_", "[_", "'", "x", "'_", ",_", "'", "y", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "hdulist_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dc_", "=_", "qg", "lue_", "(_", "data1_", "=_", "self_", "._", "hdulist_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "setup_", "(_", "dc_", ",_", "{_", "'", "data", "1", "[", "PRIMA", "RY", "]'_", ":_", "[_", "'", "PRIMA", "RY", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "glue", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Data_", "(_", "x_", "=_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dc_", "=_", "qg", "lue_", "(_", "x_", "=_", "d_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "label_", "==_", "'", "x", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "simple", "\\u", "link_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "using_", "=_", "lambda_", "x_", ":_", "x_", "*_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "links_", "=_", "[_", "[_", "'", "data", "1", ".", "x", "'_", ",_", "'", "data", "2", ".", "u", "'_", ",_", "using_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dc_", "=_", "qg", "lue_", "(_", "data1_", "=_", "self_", "._", "xy_", ",_", "data2_", "=_", "self_", "._", "dict", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "links_", "=_", "links_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "links_", "=_", "[_", "[_", "[_", "'", "x", "'_", "]_", ",_", "'", "u", "'_", ",_", "using_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "\\u", "setup_", "(_", "dc_", ",_", "{_", "'", "data", "1", "'_", ":_", "[_", "'", "x", "'_", ",_", "'", "y", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "2", "'_", ":_", "[_", "'", "u", "'_", ",_", "'", "v", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "dc_", "[_", "0_", "]_", "if_", "dc_", "[_", "0_", "]_", "._", "label_", "==_", "'", "data", "1", "'_", "else_", "dc_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "d_", "[_", "'", "x", "'_", "]_", ",_", "self_", "._", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "d_", "[_", "'", "u", "'_", "]_", ",_", "self_", "._", "x_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "dc_", "[_", "0_", "]_", "if_", "dc_", "[_", "0_", "]_", "._", "label_", "==_", "'", "data", "2", "'_", "else_", "dc_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Incomp", "atible", "Attribute_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "[_", "'", "x", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "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_", "test\\u", "multi", "\\u", "link_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "forwards_", "=_", "lambda_", "*_", "args_", ":_", "(_", "args_", "[_", "0_", "]_", "*_", "2_", ",_", "args_", "[_", "1_", "]_", "*_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "backwards_", "=_", "lambda_", "*_", "args_", ":_", "(_", "args_", "[_", "0_", "]_", "/_", "2_", ",_", "args_", "[_", "1_", "]_", "/_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "links_", "=_", "[_", "[_", "[_", "'", "Data", "1", ".", "x", "'_", ",_", "'", "Data", "1", ".", "y", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "Data", "2", ".", "u", "'_", ",_", "'", "Data", "2", ".", "v", "'_", "]_", ",_", "forwards_", ",_", "backwards_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dc_", "=_", "qg", "lue_", "(_", "Data", "1_", "=_", "self_", "._", "xy_", ",_", "Data", "2_", "=_", "self_", "._", "dict", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "links_", "=_", "links_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "check", "\\u", "setup_", "(_", "dc_", ",_", "{_", "'", "Data", "1", "'_", ":_", "[_", "'", "x", "'_", ",_", "'", "y", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Data", "2", "'_", ":_", "[_", "'", "u", "'_", ",_", "'", "v", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "d_", "in_", "dc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "d_", "._", "label_", "==_", "'", "Data", "1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "d_", "[_", "'", "x", "'_", "]_", ",_", "self_", "._", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "d_", "[_", "'", "y", "'_", "]_", ",_", "self_", "._", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "d_", "[_", "'", "u", "'_", "]_", ",_", "self_", "._", "x_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "d_", "[_", "'", "v", "'_", "]_", ",_", "self_", "._", "y_", "*_", "3_", ")_", "\\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 ", " _", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "d_", "[_", "'", "x", "'_", "]_", ",_", "self_", "._", "u_", "/_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "d_", "[_", "'", "y", "'_", "]_", ",_", "self_", "._", "v_", "/_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "d_", "[_", "'", "u", "'_", "]_", ",_", "self_", "._", "u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "d_", "[_", "'", "v", "'_", "]_", ",_", "self_", "._", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "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", "implicit", "\\u", "identi", "ty", "\\u", "link_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "links_", "=_", "[_", "(_", "'", "Data", "1", ".", "x", "'_", ",_", "'", "Data", "2", ".", "v", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Data", "1", ".", "y", "'_", ",_", "'", "Data", "2", ".", "u", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dc_", "=_", "qg", "lue_", "(_", "Data", "1_", "=_", "self_", "._", "xy_", ",_", "Data", "2_", "=_", "self_", "._", "dict", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "links_", "=_", "links_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "currentl", "y", ",", " ", "identi", "ty", " ", "link", "s", " ", "rename", " ", "the", " ", "second", " ", "link", " ", "to", " ", "first", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "u", "/", "v", " ", "disapp", "ear_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "d_", "in_", "dc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "d_", "._", "label_", "==_", "'", "Data", "1", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "d_", "[_", "'", "x", "'_", "]_", ",_", "self_", "._", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "d_", "[_", "'", "y", "'_", "]_", ",_", "self_", "._", "y_", ")_", "\\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 ", " _", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "d_", "[_", "'", "y", "'_", "]_", ",_", "self_", "._", "u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "testing_", "._", "assert", "\\u", "array", "\\u", "equal_", "(_", "d_", "[_", "'", "x", "'_", "]_", ",_", "self_", "._", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "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", "bad", "\\u", "link_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "forwards_", "=_", "lambda_", "*_", "args_", ":_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "links_", "=_", "[_", "(_", "[_", "'", "Data", "1", ".", "a", "'_", "]_", ",_", "[_", "'", "Data", "2", ".", "b", "'_", "]_", ",_", "forwards_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dc_", "=_", "qg", "lue_", "(_", "Data", "1_", "=_", "self_", "._", "xy_", ",_", "Data", "2_", "=_", "self_", "._", "dict", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "links_", "=_", "links_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "exc_", "._", "value_", "._", "args_", "[_", "0_", "]_", "==_", "\"", "Inva", "lid", " ", "link", " ", "(", "no", " ", "component", " ", "named", " ", "Data", "1", ".", "a", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bad", "\\u", "data\\u", "shape_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dc_", "=_", "qg", "lue_", "(_", "d_", "=_", "self_", "._", "bad", "\\u", "data_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "exc_", "._", "value_", "._", "args_", "[_", "0_", "]_", "._", "startswith_", "(_", "\"", "Inva", "lid", " ", "format", " ", "for", " ", "data", " ", "'", "d", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bad", "\\u", "data\\u", "format_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "pytest_", "._", "raises_", "(_", "Type", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dc_", "=_", "qg", "lue_", "(_", "d_", "=_", "5_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "exc_", "._", "value_", "._", "args_", "[_", "0_", "]_", "._", "startswith_", "(_", "\"", "Inva", "lid", " ", "data", " ", "description", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "QG", "lue_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mal", "formed", "\\u", "data\\u", "dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "pytest_", "._", "raises_", "(_", "Value", "Error_", ")_", "as_", "exc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dc_", "=_", "qg", "lue_", "(_", "d_", "=_", "{_", "'", "x", "'_", ":_", "'", "bad", "'_", "}_", ")_", "._", "data\\u", "collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "exc_", "._", "value_", "._", "args_", "[_", "0_", "]_", "._", "startswith_", "(_", "\"", "Inva", "lid", " ", "format", " ", "for", " ", "data", " ", "'", "d", "'\"_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 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 ]
An assert statement has a side-effect
eBay/bayesian-belief-networks/bayesian/test/test_gaussian.py
[ { "content": " def test_conditional_to_joint_4(self):\n # Now add Node C\n mu_x = MeansVector([\n [3],\n [4]])\n sigma_x = CovarianceMatrix([\n [4, 4],\n [4, 5]])\n beta_0 = 3\n beta = MeansVector([\n [2], # c->a\n [0], # c-> Not connected so 0\n ])\n sigma_c = 4 # variance(C) == variance(CA)\n # now mu and sigma will get the joint parameters for A,B\n mu, sigma = conditional_to_joint(\n mu_x, sigma_x, beta_0, beta, sigma_c)\n assert mu == MeansVector([\n [3],\n [4],\n [9]])\n assert sigma == CovarianceMatrix([\n [4, 4, 8],\n [4, 5, 8],\n [8, 8, 20]])", "metadata": "root.TestGaussian.test_conditional_to_joint_4", "header": "['class', 'TestGaussian', '(', ')', ':', '___EOS___']", "index": 198 } ]
[]
[]
0
true
[ "[CLS]_", "An", "_", "assert_", "statement_", "has_", "a_", "side_", "-_", "effect_", "[SEP]_", "class_", "Test", "Gaussian", "_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "conditional", "\\u", "to", "\\u", "joint", "\\u", "4_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "add", " ", "Node", " ", "C_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu", "\\u", "x_", "=_", "Means", "Vector_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "3_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "4_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sigma", "\\u", "x_", "=_", "Covar", "iance", "Matrix_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "4_", ",_", "4_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "4_", ",_", "5_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta", "\\u", "0_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "=_", "Means", "Vector_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "2_", "]_", ",_", "#", " ", "c", "->", "a_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "0_", "]_", ",_", "#", " ", "c", "->", " ", "Not", " ", "connect", "ed", " ", "so", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sigma", "\\u", "c_", "=_", "4_", "#", " ", "varian", "ce", "(", "C", ")", " ", "==", " ", "varian", "ce", "(", "CA", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "now", " ", "mu", " ", "and", " ", "sigma", " ", "will", " ", "get", " ", "the", " ", "joint", " ", "parameter", "s", " ", "for", " ", "A", ",", "B_", "\\u\\u\\uNL\\u\\u\\u_", "mu_", ",_", "sigma_", "=_", "conditional", "\\u", "to", "\\u", "joint_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mu", "\\u", "x_", ",_", "sigma", "\\u", "x_", ",_", "beta", "\\u", "0_", ",_", "beta_", ",_", "sigma", "\\u", "c_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "mu_", "==_", "Means", "Vector_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "3_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "4_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "9_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "sigma_", "==_", "Covar", "iance", "Matrix_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "4_", ",_", "4_", ",_", "8_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "4_", ",_", "5_", ",_", "8_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "8_", ",_", "8_", ",_", "20_", "]_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
scikit-learn/scikit-learn/sklearn/linear_model/tests/test_passive_aggressive.py
[ { "content": "def test_classifier_accuracy():\n for data in (X, X_csr):\n for fit_intercept in (True, False):\n clf = PassiveAggressiveClassifier(C=1.0, n_iter=30,\n fit_intercept=fit_intercept,\n random_state=0)\n clf.fit(data, y)\n score = clf.score(data, y)\n assert_greater(score, 0.79)", "metadata": "root.test_classifier_accuracy", "header": "['module', '___EOS___']", "index": 68 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "classif", "ier", "\\u", "accuracy_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "data_", "in_", "(_", "X_", ",_", "X", "\\u", "csr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "fit", "\\u", "intercept_", "in_", "(_", "True_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clf_", "=_", "Passi", "ve", "Agg", "ressi", "ve", "Classifier_", "(_", "C_", "=_", "1.0_", ",_", "n", "\\u", "iter_", "=_", "30_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fit", "\\u", "intercept_", "=_", "fit", "\\u", "intercept_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "random", "\\u", "state_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clf_", "._", "fit_", "(_", "data_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "score_", "=_", "clf_", "._", "score_", "(_", "data_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "greater_", "(_", "score_", ",_", "0.79", "_", ")_", "\\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 ]
Unused import
valhallasw/flask-mwoauth/flask_mwoauth/__init__.py
[ { "content": "#!/usr/bin/env python\n# MediaWiki OAuth connector for Flask\n#\n# Requires flask-oauthlib\n#\n# (C) 2013 Merlijn van Deen <valhallasw@arctus.nl>\n# Licensed under the MIT License // http://opensource.org/licenses/MIT\n#\n\n__version__ = '0.2.46'\n\nimport sys\nfrom future.utils import iteritems\nfrom future.moves.urllib.parse import urlencode\nfrom flask import request, session, redirect, url_for, flash, Blueprint\nfrom flask_oauthlib.client import OAuth, OAuthException\nfrom requests.models import Request\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MWOAuth(object):\n\n\n", "metadata": "root.MWOAuth", "header": "['module', '___EOS___']", "index": 19 }, { "content": " def __init__(self,\n base_url='https://www.mediawiki.org/w',\n clean_url='https://www.mediawiki.org/wiki',\n default_return_to='index',\n consumer_key=None, consumer_secret=None, name='mw.org'):\n if not consumer_key or not consumer_secret:\n raise Exception('MWOAuthBlueprintFactory needs consumer key and secret')\n self.base_url = base_url\n\n self.default_return_to = default_return_to\n\n self.oauth = OAuth()\n request_url_params = {'title': 'Special:OAuth/initiate',\n 'oauth_callback': 'oob'}\n access_token_params = {'title': 'Special:OAuth/token'}\n self.mwoauth = self.oauth.remote_app(\n name,\n base_url=base_url + \"/index.php\",\n request_token_url=base_url + \"/index.php?\" +\n urlencode(request_url_params),\n request_token_params=None,\n access_token_url=base_url + \"/index.php?\" +\n urlencode(access_token_params),\n authorize_url=clean_url + '/Special:OAuth/authorize',\n consumer_key=consumer_key,\n consumer_secret=consumer_secret,\n )\n\n @self.mwoauth.tokengetter\n def get_mwo_token(token=None):\n return session.get('mwo_token')\n\n self.bp = Blueprint('mwoauth', __name__)\n\n @self.bp.route('/logout')\n def logout():\n session['mwo_token'] = None\n session['username'] = None\n if 'next' in request.args:\n return redirect(request.args['next'])\n return \"Logged out!\"\n\n @self.bp.route('/login')\n def login():\n uri_params = {'oauth_consumer_key': self.mwoauth.consumer_key}\n redirector = self.mwoauth.authorize(**uri_params)\n\n if 'next' in request.args:\n oauth_token = session[self.mwoauth.name + '_oauthtok'][0]\n session[oauth_token + '_target'] = request.args['next']\n\n return redirector\n\n @self.bp.route('/oauth-callback')\n def oauth_authorized():\n resp = self.mwoauth.authorized_response()\n next_url_key = request.args['oauth_token'] + '_target'\n default_url = url_for(self.default_return_to)\n\n next_url = session.pop(next_url_key, default_url)\n\n if resp is None:\n flash(u'You denied the request to sign in.')\n return redirect(next_url)\n session['mwo_token'] = (\n resp['oauth_token'],\n resp['oauth_token_secret']\n )\n\n username = self.get_current_user(False)\n flash('You were signed in, %s!' % username)\n\n return redirect(next_url)", "metadata": "root.MWOAuth.__init__", "header": "['class', 'MWOAuth', '(', 'object', ')', ':', '___EOS___']", "index": 20 }, { "content": " @staticmethod\n def _prepare_long_request(url, api_query):\n \"\"\" Use requests.Request and requests.PreparedRequest to produce the\n body (and boundary value) of a multipart/form-data; POST request as\n detailed in https://www.mediawiki.org/wiki/API:Edit#Large_texts\n \"\"\"\n\n partlist = []\n for k, v in iteritems(api_query):\n if k in ('title', 'text', 'summary'):\n # title, text and summary values in the request\n # should be utf-8 encoded\n\n part = (k,\n (None, v.encode('utf-8'),\n 'text/plain; charset=UTF-8',\n {'Content-Transfer-Encoding': '8bit'}\n )\n )\n else:\n part = (k, (None, v))\n partlist.append(part)\n\n return Request(url=url, files=partlist).prepare()", "metadata": "root.MWOAuth._prepare_long_request", "header": "['class', 'MWOAuth', '(', 'object', ')', ':', '___EOS___']", "index": 94 }, { "content": " def request(self, api_query, url=None):\n \"\"\" e.g. {'action': 'query', 'meta': 'userinfo'}. format=json not required\n function returns a python dict that resembles the api's json response\n \"\"\"\n api_query['format'] = 'json'\n url = url or self.base_url\n\n size = sum([sys.getsizeof(v) for k, v in iteritems(api_query)])\n\n if size > (1024 * 8):\n # if request is bigger than 8 kB (the limit is somewhat arbitrary,\n # see https://www.mediawiki.org/wiki/API:Edit#Large_texts) then\n # transmit as multipart message\n\n req = self._prepare_long_request(url=url + \"/api.php?\",\n api_query=api_query\n )\n return self.mwoauth.post(url + \"/api.php?\",\n data=req.body,\n content_type=req.headers['Content-Type']\n ).data\n else:\n return self.mwoauth.post(url + \"/api.php?\" + urlencode(api_query),\n content_type=\"text/plain\").data", "metadata": "root.MWOAuth.request", "header": "['class', 'MWOAuth', '(', 'object', ')', ':', '___EOS___']", "index": 119 }, { "content": " def get_current_user(self, cached=True):\n if cached:\n return session.get('username')\n\n try:\n data = self.request({'action': 'query', 'meta': 'userinfo'})\n session['username'] = data['query']['userinfo']['name']\n except KeyError:\n session['username'] = None\n if data['error']['code'] == \"mwoauth-invalid-authorization\":\n flash(u'Access to this application was revoked. Please re-login!')\n else:\n raise\n except OAuthException:\n session['username'] = None\n return session['username']", "metadata": "root.MWOAuth.get_current_user", "header": "['class', 'MWOAuth', '(', 'object', ')', ':', '___EOS___']", "index": 144 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Media", "Wiki", " ", "OA", "uth", " ", "connect", "or", " ", "for", " ", "Flask_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Requ", "ires", " ", "fla", "sk", "-", "oauth", "lib_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "C", ")", " ", "2013", " ", "Mer", "li", "jn", " ", "van", " ", "De", "en", " ", "<", "val", "hall", "as", "w", "@", "arc", "tus", ".", "nl", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "MIT", " ", "License", " ", "//", " ", "http", "://", "opens", "ource", ".", "org", "/", "license", "s", "/", "MIT", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'", "0.", "2.4", "6", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "future_", "._", "utils_", "import_", "iteritems_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "future_", "._", "moves_", "._", "urllib_", "._", "parse_", "import_", "urlencode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "request_", ",_", "session_", ",_", "redirect_", ",_", "url", "\\u", "for_", ",_", "flash_", ",_", "Blueprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "sk", "\\u", "oauth", "lib_", "._", "client_", "import_", "OA", "uth_", ",_", "OA", "uth", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "requests_", "._", "models_", "import_", "Request_", "\\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_", "MW", "OA", "uth_", "(_", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "MW", "OA", "uth_", "(_", "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\\uNL\\u\\u\\u_", "base", "\\u", "url_", "=_", "'", "https", "://", "www", ".", "media", "wiki", ".", "org", "/", "w", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "clean", "\\u", "url_", "=_", "'", "https", "://", "www", ".", "media", "wiki", ".", "org", "/", "wiki", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "return", "\\u", "to_", "=_", "'", "index", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "consume", "r", "\\u", "key_", "=_", "None_", ",_", "consume", "r", "\\u", "secret_", "=_", "None_", ",_", "name_", "=_", "'", "mw", ".", "org", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "consume", "r", "\\u", "key_", "or_", "not_", "consume", "r", "\\u", "secret_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "MW", "OA", "uth", "Blue", "print", "Factor", "y", " ", "need", "s", " ", "consume", "r", " ", "key", " ", "and", " ", "secret", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "base", "\\u", "url_", "=_", "base", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "default", "\\u", "return", "\\u", "to_", "=_", "default", "\\u", "return", "\\u", "to_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "oauth_", "=_", "OA", "uth_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "\\u", "url", "\\u", "params_", "=_", "{_", "'", "title", "'_", ":_", "'", "Special", ":", "OA", "uth", "/", "initiate", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "oauth", "\\u", "callback", "'_", ":_", "'", "oob", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "access", "\\u", "token", "\\u", "params_", "=_", "{_", "'", "title", "'_", ":_", "'", "Special", ":", "OA", "uth", "/", "token", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mw", "oauth_", "=_", "self_", "._", "oauth_", "._", "remote", "\\u", "app_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base", "\\u", "url_", "=_", "base", "\\u", "url_", "+_", "\"/", "index", ".", "php", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "\\u", "token", "\\u", "url_", "=_", "base", "\\u", "url_", "+_", "\"/", "index", ".", "php", "?\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "urlencode_", "(_", "request", "\\u", "url", "\\u", "params_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "\\u", "token", "\\u", "params_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "access", "\\u", "token", "\\u", "url_", "=_", "base", "\\u", "url_", "+_", "\"/", "index", ".", "php", "?\"_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "urlencode_", "(_", "access", "\\u", "token", "\\u", "params_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "authoriz", "e\\u", "url_", "=_", "clean", "\\u", "url_", "+_", "'/", "Special", ":", "OA", "uth", "/", "authoriz", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "consume", "r", "\\u", "key_", "=_", "consume", "r", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "consume", "r", "\\u", "secret_", "=_", "consume", "r", "\\u", "secret_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "mw", "oauth_", "._", "token", "getter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "mw", "o", "\\u", "token_", "(_", "token_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "session_", "._", "get_", "(_", "'", "mw", "o", "\\u", "token", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "bp_", "=_", "Blueprint_", "(_", "'", "mw", "oauth", "'_", ",_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "self_", "._", "bp_", "._", "route_", "(_", "'/", "logo", "ut", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "logout_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", "[_", "'", "mw", "o", "\\u", "token", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "[_", "'", "user", "name", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "next", "'_", "in_", "request_", "._", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "redirect_", "(_", "request_", "._", "args_", "[_", "'", "next", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"", "Log", "ged", " ", "out", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "self_", "._", "bp_", "._", "route_", "(_", "'/", "login", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "login_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uri", "\\u", "params_", "=_", "{_", "'", "oauth", "\\u", "consume", "r", "\\u", "key", "'_", ":_", "self_", "._", "mw", "oauth_", "._", "consume", "r", "\\u", "key_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "redirec", "tor_", "=_", "self_", "._", "mw", "oauth_", "._", "authorize_", "(_", "**_", "uri", "\\u", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "next", "'_", "in_", "request_", "._", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "oauth", "\\u", "token_", "=_", "session_", "[_", "self_", "._", "mw", "oauth_", "._", "name_", "+_", "'\\u", "oauth", "tok", "'_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "[_", "oauth", "\\u", "token_", "+_", "'\\u", "target", "'_", "]_", "=_", "request_", "._", "args_", "[_", "'", "next", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "redirec", "tor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "self_", "._", "bp_", "._", "route_", "(_", "'/", "oauth", "-", "callback", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "oauth", "\\u", "authorized_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "self_", "._", "mw", "oauth_", "._", "authoriz", "ed", "\\u", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "url", "\\u", "key_", "=_", "request_", "._", "args_", "[_", "'", "oauth", "\\u", "token", "'_", "]_", "+_", "'\\u", "target", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "url_", "=_", "url", "\\u", "for_", "(_", "self_", "._", "default", "\\u", "return", "\\u", "to_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "next", "\\u", "url_", "=_", "session_", "._", "pop_", "(_", "next", "\\u", "url", "\\u", "key_", ",_", "default", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "resp_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flash_", "(_", "u", "'", "You", " ", "deni", "ed", " ", "the", " ", "request", " ", "to", " ", "sign", " ", "in", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "redirect_", "(_", "next", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "session_", "[_", "'", "mw", "o", "\\u", "token", "'_", "]_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "[_", "'", "oauth", "\\u", "token", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "[_", "'", "oauth", "\\u", "token", "\\u", "secret", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "username_", "=_", "self_", "._", "get", "\\u", "current", "\\u", "user_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flash_", "(_", "'", "You", " ", "wer", "e", " ", "sign", "ed", " ", "in", ",", " ", "%", "s", "!'_", "%_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "redirect_", "(_", "next", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MW", "OA", "uth_", "(_", "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_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "prepar", "e\\u", "long", "\\u", "request_", "(_", "url_", ",_", "api", "\\u", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Us", "e", " ", "request", "s", ".", "Request", " ", "and", " ", "request", "s", ".", "Prepare", "d", "Request", " ", "to", " ", "produce", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "body", " ", "(", "and", " ", "bound", "ary", " ", "value", ")", " ", "of", " ", "a", " ", "multip", "art", "/", "form", "-", "data", ";", " ", "POST", " ", "request", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "detailed", " ", "in", " ", "https", "://", "www", ".", "media", "wiki", ".", "org", "/", "wiki", "/", "API", ":", "Edit", "#", "Large", "\\u", "texts", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "part", "list_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "iteritems_", "(_", "api", "\\u", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "k_", "in_", "(_", "'", "title", "'_", ",_", "'", "text", "'_", ",_", "'", "summar", "y", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "title", ",", " ", " ", "text", " ", "and", " ", "summar", "y", " ", "values", " ", "in", " ", "the", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", " ", "be", " ", "utf", "-", "8", " ", "encoded_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "part_", "=_", "(_", "k_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "None_", ",_", "v_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "text", "/", "plain", ";", " ", "charset", "=", "UT", "F", "-", "8", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "Conten", "t", "-", "Transfer", "-", "Enco", "ding", "'_", ":_", "'", "8b", "it", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "part_", "=_", "(_", "k_", ",_", "(_", "None_", ",_", "v_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "part", "list_", "._", "append_", "(_", "part_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Request_", "(_", "url_", "=_", "url_", ",_", "files_", "=_", "part", "list_", ")_", "._", "prepare_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MW", "OA", "uth_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "request_", "(_", "self_", ",_", "api", "\\u", "query_", ",_", "url_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "e", ".", "g", ".", " ", "{", "'", "action", "':", " ", "'", "query", "',", " ", "'", "meta", "':", " ", "'", "userin", "fo", "'}", ".", " ", "format", "=", "json", " ", "not", " ", "require", "d", "\\", "10", ";", " ", " ", " ", " ", "function", " ", "return", "s", " ", "a", " ", "python", " ", "dict", " ", "tha", "t", " ", "rese", "mble", "s", " ", "the", " ", "api", "'", "s", " ", "json", " ", "response", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api", "\\u", "query_", "[_", "'", "format", "'_", "]_", "=_", "'", "json", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "url_", "or_", "self_", "._", "base", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "size_", "=_", "sum_", "(_", "[_", "sys_", "._", "gets", "ize", "of_", "(_", "v_", ")_", "for_", "k_", ",_", "v_", "in_", "iteritems_", "(_", "api", "\\u", "query_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "size_", ">_", "(_", "1024_", "*_", "8_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "request", " ", "is", " ", "bigger", " ", "than", " ", "8", " ", "k", "B", " ", "(", "the", " ", "limit", " ", "is", " ", "some", "what", " ", "arbitra", "ry", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "see", " ", "https", "://", "www", ".", "media", "wiki", ".", "org", "/", "wiki", "/", "API", ":", "Edit", "#", "Large", "\\u", "texts", ")", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "transmit", " ", "as", " ", "multip", "art", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "self_", "._", "\\u", "prepar", "e\\u", "long", "\\u", "request_", "(_", "url_", "=_", "url_", "+_", "\"/", "api", ".", "php", "?\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "api", "\\u", "query_", "=_", "api", "\\u", "query_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "mw", "oauth_", "._", "post_", "(_", "url_", "+_", "\"/", "api", ".", "php", "?\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "req_", "._", "body_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "req_", "._", "headers_", "[_", "'", "Conten", "t", "-", "Type", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "data_", "\\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_", "._", "mw", "oauth_", "._", "post_", "(_", "url_", "+_", "\"/", "api", ".", "php", "?\"_", "+_", "urlencode_", "(_", "api", "\\u", "query_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "type_", "=_", "\"", "text", "/", "plain", "\"_", ")_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "MW", "OA", "uth_", "(_", "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", "current", "\\u", "user_", "(_", "self_", ",_", "cached_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cached_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "session_", "._", "get_", "(_", "'", "user", "name", "'_", ")_", "\\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 ", " _", "data_", "=_", "self_", "._", "request_", "(_", "{_", "'", "action", "'_", ":_", "'", "query", "'_", ",_", "'", "meta", "'_", ":_", "'", "userin", "fo", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "[_", "'", "user", "name", "'_", "]_", "=_", "data_", "[_", "'", "query", "'_", "]_", "[_", "'", "userin", "fo", "'_", "]_", "[_", "'", "name", "'_", "]_", "\\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 ", " _", "session_", "[_", "'", "user", "name", "'_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "data_", "[_", "'", "error", "'_", "]_", "[_", "'", "code", "'_", "]_", "==_", "\"", "mw", "oauth", "-", "invalid", "-", "authoriz", "ation", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flash_", "(_", "u", "'", "Access", " ", "to", " ", "this", " ", "applica", "tion", " ", "was", " ", "revoked", ".", " ", "Ple", "ase", " ", "re", "-", "login", "!'_", ")_", "\\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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except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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, 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 ]
Unnecessary delete statement in function
lamby/django-dumpslow/django_dumpslow/management/commands/dumpslow.py
[ { "content": " def handle(self, **options):\n def check_option(name, val):\n try:\n val = int(val)\n if val < 0:\n raise ValueError()\n return val\n except ValueError:\n raise CommandError(\n 'Invalid value for %s %r' % (name, val)\n )\n except TypeError:\n pass\n\n limit = check_option('-t', options['limit'])\n max_duration = check_option('-m', options['max_duration'])\n\n after = options['after']\n if after:\n try:\n after = int(time.time()) - parse_interval(after)\n except ValueError:\n raise CommandError('Invalid interval %r' % after)\n\n order = options['order']\n if order not in ('at', 'count', 'average'):\n raise CommandError('Invalid sort order %r' % options['order'])\n\n client = redis.Redis(\n host=settings.REDIS_HOST,\n port=settings.REDIS_PORT,\n )\n\n data = {}\n totals = {}\n hits = {}\n results = client.zrangebyscore(\n getattr(settings, 'DUMPSLOW_REDIS_KEY', 'dumpslow'), after, '+inf',\n )\n\n for line in results:\n view, duration = line.split('\\n', 1)\n\n duration = float(duration)\n\n if max_duration and duration >= max_duration:\n continue\n\n if order == 'at':\n try:\n data[view] += duration\n except KeyError:\n data[view] = duration\n\n elif order == 'count':\n try:\n data[view] += 1\n except KeyError:\n data[view] = 1\n\n elif order == 'average':\n try:\n totals[view] += duration\n hits[view] += 1\n except KeyError:\n totals[view] = duration\n hits[view] = 1\n\n data[view] = totals[view] / hits[view]\n\n\n items = data.items()\n del data\n items.sort(key=itemgetter(1), reverse=not options['reverse'])\n\n if limit is not None:\n items = items[:limit]\n\n print \"\", \"View\",\n print {\n 'count': 'Count',\n 'at': 'Accumulated time',\n 'average': 'Average time',\n }[order].rjust(66)\n print \"\", \"=\" * 71\n\n for view, value in items:\n pad = 70 - len(view)\n\n print \"\", view,\n if order == 'at':\n print (\"%2.2f\" % value).rjust(pad)\n elif order == 'count':\n print str(value).rjust(pad)\n elif order == 'average':\n print (\"%2.2f\" % value).rjust(pad)", "metadata": "root.Command.handle", "header": "['class', 'Command', '(', 'NoArgsCommand', ')', ':', '___EOS___']", "index": 44 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "delete_", "statement_", "in_", "function_", "[SEP]_", "class_", "Command_", "(_", "No", "Arg", "s", "Command_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "handle_", "(_", "self_", ",_", "**_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "check", "\\u", "option_", "(_", "name_", ",_", "val_", ")_", ":_", "\\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 ", " _", "val_", "=_", "int_", "(_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "val_", "<_", "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_", "return_", "val_", "\\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_", "Command", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inva", "lid", " ", "value", " ", "for", " ", "%", "s", " ", "%", "r", "'_", "%_", "(_", "name_", ",_", "val_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "limit_", "=_", "check", "\\u", "option_", "(_", "'-", "t", "'_", ",_", "options_", "[_", "'", "limit", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "duration_", "=_", "check", "\\u", "option_", "(_", "'-", "m", "'_", ",_", "options_", "[_", "'", "max", "\\u", "duration", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "after_", "=_", "options_", "[_", "'", "after", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "after_", ":_", "\\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 ", " _", "after_", "=_", "int_", "(_", "time_", "._", "time_", "(_", ")_", ")_", "-_", "parse", "\\u", "interval_", "(_", "after_", ")_", "\\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_", "Command", "Error_", "(_", "'", "Inva", "lid", " ", "interval", " ", "%", "r", "'_", "%_", "after_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "order_", "=_", "options_", "[_", "'", "order", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "order_", "not_", "in_", "(_", "'", "at", "'_", ",_", "'", "count", "'_", ",_", "'", "averag", "e", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Command", "Error_", "(_", "'", "Inva", "lid", " ", "sort", " ", "order", " ", "%", "r", "'_", "%_", "options_", "[_", "'", "order", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "client_", "=_", "redis_", "._", "Redis_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "=_", "settings_", "._", "REDIS", "\\u", "HOST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "port_", "=_", "settings_", "._", "REDIS", "\\u", "PORT_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "totals_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hits_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "client_", "._", "zr", "ange", "bys", "core_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "getattr_", "(_", "settings_", ",_", "'", "DUMP", "SLO", "W", "\\u", "REDIS", "\\u", "KEY", "'_", ",_", "'", "dump", "slow", "'_", ")_", ",_", "after_", ",_", "'+", "inf", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "results_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "view_", ",_", "duration_", "=_", "line_", "._", "split_", "(_", "'\\\\", "n", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "duration_", "=_", "float_", "(_", "duration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "max", "\\u", "duration_", "and_", "duration_", ">=_", "max", "\\u", "duration_", ":_", "\\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_", "if_", "order_", "==_", "'", "at", "'_", ":_", "\\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 ", " ", "_", "data_", "[_", "view_", "]_", "+=_", "duration_", "\\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 ", " ", "_", "data_", "[_", "view_", "]_", "=_", "duration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "'", "count", "'_", ":_", "\\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 ", " ", "_", "data_", "[_", "view_", "]_", "+=_", "1_", "\\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 ", " ", "_", "data_", "[_", "view_", "]_", "=_", "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_", "elif_", "order_", "==_", "'", "averag", "e", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "totals_", "[_", "view_", "]_", "+=_", "duration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hits_", "[_", "view_", "]_", "+=_", "1_", "\\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 ", " ", "_", "totals_", "[_", "view_", "]_", "=_", "duration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hits_", "[_", "view_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "[_", "view_", "]_", "=_", "totals_", "[_", "view_", "]_", "/_", "hits_", "[_", "view_", "]_", "\\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_", "items_", "=_", "data_", "._", "items_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "items_", "._", "sort_", "(_", "key_", "=_", "itemgetter_", "(_", "1_", ")_", ",_", "reverse_", "=_", "not_", "options_", "[_", "'", "reverse", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "limit_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "items_", "=_", "items_", "[_", ":_", "limit_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"\"_", ",_", "\"", "View", "\"_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "count", "'_", ":_", "'", "Count", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "at", "'_", ":_", "'", "Accumulat", "ed", " ", "time", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "averag", "e", "'_", ":_", "'", "Average", " ", "time", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "[_", "order_", "]_", "._", "rjust_", "(_", "66_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"\"_", ",_", "\"=\"_", "*_", "71_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "view_", ",_", "value_", "in_", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pad_", "=_", "70_", "-_", "len_", "(_", "view_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"\"_", ",_", "view_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "order_", "==_", "'", "at", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"%", "2.2", "f", "\"_", "%_", "value_", ")_", "._", "rjust_", "(_", "pad_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "'", "count", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "str_", "(_", "value_", ")_", "._", "rjust_", "(_", "pad_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "order_", "==_", "'", "averag", "e", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_",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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 ]
Unnecessary pass
loggerhead/Easy-Karabiner/easy_karabiner/exception.py
[ { "content": "class UndefinedFilterException(ConfigError):\n pass", "metadata": "root.UndefinedFilterException", "header": "['module', '___EOS___']", "index": 12 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Unde", "fined", "Filter", "Exception_", "(_", "Config", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
CountZer0/PipelineConstructionSet/python/common/__init__.py
[ { "content": "\"\"\"\nAuthor: jason\nCreated: Apr 22, 2012\nModule: common.__init__\nPurpose: to import common packages\n\"\"\"\n\nimport sys\n\n# skip .pycs\nsys.dont_write_bytecode = True \n \nprint \"common.__init__ imported\" ", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Author", ":", " ", "jas", "on", "\\", "10", ";", "Creat", "ed", ":", " ", "Ap", "r", " ", "2", "2", ",", " ", "2012", "\\", "10", ";", "Modul", "e", ":", " ", "common", ".\\u", "\\u", "init", "\\u\\u", "\\", "10", ";", "Pur", "pose", ":", " ", "to", " ", "import", " ", "common", " ", "package", "s", "\\", "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_", "#", " ", "skip", " ", ".", "pyc", "s_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "don", "t", "\\u", "write", "\\u", "bytecode_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "common", ".\\u", "\\u", "init", "\\u\\u", " ", "import", "ed", "\"_" ]
[ 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 ]
Variable defined multiple times
AppScale/appscale/AppServer/lib/django-1.5/django/contrib/syndication/views.py
[ { "content": " def get_feed(self, obj, request):\n \"\"\"\n Returns a feedgenerator.DefaultFeed object, fully populated, for\n this feed. Raises FeedDoesNotExist for invalid parameters.\n \"\"\"\n current_site = get_current_site(request)\n\n link = self.__get_dynamic_attr('link', obj)\n link = add_domain(current_site.domain, link, request.is_secure())\n\n feed = self.feed_type(\n title = self.__get_dynamic_attr('title', obj),\n subtitle = self.__get_dynamic_attr('subtitle', obj),\n link = link,\n description = self.__get_dynamic_attr('description', obj),\n language = settings.LANGUAGE_CODE,\n feed_url = add_domain(\n current_site.domain,\n self.__get_dynamic_attr('feed_url', obj) or request.path,\n request.is_secure(),\n ),\n author_name = self.__get_dynamic_attr('author_name', obj),\n author_link = self.__get_dynamic_attr('author_link', obj),\n author_email = self.__get_dynamic_attr('author_email', obj),\n categories = self.__get_dynamic_attr('categories', obj),\n feed_copyright = self.__get_dynamic_attr('feed_copyright', obj),\n feed_guid = self.__get_dynamic_attr('feed_guid', obj),\n ttl = self.__get_dynamic_attr('ttl', obj),\n **self.feed_extra_kwargs(obj)\n )\n\n title_tmp = None\n if self.title_template is not None:\n try:\n title_tmp = loader.get_template(self.title_template)\n except TemplateDoesNotExist:\n pass\n\n description_tmp = None\n if self.description_template is not None:\n try:\n description_tmp = loader.get_template(self.description_template)\n except TemplateDoesNotExist:\n pass\n\n for item in self.__get_dynamic_attr('items', obj):\n if title_tmp is not None:\n title = title_tmp.render(RequestContext(request, {'obj': item, 'site': current_site}))\n else:\n title = self.__get_dynamic_attr('item_title', item)\n if description_tmp is not None:\n description = description_tmp.render(RequestContext(request, {'obj': item, 'site': current_site}))\n else:\n description = self.__get_dynamic_attr('item_description', item)\n link = add_domain(\n current_site.domain,\n self.__get_dynamic_attr('item_link', item),\n request.is_secure(),\n )\n enc = None\n enc_url = self.__get_dynamic_attr('item_enclosure_url', item)\n if enc_url:\n enc = feedgenerator.Enclosure(\n url = smart_text(enc_url),\n length = smart_text(self.__get_dynamic_attr('item_enclosure_length', item)),\n mime_type = smart_text(self.__get_dynamic_attr('item_enclosure_mime_type', item))\n )\n author_name = self.__get_dynamic_attr('item_author_name', item)\n if author_name is not None:\n author_email = self.__get_dynamic_attr('item_author_email', item)\n author_link = self.__get_dynamic_attr('item_author_link', item)\n else:\n author_email = author_link = None\n\n pubdate = self.__get_dynamic_attr('item_pubdate', item)\n if pubdate and is_naive(pubdate):\n ltz = tzinfo.LocalTimezone(pubdate)\n pubdate = pubdate.replace(tzinfo=ltz)\n\n feed.add_item(\n title = title,\n link = link,\n description = description,\n unique_id = self.__get_dynamic_attr('item_guid', item, link),\n enclosure = enc,\n pubdate = pubdate,\n author_name = author_name,\n author_email = author_email,\n author_link = author_link,\n categories = self.__get_dynamic_attr('item_categories', item),\n item_copyright = self.__get_dynamic_attr('item_copyright', item),\n **self.item_extra_kwargs(item)\n )\n return feed", "metadata": "root.Feed.get_feed", "header": "['class', 'Feed', '(', 'object', ')', ':', '___EOS___']", "index": 102 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Feed_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "feed_", "(_", "self_", ",_", "obj_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "feed", "generat", "or", ".", "Default", "Feed", " ", "object", ",", " ", "full", "y", " ", "populate", "d", ",", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "feed", ".", " ", "Rai", "ses", " ", "Feed", "Do", "es", "Not", "Exist", " ", "for", " ", "invalid", " ", "parameter", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "site_", "=_", "get", "\\u", "current", "\\u", "site_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "link_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "link", "'_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link_", "=_", "add", "\\u", "domain_", "(_", "current", "\\u", "site_", "._", "domain_", ",_", "link_", ",_", "request_", "._", "is", "\\u", "secure_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "feed_", "=_", "self_", "._", "feed", "\\u", "type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "title", "'_", ",_", "obj_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "subtitle_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "subtit", "le", "'_", ",_", "obj_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "link_", "=_", "link_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "description", "'_", ",_", "obj_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "language_", "=_", "settings_", "._", "LANGUAGE", "\\u", "CODE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "feed", "\\u", "url_", "=_", "add", "\\u", "domain_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "site_", "._", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "feed", "\\u", "url", "'_", ",_", "obj_", ")_", "or_", "request_", "._", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "is", "\\u", "secure_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "name_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "author", "\\u", "name", "'_", ",_", "obj_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "link_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "author", "\\u", "link", "'_", ",_", "obj_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "author", "\\u", "email", "'_", ",_", "obj_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "categories_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "categor", "ies", "'_", ",_", "obj_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "feed", "\\u", "copyright_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "feed", "\\u", "copyr", "ight", "'_", ",_", "obj_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "feed", "\\u", "guid_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "feed", "\\u", "guid", "'_", ",_", "obj_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ttl_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "ttl", "'_", ",_", "obj_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "self_", "._", "feed", "\\u", "extra", "\\u", "kwargs_", "(_", "obj_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "title", "\\u", "tmp_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "title", "\\u", "template_", "is_", "not_", "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 ", " _", "title", "\\u", "tmp_", "=_", "loader_", "._", "get", "\\u", "template_", "(_", "self_", "._", "title", "\\u", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Templa", "te", "Do", "es", "Not", "Exist_", ":_", "\\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_", "description", "\\u", "tmp_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "description", "\\u", "template_", "is_", "not_", "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 ", " _", "description", "\\u", "tmp_", "=_", "loader_", "._", "get", "\\u", "template_", "(_", "self_", "._", "description", "\\u", "template_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Templa", "te", "Do", "es", "Not", "Exist_", ":_", "\\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_", "for_", "item_", "in_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "items", "'_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "title", "\\u", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "title_", "=_", "title", "\\u", "tmp_", "._", "render_", "(_", "Request", "Context_", "(_", "request_", ",_", "{_", "'", "obj", "'_", ":_", "item_", ",_", "'", "site", "'_", ":_", "current", "\\u", "site_", "}_", ")_", ")_", "\\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 ", " _", "title_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "item", "\\u", "title", "'_", ",_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "description", "\\u", "tmp_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "description_", "=_", "description", "\\u", "tmp_", "._", "render_", "(_", "Request", "Context_", "(_", "request_", ",_", "{_", "'", "obj", "'_", ":_", "item_", ",_", "'", "site", "'_", ":_", "current", "\\u", "site_", "}_", ")_", ")_", "\\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 ", " _", "description_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "item", "\\u", "description", "'_", ",_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "link_", "=_", "add", "\\u", "domain_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "site_", "._", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "item", "\\u", "link", "'_", ",_", "item_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "is", "\\u", "secure_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "enc", "\\u", "url_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "item", "\\u", "enclosure", "\\u", "url", "'_", ",_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "enc", "\\u", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "enc_", "=_", "feed", "generator_", "._", "Enc", "los", "ure_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "smart", "\\u", "text_", "(_", "enc", "\\u", "url_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "length_", "=_", "smart", "\\u", "text_", "(_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "item", "\\u", "enclosure", "\\u", "length", "'_", ",_", "item_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mime", "\\u", "type_", "=_", "smart", "\\u", "text_", "(_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "item", "\\u", "enclosure", "\\u", "mime", "\\u", "type", "'_", ",_", "item_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "author", "\\u", "name_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "item", "\\u", "author", "\\u", "name", "'_", ",_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "author", "\\u", "name_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "author", "\\u", "email_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "item", "\\u", "author", "\\u", "email", "'_", ",_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "author", "\\u", "link_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "item", "\\u", "author", "\\u", "link", "'_", ",_", "item_", ")_", "\\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 ", " _", "author", "\\u", "email_", "=_", "author", "\\u", "link_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pub", "date_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "item", "\\u", "pub", "date", "'_", ",_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pub", "date_", "and_", "is", "\\u", "naive", "_", "(_", "pub", "date_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lt", "z_", "=_", "tzinfo_", "._", "Local", "Timezone", "_", "(_", "pub", "date_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pub", "date_", "=_", "pub", "date_", "._", "replace_", "(_", "tzinfo_", "=_", "lt", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "feed_", "._", "add", "\\u", "item_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "link_", "=_", "link_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unique", "\\u", "id_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "item", "\\u", "guid", "'_", ",_", "item_", ",_", "link_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "enclosure", "_", "=_", "enc_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pub", "date_", "=_", "pub", "date_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "name_", "=_", "author", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "author", "\\u", "email_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "link_", "=_", "author", "\\u", "link_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "categories_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "item", "\\u", "categor", "ies", "'_", ",_", "item_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "item", "\\u", "copyright_", "=_", "self_", "._", "\\u\\u", "get", "\\u", "dynami", "c\\u", "attr_", "(_", "'", "item", "\\u", "copyr", "ight", "'_", ",_", "item_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "self_", "._", "item", "\\u", "extra", "\\u", "kwargs_", "(_", "item_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "feed_" ]
[ 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,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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 ]
Except block handles 'BaseException'
wtolson/gnsq/gnsq/httpclient.py
[ { "content": " def _http_check_json(self, response):\n try:\n data = json.loads(response.data.decode('utf-8'))\n except ValueError:\n return self._http_check(response)\n\n if response.status != 200:\n status_txt = data.get('status_txt', 'http error')\n raise NSQHttpError('%s <%s>' % (status_txt, response.status))\n\n return data['data']", "metadata": "root.HTTPClient._http_check_json", "header": "['class', 'HTTPClient', '(', 'object', ')', ':', '___EOS___']", "index": 32 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "HTTP", "Client_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "http", "\\u", "check", "\\u", "json_", "(_", "self_", ",_", "response_", ")_", ":_", "\\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 ", " _", "data_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "data_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\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 ", " _", "return_", "self_", "._", "\\u", "http", "\\u", "check_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "status_", "!=_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status", "\\u", "txt_", "=_", "data_", "._", "get_", "(_", "'", "status", "\\u", "txt", "'_", ",_", "'", "http", " ", "error", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "NS", "Q", "Http", "Error_", "(_", "'%", "s", " ", "<", "%", "s", ">'_", "%_", "(_", "status", "\\u", "txt_", ",_", "response_", "._", "status_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", "[_", "'", "data", "'_", "]_", "\\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 ]
Missing call to `__init__` during object initialization
BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/api/openstack/compute/test_access_ips.py
[ { "content": "class AccessIPsControllerTestV21(test.NoDBTestCase):\n\n\n\n\n\n\n\n\n\n", "metadata": "root.AccessIPsControllerTestV21", "header": "['module', '___EOS___']", "index": 315 } ]
[]
[]
0
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[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_", "Access", "IP", "s", "Controlle", "r", "Test", "V2", "1_", "(_", "test_", "._", "No", "DB", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
kivy/kivy-ios/tools/external/cookiecutter/hooks.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\n\"\"\"\ncookiecutter.hooks\n------------------\n\nFunctions for discovering and executing various cookiecutter hooks.\n\"\"\"\n\nimport io\nimport logging\nimport os\nimport subprocess\nimport sys\nimport tempfile\n\nfrom jinja2 import Template\n\nfrom cookiecutter import utils\n\n_HOOKS = [\n 'pre_gen_project',\n 'post_gen_project',\n # TODO: other hooks should be listed here\n]\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def find_hooks():\n \"\"\"\n Must be called with the project template as the current working directory.\n Returns a dict of all hook scripts provided.\n Dict's key will be the hook/script's name, without extension, while\n values will be the absolute path to the script.\n Missing scripts will not be included in the returned dict.\n \"\"\"\n hooks_dir = 'hooks'\n r = {}\n logging.debug('hooks_dir is {0}'.format(hooks_dir))\n if not os.path.isdir(hooks_dir):\n logging.debug('No hooks/ dir in template_dir')\n return r\n for f in os.listdir(hooks_dir):\n basename = os.path.splitext(os.path.basename(f))[0]\n if basename in _HOOKS:\n r[basename] = os.path.abspath(os.path.join(hooks_dir, f))\n return r", "metadata": "root.find_hooks", "header": "['module', '___EOS___']", "index": 28 }, { "content": "def run_script(script_path, cwd='.'):\n \"\"\"\n Executes a script from a working directory.\n\n :param script_path: Absolute path to the script to run.\n :param cwd: The directory to run the script from.\n \"\"\"\n run_thru_shell = sys.platform.startswith('win')\n if script_path.endswith('.py'):\n script_command = [sys.executable, script_path]\n else:\n script_command = [script_path]\n\n utils.make_executable(script_path)\n\n proc = subprocess.Popen(\n script_command,\n shell=run_thru_shell,\n cwd=cwd\n )\n proc.wait()", "metadata": "root.run_script", "header": "['module', '___EOS___']", "index": 49 }, { "content": "def run_script_with_context(script_path, cwd, context):\n \"\"\"\n Executes a script after rendering with it Jinja.\n\n :param script_path: Absolute path to the script to run.\n :param cwd: The directory to run the script from.\n :param context: Cookiecutter project template context.\n \"\"\"\n _, extension = os.path.splitext(script_path)\n\n contents = io.open(script_path, 'r', encoding='utf-8').read()\n\n with tempfile.NamedTemporaryFile(\n delete=False,\n mode='w',\n suffix=extension\n ) as temp:\n temp.write(Template(contents).render(**context))\n\n run_script(temp.name, cwd)", "metadata": "root.run_script_with_context", "header": "['module', '___EOS___']", "index": 72 }, { "content": "def run_hook(hook_name, project_dir, context):\n \"\"\"\n Try to find and execute a hook from the specified project directory.\n\n :param hook_name: The hook to execute.\n :param project_dir: The directory to execute the script from.\n :param context: Cookiecutter project context.\n \"\"\"\n script = find_hooks().get(hook_name)\n if script is None:\n logging.debug('No hooks found')\n return\n return run_script_with_context(script, project_dir, context)", "metadata": "root.run_hook", "header": "['module', '___EOS___']", "index": 94 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "cookie", "cutter", ".", "hook", "s", "\\", "10", ";", "--------------", "----", "\\", "10", ";", "\\", "10", ";", "Function", "s", " ", "for", " ", "discove", "ring", " ", "and", " ", "executi", "ng", " ", "vari", "ous", " ", "cookie", "cutter", " ", "hook", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "jinja2_", "import_", "Template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "cookie", "cutter", "_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "HOOK", "S_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "pre", "\\u", "gen", "\\u", "project", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "post", "\\u", "gen", "\\u", "project", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "other", " ", "hook", "s", " ", "shou", "ld", " ", "be", " ", "liste", "d", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "find", "\\u", "hooks_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Mus", "t", " ", "be", " ", "call", "ed", " ", "with", " ", "the", " ", "project", " ", "template", " ", "as", " ", "the", " ", "current", " ", "working", " ", "director", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "dict", " ", "of", " ", "all", " ", "hook", " ", "scripts", " ", "provided", ".", "\\", "10", ";", " ", " ", " ", " ", "Dict", "'", "s", " ", "key", " ", "will", " ", "be", " ", "the", " ", "hook", "/", "script", "'", "s", " ", "name", ",", " ", "with", "out", " ", "extensi", "on", ",", " ", "whi", "le", "\\", "10", ";", " ", " ", " ", " ", "values", " ", "will", " ", "be", " ", "the", " ", "abs", "olute", " ", "path", " ", "to", " ", "the", " ", "script", ".", "\\", "10", ";", " ", " ", " ", " ", "Missing", " ", "scripts", " ", "will", " ", "not", " ", "be", " ", "include", "d", " ", "in", " ", "the", " ", "return", "ed", " ", "dict", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hook", "s", "\\u", "dir_", "=_", "'", "hook", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "debug_", "(_", "'", "hook", "s", "\\u", "dir", " ", "is", " ", "{", "0", "}'_", "._", "format_", "(_", "hook", "s", "\\u", "dir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "hook", "s", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "'", "No", " ", "hook", "s", "/", " ", "dir", " ", "in", " ", "template", "\\u", "dir", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "f_", "in_", "os_", "._", "listdir_", "(_", "hook", "s", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "basename_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "os_", "._", "path_", "._", "basename_", "(_", "f_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "basename_", "in_", "\\u", "HOOK", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "[_", "basename_", "]_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "hook", "s", "\\u", "dir_", ",_", "f_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "r_", "\\u\\u\\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_", "run", "\\u", "script_", "(_", "script", "\\u", "path_", ",_", "cwd_", "=_", "'.'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Execut", "es", " ", "a", " ", "script", " ", "from", " ", "a", " ", "working", " ", "director", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "script", "\\u", "path", ":", " ", "Abs", "olute", " ", "path", " ", "to", " ", "the", " ", "script", " ", "to", " ", "run", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "cw", "d", ":", " ", "The", " ", "director", "y", " ", "to", " ", "run", " ", "the", " ", "script", " ", "from", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run", "\\u", "thru", "\\u", "shell_", "=_", "sys_", "._", "platform_", "._", "startswith_", "(_", "'", "win", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "script", "\\u", "path_", "._", "endswith_", "(_", "'.", "py", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "script", "\\u", "command_", "=_", "[_", "sys_", "._", "executable_", ",_", "script", "\\u", "path_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "script", "\\u", "command_", "=_", "[_", "script", "\\u", "path_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "utils_", "._", "make", "\\u", "executable_", "(_", "script", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "proc_", "=_", "subprocess_", "._", "Popen_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "script", "\\u", "command_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shell_", "=_", "run", "\\u", "thru", "\\u", "shell_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cwd_", "=_", "cwd_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proc_", "._", "wait_", "(_", ")_", "\\u\\u\\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_", "run", "\\u", "script", "\\u", "with", "\\u", "context_", "(_", "script", "\\u", "path_", ",_", "cwd_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Execut", "es", " ", "a", " ", "script", " ", "after", " ", "render", "ing", " ", "with", " ", "it", " ", "Jin", "ja", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "script", "\\u", "path", ":", " ", "Abs", "olute", " ", "path", " ", "to", " ", "the", " ", "script", " ", "to", " ", "run", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "cw", "d", ":", " ", "The", " ", "director", "y", " ", "to", " ", "run", " ", "the", " ", "script", " ", "from", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "context", ":", " ", "Cooki", "ecu", "tter", " ", "project", " ", "template", " ", "context", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "extension_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "script", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "contents_", "=_", "io_", "._", "open_", "(_", "script", "\\u", "path_", ",_", "'", "r", "'_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "tempfile_", "._", "Name", "d", "Tempora", "ry", "File_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "delete_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "'", "w", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "suffix_", "=_", "extension_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "as_", "temp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "temp_", "._", "write_", "(_", "Template_", "(_", "contents_", ")_", "._", "render_", "(_", "**_", "context_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "run", "\\u", "script_", "(_", "temp_", "._", "name_", ",_", "cwd_", ")_", "\\u\\u\\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_", "run", "\\u", "hook_", "(_", "hook", "\\u", "name_", ",_", "project", "\\u", "dir_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Tr", "y", " ", "to", " ", "find", " ", "and", " ", "execute", " ", "a", " ", "hook", " ", "from", " ", "the", " ", "specified", " ", "project", " ", "director", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "hook", "\\u", "name", ":", " ", "The", " ", "hook", " ", "to", " ", "execute", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "project", "\\u", "dir", ":", " ", "The", " ", "director", "y", " ", "to", " ", "execute", " ", "the", " ", "script", " ", "from", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "context", ":", " ", "Cooki", "ecu", "tter", " ", "project", " ", "context", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script_", "=_", "find", "\\u", "hooks_", "(_", ")_", "._", "get_", "(_", "hook", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "script_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "'", "No", " ", "hook", "s", " ", "found", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "run", "\\u", "script", "\\u", "with", "\\u", "context_", "(_", "script_", ",_", "project", "\\u", "dir_", ",_", "context_", ")_" ]
[ 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, 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,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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, 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 ]
Illegal raise
cournape/Bento/bento/private/_yaku/yaku/tools/pyext.py
[ { "content": "def setup_pyext_env(ctx, cc_type=\"default\", use_distutils=True):\n pyenv = Environment()\n if use_distutils:\n if cc_type == \"default\":\n dist_env = get_configuration()\n else:\n dist_env = get_configuration(cc_type)\n print(dist_env)\n for name, value in dist_env.items():\n pyenv[\"PYEXT_%s\" % name] = value\n pyenv[\"PYEXT_CFLAGS\"].extend(dist_env.get(\"SHARED\", []))\n pyenv[\"PYEXT_FMT\"] = \"%%s%s\" % dist_env[\"SO\"]\n pyenv[\"PYEXT_SHLINKFLAGS\"] = dist_env[\"LDFLAGS\"]\n else:\n old_env = ctx.env\n ctx.env = Environment()\n cc_env = None\n sys.path.insert(0, os.path.dirname(yaku.tools.__file__))\n try:\n try:\n mod = __import__(cc_type)\n mod.setup(ctx)\n except ImportError:\n raise RuntimeError(\"No tool %s is available (import failed)\" \\\n % cc_type)\n cc_env = ctx.env\n finally:\n sys.path.pop(0)\n ctx.env = old_env\n pyenv[\"PYEXT_CC\"] = cc_env[\"CC\"]\n pyenv[\"PYEXT_CFLAGS\"] = cc_env[\"CFLAGS\"]\n pyenv[\"PYEXT_LIBDIR\"] = cc_env[\"LIBDIR\"]\n pyenv[\"PYEXT_LIBS\"] = cc_env[\"LIBS\"]\n pyenv[\"PYEXT_FMT\"] = \"%s.so\"\n pyenv[\"PYEXT_SHLINK\"] = cc_env[\"MODLINK\"]\n pyenv[\"PYEXT_SHLINKFLAGS\"] = cc_env[\"MODLINKFLAGS\"]\n pyenv[\"PYEXT_CPPPATH\"] = cc_env[\"CPPPATH\"]\n pyenv.append(\"PYEXT_CPPPATH\", distutils.sysconfig.get_python_inc(), create=True)\n if sys.platform == \"win32\":\n pyenv.append(\"PYEXT_LIBDIR\", os.path.join(sys.exec_prefix, \"libs\"))\n\n return pyenv", "metadata": "root.setup_pyext_env", "header": "['module', '___EOS___']", "index": 101 } ]
[]
[]
0
true
[ "[CLS]_", "Il", "lega", "l_", "raise_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "setup", "\\u", "pye", "xt\\u", "env_", "(_", "ctx_", ",_", "cc", "\\u", "type_", "=_", "\"", "default", "\"_", ",_", "use", "\\u", "distutils_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pye", "nv_", "=_", "Environment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "use", "\\u", "distutils_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cc", "\\u", "type_", "==_", "\"", "default", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dist", "\\u", "env_", "=_", "get", "\\u", "configuration_", "(_", ")_", "\\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 ", " _", "dist", "\\u", "env_", "=_", "get", "\\u", "configuration_", "(_", "cc", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "dist", "\\u", "env_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", ",_", "value_", "in_", "dist", "\\u", "env_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pye", "nv_", "[_", "\"", "PY", "EXT", "\\u", "%", "s", "\"_", "%_", "name_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pye", "nv_", "[_", "\"", "PY", "EXT", "\\u", "CFLAGS", "\"_", "]_", "._", "extend_", "(_", "dist", "\\u", "env_", "._", "get_", "(_", "\"", "SHARED", "\"_", ",_", "[_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pye", "nv_", "[_", "\"", "PY", "EXT", "\\u", "FMT", "\"_", "]_", "=_", "\"%%", "s", "%", "s", "\"_", "%_", "dist", "\\u", "env_", "[_", "\"", "SO", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pye", "nv_", "[_", "\"", "PY", "EXT", "\\u", "SH", "LINK", "FLAG", "S", "\"_", "]_", "=_", "dist", "\\u", "env_", "[_", "\"", "LD", "FLAG", "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 ", " _", "old", "\\u", "env_", "=_", "ctx_", "._", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "env_", "=_", "Environment_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cc", "\\u", "env_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "os_", "._", "path_", "._", "dirname_", "(_", "yak", "u_", "._", "tools_", "._", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\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 ", " _", "mod_", "=_", "\\u\\u", "import\\u\\u_", "(_", "cc", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "._", "setup_", "(_", "ctx_", ")_", "\\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 ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "No", " ", "tool", " ", "%", "s", " ", "is", " ", "avail", "able", " ", "(", "import", " ", "fail", "ed", ")\"_", "%_", "cc", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cc", "\\u", "env_", "=_", "ctx_", "._", "env_", "\\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 ", " _", "sys_", "._", "path_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "env_", "=_", "old", "\\u", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pye", "nv_", "[_", "\"", "PY", "EXT", "\\u", "CC", "\"_", "]_", "=_", "cc", "\\u", "env_", "[_", "\"", "CC", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pye", "nv_", "[_", "\"", "PY", "EXT", "\\u", "CFLAGS", "\"_", "]_", "=_", "cc", "\\u", "env_", "[_", "\"", "CFLAGS", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pye", "nv_", "[_", "\"", "PY", "EXT", "\\u", "LIB", "DIR", "\"_", "]_", "=_", "cc", "\\u", "env_", "[_", "\"", "LIB", "DIR", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pye", "nv_", "[_", "\"", "PY", "EXT", "\\u", "LIBS", "\"_", "]_", "=_", "cc", "\\u", "env_", "[_", "\"", "LIBS", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pye", "nv_", "[_", "\"", "PY", "EXT", "\\u", "FMT", "\"_", "]_", "=_", "\"%", "s", ".", "so", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pye", "nv_", "[_", "\"", "PY", "EXT", "\\u", "SH", "LINK", "\"_", "]_", "=_", "cc", "\\u", "env_", "[_", "\"", "MOD", "LINK", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pye", "nv_", "[_", "\"", "PY", "EXT", "\\u", "SH", "LINK", "FLAG", "S", "\"_", "]_", "=_", "cc", "\\u", "env_", "[_", "\"", "MOD", "LINK", "FLAG", "S", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pye", "nv_", "[_", "\"", "PY", "EXT", "\\u", "CPP", "PATH", "\"_", "]_", "=_", "cc", "\\u", "env_", "[_", "\"", "CPP", "PATH", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pye", "nv_", "._", "append_", "(_", "\"", "PY", "EXT", "\\u", "CPP", "PATH", "\"_", ",_", "distutils_", "._", "sysconfig", "_", "._", "get", "\\u", "python", "\\u", "inc_", "(_", ")_", ",_", "create_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sys_", "._", "platform_", "==_", "\"", "win32", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pye", "nv_", "._", "append_", "(_", "\"", "PY", "EXT", "\\u", "LIB", "DIR", "\"_", ",_", "os_", "._", "path_", "._", "join_", "(_", "sys_", "._", "exec", "\\u", "prefix_", ",_", "\"", "libs", "\"_", ")_", ")_", "\\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_", "pye", "nv_", "\\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,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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 ]
Unreachable code
ajinabraham/Mobile-Security-Framework-MobSF/StaticAnalyzer/tools/enjarify/enjarify/treelist.py
[ { "content": " @staticmethod\n def merge(left, right, func):\n # Effectively computes [func(x, y) for x, y in zip(left, right)]\n # Assume func(x, x) == x\n if left is right:\n return left\n\n if left is None:\n left, right = right, left\n\n default = left.default\n merge = _TreeListSub.merge\n if right is None:\n direct = [func(x, default) for x in left.direct]\n children = [merge(child, None, func) for child in left.children]\n if direct == left.direct and children == left.children:\n return left\n return _TreeListSub(default, direct, children)\n\n direct = [func(x, y) for x, y in zip(left.direct, right.direct)]\n children = [merge(c1, c2, func) for c1, c2 in zip(left.children, right.children)]\n if direct == left.direct and children == left.children:\n return left\n if direct == right.direct and children == right.children:\n return right\n return _TreeListSub(default, direct, children)", "metadata": "root._TreeListSub.merge", "header": "['class', '_TreeListSub', ':', '___EOS___']", "index": 93 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "\\u", "Tree", "List", "Sub_", ":_", "\\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_", "merge_", "(_", "left_", ",_", "right_", ",_", "func_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Effe", "ctive", "ly", " ", "compute", "s", " ", "[", "func", "(", "x", ",", " ", "y", ")", " ", "for", " ", "x", ",", " ", "y", " ", "in", " ", "zip", "(", "left", ",", " ", "right", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Assume", " ", "func", "(", "x", ",", " ", "x", ")", " ", "==", " ", "x_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "left_", "is_", "right_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "left_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", ",_", "right_", "=_", "right_", ",_", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "default_", "=_", "left_", "._", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge_", "=_", "\\u", "Tree", "List", "Sub_", "._", "merge_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "right_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "direct_", "=_", "[_", "func_", "(_", "x_", ",_", "default_", ")_", "for_", "x_", "in_", "left_", "._", "direct_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "children_", "=_", "[_", "merge_", "(_", "child_", ",_", "None_", ",_", "func_", ")_", "for_", "child_", "in_", "left_", "._", "children_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "direct_", "==_", "left_", "._", "direct_", "and_", "children_", "==_", "left_", "._", "children_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "Tree", "List", "Sub_", "(_", "default_", ",_", "direct_", ",_", "children_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "direct_", "=_", "[_", "func_", "(_", "x_", ",_", "y_", ")_", "for_", "x_", ",_", "y_", "in_", "zip_", "(_", "left_", "._", "direct_", ",_", "right_", "._", "direct_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "children_", "=_", "[_", "merge_", "(_", "c1_", ",_", "c2_", ",_", "func_", ")_", "for_", "c1_", ",_", "c2_", "in_", "zip_", "(_", "left_", "._", "children_", ",_", "right_", "._", "children_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "direct_", "==_", "left_", "._", "direct_", "and_", "children_", "==_", "left_", "._", "children_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "direct_", "==_", "right_", "._", "direct_", "and_", "children_", "==_", "right_", "._", "children_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "Tree", "List", "Sub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[ { "content": " def test_dbs_by_group(self):\n config = PartitionConfig()\n dbs = config.get_form_processing_dbs()\n self.assertIn('db1', dbs)\n self.assertIn('db2', dbs)", "metadata": "root.TestPartitionConfig.test_dbs_by_group", "header": "['class', 'TestPartitionConfig', '(', 'SimpleTestCase', ')', ':', '___EOS___']", "index": 60 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Partition", "Config_", "(_", "Simple", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "dbs", "\\u", "by", "\\u", "group_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config_", "=_", "Partition", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbs_", "=_", "config_", "._", "get", "\\u", "form", "\\u", "process", "ing", "\\u", "dbs_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "db", "1", "'_", ",_", "dbs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "db", "2", "'_", ",_", "dbs_", ")_", "\\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 ]
Variable defined multiple times
bslatkin/dpxdt/dpxdt/server/work_queue.py
[ { "content": "def _query(queue_name=None, build_id=None, release_id=None, run_id=None,\n count=None):\n \"\"\"Queries for work items based on their criteria.\n\n Args:\n queue_name: Optional queue name to restrict to.\n build_id: Optional build ID to restrict to.\n release_id: Optional release ID to restrict to.\n run_id: Optional run ID to restrict to.\n count: How many tasks to fetch. Defaults to None, which means all\n tasks are fetch that match the query.\n\n Returns:\n List of WorkQueue items.\n \"\"\"\n assert queue_name or build_id or release_id or run_id\n\n q = WorkQueue.query\n if queue_name:\n q = q.filter_by(queue_name=queue_name)\n if build_id:\n q = q.filter_by(build_id=build_id)\n if release_id:\n q = q.filter_by(release_id=release_id)\n if run_id:\n q = q.filter_by(run_id=run_id)\n\n q = q.order_by(WorkQueue.created.desc())\n\n if count is not None:\n q = q.limit(count)\n\n return q.all()", "metadata": "root._query", "header": "['module', '___EOS___']", "index": 344 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "query_", "(_", "queue", "\\u", "name_", "=_", "None_", ",_", "build", "\\u", "id_", "=_", "None_", ",_", "release", "\\u", "id_", "=_", "None_", ",_", "run", "\\u", "id_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Querie", "s", " ", "for", " ", "work", " ", "items", " ", "based", " ", "on", " ", "thei", "r", " ", "crite", "ria", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "queue", "\\u", "name", ":", " ", "Optio", "nal", " ", "queue", " ", "name", " ", "to", " ", "restrict", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "build", "\\u", "id", ":", " ", "Optio", "nal", " ", "build", " ", "ID", " ", "to", " ", "restrict", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "release", "\\u", "id", ":", " ", "Optio", "nal", " ", "release", " ", "ID", " ", "to", " ", "restrict", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "run", "\\u", "id", ":", " ", "Optio", "nal", " ", "run", " ", "ID", " ", "to", " ", "restrict", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "count", ":", " ", "Ho", "w", " ", "many", " ", "task", "s", " ", "to", " ", "fetch", ".", " ", "Default", "s", " ", "to", " ", "Non", "e", ",", " ", "whi", "ch", " ", "means", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "task", "s", " ", "are", " ", "fetch", " ", "tha", "t", " ", "match", " ", "the", " ", "query", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "List", " ", "of", " ", "Work", "Queue", " ", "items", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "queue", "\\u", "name_", "or_", "build", "\\u", "id_", "or_", "release", "\\u", "id_", "or_", "run", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "q_", "=_", "Work", "Queue_", "._", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "queue", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "q_", "._", "filter", "\\u", "by_", "(_", "queue", "\\u", "name_", "=_", "queue", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "build", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "q_", "._", "filter", "\\u", "by_", "(_", "build", "\\u", "id_", "=_", "build", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "release", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "q_", "._", "filter", "\\u", "by_", "(_", "release", "\\u", "id_", "=_", "release", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "run", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "q_", "._", "filter", "\\u", "by_", "(_", "run", "\\u", "id_", "=_", "run", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "q_", "=_", "q_", "._", "order", "\\u", "by_", "(_", "Work", "Queue_", "._", "created_", "._", "desc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "count_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "q_", "._", "limit_", "(_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "q_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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 ]
Testing equality to None
Bolton-and-Menk-GIS/restapi/restapi/requests/sessions.py
[ { "content": "def merge_setting(request_setting, session_setting, dict_class=OrderedDict):\n \"\"\"\n Determines appropriate setting for a given request, taking into account the\n explicit setting on that request, and the setting in the session. If a\n setting is a dictionary, they will be merged together using `dict_class`\n \"\"\"\n\n if session_setting is None:\n return request_setting\n\n if request_setting is None:\n return session_setting\n\n # Bypass if not a dictionary (e.g. verify)\n if not (\n isinstance(session_setting, Mapping) and\n isinstance(request_setting, Mapping)\n ):\n return request_setting\n\n merged_setting = dict_class(to_key_val_list(session_setting))\n merged_setting.update(to_key_val_list(request_setting))\n\n # Remove keys that are set to None.\n for (k, v) in request_setting.items():\n if v is None:\n del merged_setting[k]\n\n return merged_setting", "metadata": "root.merge_setting", "header": "['module', '___EOS___']", "index": 37 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "merge", "\\u", "setting_", "(_", "request", "\\u", "setting_", ",_", "session", "\\u", "setting_", ",_", "dict", "\\u", "class_", "=_", "Order", "ed", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Det", "erm", "ine", "s", " ", "appropr", "iate", " ", "setti", "ng", " ", "for", " ", "a", " ", "give", "n", " ", "request", ",", " ", "tak", "ing", " ", "int", "o", " ", "account", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "explicit", " ", "setti", "ng", " ", "on", " ", "tha", "t", " ", "request", ",", " ", "and", " ", "the", " ", "setti", "ng", " ", "in", " ", "the", " ", "session", ".", " ", "If", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "setti", "ng", " ", "is", " ", "a", " ", "dictionar", "y", ",", " ", "the", "y", " ", "will", " ", "be", " ", "merge", "d", " ", "tog", "ether", " ", "usi", "ng", " ", "`", "dict", "\\u", "class", "`", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "session", "\\u", "setting_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "request", "\\u", "setting_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request", "\\u", "setting_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "session", "\\u", "setting_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "By", "pass", " ", "if", " ", "not", " ", "a", " ", "dictionar", "y", " ", "(", "e", ".", "g", ".", " ", "verify", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "session", "\\u", "setting_", ",_", "Mapping_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "request", "\\u", "setting_", ",_", "Mapping_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "request", "\\u", "setting_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "merge", "d\\u", "setting_", "=_", "dict", "\\u", "class_", "(_", "to", "\\u", "key", "\\u", "val", "\\u", "list_", "(_", "session", "\\u", "setting_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge", "d\\u", "setting_", "._", "update_", "(_", "to", "\\u", "key", "\\u", "val", "\\u", "list_", "(_", "request", "\\u", "setting_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remove", " ", "keys", " ", "tha", "t", " ", "are", " ", "set", " ", "to", " ", "Non", "e", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "(_", "k_", ",_", "v_", ")_", "in_", "request", "\\u", "setting_", "._", "items_", "(_", ")_", ":_", "\\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 ", " _", "del_", "merge", "d\\u", "setting_", "[_", "k_", "]_", "\\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_", "merge", "d\\u", "setting_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ebu/radiodns-plugit/RadioDns-PlugIt/channels/actions.py
[ { "content": "@action(route=\"/channels/edit/<id>\", template=\"channels/edit.html\", methods=['POST', 'GET'])\n@only_orga_admin_user()\ndef channels_edit(request, id):\n \"\"\"Edit a channel.\"\"\"\n\n object = None\n errors = []\n\n if id != '-':\n object = Channel.query.join(Station).filter(Channel.id == int(id), Station.orga==int(request.args.get('ebuio_orgapk') or request.form.get('ebuio_orgapk'))).first()\n\n if request.method == 'POST':\n\n if not object:\n object = Channel()\n\n\n object.station_id = int(request.form.get('station'))\n\n # Get values\n for x in ['name', 'type_id', 'ecc_id', 'pi', 'frequency', 'eid', 'sid', 'scids', 'appty_uatype', 'pa', 'tx', 'cc', 'fqdn', 'serviceIdentifier']:\n val = request.form.get(x)\n if val == '':\n val = None\n\n # Secial case : CC\n if x == 'cc' and val is not None:\n cc_obj = Ecc.query.filter_by(id = val).first()\n val = cc_obj.pi + cc_obj.ecc\n\n\n setattr(object, x, val)\n\n # Check errors\n if object.name == '' or object.name is None:\n errors.append(\"Please set a name\")\n\n # Set to '' useless values, and check if values needed are present\n list_props = None\n for (type_id, _, type_props) in Channel.TYPE_ID_CHOICES:\n if type_id == object.type_id:\n list_props = type_props\n\n if list_props is None:\n errors.append('Type not found oO')\n\n if list_props:\n\n for x in ['ecc_id', 'pi', 'frequency', 'eid', 'sid', 'scids', 'appty_uatype', 'pa', 'tx', 'cc', 'fqdn', 'serviceIdentifier']:\n if x in list_props: # Want it ? Keep it !\n if x != 'appty_uatype' and x != 'pa': # Exception\n if getattr(object, x) is None or getattr(object, x) == '':\n errors.append(x + \" cannot be empty\")\n else:\n setattr(object, x, None)\n\n # Check each prop\n if object.pi is not None:\n if not re.match(r\"^[a-fA-F0-9]{4}$\", object.pi):\n errors.append(\"pi must be 4 characters in hexadecimal\")\n\n if object.frequency is not None:\n if not re.match(r\"^[0-9]{5}$\", object.frequency) and object.frequency != '*':\n errors.append(\"frequency must be 5 digits or *\")\n\n if object.eid is not None:\n if not re.match(r\"^[a-fA-F0-9]{4}$\", object.eid):\n errors.append(\"eid must be 4 characters in hexadecimal\")\n\n if object.sid is not None:\n if not re.match(r\"^[a-fA-F0-9]{4}([a-fA-F0-9]{4})?$\", object.sid):\n errors.append(\"sid must be 4 or 8 characters in hexadecimal\")\n\n if object.scids is not None:\n if not re.match(r\"^[a-fA-F0-9]([a-fA-F0-9]{2})?$\", object.scids):\n errors.append(\"scids must be 1 or 3 characters in hexadecimal\")\n\n if object.appty_uatype is not None:\n if not re.match(r\"^[a-fA-F0-9]{2}\\-[a-fA-F0-9]{3}$\", object.appty_uatype):\n errors.append(\"appty_uatype must be 2 char hexadecimal, hyphen, 3 char hexadecimal\")\n\n if object.pa is not None:\n if object.pa < 1 or object.pa > 1023:\n errors.append(\"pa must be between 1 and 1023\")\n\n if object.tx is not None:\n if not re.match(r\"^[a-fA-F0-9]{5}$\", object.tx):\n errors.append(\"tx must be 5 characters in hexadecimal\")\n\n if object.cc is not None:\n if not re.match(r\"^[a-fA-F0-9]{3}$\", object.cc):\n errors.append(\"cc must be 3 characters in hexadecimal\")\n\n if object.fqdn is not None:\n if not re.match(r\"^[a-zA-Z\\d-]{,63}(\\.[a-zA-Z\\d-]{,63}).$\", object.fqdn):\n errors.append(\"fqdn must be a domain name\")\n\n if object.serviceIdentifier is not None:\n if not re.match(r\"^[a-f0-9]{,16}$\", object.serviceIdentifier):\n errors.append(\"serviceIdentifier must be up to 16 characters in hexadecimal, lowercase\")\n\n\n\n # Check station\n sta = Station.query.filter_by(id=object.station_id).first()\n if not sta or sta.orga != int(request.form.get('ebuio_orgapk')):\n errors.append(\"Please set a station\")\n\n # If no errors, save\n if not errors:\n \n if not object.id:\n db.session.add(object)\n\n db.session.commit()\n\n return PlugItRedirect('channels/?saved=yes')\n\n if object:\n object = object.json\n\n stations = []\n\n for station in Station.query.filter_by(orga=int(request.args.get('ebuio_orgapk') or request.form.get('ebuio_orgapk'))).all():\n stations.append(station.json)\n \n return {'object': object, 'errors': errors, 'stations': stations, 'types_id': Channel.TYPE_ID_CHOICES}", "metadata": "root.channels_edit", "header": "['module', '___EOS___']", "index": 32 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "action_", "(_", "route_", "=_", "\"/", "channel", "s", "/", "edit", "/", "<", "id", ">\"_", ",_", "template_", "=_", "\"", "channel", "s", "/", "edit", ".", "html", "\"_", ",_", "methods_", "=_", "[_", "'", "POST", "'_", ",_", "'", "GET", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "only", "\\u", "orga", "\\u", "admin", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "channel", "s", "\\u", "edit_", "(_", "request_", ",_", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Edit", " ", "a", " ", "channel", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "object_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "id_", "!=_", "'-'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "Channel_", "._", "query_", "._", "join_", "(_", "Station_", ")_", "._", "filter_", "(_", "Channel_", "._", "id_", "==_", "int_", "(_", "id_", ")_", ",_", "Station_", "._", "orga", "_", "==_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", "or_", "request_", "._", "form_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "object_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "Channel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "object_", "._", "station", "\\u", "id_", "=_", "int_", "(_", "request_", "._", "form_", "._", "get_", "(_", "'", "station", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "values_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "x_", "in_", "[_", "'", "name", "'_", ",_", "'", "type", "\\u", "id", "'_", ",_", "'", "ecc", "\\u", "id", "'_", ",_", "'", "pi", "'_", ",_", "'", "freque", "nc", "y", "'_", ",_", "'", "eid", "'_", ",_", "'", "sid", "'_", ",_", "'", "sci", "ds", "'_", ",_", "'", "app", "ty", "\\u", "uat", "ype", "'_", ",_", "'", "pa", "'_", ",_", "'", "tx", "'_", ",_", "'", "cc", "'_", ",_", "'", "fq", "dn", "'_", ",_", "'", "service", "Identifie", "r", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "request_", "._", "form_", "._", "get_", "(_", "x_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "val_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sec", "ial", " ", "case", " ", ":", " ", "CC_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "x_", "==_", "'", "cc", "'_", "and_", "val_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cc", "\\u", "obj_", "=_", "Ec", "c_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "id_", "=_", "val_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "cc", "\\u", "obj_", "._", "pi_", "+_", "cc", "\\u", "obj_", "._", "ecc", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setattr_", "(_", "object_", ",_", "x_", ",_", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "errors_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "object_", "._", "name_", "==_", "''_", "or_", "object_", "._", "name_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "Ple", "ase", " ", "set", " ", "a", " ", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "to", " ", "''", " ", "usel", "ess", " ", "values", ",", " ", "and", " ", "check", " ", "if", " ", "values", " ", "need", "ed", " ", "are", " ", "present_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "list", "\\u", "props_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "(_", "type", "\\u", "id_", ",_", "\\u_", ",_", "type", "\\u", "props_", ")_", "in_", "Channel_", "._", "TYPE", "\\u", "ID", "\\u", "CHOICES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type", "\\u", "id_", "==_", "object_", "._", "type", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "list", "\\u", "props_", "=_", "type", "\\u", "props_", "\\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_", "list", "\\u", "props_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "'", "Type", " ", "not", " ", "found", " ", "o", "O", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "list", "\\u", "props_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "[_", "'", "ecc", "\\u", "id", "'_", ",_", "'", "pi", "'_", ",_", "'", "freque", "nc", "y", "'_", ",_", "'", "eid", "'_", ",_", "'", "sid", "'_", ",_", "'", "sci", "ds", "'_", ",_", "'", "app", "ty", "\\u", "uat", "ype", "'_", ",_", "'", "pa", "'_", ",_", "'", "tx", "'_", ",_", "'", "cc", "'_", ",_", "'", "fq", "dn", "'_", ",_", "'", "service", "Identifie", "r", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "in_", "list", "\\u", "props_", ":_", "#", " ", "Wan", "t", " ", "it", " ", "?", " ", "Keep", " ", "it", " ", "!", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "x_", "!=_", "'", "app", "ty", "\\u", "uat", "ype", "'_", "and_", "x_", "!=_", "'", "pa", "'_", ":_", "#", " ", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "getattr_", "(_", "object_", ",_", "x_", ")_", "is_", "None_", "or_", "getattr_", "(_", "object_", ",_", "x_", ")_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "errors_", "._", "append_", "(_", "x_", "+_", "\"", " ", "cann", "ot", " ", "be", " ", "empty", "\"_", ")_", "\\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 ", " ", "_", "setattr_", "(_", "object_", ",_", "x_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "each", " ", "prop_", "\\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_", "object_", "._", "pi_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "re_", "._", "match_", "(_", "r", "\"", "^", "[", "a", "-", "f", "A", "-", "F0", "-", "9", "]{", "4", "}$\"_", ",_", "object_", "._", "pi_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "pi", " ", "must", " ", "be", " ", "4", " ", "character", "s", " ", "in", " ", "hexadec", "imal", "\"_", ")_", "\\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_", "object_", "._", "frequency_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "re_", "._", "match_", "(_", "r", "\"", "^", "[", "0", "-", "9", "]{", "5", "}$\"_", ",_", "object_", "._", "frequency_", ")_", "and_", "object_", "._", "frequency_", "!=_", "'*'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "freque", "nc", "y", " ", "must", " ", "be", " ", "5", " ", "digit", "s", " ", "or", " ", "*\"_", ")_", "\\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_", "object_", "._", "eid_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "re_", "._", "match_", "(_", "r", "\"", "^", "[", "a", "-", "f", "A", "-", "F0", "-", "9", "]{", "4", "}$\"_", ",_", "object_", "._", "eid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "eid", " ", "must", " ", "be", " ", "4", " ", "character", "s", " ", "in", " ", "hexadec", "imal", "\"_", ")_", "\\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_", "object_", "._", "sid_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "re_", "._", "match_", "(_", "r", "\"", "^", "[", "a", "-", "f", "A", "-", "F0", "-", "9", "]{", "4", "}([", "a", "-", "f", "A", "-", "F0", "-", "9", "]{", "4", "})", "?$", "\"_", ",_", "object_", "._", "sid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "sid", " ", "must", " ", "be", " ", "4", " ", "or", " ", "8", " ", "character", "s", " ", "in", " ", "hexadec", "imal", "\"_", ")_", "\\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_", "object_", "._", "sci", "ds_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "re_", "._", "match_", "(_", "r", "\"", "^", "[", "a", "-", "f", "A", "-", "F0", "-", "9", "](", "[", "a", "-", "f", "A", "-", "F0", "-", "9", "]{", "2", "})", "?$", "\"_", ",_", "object_", "._", "sci", "ds_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "sci", "ds", " ", "must", " ", "be", " ", "1", " ", "or", " ", "3", " ", "character", "s", " ", "in", " ", "hexadec", "imal", "\"_", ")_", "\\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_", "object_", "._", "app", "ty", "\\u", "uat", "ype_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "re_", "._", "match_", "(_", "r", "\"", "^", "[", "a", "-", "f", "A", "-", "F0", "-", "9", "]{", "2", "}\\\\", "-[", "a", "-", "f", "A", "-", "F0", "-", "9", "]{", "3", "}$\"_", ",_", "object_", "._", "app", "ty", "\\u", "uat", "ype_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "app", "ty", "\\u", "uat", "ype", " ", "must", " ", "be", " ", "2", " ", "char", " ", "hexadec", "imal", ",", " ", "hyphen", ",", " ", "3", " ", "char", " ", "hexadec", "imal", "\"_", ")_", "\\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_", "object_", "._", "pa_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "object_", "._", "pa_", "<_", "1_", "or_", "object_", "._", "pa_", ">_", "1023", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "pa", " ", "must", " ", "be", " ", "bet", "ween", " ", "1", " ", "and", " ", "1023", "\"_", ")_", "\\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_", "object_", "._", "tx_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "re_", "._", "match_", "(_", "r", "\"", "^", "[", "a", "-", "f", "A", "-", "F0", "-", "9", "]{", "5", "}$\"_", ",_", "object_", "._", "tx_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "tx", " ", "must", " ", "be", " ", "5", " ", "character", "s", " ", "in", " ", "hexadec", "imal", "\"_", ")_", "\\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_", "object_", "._", "cc_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "re_", "._", "match_", "(_", "r", "\"", "^", "[", "a", "-", "f", "A", "-", "F0", "-", "9", "]{", "3", "}$\"_", ",_", "object_", "._", "cc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "cc", " ", "must", " ", "be", " ", "3", " ", "character", "s", " ", "in", " ", "hexadec", "imal", "\"_", ")_", "\\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_", "object_", "._", "fqdn_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "re_", "._", "match_", "(_", "r", "\"", "^", "[", "a", "-", "z", "A", "-", "Z", "\\\\", "d", "-]", "{", ",", "6", "3", "}(", "\\\\.", "[", "a", "-", "z", "A", "-", "Z", "\\\\", "d", "-]", "{", ",", "6", "3", "}).", "$\"_", ",_", "object_", "._", "fqdn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "fq", "dn", " ", "must", " ", "be", " ", "a", " ", "domain", " ", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "object_", "._", "service", "Identifier_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "re_", "._", "match_", "(_", "r", "\"", "^", "[", "a", "-", "f0", "-", "9", "]{", ",", "16", "}$\"_", ",_", "object_", "._", "service", "Identifier_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "service", "Identifie", "r", " ", "must", " ", "be", " ", "up", " ", "to", " ", "16", " ", "character", "s", " ", "in", " ", "hexadec", "imal", ",", " ", "lower", "case", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "station_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sta_", "=_", "Station_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "id_", "=_", "object_", "._", "station", "\\u", "id_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "sta_", "or_", "sta_", "._", "orga", "_", "!=_", "int_", "(_", "request_", "._", "form_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "\"", "Ple", "ase", " ", "set", " ", "a", " ", "station", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "no", " ", "error", "s", ",", " ", "save_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "object_", "._", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "session_", "._", "add_", "(_", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "session_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Plug", "It", "Redirect_", "(_", "'", "channel", "s", "/?", "saved", "=", "ye", "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_", "object_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "object_", "._", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stations_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "station_", "in_", "Station_", "._", "query_", "._", "filter", "\\u", "by_", "(_", "orga", "_", "=_", "int_", "(_", "request_", "._", "args_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", "or_", "request_", "._", "form_", "._", "get_", "(_", "'", "ebu", "io", "\\u", "orga", "pk", "'_", ")_", ")_", ")_", "._", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stations_", "._", "append_", "(_", "station_", "._", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "'", "object", "'_", ":_", "object_", ",_", "'", "error", "s", "'_", ":_", "errors_", ",_", "'", "station", "s", "'_", ":_", "stations_", ",_", "'", "types", "\\u", "id", "'_", ":_", "Channel_", "._", "TYPE", "\\u", "ID", "\\u", "CHOICES_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Unused local variable
sympy/sympy/sympy/combinatorics/permutations.py
[ { "content": " def index(self):\n \"\"\"\n Returns the index of a permutation.\n\n The index of a permutation is the sum of all subscripts j such\n that p[j] is greater than p[j+1].\n\n Examples\n ========\n\n >>> from sympy.combinatorics.permutations import Permutation\n >>> p = Permutation([3, 0, 2, 1, 4])\n >>> p.index()\n 2\n \"\"\"\n a = self.array_form\n\n return sum([j for j in range(len(a) - 1) if a[j] > a[j + 1]])", "metadata": "root.Permutation.index", "header": "['class', 'Permutation', '(', 'Basic', ')', ':', '___EOS___']", "index": 2262 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Permut", "ation_", "(_", "Basic_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "index_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "index", " ", "of", " ", "a", " ", "permutation", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "index", " ", "of", " ", "a", " ", "permutation", " ", "is", " ", "the", " ", "sum", " ", "of", " ", "all", " ", "subscript", "s", " ", "j", " ", "suc", "h", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "p", "[", "j", "]", " ", "is", " ", "great", "er", " ", "than", " ", "p", "[", "j", "+", "1", "].", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Exam", "ples", "\\", "10", ";", " ", " ", " ", " ", "=======", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "from", " ", "symp", "y", ".", "combinat", "ori", "cs", ".", "permutation", "s", " ", "import", " ", "Permut", "ation", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "p", " ", "=", " ", "Permut", "ation", "([", "3", ",", " ", "0", ",", " ", "2", ",", " ", "1", ",", " ", "4", "])", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "p", ".", "index", "()", "\\", "10", ";", " ", " ", " ", " ", "2", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "self_", "._", "array", "\\u", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "sum_", "(_", "[_", "j_", "for_", "j_", "in_", "range_", "(_", "len_", "(_", "a_", ")_", "-_", "1_", ")_", "if_", "a_", "[_", "j_", "]_", ">_", "a_", "[_", "j_", "+_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
openstack/sahara/sahara/utils/api.py
[ { "content": "# Copyright (c) 2013 Mirantis 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\n# implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport traceback\n\nimport flask\nfrom oslo_log import log as logging\nfrom oslo_middleware import request_id as oslo_req_id\nfrom werkzeug import datastructures\n\nfrom sahara import context\nfrom sahara import exceptions as ex\nfrom sahara.i18n import _\nfrom sahara.i18n import _LE\nfrom sahara.utils import wsgi\n\n\nLOG = logging.getLogger(__name__)\n\n\n\n\n\n\nRT_JSON = datastructures.MIMEAccept([(\"application/json\", 1)])\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 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2013", " ", "Mir", "anti", "s", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "flask_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "log_", "import_", "log_", "as_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "middleware_", "import_", "request", "\\u", "id_", "as_", "oslo", "\\u", "req", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "import_", "datastr", "ucture", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "sahara", "_", "import_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sahara", "_", "import_", "exceptions_", "as_", "ex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sahara", "_", "._", "i18n_", "import_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sahara", "_", "._", "i18n_", "import_", "\\u", "LE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sahara", "_", "._", "utils_", "import_", "wsgi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "RT", "\\u", "JSON_", "=_", "datastr", "ucture", "s_", "._", "MIME", "Accept", "_", "(_", "[_", "(_", "\"", "applica", "tion", "/", "json", "\"_", ",_", "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\\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\\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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 ]
Non-standard exception raised in special method
glue-viz/glue/glue/viewers/scatter/qt/tests/test_viewer_widget.py
[ { "content": " def test_subsets_dont_duplicate_fields(self):\n layer = self.add_layer_via_method()\n nobj = self.widget.ui.xAxisComboBox.count()\n subset = layer.new_subset()\n subset.register()\n assert self.widget.ui.xAxisComboBox.count() == nobj", "metadata": "root.TestScatterWidget.test_subsets_dont_duplicate_fields", "header": "['class', 'TestScatterWidget', '(', 'object', ')', ':', '___EOS___']", "index": 155 } ]
[]
[]
0
true
[ "[CLS]_", "Non", "_", "-_", "standard_", "exception_", "raised_", "in_", "special_", "method_", "[SEP]_", "class_", "Test", "Scatter", "Widget_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "subsets", "\\u", "don", "t", "\\u", "duplicat", "e\\u", "fields_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "layer_", "=_", "self_", "._", "add", "\\u", "layer", "\\u", "via", "\\u", "method_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nob", "j_", "=_", "self_", "._", "widget_", "._", "ui_", "._", "x", "Axi", "s", "Comb", "o", "Box_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subset_", "=_", "layer_", "._", "new", "\\u", "subset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subset_", "._", "register_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "widget_", "._", "ui_", "._", "x", "Axi", "s", "Comb", "o", "Box_", "._", "count_", "(_", ")_", "==_", "nob", "j_", "\\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 ]
Unused import
onitu/onitu/drivers/flickr/onitu_flickr/__init__.py
[ { "content": "from .flickr_driver import start, plug\n\n__all__ = [\"start\", \"plug\"]\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "._", "flickr", "\\u", "driver_", "import_", "start_", ",_", "plug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "\"", "start", "\"_", ",_", "\"", "plug", "\"_", "]_" ]
[ 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 ]
Except block handles 'BaseException'
bigmlcom/python/bigml/multivote.py
[ { "content": " def append_row(self, prediction_row,\n prediction_headers=PREDICTION_HEADERS):\n \"\"\"Adds a new prediction into a list of predictions\n\n prediction_headers should contain the labels for the prediction_row\n values in the same order.\n\n prediction_headers should contain at least the following string\n - 'prediction': whose associated value in prediction_row\n is the predicted category or value\n\n for instance:\n prediction_row = ['Iris-virginica']\n prediction_headers = ['prediction']\n\n it may also contain the following headers and values:\n - 'confidence': whose associated value in prediction_row\n is the confidence/error of the prediction\n - 'distribution': a list of [category/value, instances] pairs\n describing the distribution at the prediction node\n - 'count': the total number of instances of the training set in the\n node\n \"\"\"\n\n if (isinstance(prediction_row, list) and\n isinstance(prediction_headers, list) and\n len(prediction_row) == len(prediction_headers) and\n 'prediction' in prediction_headers):\n order = self.next_order()\n try:\n index = prediction_headers.index('order')\n prediction_row[index] = order\n except ValueError:\n prediction_headers.append('order')\n prediction_row.append(order)\n prediction_info = {}\n for i in range(0, len(prediction_row)):\n prediction_info.update({prediction_headers[i]:\n prediction_row[i]})\n self.predictions.append(prediction_info)\n else:\n LOGGER.error(\"WARNING: failed to add the prediction.\\n\"\n \"The row must have label 'prediction' at least.\")", "metadata": "root.MultiVote.append_row", "header": "['class', 'MultiVote', '(', 'object', ')', ':', '___EOS___']", "index": 609 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Multi", "Vote", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "append", "\\u", "row_", "(_", "self_", ",_", "predicti", "on", "\\u", "row_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "predicti", "on", "\\u", "headers_", "=_", "PREDIC", "TIO", "N", "\\u", "HEADERS_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", "s", " ", "a", " ", "new", " ", "predicti", "on", " ", "int", "o", " ", "a", " ", "list", " ", "of", " ", "predicti", "ons", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "predicti", "on", "\\u", "header", "s", " ", "shou", "ld", " ", "contain", " ", "the", " ", "labels", " ", "for", " ", "the", " ", "predicti", "on", "\\u", "row", "\\", "10", ";", " ", " ", " ", "values", " ", "in", " ", "the", " ", "same", " ", "order", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "predicti", "on", "\\u", "header", "s", " ", "shou", "ld", " ", "contain", " ", "at", " ", "leas", "t", " ", "the", " ", "follow", "ing", " ", "string", "\\", "10", ";", " ", " ", " ", "-", " ", "'", "predicti", "on", "':", " ", "who", "se", " ", "associate", "d", " ", "value", " ", "in", " ", "predicti", "on", "\\u", "row", "\\", "10", ";", " ", " ", " ", " ", " ", "is", " ", "the", " ", "predi", "cte", "d", " ", "category", " ", "or", " ", "value", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "for", " ", "instance", ":", "\\", "10", ";", " ", " ", " ", "predicti", "on", "\\u", "row", " ", "=", " ", "['", "Ir", "is", "-", "virg", "ini", "ca", "']", "\\", "10", ";", " ", " ", " ", "predicti", "on", "\\u", "header", "s", " ", "=", " ", "['", "predicti", "on", "']", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "it", " ", "may", " ", "als", "o", " ", "contain", " ", "the", " ", "follow", "ing", " ", "header", "s", " ", "and", " ", "values", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "'", "confidence", "':", " ", "who", "se", " ", "associate", "d", " ", "value", " ", "in", " ", "predicti", "on", "\\u", "row", "\\", "10", ";", " ", " ", " ", " ", " ", "is", " ", "the", " ", "confidence", "/", "error", " ", "of", " ", "the", " ", "predicti", "on", "\\", "10", ";", " ", " ", " ", "-", " ", "'", "distribu", "tion", "':", " ", "a", " ", "list", " ", "of", " ", "[", "category", "/", "value", ",", " ", "instance", "s", "]", " ", "pair", "s", "\\", "10", ";", " ", " ", " ", "descri", "bing", " ", "the", " ", "distribu", "tion", " ", "at", " ", "the", " ", "predicti", "on", " ", "node", "\\", "10", ";", " ", " ", " ", "-", " ", "'", "count", "':", " ", "the", " ", "total", " ", "number", " ", "of", " ", "instance", "s", " ", "of", " ", "the", " ", "train", "ing", " ", "set", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "node", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "isinstance_", "(_", "predicti", "on", "\\u", "row_", ",_", "list_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "isinstance_", "(_", "predicti", "on", "\\u", "headers_", ",_", "list_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "len_", "(_", "predicti", "on", "\\u", "row_", ")_", "==_", "len_", "(_", "predicti", "on", "\\u", "headers_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "'", "predicti", "on", "'_", "in_", "predicti", "on", "\\u", "headers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order_", "=_", "self_", "._", "next", "\\u", "order_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index_", "=_", "predicti", "on", "\\u", "headers_", "._", "index_", "(_", "'", "order", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "predicti", "on", "\\u", "row_", "[_", "index_", "]_", "=_", "order_", "\\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 ", " _", "predicti", "on", "\\u", "headers_", "._", "append_", "(_", "'", "order", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "predicti", "on", "\\u", "row_", "._", "append_", "(_", "order_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "predicti", "on", "\\u", "info_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "predicti", "on", "\\u", "row_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "predicti", "on", "\\u", "info_", "._", "update_", "(_", "{_", "predicti", "on", "\\u", "headers_", "[_", "i_", "]_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "predicti", "on", "\\u", "row_", "[_", "i_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "predictions_", "._", "append_", "(_", "predicti", "on", "\\u", "info_", ")_", "\\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 ", " _", "LOGGER_", "._", "error_", "(_", "\"", "WARN", "ING", ":", " ", "fail", "ed", " ", "to", " ", "add", " ", "the", " ", "predicti", "on", ".\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "The", " ", "row", " ", "must", " ", "have", " ", "label", " ", "'", "predicti", "on", "'", " ", "at", " ", "leas", "t", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Variable defined multiple times
winhamwr/neckbeard/neckbeard/tests/test_configuration.py
[ { "content": " def test_environment_constants(self):\n constants = {\n NeckbeardLoader.VERSION_OPTION: '0.1',\n 'environments': {\n 'test1': {\n 'foo1': 'v_foo1',\n },\n 'test2': {\n 'foo2': 'v_foo2',\n },\n },\n }\n configuration = ConfigurationManager(\n constants=constants,\n secrets={},\n secrets_tpl={},\n environments={},\n node_templates={},\n scaling_backend=MaxScalingBackend(),\n )\n\n test1_constants = configuration._get_environment_constants('test1')\n self.assertEqual(len(test1_constants), 1)\n self.assertEqual(test1_constants['foo1'], 'v_foo1')\n\n test2_constants = configuration._get_environment_constants('test2')\n self.assertEqual(len(test2_constants), 1)\n self.assertEqual(test2_constants['foo2'], 'v_foo2')", "metadata": "root.TestConfigContext.test_environment_constants", "header": "['class', 'TestConfigContext', '(', 'unittest2', '.', 'TestCase', ')', ':', '___EOS___']", "index": 16 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Config", "Context_", "(_", "unittest2_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "environ", "ment", "\\u", "constants_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "constants_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "Nec", "kb", "ear", "d", "Loader_", "._", "VERSI", "ON", "\\u", "OPTION", "_", ":_", "'", "0.", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "environ", "ment", "s", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", "1", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foo", "1", "'_", ":_", "'", "v", "\\u", "foo", "1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "test", "2", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foo", "2", "'_", ":_", "'", "v", "\\u", "foo", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "configuration_", "=_", "Configura", "tion", "Manager_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "constants_", "=_", "constants_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "secrets_", "=_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "secret", "s", "\\u", "tpl_", "=_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "environments_", "=_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "node", "\\u", "templates_", "=_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scal", "ing", "\\u", "backend_", "=_", "Max", "Sca", "ling", "Backend_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test", "1", "\\u", "constants_", "=_", "configuration_", "._", "\\u", "get", "\\u", "environ", "ment", "\\u", "constants_", "(_", "'", "test", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "test", "1", "\\u", "constants_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "test", "1", "\\u", "constants_", "[_", "'", "foo", "1", "'_", "]_", ",_", "'", "v", "\\u", "foo", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test", "2", "\\u", "constants_", "=_", "configuration_", "._", "\\u", "get", "\\u", "environ", "ment", "\\u", "constants_", "(_", "'", "test", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "test", "2", "\\u", "constants_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "test", "2", "\\u", "constants_", "[_", "'", "foo", "2", "'_", "]_", ",_", "'", "v", "\\u", "foo", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
bmbouter/Opus/opus/lib/osutils/windows.py
[ { "content": " def check_user_load(self):\n try:\n self.sessions = []\n output = self.node.ssh_run_command([\"Quser\"])\n for line in output.split('\\n'):\n fields = split(\"(\\S+) +(\\d+) +(Disc) +([none]*[\\d+\\+]*[\\. ]*[\\d*\\:\\d* ]*[\\d ]*) (\\d*/\\d*/\\d*) +(\\d*\\:\\d* +[AM]*[PM]*)\",line)\n if (len(fields) > 1):\n user = dict()\n for i,value in enumerate(fields):\n if(i == 1):\n user[\"username\"] = string.rstrip(value)\n if(i == 2):\n user[\"sessionid\"] = string.rstrip(value)\n if(i == 3):\n user[\"state\"] = string.rstrip(value)\n if(i == 4):\n user[\"idletime\"] = string.rstrip(value)\n if(i == 5):\n user[\"logondate\"] = string.rstrip(value)\n if(i == 6):\n user[\"logontime\"] = string.rstrip(value)\n if (len(user) == 6):\n self.sessions.append(user)\n\n else:\n fields = split(\"(\\S+) +(\\S+) +(\\d+) +(Active) +([none]*[\\d+\\+]*[\\. ]*[\\d*\\:\\d* ]*[\\d ]*) (\\d*/\\d*/\\d*) +(\\d*\\:\\d* +[AM]*[PM]*)\",line)\n user = dict()\n for i,value in enumerate(fields):\n if(i == 1):\n user[\"username\"] = string.rstrip(value)\n if(i == 2):\n user[\"sessionname\"] = string.rstrip(value)\n if(i == 3):\n user[\"sessionid\"] = string.rstrip(value)\n if(i == 4):\n user[\"state\"] = string.rstrip(value)\n if(i == 5):\n user[\"idletime\"] = string.rstrip(value)\n if(i == 6):\n user[\"logondate\"] = string.rstrip(value)\n if(i == 7):\n user[\"logontime\"] = string.rstrip(value)\n if (len(user) == 7):\n self.sessions.append(user)\n return self.sessions \n except HostNotConnectableError:\n return False", "metadata": "root.Windows.check_user_load", "header": "['class', 'Windows', '(', 'Generic', ')', ':', '___EOS___']", "index": 85 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Windows_", "(_", "Generic_", ")_", ":_", "\\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_", "check", "\\u", "user", "\\u", "load_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sessions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "self_", "._", "node_", "._", "ssh", "\\u", "run", "\\u", "command_", "(_", "[_", "\"", "Qu", "ser", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "output_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "split_", "(_", "\"(", "\\\\", "S", "+)", " ", "+(", "\\\\", "d", "+)", " ", "+(", "Disc", ")", " ", "+([", "none", "]*", "[\\\\", "d", "+\\\\", "+]", "*[", "\\\\.", " ", "]*", "[\\\\", "d", "*\\\\", ":\\\\", "d", "*", " ", "]*", "[\\\\", "d", " ", "]*)", " ", "(\\\\", "d", "*/", "\\\\", "d", "*/", "\\\\", "d", "*)", " ", "+(", "\\\\", "d", "*\\\\", ":\\\\", "d", "*", " ", "+[", "AM", "]*", "[", "PM", "]*)", "\"_", ",_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "len_", "(_", "fields_", ")_", ">_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "user_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "value_", "in_", "enumerate_", "(_", "fields_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "(_", "i_", "==_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "user_", "[_", "\"", "user", "name", "\"_", "]_", "=_", "string_", "._", "rstrip_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "i_", "==_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "user_", "[_", "\"", "sessionid", "\"_", "]_", "=_", "string_", "._", "rstrip_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "i_", "==_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "user_", "[_", "\"", "state", "\"_", "]_", "=_", "string_", "._", "rstrip_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "i_", "==_", "4_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "user_", "[_", "\"", "idle", "time", "\"_", "]_", "=_", "string_", "._", "rstrip_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "i_", "==_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "user_", "[_", "\"", "logo", "nda", "te", "\"_", "]_", "=_", "string_", "._", "rstrip_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "i_", "==_", "6_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "user_", "[_", "\"", "logo", "ntime", "\"_", "]_", "=_", "string_", "._", "rstrip_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "len_", "(_", "user_", ")_", "==_", "6_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "sessions_", "._", "append_", "(_", "user_", ")_", "\\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 ", " ", "_", "fields_", "=_", "split_", "(_", "\"(", "\\\\", "S", "+)", " ", "+(", "\\\\", "S", "+)", " ", "+(", "\\\\", "d", "+)", " ", "+(", "Activ", "e", ")", " ", "+([", "none", "]*", "[\\\\", "d", "+\\\\", "+]", "*[", "\\\\.", " ", "]*", "[\\\\", "d", "*\\\\", ":\\\\", "d", "*", " ", "]*", "[\\\\", "d", " ", "]*)", " ", "(\\\\", "d", "*/", "\\\\", "d", "*/", "\\\\", "d", "*)", " ", "+(", "\\\\", "d", "*\\\\", ":\\\\", "d", "*", " ", "+[", "AM", "]*", "[", "PM", "]*)", "\"_", ",_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "value_", "in_", "enumerate_", "(_", "fields_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "(_", "i_", "==_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "user_", "[_", "\"", "user", "name", "\"_", "]_", "=_", "string_", "._", "rstrip_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "i_", "==_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "user_", "[_", "\"", "session", "name", "\"_", "]_", "=_", "string_", "._", "rstrip_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "i_", "==_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "user_", "[_", "\"", "sessionid", "\"_", "]_", "=_", "string_", "._", "rstrip_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "i_", "==_", "4_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "user_", "[_", "\"", "state", "\"_", "]_", "=_", "string_", "._", "rstrip_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "i_", "==_", "5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "user_", "[_", "\"", "idle", "time", "\"_", "]_", "=_", "string_", "._", "rstrip_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "i_", "==_", "6_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "user_", "[_", "\"", "logo", "nda", "te", "\"_", "]_", "=_", "string_", "._", "rstrip_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "i_", "==_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "user_", "[_", "\"", "logo", "ntime", "\"_", "]_", "=_", "string_", "._", "rstrip_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "len_", "(_", "user_", ")_", "==_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "sessions_", "._", "append_", "(_", "user_", ")_", "\\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_", "self_", "._", "sessions_", "\\u\\u\\uNEWLINE\\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 ]
Imprecise assert
openstack-infra/release-tools/releasetools/tests/test_governance.py
[ { "content": " def test_all(self):\n repos = governance.get_repositories(\n TEAM_DATA,\n None,\n None,\n [],\n code_only=False,\n )\n repo_names = sorted(r.name for r in repos)\n self.assertEqual(\n sorted(['openstack/barbican',\n 'openstack/barbican-specs',\n 'openstack/python-barbicanclient',\n 'openstack/castellan',\n 'openstack/kite',\n 'openstack/python-kiteclient',\n 'openstack/cinder',\n 'openstack/cinder-specs',\n 'openstack/os-brick',\n 'openstack/python-cinderclient',\n 'openstack-test/cookies-cookiecutter']),\n repo_names,\n )", "metadata": "root.GetRepositoriesTest.test_all", "header": "['class', 'GetRepositoriesTest', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 123 } ]
[]
[]
0
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Get", "Repos", "itori", "es", "Test_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "all_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repos_", "=_", "govern", "ance_", "._", "get", "\\u", "repositories_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "TEAM", "\\u", "DATA_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "code", "\\u", "only_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repo", "\\u", "names_", "=_", "sorted_", "(_", "r_", "._", "name_", "for_", "r_", "in_", "repos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "sorted_", "(_", "[_", "'", "openst", "ack", "/", "barb", "ican", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "openst", "ack", "/", "barb", "ican", "-", "spec", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "openst", "ack", "/", "python", "-", "barb", "ican", "client", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "openst", "ack", "/", "cast", "ella", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "openst", "ack", "/", "kite", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "openst", "ack", "/", "python", "-", "kite", "client", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "openst", "ack", "/", "cinde", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "openst", "ack", "/", "cinde", "r", "-", "spec", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "openst", "ack", "/", "os", "-", "brick", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "openst", "ack", "/", "python", "-", "cinde", "rcli", "ent", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "openst", "ack", "-", "test", "/", "cookie", "s", "-", "cookie", "cutter", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "repo", "\\u", "names_", ",_", "\\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 ]
Unused import
saltstack/salt/salt/modules/openbsd_sysctl.py
[ { "content": "# -*- coding: utf-8 -*-\n'''\nModule for viewing and modifying OpenBSD sysctl parameters\n'''\nfrom __future__ import absolute_import\nimport os\n\n# Import salt libs\nimport salt.utils\nfrom salt.exceptions import CommandExecutionError\n\n# Define the module's virtual name\n__virtualname__ = 'sysctl'\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def __virtual__():\n '''\n Only run on OpenBSD systems\n '''\n if __grains__['os'] == 'OpenBSD':\n return __virtualname__\n return (False, 'The openbsd_sysctl execution module cannot be loaded: '\n 'only available on FreeBSD systems.')", "metadata": "root.__virtual__", "header": "['module', '___EOS___']", "index": 15 }, { "content": "def show(config_file=False):\n '''\n Return a list of sysctl parameters for this minion\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' sysctl.show\n '''\n cmd = 'sysctl'\n ret = {}\n out = __salt__['cmd.run_stdout'](cmd, output_loglevel='trace')\n for line in out.splitlines():\n if not line or '=' not in line:\n continue\n comps = line.split('=', 1)\n ret[comps[0]] = comps[1]\n return ret", "metadata": "root.show", "header": "['module', '___EOS___']", "index": 25 }, { "content": "def get(name):\n '''\n Return a single sysctl parameter for this minion\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' sysctl.get hw.physmem\n '''\n cmd = 'sysctl -n {0}'.format(name)\n out = __salt__['cmd.run'](cmd)\n return out", "metadata": "root.get", "header": "['module', '___EOS___']", "index": 46 }, { "content": "def assign(name, value):\n '''\n Assign a single sysctl parameter for this minion\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' sysctl.assign net.inet.ip.forwarding 1\n '''\n ret = {}\n cmd = 'sysctl {0}=\"{1}\"'.format(name, value)\n data = __salt__['cmd.run_all'](cmd)\n\n if data['retcode'] != 0:\n raise CommandExecutionError('sysctl failed: {0}'.format(\n data['stderr']))\n new_name, new_value = data['stdout'].split(':', 1)\n ret[new_name] = new_value.split(' -> ')[-1]\n return ret", "metadata": "root.assign", "header": "['module', '___EOS___']", "index": 61 }, { "content": "def persist(name, value, config='/etc/sysctl.conf'):\n '''\n Assign and persist a simple sysctl parameter for this minion\n\n CLI Example:\n\n .. code-block:: bash\n\n salt '*' sysctl.persist net.inet.ip.forwarding 1\n '''\n nlines = []\n edited = False\n value = str(value)\n\n # create /etc/sysctl.conf if not present\n if not os.path.isfile(config):\n try:\n salt.utils.fopen(config, 'w+').close()\n except (IOError, OSError):\n msg = 'Could not create {0}'\n raise CommandExecutionError(msg.format(config))\n\n with salt.utils.fopen(config, 'r') as ifile:\n for line in ifile:\n if not line.startswith('{0}='.format(name)):\n nlines.append(line)\n continue\n else:\n key, rest = line.split('=', 1)\n if rest.startswith('\"'):\n _, rest_v, rest = rest.split('\"', 2)\n elif rest.startswith('\\''):\n _, rest_v, rest = rest.split('\\'', 2)\n else:\n rest_v = rest.split()[0]\n rest = rest[len(rest_v):]\n if rest_v == value:\n return 'Already set'\n new_line = '{0}={1}{2}'.format(key, value, rest)\n nlines.append(new_line)\n edited = True\n if not edited:\n nlines.append('{0}={1}\\n'.format(name, value))\n with salt.utils.fopen(config, 'w+') as ofile:\n ofile.writelines(nlines)\n\n assign(name, value)\n return 'Updated'", "metadata": "root.persist", "header": "['module', '___EOS___']", "index": 83 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Modul", "e", " ", "for", " ", "viewin", "g", " ", "and", " ", "modif", "ying", " ", "Open", "BS", "D", " ", "sysc", "tl", " ", "parameter", "s", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "salt", " ", "libs_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "salt_", "._", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "salt_", "._", "exceptions_", "import_", "Command", "Execut", "ion", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Define", " ", "the", " ", "module", "'", "s", " ", "virtual", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "virtual", "name\\u\\u_", "=_", "'", "sysc", "tl", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "virtual", "\\u\\u_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "On", "ly", " ", "run", " ", "on", " ", "Open", "BS", "D", " ", "system", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "grains", "\\u\\u_", "[_", "'", "os", "'_", "]_", "==_", "'", "Open", "BS", "D", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u", "virtual", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "False_", ",_", "'", "The", " ", "openb", "sd", "\\u", "sysc", "tl", " ", "executi", "on", " ", "module", " ", "cann", "ot", " ", "be", " ", "load", "ed", ":", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "only", " ", "avail", "able", " ", "on", " ", "Free", "BS", "D", " ", "system", "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_", "show_", "(_", "config", "\\u", "file_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "list", " ", "of", " ", "sysc", "tl", " ", "parameter", "s", " ", "for", " ", "this", " ", "minion", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "'*", "'", " ", "sysc", "tl", ".", "show", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "'", "sysc", "tl", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "\\u\\u", "salt\\u\\u_", "[_", "'", "cmd", ".", "run", "\\u", "stdout", "'_", "]_", "(_", "cmd_", ",_", "output", "\\u", "loglevel_", "=_", "'", "trace", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "out_", "._", "splitlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "line_", "or_", "'='_", "not_", "in_", "line_", ":_", "\\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_", "comps_", "=_", "line_", "._", "split_", "(_", "'='_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "comps_", "[_", "0_", "]_", "]_", "=_", "comps_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "single", " ", "sysc", "tl", " ", "parameter", " ", "for", " ", "this", " ", "minion", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "'*", "'", " ", "sysc", "tl", ".", "get", " ", "hw", ".", "phys", "mem", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "'", "sysc", "tl", " ", "-", "n", " ", "{", "0", "}'_", "._", "format_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "\\u\\u", "salt\\u\\u_", "[_", "'", "cmd", ".", "run", "'_", "]_", "(_", "cmd_", ")_", "\\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_", "def_", "assign_", "(_", "name_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Assign", " ", "a", " ", "single", " ", "sysc", "tl", " ", "parameter", " ", "for", " ", "this", " ", "minion", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "'*", "'", " ", "sysc", "tl", ".", "assign", " ", "net", ".", "inet", ".", "ip", ".", "forward", "ing", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "'", "sysc", "tl", " ", "{", "0", "}=", "\"{", "1", "}\"'_", "._", "format_", "(_", "name_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "\\u\\u", "salt\\u\\u_", "[_", "'", "cmd", ".", "run", "\\u", "all", "'_", "]_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "data_", "[_", "'", "ret", "code", "'_", "]_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Command", "Execut", "ion", "Error_", "(_", "'", "sysc", "tl", " ", "fail", "ed", ":", " ", "{", "0", "}'_", "._", "format_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "std", "err", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "name_", ",_", "new", "\\u", "value_", "=_", "data_", "[_", "'", "stdout", "'_", "]_", "._", "split_", "(_", "':'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "[_", "new", "\\u", "name_", "]_", "=_", "new", "\\u", "value_", "._", "split_", "(_", "'", " ", "->", " ", "'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ret_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "persist_", "(_", "name_", ",_", "value_", ",_", "config_", "=_", "'/", "etc", "/", "sysc", "tl", ".", "conf", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Assign", " ", "and", " ", "persist", " ", "a", " ", "simple", " ", "sysc", "tl", " ", "parameter", " ", "for", " ", "this", " ", "minion", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "'*", "'", " ", "sysc", "tl", ".", "persist", " ", "net", ".", "inet", ".", "ip", ".", "forward", "ing", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nline", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edited", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "/", "etc", "/", "sysc", "tl", ".", "conf", " ", "if", " ", "not", " ", "present_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "config_", ")_", ":_", "\\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 ", " _", "salt_", "._", "utils_", "._", "fop", "en_", "(_", "config_", ",_", "'", "w", "+'_", ")_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "IO", "Error_", ",_", "OSE", "rror_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "{", "0", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Command", "Execut", "ion", "Error_", "(_", "msg_", "._", "format_", "(_", "config_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "salt_", "._", "utils_", "._", "fop", "en_", "(_", "config_", ",_", "'", "r", "'_", ")_", "as_", "ifile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "line_", "in_", "ifile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "line_", "._", "startswith_", "(_", "'{", "0", "}=", "'_", "._", "format_", "(_", "name_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nline", "s_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", ",_", "rest_", "=_", "line_", "._", "split_", "(_", "'='_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rest_", "._", "startswith_", "(_", "'\"'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u_", ",_", "rest", "\\u", "v_", ",_", "rest_", "=_", "rest_", "._", "split_", "(_", "'\"'_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "rest_", "._", "startswith_", "(_", "'\\\\''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u_", ",_", "rest", "\\u", "v_", ",_", "rest_", "=_", "rest_", "._", "split_", "(_", "'\\\\''_", ",_", "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 ", " ", "_", "rest", "\\u", "v_", "=_", "rest_", "._", "split_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rest_", "=_", "rest_", "[_", "len_", "(_", "rest", "\\u", "v_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rest", "\\u", "v_", "==_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "'", "Al", "read", "y", " ", "set", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "line_", "=_", "'{", "0", "}=", "{", "1", "}{", "2", "}'_", "._", "format_", "(_", "key_", ",_", "value_", ",_", "rest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nline", "s_", "._", "append_", "(_", "new", "\\u", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edited", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "edited", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nline", "s_", "._", "append_", "(_", "'{", "0", "}=", "{", "1", "}\\\\", "n", "'_", "._", "format_", "(_", "name_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "salt_", "._", "utils_", "._", "fop", "en_", "(_", "config_", ",_", "'", "w", "+'_", ")_", "as_", "ofile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ofile_", "._", "writelines_", "(_", "nline", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assign_", "(_", "name_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'", "Update", "d", "'_" ]
[ 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,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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 ]
Unused import
disqus/porkchop/porkchop/server.py
[ { "content": "\"\"\"\nporkchop.server\n~~~~~~~~~~~~~~~\n\n:copyright: (c) 2011-2012 DISQUS.\n:license: Apache License 2.0, see LICENSE for more details.\n\"\"\"\nfrom BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer\nfrom SocketServer import ThreadingMixIn\nimport json\nimport traceback\nimport urlparse\n\nfrom porkchop.plugin import PorkchopPluginHandler\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class GetHandler(BaseHTTPRequestHandler):\n\n", "metadata": "root.GetHandler", "header": "['module', '___EOS___']", "index": 16 }, { "content": " def format_output(self, fmt, data):\n if fmt == 'json':\n return json.dumps(data)\n else:\n return '\\n'.join(self.json_path(data))", "metadata": "root.GetHandler.format_output", "header": "['class', 'GetHandler', '(', 'BaseHTTPRequestHandler', ')', ':', '___EOS___']", "index": 17 }, { "content": " def json_path(self, data):\n results = []\n\n def path_helper(data, path, results):\n for key, val in data.iteritems():\n if isinstance(val, dict):\n path_helper(val, '/'.join((path, key)), results)\n else:\n results.append(('%s %s' % (('/'.join((path, key)))\\\n .replace('.', '_'), val)))\n\n path_helper(data, '', results)\n return results", "metadata": "root.GetHandler.json_path", "header": "['class', 'GetHandler', '(', 'BaseHTTPRequestHandler', ')', ':', '___EOS___']", "index": 23 }, { "content": " def do_GET(self):\n data = {}\n formats = {'json': 'application/json', 'text': 'text/plain'}\n request = urlparse.urlparse(self.path)\n\n try:\n (path, fmt) = request.path.split('.')\n if fmt not in formats.keys():\n fmt = 'text'\n except ValueError:\n path = request.path\n if self.headers.get('accept', False) == 'application/json':\n fmt = 'json'\n else:\n fmt = 'text'\n\n if self.headers.get('x-porkchop-refresh', False):\n force_refresh = True\n else:\n force_refresh = False\n\n module = path.split('/')[1]\n\n try:\n if module:\n plugin = PorkchopPluginHandler.plugins[module](self)\n plugin.force_refresh = force_refresh\n self.log_message('Calling plugin: %s with force=%s' % (module, force_refresh))\n data.update({module: plugin.data})\n else:\n for plugin_name, plugin in PorkchopPluginHandler.plugins.iteritems():\n try:\n plugin.force_refresh = force_refresh\n self.log_message('Calling plugin: %s with force=%s' % (plugin_name, force_refresh))\n # if the plugin has no data, it'll only have one key:\n # refreshtime\n result = plugin(self).data\n if len(result) > 1:\n data.update({plugin_name: result})\n except Exception, e:\n self.log_error('Error loading plugin: name=%s exception=%s, traceback=%s', plugin_name, e,\n traceback.format_exc())\n\n if len(data):\n self.send_response(200)\n self.send_header('Content-Type', formats[fmt])\n self.end_headers()\n self.wfile.write(self.format_output(fmt, data) + '\\n')\n else:\n raise Exception('Unable to load any plugins')\n except Exception, e:\n self.log_error('Error: %s\\n%s', e, traceback.format_exc())\n self.send_response(404)\n self.send_header('Content-Type', formats[fmt])\n self.end_headers()\n self.wfile.write(self.format_output(fmt, {}))", "metadata": "root.GetHandler.do_GET", "header": "['class', 'GetHandler', '(', 'BaseHTTPRequestHandler', ')', ':', '___EOS___']", "index": 37 }, { "content": "class ThreadedHTTPServer(ThreadingMixIn, HTTPServer):\n pass", "metadata": "root.ThreadedHTTPServer", "header": "['module', '___EOS___']", "index": 95 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "por", "kc", "hop", ".", "server", "\\", "10", ";", "~~~~~~~~~~~", "~~~", "~", "\\", "10", ";", "\\", "10", ";", ":", "copyr", "ight", ":", " ", "(", "c", ")", " ", "2011", "-", "2012", " ", "DIS", "QU", "S", ".", "\\", "10", ";", ":", "license", ":", " ", "Ap", "ache", " ", "License", " ", "2.0", ",", " ", "see", " ", "LICENSE", " ", "for", " ", "more", " ", "deta", "il", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Base", "HTTP", "Server_", "import_", "Base", "HTTP", "Request", "Handler_", ",_", "HTTP", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Sock", "et", "Server_", "import_", "Thread", "ing", "Mix", "In_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "por", "kc", "hop_", "._", "plugin_", "import_", "Por", "kc", "hop", "Plug", "in", "Handler_", "\\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_", "Get", "Handler_", "(_", "Base", "HTTP", "Request", "Handler_", ")_", ":_", "\\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_", "Get", "Handler_", "(_", "Base", "HTTP", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "format\\u", "output_", "(_", "self_", ",_", "fmt_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fmt_", "==_", "'", "json", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "json_", "._", "dumps_", "(_", "data_", ")_", "\\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_", "'\\\\", "n", "'_", "._", "join_", "(_", "self_", "._", "json", "\\u", "path_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Handler_", "(_", "Base", "HTTP", "Request", "Handler_", ")_", ":_", "\\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_", "json", "\\u", "path_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "path", "\\u", "helper_", "(_", "data_", ",_", "path_", ",_", "results_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "val_", "in_", "data_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "val_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "path", "\\u", "helper_", "(_", "val_", ",_", "'/'_", "._", "join_", "(_", "(_", "path_", ",_", "key_", ")_", ")_", ",_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "results_", "._", "append_", "(_", "(_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "(_", "'/'_", "._", "join_", "(_", "(_", "path_", ",_", "key_", ")_", ")_", ")_", "._", "replace_", "(_", "'.'_", ",_", "'\\u'_", ")_", ",_", "val_", ")_", ")_", ")_", "\\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_", "path", "\\u", "helper_", "(_", "data_", ",_", "''_", ",_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Get", "Handler_", "(_", "Base", "HTTP", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "GET_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formats_", "=_", "{_", "'", "json", "'_", ":_", "'", "applica", "tion", "/", "json", "'_", ",_", "'", "text", "'_", ":_", "'", "text", "/", "plain", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "urlparse_", "._", "urlparse_", "(_", "self_", "._", "path_", ")_", "\\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 ", " _", "(_", "path_", ",_", "fmt_", ")_", "=_", "request_", "._", "path_", "._", "split_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fmt_", "not_", "in_", "formats_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fmt_", "=_", "'", "text", "'_", "\\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 ", " _", "path_", "=_", "request_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "headers_", "._", "get_", "(_", "'", "accept", "'_", ",_", "False_", ")_", "==_", "'", "applica", "tion", "/", "json", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fmt_", "=_", "'", "json", "'_", "\\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 ", " _", "fmt_", "=_", "'", "text", "'_", "\\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_", "._", "headers_", "._", "get_", "(_", "'", "x", "-", "por", "kc", "hop", "-", "refre", "sh", "'_", ",_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "force", "\\u", "refresh_", "=_", "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 ", " _", "force", "\\u", "refresh_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "module_", "=_", "path_", "._", "split_", "(_", "'/'_", ")_", "[_", "1_", "]_", "\\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 ", " _", "if_", "module_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plugin_", "=_", "Por", "kc", "hop", "Plug", "in", "Handler_", "._", "plugins_", "[_", "module_", "]_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plugin_", "._", "force", "\\u", "refresh_", "=_", "force", "\\u", "refresh_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "\\u", "message_", "(_", "'", "Call", "ing", " ", "plugin", ":", " ", "%", "s", " ", "with", " ", "force", "=", "%", "s", "'_", "%_", "(_", "module_", ",_", "force", "\\u", "refresh_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "._", "update_", "(_", "{_", "module_", ":_", "plugin_", "._", "data_", "}_", ")_", "\\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 ", " _", "for_", "plugin", "\\u", "name_", ",_", "plugin_", "in_", "Por", "kc", "hop", "Plug", "in", "Handler_", "._", "plugins_", "._", "iteritems_", "(_", ")_", ":_", "\\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 ", " ", " _", "plugin_", "._", "force", "\\u", "refresh_", "=_", "force", "\\u", "refresh_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log", "\\u", "message_", "(_", "'", "Call", "ing", " ", "plugin", ":", " ", "%", "s", " ", "with", " ", "force", "=", "%", "s", "'_", "%_", "(_", "plugin", "\\u", "name_", ",_", "force", "\\u", "refresh_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "plugin", " ", "has", " ", "no", " ", "data", ",", " ", "it", "'", "ll", " ", "only", " ", "have", " ", "one", " ", "key", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "refre", "sht", "ime_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "plugin_", "(_", "self_", ")_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "result_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "data_", "._", "update_", "(_", "{_", "plugin", "\\u", "name_", ":_", "result_", "}_", ")_", "\\u\\u\\uNEWLINE\\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 ", " ", " _", "self_", "._", "log", "\\u", "error_", "(_", "'", "Error", " ", "load", "ing", " ", "plugin", ":", " ", "name", "=", "%", "s", " ", "exception", "=", "%", "s", ",", " ", "traceback", "=", "%", "s", "'_", ",_", "plugin", "\\u", "name_", ",_", "e_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\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_", "len_", "(_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "\\u", "response_", "(_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "formats_", "[_", "fmt_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "end", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wfile_", "._", "write_", "(_", "self_", "._", "format\\u", "output_", "(_", "fmt_", ",_", "data_", ")_", "+_", "'\\\\", "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 ", " _", "raise_", "Exception_", "(_", "'", "Una", "ble", " ", "to", " ", "load", " ", "any", " ", "plugin", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\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 ", " _", "self_", "._", "log", "\\u", "error_", "(_", "'", "Error", ":", " ", "%", "s", "\\\\", "n", "%", "s", "'_", ",_", "e_", ",_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "response_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "header_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "formats_", "[_", "fmt_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "end", "\\u", "headers_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wfile_", "._", "write_", "(_", "self_", "._", "format\\u", "output_", "(_", "fmt_", ",_", "{_", "}_", ")_", ")_", "\\u\\u\\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_", "Thread", "ed", "HTTP", "Server_", "(_", "Thread", "ing", "Mix", "In_", ",_", "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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, 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 ]
Except block handles 'BaseException'
dimagi/commcare-hq/corehq/util/spreadsheets/excel.py
[ { "content": " @classmethod\n def set_field_value(cls, obj, field, value):\n if isinstance(value, basestring):\n value = value.strip()\n # try dict\n try:\n field, subfield = field.split(':')\n except Exception:\n pass\n else:\n field = field.strip()\n\n if field not in obj:\n obj[field] = {}\n\n cls.set_field_value(obj[field], subfield, value)\n return\n\n # try list\n try:\n field, _ = field.split()\n except Exception:\n pass\n else:\n dud = {}\n cls.set_field_value(dud, field, value)\n (field, value), = dud.items()\n\n if field not in obj:\n obj[field] = []\n elif not isinstance(obj[field], list):\n obj[field] = [obj[field]]\n if value not in (None, ''):\n obj[field].append(value)\n return\n\n # else flat\n\n # try boolean\n try:\n field, nothing = field.split('?')\n assert(nothing.strip() == '')\n except Exception:\n pass\n else:\n try:\n value = {\n 'yes': True,\n 'true': True,\n 'no': False,\n 'false': False,\n '': False,\n None: False,\n }[value.lower() if hasattr(value, 'lower') else value]\n except KeyError:\n raise JSONReaderError(\n 'Values for field %s must be \"yes\" or \"no\", not \"%s\"' % (\n field, value)\n )\n\n # set for any flat type\n field = field.strip()\n if field in obj:\n raise JSONReaderError(\n 'You have a repeat field: %s' % field\n )\n\n obj[field] = value", "metadata": "root.IteratorJSONReader.set_field_value", "header": "['class', 'IteratorJSONReader', '(', 'object', ')', ':', '___EOS___']", "index": 58 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Iterat", "or", "JSONR", "eader", "_", "(_", "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_", "set\\u", "field", "\\u", "value_", "(_", "cls_", ",_", "obj_", ",_", "field_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "try", " ", "dict_", "\\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 ", " _", "field_", ",_", "subfield", "_", "=_", "field_", "._", "split_", "(_", "':'_", ")_", "\\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 ", " _", "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 ", " _", "field_", "=_", "field_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "field_", "not_", "in_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "[_", "field_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cls_", "._", "set\\u", "field", "\\u", "value_", "(_", "obj_", "[_", "field_", "]_", ",_", "subfield", "_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", " ", "list_", "\\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 ", " _", "field_", ",_", "\\u_", "=_", "field_", "._", "split_", "(_", ")_", "\\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 ", " _", "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 ", " _", "dud", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls_", "._", "set\\u", "field", "\\u", "value_", "(_", "dud", "_", ",_", "field_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "field_", ",_", "value_", ")_", ",_", "=_", "dud", "_", "._", "items_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "field_", "not_", "in_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "[_", "field_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "not_", "isinstance_", "(_", "obj_", "[_", "field_", "]_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "[_", "field_", "]_", "=_", "[_", "obj_", "[_", "field_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "not_", "in_", "(_", "None_", ",_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "[_", "field_", "]_", "._", "append_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "else", " ", "flat_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", " ", "boolean_", "\\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 ", " _", "field_", ",_", "nothing_", "=_", "field_", "._", "split_", "(_", "'?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "nothing_", "._", "strip_", "(_", ")_", "==_", "''_", ")_", "\\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 ", " _", "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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ye", "s", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "true", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "no", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fal", "se", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "''_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "[_", "value_", "._", "lower_", "(_", ")_", "if_", "hasattr_", "(_", "value_", ",_", "'", "lower", "'_", ")_", "else_", "value_", "]_", "\\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_", "JSONR", "eader", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Value", "s", " ", "for", " ", "field", " ", "%", "s", " ", "must", " ", "be", " ", "\"", "ye", "s", "\"", " ", "or", " ", "\"", "no", "\",", " ", "not", " ", "\"%", "s", "\"'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "field_", ",_", "value_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "for", " ", "any", " ", "flat", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field_", "=_", "field_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "field_", "in_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "JSONR", "eader", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "You", " ", "have", " ", "a", " ", "repeat", " ", "field", ":", " ", "%", "s", "'_", "%_", "field_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "obj_", "[_", "field_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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Returns a dict with tuples of getworks, accepted, reject, priority, percentage\n \"\"\"\n __patch()\n res = {}\n for key in getworks:\n server, username, password, diff = key\n if key not in accepted:\n accepted[key] = 0\n if key not in rejected:\n rejected[key] = 0\n if server not in res:\n res[server] = {}\n name = \":\".join([shorten(username), password])\n if name not in res[server]:\n res[server][name] = [0, 0, 0, 0, 0]\n res[server][name][0] += getworks[key]\n res[server][name][1] += accepted[key]\n res[server][name][2] += rejected[key]\n res[server][name] = map(int, res[server][name])\n return res", "metadata": "root.build_dict", "header": "['module', '___EOS___']", "index": 20 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "build", "\\u", "dict_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "dict", " ", "with", " ", "tuple", "s", " ", "of", " ", "getw", "ork", "s", ",", " ", "accept", "ed", ",", " ", "reject", ",", " ", "priorit", "y", ",", " ", "percentage", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "patch_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "getw", "ork", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", ",_", "username_", ",_", "password_", ",_", "diff_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "not_", "in_", "accepted_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "accepted_", "[_", "key_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "key_", "not_", "in_", "rejected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rejected_", "[_", "key_", "]_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "server_", "not_", "in_", "res_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "[_", "server_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name_", "=_", "\":\"_", "._", "join_", "(_", "[_", "shorten", "_", "(_", "username_", ")_", ",_", "password_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "not_", "in_", "res_", "[_", "server_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "[_", "server_", "]_", "[_", "name_", "]_", "=_", "[_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "[_", "server_", "]_", "[_", "name_", "]_", "[_", "0_", "]_", "+=_", "getw", "ork", "s_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "server_", "]_", "[_", "name_", "]_", "[_", "1_", "]_", "+=_", "accepted_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "server_", "]_", "[_", "name_", "]_", "[_", "2_", "]_", "+=_", "rejected_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "[_", "server_", "]_", "[_", "name_", "]_", "=_", "map_", "(_", "int_", ",_", "res_", "[_", "server_", "]_", "[_", "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__ import print_function\n\n__authors__ = \"Ian Goodfellow\"\n__copyright__ = \"Copyright 2010-2012, Universite de Montreal\"\n__credits__ = [\"Ian Goodfellow\"]\n__license__ = \"3-clause BSD\"\n__maintainer__ = \"LISA Lab\"\n__email__ = \"pylearn-dev@googlegroups\"\n\nimport sys\nfrom pylearn2.utils import serial\n\nif __name__ == \"__main__\":\n for model_path in sys.argv[1:]:\n if len(sys.argv) > 2:\n print(model_path)\n model = serial.load(model_path)\n monitor = model.monitor\n channels = monitor.channels\n for key in sorted(channels.keys()):\n print(key)\n value = channels[key]\n if not hasattr(value, 'doc'):\n print(\"\\tOld pkl file, written before doc system.\")\n else:\n doc = value.doc\n if doc is None:\n print(\"No doc available.\")\n else:\n print(doc)\n print()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "..", " ", "todo", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "WRITE", "ME", "\\", "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_", "\\u\\u", "authors\\u", "\\u_", "=_", "\"", "Ia", "n", " ", "Good", "fel", "low", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "copyright\\u\\u_", "=_", "\"", "Copy", "right", " ", "2010", "-", "2012", ",", " ", "Univers", "ite", " ", "de", " ", "Mont", "real", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "credits\\u\\u_", "=_", "[_", "\"", "Ia", "n", " ", "Good", "fel", "low", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "license\\u\\u_", "=_", "\"", "3", "-", "clause", " ", "BS", "D", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "maintainer\\u\\u_", "=_", "\"", "LIS", "A", " ", "Lab", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "email\\u\\u_", "=_", "\"", "pyl", "earn", "-", "dev", "@", "google", "group", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "utils_", "import_", "serial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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 ", " _", "for_", "model", "\\u", "path_", "in_", "sys_", "._", "argv_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "sys_", "._", "argv_", ")_", ">_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "model", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "model_", "=_", "serial_", "._", "load_", "(_", "model", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "monitor_", "=_", "model_", "._", "monitor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "channels_", "=_", "monitor_", "._", "channels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "sorted_", "(_", "channels_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "channels_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "value_", ",_", "'", "doc", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"\\\\", "t", "Old", " ", "pkl", " ", "file", ",", " ", "writt", "en", " ", "bef", "ore", " ", "doc", " ", "system", ".\"_", ")_", "\\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 ", " _", "doc_", "=_", "value_", "._", "doc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "doc_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "\"", "No", " ", "doc", " ", "avail", "able", ".\"_", ")_", "\\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_", "(_", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
amorton/cassback/cassback/dt_util.py
[ { "content": "#!/usr/bin/env python\n# encoding: utf-8\n\n# Copyright 2012 Aaron Morton\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\"\"\"Functions for working with date's n time n things like that. \n\"\"\"\n\nimport datetime\nimport time\n\nISO_FORMAT = \"%Y-%m-%dT%H:%M:%S.%f\"\n\"\"\"ISO string format\"\"\"\n\nDT_INPUT_FORMATS= [\n \"%Y-%m-%dT%H:%M:%S.%f\",\n \"%Y-%m-%dT%H:%M:%S\", \n \"%Y-%m-%dT%H:%M\", \n \"%Y-%m-%d\"\n]\n\"\"\"Formats to accept as datetime input. \"\"\"\n\n \n \n \n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def now():\n return datetime.datetime.utcnow()", "metadata": "root.now", "header": "['module', '___EOS___']", "index": 33 }, { "content": "def now_local():\n return datetime.datetime.now()", "metadata": "root.now_local", "header": "['module', '___EOS___']", "index": 36 }, { "content": "def now_iso():\n \"\"\"Get the current date/time formatted as ISO.\"\"\"\n return to_iso(now())", "metadata": "root.now_iso", "header": "['module', '___EOS___']", "index": 39 }, { "content": "def to_iso(dt):\n \"\"\"Convert the `dt` datetime to iso format. \n \"\"\"\n return dt.strftime(ISO_FORMAT)", "metadata": "root.to_iso", "header": "['module', '___EOS___']", "index": 43 }, { "content": "def from_iso(dt_str):\n \"\"\"Convert the iso ``dt_str`` to a datetime. \n \"\"\"\n return datetime.datetime.strptime(dt_str, ISO_FORMAT)", "metadata": "root.from_iso", "header": "['module', '___EOS___']", "index": 48 }, { "content": "def to_utc(dt):\n \"\"\"Convert a local datetime to utc.\"\"\"\n time_tuple = time.gmtime(time.mktime(dt.timetuple()))\n return datetime.datetime(*time_tuple[0:6])", "metadata": "root.to_utc", "header": "['module', '___EOS___']", "index": 53 }, { "content": "def parse_date_input(input, formats=DT_INPUT_FORMATS):\n \"\"\"Parse the datetime input ``input`` using the ``formats``.\n \n If input cannot be parsed a :exc:`ValueError` is raised. \n \"\"\"\n\n for fmt in formats:\n try:\n return datetime.datetime.strptime(input, fmt)\n except (ValueError):\n pass\n raise ValueError(\"'%(input)s' is not a valid datetime.\" % vars())", "metadata": "root.parse_date_input", "header": "['module', '___EOS___']", "index": 58 } ]
[]
[]
0
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_", "#", " ", "Copy", "right", " ", "2012", " ", "Aa", "ron", " ", "Mor", "ton_", "\\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_", "\"\"\"", "Function", "s", " ", "for", " ", "working", " ", "with", " ", "date", "'", "s", " ", "n", " ", "time", " ", "n", " ", "thing", "s", " ", "like", " ", "tha", "t", ".", " ", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ISO", "\\u", "FORMAT_", "=_", "\"%", "Y", "-%", "m", "-%", "d", "T", "%", "H", ":", "%", "M", ":", "%", "S", ".", "%", "f", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "ISO", " ", "string", " ", "format", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DT", "\\u", "INPUT", "\\u", "FORMATS_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "Y", "-%", "m", "-%", "d", "T", "%", "H", ":", "%", "M", ":", "%", "S", ".", "%", "f", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "Y", "-%", "m", "-%", "d", "T", "%", "H", ":", "%", "M", ":", "%", "S", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "Y", "-%", "m", "-%", "d", "T", "%", "H", ":", "%", "M", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "Y", "-%", "m", "-%", "d", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Format", "s", " ", "to", " ", "accept", " ", "as", " ", "datetime", " ", "input", ".", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "now_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\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_", "now", "\\u", "local_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\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_", "now", "\\u", "iso_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "current", " ", "date", "/", "time", " ", "format", "ted", " ", "as", " ", "ISO", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "to", "\\u", "iso_", "(_", "now_", "(_", ")_", ")_", "\\u\\u\\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_", "to", "\\u", "iso_", "(_", "dt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "the", " ", "`", "dt", "`", " ", "datetime", " ", "to", " ", "iso", " ", "format", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dt_", "._", "strftime_", "(_", "ISO", "\\u", "FORMAT_", ")_", "\\u\\u\\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_", "from", "\\u", "iso_", "(_", "dt", "\\u", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "the", " ", "iso", " ", "``", "dt", "\\u", "str", "``", " ", "to", " ", "a", " ", "datetime", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "dt", "\\u", "str_", ",_", "ISO", "\\u", "FORMAT_", ")_", "\\u\\u\\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_", "to", "\\u", "utc_", "(_", "dt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "a", " ", "local", " ", "datetime", " ", "to", " ", "utc", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time", "\\u", "tuple_", "=_", "time_", "._", "gmtime_", "(_", "time_", "._", "mktime_", "(_", "dt_", "._", "timetuple_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "datetime_", "._", "datetime_", "(_", "*_", "time", "\\u", "tuple_", "[_", "0_", ":_", "6_", "]_", ")_", "\\u\\u\\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", "date", "\\u", "input_", "(_", "input_", ",_", "formats_", "=_", "DT", "\\u", "INPUT", "\\u", "FORMATS_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "e", " ", "the", " ", "datetime", " ", "input", " ", "``", "input", "``", " ", "usi", "ng", " ", "the", " ", "``", "formats", "``.", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "input", " ", "cann", "ot", " ", "be", " ", "parsed", " ", "a", " ", ":", "exc", ":`", "Value", "Error", "`", " ", "is", " ", "raise", "d", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "fmt_", "in_", "formats_", ":_", "\\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_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "input_", ",_", "fmt_", ")_", "\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Value", "Error_", "(_", "\"'", "%", "(", "input", ")", "s", "'", " ", "is", " ", "not", " ", "a", " ", "valid", " ", "datetime", ".\"_", "%_", "vars_", "(_", ")_", ")_" ]
[ 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,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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 ]
Except block handles 'BaseException'
peterbe/django-mongokit/django_mongokit/tests.py
[ { "content": " def test_create_test_database(self):\n from django.conf import settings\n try:\n assert 'mongodb' in settings.DATABASES\n except AttributeError:\n # Django <1.2\n return # :(\n old_database_name = settings.DATABASES['mongodb']['NAME']\n assert 'test_' not in old_database_name\n # pretend we're the Django 'test' command\n\n from django.db import connections\n connection = connections['mongodb']\n\n connection.creation.create_test_db()\n test_database_name = settings.DATABASES['mongodb']['NAME']\n self.assertTrue('test_' in test_database_name)\n\n from mongokit import Connection\n con = Connection()\n # the test database isn't created till it's needed\n self.assertTrue(test_database_name not in con.database_names())\n\n # creates it\n db = con[settings.DATABASES['mongodb']['NAME']]\n coll = db.test_collection_name\n # do a query on the collection to force the database to be created\n list(coll.find())\n test_database_name = settings.DATABASES['mongodb']['NAME']\n self.assertTrue(test_database_name in con.database_names())\n\n connection.creation.destroy_test_db(old_database_name)\n self.assertTrue('test_' not in settings.DATABASES['mongodb']['NAME'])\n self.assertTrue(test_database_name not in con.database_names())\n\n # this should work even though it doesn't need to do anything\n connection.close()", "metadata": "root.MongoDBBaseTestCase.test_create_test_database", "header": "['class', 'MongoDBBaseTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 195 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Mon", "go", "DB", "Base", "Test", "Case_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "\\u", "test\\u", "database_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "'", "mongodb", "'_", "in_", "settings_", "._", "DATABASES_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Dj", "ang", "o", " ", "<", "1.2_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "#", " ", ":(", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "databa", "se", "\\u", "name_", "=_", "settings_", "._", "DATABASES_", "[_", "'", "mongodb", "'_", "]_", "[_", "'", "NAME", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'", "test\\u", "'_", "not_", "in_", "old", "\\u", "databa", "se", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "prete", "nd", " ", "we", "'", "re", " ", "the", " ", "Dj", "ang", "o", " ", "'", "test", "'", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "connections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "connection_", "=_", "connections_", "[_", "'", "mongodb", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "connection_", "._", "creation_", "._", "create", "\\u", "test\\u", "db_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "databa", "se", "\\u", "name_", "=_", "settings_", "._", "DATABASES_", "[_", "'", "mongodb", "'_", "]_", "[_", "'", "NAME", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "test\\u", "'_", "in_", "test\\u", "databa", "se", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mongo", "kit_", "import_", "Connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "con_", "=_", "Connection_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "test", " ", "databa", "se", " ", "isn", "'", "t", " ", "created", " ", "till", " ", "it", "'", "s", " ", "needed_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "test\\u", "databa", "se", "\\u", "name_", "not_", "in_", "con_", "._", "databa", "se", "\\u", "names_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", "s", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "=_", "con_", "[_", "settings_", "._", "DATABASES_", "[_", "'", "mongodb", "'_", "]_", "[_", "'", "NAME", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coll_", "=_", "db_", "._", "test\\u", "collection", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "do", " ", "a", " ", "query", " ", "on", " ", "the", " ", "collection", " ", "to", " ", "force", " ", "the", " ", "databa", "se", " ", "to", " ", "be", " ", "created_", "\\u\\u\\uNL\\u\\u\\u_", "list_", "(_", "coll_", "._", "find_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "databa", "se", "\\u", "name_", "=_", "settings_", "._", "DATABASES_", "[_", "'", "mongodb", "'_", "]_", "[_", "'", "NAME", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "test\\u", "databa", "se", "\\u", "name_", "in_", "con_", "._", "databa", "se", "\\u", "names_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "connection_", "._", "creation_", "._", "destroy", "\\u", "test\\u", "db_", "(_", "old", "\\u", "databa", "se", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "test\\u", "'_", "not_", "in_", "settings_", "._", "DATABASES_", "[_", "'", "mongodb", "'_", "]_", "[_", "'", "NAME", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "test\\u", "databa", "se", "\\u", "name_", "not_", "in_", "con_", "._", "databa", "se", "\\u", "names_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "shou", "ld", " ", "work", " ", "even", " ", "tho", "ugh", " ", "it", " ", "doe", "sn", "'", "t", " ", "need", " ", "to", " ", "do", " ", "anyt", "hing_", "\\u\\u\\uNL\\u\\u\\u_", "connection_", "._", "close_", "(_", ")_", "\\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,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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 ]
Unused import
svetlyak40wt/django-counter/src/django_counter/templatetags/counter_tags.py
[ { "content": "from django import template\nfrom django.contrib.contenttypes.models import ContentType\nfrom django.contrib.sites.models import Site\nfrom django_counter.models import ViewCounter\n\n\nregister = template.Library()\nregister.inclusion_tag('counter/counter.html')(counter)\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def counter(object):\n ctype = ContentType.objects.get_for_model(object)\n return {\n 'ctype': ctype,\n 'object': object,\n 'site': Site.objects.get_current()}", "metadata": "root.counter", "header": "['module', '___EOS___']", "index": 5 }, { "content": "@register.tag('view_count')\ndef do_count(parser, token):\n \"\"\"example: {% view_count for app.model object_id as varname %}\"\"\"\n try:\n tag, tmp_for, package, obj, tmp_as, var = token.split_contents()\n if tmp_for != 'for': raise ValueError\n if tmp_as != 'as': raise ValueError\n app, model = package.split('.')\n except ValueError:\n raise template.TemplateSyntaxError, \"The valid syntax for view_count tag is: 'view_count for app.model object_id as varname'\"\n content_type = ContentType.objects.get(app_label__exact=app, model__exact=model)\n return ViewCountNode(content_type=content_type, obj=obj, var=var)", "metadata": "root.do_count", "header": "['module', '___EOS___']", "index": 15 }, { "content": "class ViewCountNode(template.Node):\n", "metadata": "root.ViewCountNode", "header": "['module', '___EOS___']", "index": 29 }, { "content": " def __init__(self, content_type, obj, var):\n self.content_type = content_type\n self.obj = obj\n self.var = var", "metadata": "root.ViewCountNode.__init__", "header": "['class', 'ViewCountNode', '(', 'template', '.', 'Node', ')', ':', '___EOS___']", "index": 30 }, { "content": " def render(self, context):\n if self.obj.isdigit():\n object_id = self.obj\n else:\n try:\n object_id = template.resolve_variable(self.obj, context)\n except template.VariableDoesNotExist:\n return ''\n try:\n count = ViewCounter.objects.get(content_type=self.content_type, object_id=object_id).count\n except ViewCounter.DoesNotExist:\n count = 0\n context[self.var] = count\n return ''", "metadata": "root.ViewCountNode.render", "header": "['class', 'ViewCountNode', '(', 'template', '.', 'Node', ')', ':', '___EOS___']", "index": 35 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "import_", "template_", "\\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_", "._", "sites_", "._", "models_", "import_", "Site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django", "\\u", "counter_", "._", "models_", "import_", "View", "Counter_", "\\u\\u\\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_", "register_", "=_", "template_", "._", "Library_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register_", "._", "inclusion", "\\u", "tag_", "(_", "'", "counter", "/", "counter", ".", "html", "'_", ")_", "(_", "counter_", ")_", "\\u\\u\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "counter_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctype_", "=_", "Conten", "t", "Type_", "._", "objects_", "._", "get", "\\u", "for", "\\u", "model_", "(_", "object_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ctype", "'_", ":_", "ctype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object", "'_", ":_", "object_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "site", "'_", ":_", "Site_", "._", "objects_", "._", "get", "\\u", "current_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "register_", "._", "tag_", "(_", "'", "view", "\\u", "count", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "do", "\\u", "count_", "(_", "parser_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "example", ":", " ", "{%", " ", "view", "\\u", "count", " ", "for", " ", "app", ".", "model", " ", "object\\u", "id", " ", "as", " ", "varname", " ", "%}", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag_", ",_", "tmp", "\\u", "for_", ",_", "package_", ",_", "obj_", ",_", "tmp", "\\u", "as_", ",_", "var_", "=_", "token_", "._", "split", "\\u", "contents_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp", "\\u", "for_", "!=_", "'", "for", "'_", ":_", "raise_", "Value", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tmp", "\\u", "as_", "!=_", "'", "as", "'_", ":_", "raise_", "Value", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", ",_", "model_", "=_", "package_", "._", "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 ", " _", "raise_", "template_", "._", "Templa", "te", "Syntax", "Error_", ",_", "\"", "The", " ", "valid", " ", "synta", "x", " ", "for", " ", "view", "\\u", "count", " ", "tag", " ", "is", ":", " ", "'", "view", "\\u", "count", " ", "for", " ", "app", ".", "model", " ", "object\\u", "id", " ", "as", " ", "varname", "'\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "content", "\\u", "type_", "=_", "Conten", "t", "Type_", "._", "objects_", "._", "get_", "(_", "app", "\\u", "label", "\\u\\u", "exact_", "=_", "app_", ",_", "model", "\\u\\u", "exact_", "=_", "model_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "View", "Count", "Node_", "(_", "content", "\\u", "type_", "=_", "content", "\\u", "type_", ",_", "obj_", "=_", "obj_", ",_", "var_", "=_", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "View", "Count", "Node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "View", "Count", "Node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "content", "\\u", "type_", ",_", "obj_", ",_", "var_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "content", "\\u", "type_", "=_", "content", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "obj_", "=_", "obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "var_", "=_", "var_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "View", "Count", "Node_", "(_", "template_", "._", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "obj_", "._", "isdigit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object\\u", "id_", "=_", "self_", "._", "obj_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object\\u", "id_", "=_", "template_", "._", "resolve", "\\u", "variable_", "(_", "self_", "._", "obj_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "template_", "._", "Varia", "ble", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "View", "Counter_", "._", "objects_", "._", "get_", "(_", "content", "\\u", "type_", "=_", "self_", "._", "content", "\\u", "type_", ",_", "object\\u", "id_", "=_", "object\\u", "id_", ")_", "._", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "View", "Counter_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "[_", "self_", "._", "var_", "]_", "=_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "''_" ]
[ 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
First parameter of a method is not named 'self'
ngsutils/ngsutils/ngsutils/bam/t/__init__.py
[ { "content": " def __init__(self, qname, seq=None, qual=None, tid=-1, pos=-1, aend=None, cigar=None, tags=None, mapq=0, rnext=-1, pnext=-1, isize=0, tlen=0, is_reverse=False, is_paired=False, is_secondary=False, is_qcfail=False, mate_is_unmapped=False, mate_is_reverse=False, is_read1=False, is_read2=False, flag=0, bam=None):\n self.qname = qname\n self.seq = seq.upper() if seq else ''\n self.qual = qual\n self.tid = tid\n self.pos = pos\n self.aend = aend\n self.mapq = mapq\n self.rnext = rnext\n self.pnext = pnext\n self.isize = isize\n self.tlen = tlen\n self.bam = bam\n\n self.is_paired = is_paired\n self.is_reverse = is_reverse\n self.is_secondary = is_secondary\n self.is_qcfail = is_qcfail\n self.mate_is_reverse = mate_is_reverse\n self.is_read1 = is_read1\n self.is_read2 = is_read2\n\n if flag:\n self._flag = flag\n self.is_paired = 0x1 & self.flag > 0\n self.is_unmapped = 0x4 & self.flag > 0\n self.mate_is_unmapped = 0x8 & self.flag > 0\n self.is_reverse = 0x10 & self.flag > 0\n self.mate_is_reverse = 0x20 & self.flag > 0\n self.is_read1 = 0x40 & self.flag > 0\n self.is_read2 = 0x80 & self.flag > 0\n self.is_secondary = 0x100 & self.flag > 0\n self.is_qcfail = 0x200 & self.flag > 0\n else:\n self._flag = 0\n self._flag |= 0x1 if self.is_paired else 0\n self._flag |= 0x4 if self.is_unmapped else 0\n self._flag |= 0x8 if self.mate_is_unmapped else 0\n self._flag |= 0x10 if self.is_reverse else 0\n self._flag |= 0x20 if self.mate_is_reverse else 0\n self._flag |= 0x40 if self.is_read1 else 0\n self._flag |= 0x80 if self.is_read2 else 0\n self._flag |= 0x100 if self.is_secondary else 0\n self._flag |= 0x200 if self.is_qcfail else 0\n\n if self.tid == -1 or self.pos == -1:\n self.is_unmapped = True\n\n if self.is_paired:\n if self.rnext == -1 or self.pnext == -1:\n self.mate_is_unmapped = True\n\n if cigar:\n self.cigar = ngsutils.bam.cigar_fromstr(cigar)\n if not aend:\n self.aend = self.pos + ngsutils.bam.cigar_read_len(self.cigar)\n else:\n self.cigar = None\n\n if tags:\n self.tags = tags\n else:\n self.tags = [('IH', 1), ('HI', 1)]", "metadata": "root.MockRead.__init__", "header": "['class', 'MockRead', '(', 'object', ')', ':', '___EOS___']", "index": 178 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Moc", "k", "Read_", "(_", "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_", ",_", "qname_", ",_", "seq_", "=_", "None_", ",_", "qual_", "=_", "None_", ",_", "tid_", "=_", "-_", "1_", ",_", "pos_", "=_", "-_", "1_", ",_", "ae", "nd_", "=_", "None_", ",_", "cigar", "_", "=_", "None_", ",_", "tags_", "=_", "None_", ",_", "map", "q_", "=_", "0_", ",_", "rne", "xt_", "=_", "-_", "1_", ",_", "pne", "xt_", "=_", "-_", "1_", ",_", "isi", "ze_", "=_", "0_", ",_", "tle", "n_", "=_", "0_", ",_", "is", "\\u", "reverse_", "=_", "False_", ",_", "is", "\\u", "paired", "_", "=_", "False_", ",_", "is", "\\u", "secondary_", "=_", "False_", ",_", "is", "\\u", "qc", "fail_", "=_", "False_", ",_", "mate", "\\u", "is", "\\u", "unmapped", "_", "=_", "False_", ",_", "mate", "\\u", "is", "\\u", "reverse_", "=_", "False_", ",_", "is", "\\u", "read", "1_", "=_", "False_", ",_", "is", "\\u", "read", "2_", "=_", "False_", ",_", "flag_", "=_", "0_", ",_", "bam_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "qname_", "=_", "qname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "seq_", "=_", "seq_", "._", "upper_", "(_", ")_", "if_", "seq_", "else_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "qual_", "=_", "qual_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tid_", "=_", "tid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pos_", "=_", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ae", "nd_", "=_", "ae", "nd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "map", "q_", "=_", "map", "q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rne", "xt_", "=_", "rne", "xt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pne", "xt_", "=_", "pne", "xt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "isi", "ze_", "=_", "isi", "ze_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tle", "n_", "=_", "tle", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bam_", "=_", "bam_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "is", "\\u", "paired", "_", "=_", "is", "\\u", "paired", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "reverse_", "=_", "is", "\\u", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "secondary_", "=_", "is", "\\u", "secondary_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "qc", "fail_", "=_", "is", "\\u", "qc", "fail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mate", "\\u", "is", "\\u", "reverse_", "=_", "mate", "\\u", "is", "\\u", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "read", "1_", "=_", "is", "\\u", "read", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "read", "2_", "=_", "is", "\\u", "read", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "flag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "flag_", "=_", "flag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "paired", "_", "=_", "0x1_", "&_", "self_", "._", "flag_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "unmapped", "_", "=_", "0x4_", "&_", "self_", "._", "flag_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mate", "\\u", "is", "\\u", "unmapped", "_", "=_", "0x8_", "&_", "self_", "._", "flag_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "reverse_", "=_", "0x10_", "&_", "self_", "._", "flag_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mate", "\\u", "is", "\\u", "reverse_", "=_", "0x20_", "&_", "self_", "._", "flag_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "read", "1_", "=_", "0x40_", "&_", "self_", "._", "flag_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "read", "2_", "=_", "0x80_", "&_", "self_", "._", "flag_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "secondary_", "=_", "0x100", "_", "&_", "self_", "._", "flag_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "is", "\\u", "qc", "fail_", "=_", "0x200", "_", "&_", "self_", "._", "flag_", ">_", "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 ", " _", "self_", "._", "\\u", "flag_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "flag_", "|=_", "0x1_", "if_", "self_", "._", "is", "\\u", "paired", "_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "flag_", "|=_", "0x4_", "if_", "self_", "._", "is", "\\u", "unmapped", "_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "flag_", "|=_", "0x8_", "if_", "self_", "._", "mate", "\\u", "is", "\\u", "unmapped", "_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "flag_", "|=_", "0x10_", "if_", "self_", "._", "is", "\\u", "reverse_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "flag_", "|=_", "0x20_", "if_", "self_", "._", "mate", "\\u", "is", "\\u", "reverse_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "flag_", "|=_", "0x40_", "if_", "self_", "._", "is", "\\u", "read", "1_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "flag_", "|=_", "0x80_", "if_", "self_", "._", "is", "\\u", "read", "2_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "flag_", "|=_", "0x100", "_", "if_", "self_", "._", "is", "\\u", "secondary_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "flag_", "|=_", "0x200", "_", "if_", "self_", "._", "is", "\\u", "qc", "fail_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "tid_", "==_", "-_", "1_", "or_", "self_", "._", "pos_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "is", "\\u", "unmapped", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "paired", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "rne", "xt_", "==_", "-_", "1_", "or_", "self_", "._", "pne", "xt_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mate", "\\u", "is", "\\u", "unmapped", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cigar", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cigar", "_", "=_", "ngs", "utils_", "._", "bam_", "._", "cigar", "\\u", "froms", "tr_", "(_", "cigar", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "ae", "nd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ae", "nd_", "=_", "self_", "._", "pos_", "+_", "ngs", "utils_", "._", "bam_", "._", "cigar", "\\u", "read", "\\u", "len_", "(_", "self_", "._", "cigar", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cigar", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tags_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tags_", "=_", "tags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tags_", "=_", "[_", "(_", "'", "IH", "'_", ",_", "1_", ")_", ",_", "(_", "'", "HI", "'_", ",_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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self, key, default=None, with_age=False, max_age=None):\n try:\n return self.__getitem__(key.casefold(), with_age, max_age)\n except KeyError:\n if with_age:\n return default, None\n else:\n return default", "metadata": "root.ExpiringDict.get", "header": "['class', 'ExpiringDict', '(', 'collections', '.', 'OrderedDict', ')', ':', '___EOS___']", "index": 150 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Expir", "ing", "Dict_", "(_", "collections_", "._", "Order", "ed", "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_", "get_", "(_", "self_", ",_", "key_", ",_", "default_", "=_", "None_", ",_", "with", "\\u", "age_", "=_", "False_", ",_", "max", "\\u", "age_", "=_", "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 ", " _", "return_", "self_", "._", "\\u\\u", "getitem\\u\\u_", "(_", "key_", "._", "case", "fold_", "(_", ")_", ",_", "with", "\\u", "age_", ",_", "max", "\\u", "age_", ")_", "\\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 ", " _", "if_", "with", "\\u", "age_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "default_", ",_", "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 ", " _", "return_", "default_", "\\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 ]
Unused import
Robpol86/Flask-Celery-Helper/tests/conftest.py
[ { "content": "\"\"\"pytest configuration for all tests in all directories.\"\"\"\n\nimport threading\nimport time\n\nfrom celery.signals import worker_ready\nimport pytest\n\nfrom tests.instances import app, celery\n\nWORKER_READY = list()\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Worker(threading.Thread):", "metadata": "root.Worker", "header": "['module', '___EOS___']", "index": 13 }, { "content": " def run(self):\n celery_args = ['-C', '-q', '-c', '1', '-P', 'solo', '--without-gossip']\n with app.app_context():\n celery.worker_main(celery_args)", "metadata": "root.Worker.run", "header": "['class', 'Worker', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 14 }, { "content": "@worker_ready.connect\ndef on_worker_ready(**_):\n \"\"\"Called when the Celery worker thread is ready to do work.\n\n This is to avoid race conditions since everything is in one python process.\n \"\"\"\n WORKER_READY.append(True)", "metadata": "root.on_worker_ready", "header": "['module', '___EOS___']", "index": 20 }, { "content": "@pytest.fixture(autouse=True, scope='session')\ndef celery_worker():\n \"\"\"Starts the Celery worker in a background thread.\"\"\"\n thread = Worker()\n thread.daemon = True\n thread.start()\n for i in range(10): # Wait for worker to finish initializing to avoid a race condition I've been experiencing.\n if WORKER_READY:\n break\n time.sleep(1)", "metadata": "root.celery_worker", "header": "['module', '___EOS___']", "index": 29 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "pytest", " ", "configura", "tion", " ", "for", " ", "all", " ", "tests", " ", "in", " ", "all", " ", "director", "ies", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "celery_", "._", "signals_", "import_", "worker", "\\u", "ready_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "tests_", "._", "instances_", "import_", "app_", ",_", "celery_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "WORKER", "\\u", "READY", "_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Worker_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Worker_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\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 ", " _", "celery", "\\u", "args_", "=_", "[_", "'-", "C", "'_", ",_", "'-", "q", "'_", ",_", "'-", "c", "'_", ",_", "'", "1", "'_", ",_", "'-", "P", "'_", ",_", "'", "solo", "'_", ",_", "'--", "with", "out", "-", "gos", "sip", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "app_", "._", "app", "\\u", "context_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "celery_", "._", "worker", "\\u", "main_", "(_", "celery", "\\u", "args_", ")_", "\\u\\u\\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_", "@_", "worker", "\\u", "ready_", "._", "connect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "on", "\\u", "worker", "\\u", "ready_", "(_", "**_", "\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Call", "ed", " ", "whe", "n", " ", "the", " ", "Celery", " ", "worker", " ", "thread", " ", "is", " ", "read", "y", " ", "to", " ", "do", " ", "work", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "to", " ", "avoid", " ", "race", " ", "condition", "s", " ", "sinc", "e", " ", "every", "thing", " ", "is", " ", "in", " ", "one", " ", "python", " ", "process", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WORKER", "\\u", "READY", "_", "._", "append_", "(_", "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_", "@_", "pytest_", "._", "fixture_", "(_", "autou", "se_", "=_", "True_", ",_", "scope_", "=_", "'", "session", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "celery", "\\u", "worker_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Start", "s", " ", "the", " ", "Celery", " ", "worker", " ", "in", " ", "a", " ", "background", " ", "thread", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "=_", "Worker_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "daemon_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "thread_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "10_", ")_", ":_", "#", " ", "Wait", " ", "for", " ", "worker", " ", "to", " ", "finish", " ", "initiali", "zin", "g", " ", "to", " ", "avoid", " ", "a", " ", "race", " ", "condition", " ", "I", "'", "ve", " ", "bee", "n", " ", "expe", "rien", "cing", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "WORKER", "\\u", "READY", "_", ":_", "\\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_", "time_", "._", "sleep_", "(_", "1_", ")_" ]
[ 4, 4, 4, 4, 4, 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 ]
Unused import
saltstack/salt/salt/modules/mssql.py
[ { "content": "# -*- coding: utf-8 -*-\n'''\nModule to provide MS SQL Server compatibility to salt.\n\n:depends: - FreeTDS\n - pymssql Python module\n\n:configuration: In order to connect to MS SQL Server, certain configuration is\n required in minion configs/pillars on the relevant minions. Some sample\n pillars might look like::\n\n mssql.server: 'localhost'\n mssql.port: 1433\n mssql.user: 'sysdba'\n mssql.password: 'Some preferable complex password'\n mssql.database: ''\n\n The default for the port is '1433' and for the database is '' (empty string);\n in most cases they can be left at the default setting.\n Options that are directly passed into functions will overwrite options from\n configs or pillars.\n'''\n\n# Import python libs\nfrom __future__ import absolute_import\nfrom json import JSONEncoder, loads\n\ntry:\n import pymssql\n HAS_ALL_IMPORTS = True\nexcept ImportError:\n HAS_ALL_IMPORTS = False\n\n\n_DEFAULTS = {\n 'server': 'localhost',\n 'port': 1433,\n 'user': 'sysdba',\n 'password': '',\n 'database': '',\n 'as_dict': False\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": "def __virtual__():\n '''\n Only load this module if all imports succeeded bin exists\n '''\n if HAS_ALL_IMPORTS:\n return True\n return (False, 'The mssql execution module cannot be loaded: the pymssql python library is not available.')", "metadata": "root.__virtual__", "header": "['module', '___EOS___']", "index": 44 }, { "content": "def _get_connection(**kwargs):\n connection_args = {}\n for arg in ('server', 'port', 'user', 'password', 'database', 'as_dict'):\n if arg in kwargs:\n connection_args[arg] = kwargs[arg]\n else:\n connection_args[arg] = __salt__['config.option']('mssql.'+arg, _DEFAULTS.get(arg, None))\n return pymssql.connect(**connection_args)", "metadata": "root._get_connection", "header": "['module', '___EOS___']", "index": 53 }, { "content": "class _MssqlEncoder(JSONEncoder):\n # E0202: 68:_MssqlEncoder.default: An attribute inherited from JSONEncoder hide this method", "metadata": "root._MssqlEncoder", "header": "['module', '___EOS___']", "index": 63 }, { "content": " def default(self, o): # pylint: disable=E0202\n return str(o)", "metadata": "root._MssqlEncoder.default", "header": "['class', '_MssqlEncoder', '(', 'JSONEncoder', ')', ':', '___NEWLINE___', '# E0202: 68:_MssqlEncoder.default: An attribute inherited from JSONEncoder hide this method', '___NL___', '___EOS___']", "index": 65 }, { "content": "def tsql_query(query, **kwargs):\n '''\n Run a SQL query and return query result as list of tuples, or a list of dictionaries if as_dict was passed, or an empty list if no data is available.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt minion mssql.tsql_query 'SELECT @@version as version' as_dict=True\n '''\n try:\n cur = _get_connection(**kwargs).cursor()\n cur.execute(query)\n # Making sure the result is JSON serializable\n return loads(_MssqlEncoder().encode({'resultset': cur.fetchall()}))['resultset']\n except Exception as e:\n # Trying to look like the output of cur.fetchall()\n return (('Could not run the query', ), (str(e), ))", "metadata": "root.tsql_query", "header": "['module', '___EOS___']", "index": 69 }, { "content": "def version(**kwargs):\n '''\n Return the version of a MS SQL server.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt minion mssql.version\n '''\n return tsql_query('SELECT @@version', **kwargs)", "metadata": "root.version", "header": "['module', '___EOS___']", "index": 89 }, { "content": "def db_list(**kwargs):\n '''\n Return the databse list created on a MS SQL server.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt minion mssql.db_list\n '''\n return [row[0] for row in tsql_query('SELECT name FROM sys.databases', as_dict=False, **kwargs)]", "metadata": "root.db_list", "header": "['module', '___EOS___']", "index": 102 }, { "content": "def db_exists(database_name, **kwargs):\n '''\n Find if a specific database exists on the MS SQL server.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt minion mssql.db_exists database_name='DBNAME'\n '''\n # We should get one, and only one row\n return len(tsql_query(\"SELECT database_id FROM sys.databases WHERE NAME='{0}'\".format(database_name), **kwargs)) == 1", "metadata": "root.db_exists", "header": "['module', '___EOS___']", "index": 115 }, { "content": "def db_remove(database_name, **kwargs):\n '''\n Drops a specific database from the MS SQL server.\n It will not drop any of 'master', 'model', 'msdb' or 'tempdb'.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt minion mssql.db_remove database_name='DBNAME'\n '''\n try:\n if db_exists(database_name) and database_name not in ['master', 'model', 'msdb', 'tempdb']:\n conn = _get_connection(**kwargs)\n conn.autocommit(True)\n cur = conn.cursor()\n cur.execute('ALTER DATABASE {0} SET SINGLE_USER WITH ROLLBACK IMMEDIATE'.format(database_name))\n cur.execute('DROP DATABASE {0}'.format(database_name))\n conn.autocommit(False)\n conn.close()\n return True\n else:\n return False\n except Exception as e:\n return 'Could not find the database: {0}'.format(e)", "metadata": "root.db_remove", "header": "['module', '___EOS___']", "index": 129 }, { "content": "def role_list(**kwargs):\n\n '''\n Lists database roles.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt minion mssql.role_list\n '''\n return tsql_query(query='sp_helprole', as_dict=True, **kwargs)", "metadata": "root.role_list", "header": "['module', '___EOS___']", "index": 156 }, { "content": "def role_exists(role, **kwargs):\n\n '''\n Checks if a role exists.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt minion mssql.role_exists db_owner\n '''\n # We should get one, and only one row\n return len(tsql_query(query='sp_helprole \"{0}\"'.format(role), as_dict=True, **kwargs)) == 1", "metadata": "root.role_exists", "header": "['module', '___EOS___']", "index": 170 }, { "content": "def role_create(role, owner=None, **kwargs):\n '''\n Creates a new database role.\n If no owner is specified, the role will be owned by the user that\n executes CREATE ROLE, which is the user argument or mssql.user option.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt minion mssql.role_create role=product01 owner=sysdba\n '''\n try:\n conn = _get_connection(**kwargs)\n conn.autocommit(True)\n cur = conn.cursor()\n if owner:\n cur.execute('CREATE ROLE {0} AUTHORIZATION {1}'.format(role, owner))\n else:\n cur.execute('CREATE ROLE {0}'.format(role))\n conn.autocommit(True)\n conn.close()\n return True\n except Exception as e:\n return 'Could not create the role: {0}'.format(e)", "metadata": "root.role_create", "header": "['module', '___EOS___']", "index": 185 }, { "content": "def role_remove(role, **kwargs):\n '''\n Remove a database role.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt minion mssql.role_create role=test_role01\n '''\n try:\n conn = _get_connection(**kwargs)\n conn.autocommit(True)\n cur = conn.cursor()\n cur.execute('DROP ROLE {0}'.format(role))\n conn.autocommit(True)\n conn.close()\n return True\n except Exception as e:\n return 'Could not create the role: {0}'.format(e)", "metadata": "root.role_remove", "header": "['module', '___EOS___']", "index": 212 }, { "content": "def login_exists(login, **kwargs):\n '''\n Find if a login exists in the MS SQL server.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt minion mssql.login_exists 'LOGIN'\n '''\n try:\n # We should get one, and only one row\n return len(tsql_query(query=\"SELECT name FROM sys.syslogins WHERE name='{0}'\".format(login), **kwargs)) == 1\n\n except Exception as e:\n return 'Could not find the login: {0}'.format(e)", "metadata": "root.login_exists", "header": "['module', '___EOS___']", "index": 234 }, { "content": "def user_exists(username, **kwargs):\n '''\n Find if an user exists in a specific database on the MS SQL server.\n\n Note:\n *database* argument is mandatory\n\n CLI Example:\n\n .. code-block:: bash\n\n salt minion mssql.user_exists 'USERNAME' [database='DBNAME']\n '''\n # 'database' argument is mandatory\n if 'database' not in kwargs:\n return False\n\n # We should get one, and only one row\n return len(tsql_query(query=\"SELECT name FROM sysusers WHERE name='{0}'\".format(username), **kwargs)) == 1", "metadata": "root.user_exists", "header": "['module', '___EOS___']", "index": 252 }, { "content": "def user_list(**kwargs):\n '''\n Get the user list for a specific database on the MS SQL server.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt minion mssql.user_list [database='DBNAME']\n '''\n return [row[0] for row in tsql_query(\"SELECT name FROM sysusers where issqluser=1 or isntuser=1\", as_dict=False, **kwargs)]", "metadata": "root.user_list", "header": "['module', '___EOS___']", "index": 273 }, { "content": "def user_create(username, new_login_password=None, **kwargs):\n '''\n Creates a new user.\n If new_login_password is not specified, the user will be created without a login.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt minion mssql.user_create USERNAME database=DBNAME [new_login_password=PASSWORD]\n '''\n # 'database' argument is mandatory\n if 'database' not in kwargs:\n return False\n if user_exists(username, **kwargs):\n return False\n\n try:\n conn = _get_connection(**kwargs)\n conn.autocommit(True)\n cur = conn.cursor()\n\n if new_login_password:\n if login_exists(username, **kwargs):\n conn.close()\n return False\n cur.execute(\"CREATE LOGIN {0} WITH PASSWORD='{1}',check_policy = off\".format(username, new_login_password))\n cur.execute(\"CREATE USER {0} FOR LOGIN {1}\".format(username, username))\n else: # new_login_password is not specified\n cur.execute(\"CREATE USER {0} WITHOUT LOGIN\".format(username))\n\n conn.autocommit(False)\n conn.close()\n return True\n except Exception as e:\n return 'Could not create the user: {0}'.format(e)", "metadata": "root.user_create", "header": "['module', '___EOS___']", "index": 286 }, { "content": "def user_remove(username, **kwargs):\n '''\n Removes an user.\n\n CLI Example:\n\n .. code-block:: bash\n\n salt minion mssql.user_remove USERNAME database=DBNAME\n '''\n # 'database' argument is mandatory\n if 'database' not in kwargs:\n return False\n try:\n conn = _get_connection(**kwargs)\n conn.autocommit(True)\n cur = conn.cursor()\n cur.execute(\"DROP USER {0}\".format(username))\n conn.autocommit(False)\n conn.close()\n return True\n except Exception as e:\n return 'Could not create the user: {0}'.format(e)", "metadata": "root.user_remove", "header": "['module', '___EOS___']", "index": 324 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Modul", "e", " ", "to", " ", "provide", " ", "MS", " ", "SQL", " ", "Server", " ", "compatibility", " ", "to", " ", "salt", ".", "\\", "10", ";", "\\", "10", ";", ":", "depend", "s", ":", " ", " ", " ", "-", " ", "Free", "TD", "S", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "pym", "ss", "ql", " ", "Pyth", "on", " ", "module", "\\", "10", ";", "\\", "10", ";", ":", "configura", "tion", ":", " ", "In", " ", "order", " ", "to", " ", "connect", " ", "to", " ", "MS", " ", "SQL", " ", "Server", ",", " ", "cert", "ain", " ", "configura", "tion", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "require", "d", " ", "in", " ", "minion", " ", "configs", "/", "pillar", "s", " ", "on", " ", "the", " ", "rele", "van", "t", " ", "minion", "s", ".", " ", "Some", " ", "sample", "\\", "10", ";", " ", " ", " ", " ", "pillar", "s", " ", "mig", "ht", " ", "look", " ", "like", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "mss", "ql", ".", "server", ":", " ", "'", "local", "host", "'", "\\", "10", ";", " ", " ", " ", " ", "mss", "ql", ".", "port", ":", " ", " ", " ", "143", "3", "\\", "10", ";", " ", " ", " ", " ", "mss", "ql", ".", "user", ":", " ", " ", " ", "'", "sys", "dba", "'", "\\", "10", ";", " ", " ", " ", " ", "mss", "ql", ".", "password", ":", " ", " ", " ", "'", "Some", " ", "prefer", "able", " ", "complex", " ", "password", "'", "\\", "10", ";", " ", " ", " ", " ", "mss", "ql", ".", "databa", "se", ":", " ", "''", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "default", " ", "for", " ", "the", " ", "port", " ", "is", " ", "'", "143", "3", "'", " ", "and", " ", "for", " ", "the", " ", "databa", "se", " ", "is", " ", "''", " ", "(", "empty", " ", "string", ");", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "most", " ", "case", "s", " ", "the", "y", " ", "can", " ", "be", " ", "left", " ", "at", " ", "the", " ", "default", " ", "setti", "ng", ".", "\\", "10", ";", " ", " ", " ", " ", "Optio", "ns", " ", "tha", "t", " ", "are", " ", "direct", "ly", " ", "pass", "ed", " ", "int", "o", " ", "function", "s", " ", "will", " ", "overwrit", "e", " ", "options", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "configs", " ", "or", " ", "pillar", "s", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "python", " ", "libs_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "json_", "import_", "JSO", "NE", "ncode", "r_", ",_", "loads_", "\\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_", "pym", "ss", "ql_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HAS", "\\u", "ALL", "\\u", "IMPORT", "S_", "=_", "True_", "\\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 ", " _", "HAS", "\\u", "ALL", "\\u", "IMPORT", "S_", "=_", "False_", "\\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", "DEFAULTS_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "server", "'_", ":_", "'", "local", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "143", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "'", "sys", "dba", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "databa", "se", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "as", "\\u", "dict", "'_", ":_", "False_", "\\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\\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_", "\\u\\u", "virtual", "\\u\\u_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "On", "ly", " ", "load", " ", "this", " ", "module", " ", "if", " ", "all", " ", "import", "s", " ", "succe", "eded", " ", "bin", " ", "exist", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "HAS", "\\u", "ALL", "\\u", "IMPORT", "S_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "(_", "False_", ",_", "'", "The", " ", "mss", "ql", " ", "executi", "on", " ", "module", " ", "cann", "ot", " ", "be", " ", "load", "ed", ":", " ", "the", " ", "pym", "ss", "ql", " ", "python", " ", "librar", "y", " ", "is", " ", "not", " ", "avail", "able", ".'_", ")_", "\\u\\u\\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", "get", "\\u", "connection_", "(_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connecti", "on", "\\u", "args_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "(_", "'", "server", "'_", ",_", "'", "port", "'_", ",_", "'", "user", "'_", ",_", "'", "password", "'_", ",_", "'", "databa", "se", "'_", ",_", "'", "as", "\\u", "dict", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arg_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connecti", "on", "\\u", "args_", "[_", "arg_", "]_", "=_", "kwargs_", "[_", "arg_", "]_", "\\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 ", " _", "connecti", "on", "\\u", "args_", "[_", "arg_", "]_", "=_", "\\u\\u", "salt\\u\\u_", "[_", "'", "config", ".", "option", "'_", "]_", "(_", "'", "mss", "ql", ".'_", "+_", "arg_", ",_", "\\u", "DEFAULTS_", "._", "get_", "(_", "arg_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "pym", "ss", "ql_", "._", "connect_", "(_", "**_", "connecti", "on", "\\u", "args_", ")_", "\\u\\u\\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", "Ms", "sql", "Encoder_", "(_", "JSO", "NE", "ncode", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "E0", "202", ":", " ", "6", "8", ":\\u", "Ms", "sql", "Encode", "r", ".", "default", ":", " ", "An", " ", "attribute", " ", "inherited", " ", "from", " ", "JSO", "NE", "ncode", "r", " ", "hide", " ", "this", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "\\u", "Ms", "sql", "Encoder_", "(_", "JSO", "NE", "ncode", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "E0", "202", ":", " ", "6", "8", ":\\u", "Ms", "sql", "Encode", "r", ".", "default", ":", " ", "An", " ", "attribute", " ", "inherited", " ", "from", " ", "JSO", "NE", "ncode", "r", " ", "hide", " ", "this", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "default_", "(_", "self_", ",_", "o_", ")_", ":_", "#", " ", "pylint", ":", " ", "disable", "=", "E0", "202_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "o_", ")_", "\\u\\u\\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_", "ts", "ql", "\\u", "query_", "(_", "query_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Run", " ", "a", " ", "SQL", " ", "query", " ", "and", " ", "return", " ", "query", " ", "result", " ", "as", " ", "list", " ", "of", " ", "tuple", "s", ",", " ", "or", " ", "a", " ", "list", " ", "of", " ", "dictionar", "ies", " ", "if", " ", "as", "\\u", "dict", " ", "was", " ", "pass", "ed", ",", " ", "or", " ", "an", " ", "empty", " ", "list", " ", "if", " ", "no", " ", "data", " ", "is", " ", "avail", "able", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "minion", " ", "mss", "ql", ".", "ts", "ql", "\\u", "query", " ", "'", "SELECT", " ", "@@", "version", " ", "as", " ", "version", "'", " ", "as", "\\u", "dict", "=", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur_", "=_", "\\u", "get", "\\u", "connection_", "(_", "**_", "kwargs_", ")_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "._", "execute_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Maki", "ng", " ", "sure", " ", "the", " ", "result", " ", "is", " ", "JSO", "N", " ", "serializable", "_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "loads_", "(_", "\\u", "Ms", "sql", "Encoder_", "(_", ")_", "._", "encode_", "(_", "{_", "'", "results", "et", "'_", ":_", "cur_", "._", "fetchall_", "(_", ")_", "}_", ")_", ")_", "[_", "'", "results", "et", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Tr", "ying", " ", "to", " ", "look", " ", "like", " ", "the", " ", "output", " ", "of", " ", "cur", ".", "fetch", "all", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "(_", "'", "Cou", "ld", " ", "not", " ", "run", " ", "the", " ", "query", "'_", ",_", ")_", ",_", "(_", "str_", "(_", "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_", "version_", "(_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "the", " ", "version", " ", "of", " ", "a", " ", "MS", " ", "SQL", " ", "server", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "minion", " ", "mss", "ql", ".", "version", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ts", "ql", "\\u", "query_", "(_", "'", "SELECT", " ", "@@", "version", "'_", ",_", "**_", "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_", "def_", "db", "\\u", "list_", "(_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "the", " ", "datab", "se", " ", "list", " ", "created", " ", "on", " ", "a", " ", "MS", " ", "SQL", " ", "server", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "minion", " ", "mss", "ql", ".", "db", "\\u", "list", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "row_", "[_", "0_", "]_", "for_", "row_", "in_", "ts", "ql", "\\u", "query_", "(_", "'", "SELECT", " ", "name", " ", "FROM", " ", "sys", ".", "databa", "ses", "'_", ",_", "as", "\\u", "dict_", "=_", "False_", ",_", "**_", "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_", "def_", "db", "\\u", "exists_", "(_", "databa", "se", "\\u", "name_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Fin", "d", " ", "if", " ", "a", " ", "specific", " ", "databa", "se", " ", "exist", "s", " ", "on", " ", "the", " ", "MS", " ", "SQL", " ", "server", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "minion", " ", "mss", "ql", ".", "db", "\\u", "exist", "s", " ", "databa", "se", "\\u", "name", "='", "DB", "NAME", "'", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", " ", "get", " ", "one", ",", " ", "and", " ", "only", " ", "one", " ", "row_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "len_", "(_", "ts", "ql", "\\u", "query_", "(_", "\"", "SELECT", " ", "databa", "se", "\\u", "id", " ", "FROM", " ", "sys", ".", "databa", "ses", " ", "WHE", "RE", " ", "NAME", "='", "{", "0", "}'\"_", "._", "format_", "(_", "databa", "se", "\\u", "name_", ")_", ",_", "**_", "kwargs_", ")_", ")_", "==_", "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_", "db", "\\u", "remove_", "(_", "databa", "se", "\\u", "name_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Drop", "s", " ", "a", " ", "specific", " ", "databa", "se", " ", "from", " ", "the", " ", "MS", " ", "SQL", " ", "server", ".", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "will", " ", "not", " ", "drop", " ", "any", " ", "of", " ", "'", "master", "',", " ", "'", "model", "',", " ", "'", "msd", "b", "'", " ", "or", " ", "'", "temp", "db", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "minion", " ", "mss", "ql", ".", "db", "\\u", "remove", " ", "databa", "se", "\\u", "name", "='", "DB", "NAME", "'", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "db", "\\u", "exists_", "(_", "databa", "se", "\\u", "name_", ")_", "and_", "databa", "se", "\\u", "name_", "not_", "in_", "[_", "'", "master", "'_", ",_", "'", "model", "'_", ",_", "'", "msd", "b", "'_", ",_", "'", "temp", "db", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "=_", "\\u", "get", "\\u", "connection_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "autocommit_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "=_", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "._", "execute_", "(_", "'", "ALT", "ER", " ", "DATA", "BASE", " ", "{", "0", "}", " ", "SET", " ", "SINGLE", "\\u", "USER", " ", "WITH", " ", "ROLL", "BACK", " ", "IMM", "EDI", "ATE", "'_", "._", "format_", "(_", "databa", "se", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "._", "execute_", "(_", "'", "DROP", " ", "DATA", "BASE", " ", "{", "0", "}'_", "._", "format_", "(_", "databa", "se", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "autocommit_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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 ", " _", "return_", "False_", "\\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 ", " _", "return_", "'", "Cou", "ld", " ", "not", " ", "find", " ", "the", " ", "databa", "se", ":", " ", "{", "0", "}'_", "._", "format_", "(_", "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_", "role", "\\u", "list_", "(_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "List", "s", " ", "databa", "se", " ", "role", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "minion", " ", "mss", "ql", ".", "role", "\\u", "list", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ts", "ql", "\\u", "query_", "(_", "query_", "=_", "'", "sp", "\\u", "help", "role", "'_", ",_", "as", "\\u", "dict_", "=_", "True_", ",_", "**_", "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_", "def_", "role", "\\u", "exists_", "(_", "role_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Check", "s", " ", "if", " ", "a", " ", "role", " ", "exist", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "minion", " ", "mss", "ql", ".", "role", "\\u", "exist", "s", " ", "db", "\\u", "owner", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", " ", "get", " ", "one", ",", " ", "and", " ", "only", " ", "one", " ", "row_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "len_", "(_", "ts", "ql", "\\u", "query_", "(_", "query_", "=_", "'", "sp", "\\u", "help", "role", " ", "\"{", "0", "}\"'_", "._", "format_", "(_", "role_", ")_", ",_", "as", "\\u", "dict_", "=_", "True_", ",_", "**_", "kwargs_", ")_", ")_", "==_", "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_", "role", "\\u", "create_", "(_", "role_", ",_", "owner_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "a", " ", "new", " ", "databa", "se", " ", "role", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "no", " ", "owner", " ", "is", " ", "specified", ",", " ", "the", " ", "role", " ", "will", " ", "be", " ", "owned", " ", "by", " ", "the", " ", "user", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "execute", "s", " ", "CREATE", " ", "ROLE", ",", " ", "whi", "ch", " ", "is", " ", "the", " ", "user", " ", "argu", "ment", " ", "or", " ", "mss", "ql", ".", "user", " ", "option", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "minion", " ", "mss", "ql", ".", "role", "\\u", "create", " ", "role", "=", "product", "01", " ", "owner", "=", "sys", "dba", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "=_", "\\u", "get", "\\u", "connection_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "autocommit_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "=_", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "owner_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur_", "._", "execute_", "(_", "'", "CREATE", " ", "ROLE", " ", "{", "0", "}", " ", "AUTHORIZATION", " ", "{", "1", "}'_", "._", "format_", "(_", "role_", ",_", "owner_", ")_", ")_", "\\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 ", " _", "cur_", "._", "execute_", "(_", "'", "CREATE", " ", "ROLE", " ", "{", "0", "}'_", "._", "format_", "(_", "role_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conn_", "._", "autocommit_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\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 ", " _", "return_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "the", " ", "role", ":", " ", "{", "0", "}'_", "._", "format_", "(_", "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_", "role", "\\u", "remove_", "(_", "role_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Remove", " ", "a", " ", "databa", "se", " ", "role", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "minion", " ", "mss", "ql", ".", "role", "\\u", "create", " ", "role", "=", "test\\u", "role", "01", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "=_", "\\u", "get", "\\u", "connection_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "autocommit_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "=_", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "._", "execute_", "(_", "'", "DROP", " ", "ROLE", " ", "{", "0", "}'_", "._", "format_", "(_", "role_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "autocommit_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\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 ", " _", "return_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "the", " ", "role", ":", " ", "{", "0", "}'_", "._", "format_", "(_", "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", "\\u", "exists_", "(_", "login_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Fin", "d", " ", "if", " ", "a", " ", "login", " ", "exist", "s", " ", "in", " ", "the", " ", "MS", " ", "SQL", " ", "server", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "minion", " ", "mss", "ql", ".", "login", "\\u", "exist", "s", " ", "'", "LOGIN", "'", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", " ", "get", " ", "one", ",", " ", "and", " ", "only", " ", "one", " ", "row_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "ts", "ql", "\\u", "query_", "(_", "query_", "=_", "\"", "SELECT", " ", "name", " ", "FROM", " ", "sys", ".", "syslo", "gin", "s", " ", "WHE", "RE", " ", "name", "='", "{", "0", "}'\"_", "._", "format_", "(_", "login_", ")_", ",_", "**_", "kwargs_", ")_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Cou", "ld", " ", "not", " ", "find", " ", "the", " ", "login", ":", " ", "{", "0", "}'_", "._", "format_", "(_", "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_", "user", "\\u", "exists_", "(_", "username_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Fin", "d", " ", "if", " ", "an", " ", "user", " ", "exist", "s", " ", "in", " ", "a", " ", "specific", " ", "databa", "se", " ", "on", " ", "the", " ", "MS", " ", "SQL", " ", "server", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ":", "\\", "10", ";", " ", " ", " ", " ", "*", "databa", "se", "*", " ", "argu", "ment", " ", "is", " ", "mandat", "ory", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "minion", " ", "mss", "ql", ".", "user", "\\u", "exist", "s", " ", "'", "USER", "NAME", "'", " ", "[", "databa", "se", "='", "DB", "NAME", "']", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "'", "databa", "se", "'", " ", "argu", "ment", " ", "is", " ", "mandatory_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "databa", "se", "'_", "not_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "shou", "ld", " ", "get", " ", "one", ",", " ", "and", " ", "only", " ", "one", " ", "row_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "len_", "(_", "ts", "ql", "\\u", "query_", "(_", "query_", "=_", "\"", "SELECT", " ", "name", " ", "FROM", " ", "sys", "users", " ", "WHE", "RE", " ", "name", "='", "{", "0", "}'\"_", "._", "format_", "(_", "username_", ")_", ",_", "**_", "kwargs_", ")_", ")_", "==_", "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_", "user", "\\u", "list_", "(_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "the", " ", "user", " ", "list", " ", "for", " ", "a", " ", "specific", " ", "databa", "se", " ", "on", " ", "the", " ", "MS", " ", "SQL", " ", "server", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "minion", " ", "mss", "ql", ".", "user", "\\u", "list", " ", "[", "databa", "se", "='", "DB", "NAME", "']", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "row_", "[_", "0_", "]_", "for_", "row_", "in_", "ts", "ql", "\\u", "query_", "(_", "\"", "SELECT", " ", "name", " ", "FROM", " ", "sys", "users", " ", "where", " ", "iss", "ql", "user", "=", "1", " ", "or", " ", "isn", "tus", "er", "=", "1", "\"_", ",_", "as", "\\u", "dict_", "=_", "False_", ",_", "**_", "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_", "def_", "user", "\\u", "create_", "(_", "username_", ",_", "new", "\\u", "login", "\\u", "password_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "a", " ", "new", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "new", "\\u", "login", "\\u", "password", " ", "is", " ", "not", " ", "specified", ",", " ", "the", " ", "user", " ", "will", " ", "be", " ", "created", " ", "with", "out", " ", "a", " ", "login", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "minion", " ", "mss", "ql", ".", "user", "\\u", "create", " ", "USER", "NAME", " ", "databa", "se", "=", "DB", "NAME", " ", "[", "new", "\\u", "login", "\\u", "password", "=", "PASS", "WORD", "]", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "'", "databa", "se", "'", " ", "argu", "ment", " ", "is", " ", "mandatory_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "databa", "se", "'_", "not_", "in_", "kwargs_", ":_", "\\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_", "if_", "user", "\\u", "exists_", "(_", "username_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "=_", "\\u", "get", "\\u", "connection_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "autocommit_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "=_", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "new", "\\u", "login", "\\u", "password_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "login", "\\u", "exists_", "(_", "username_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cur_", "._", "execute_", "(_", "\"", "CREATE", " ", "LOGIN", " ", "{", "0", "}", " ", "WITH", " ", "PASS", "WORD", "='", "{", "1", "}'", ",", "check", "\\u", "policy", " ", "=", " ", "off", "\"_", "._", "format_", "(_", "username_", ",_", "new", "\\u", "login", "\\u", "password_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "._", "execute_", "(_", "\"", "CREATE", " ", "USER", " ", "{", "0", "}", " ", "FOR", " ", "LOGIN", " ", "{", "1", "}\"_", "._", "format_", "(_", "username_", ",_", "username_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "new", "\\u", "login", "\\u", "password", " ", "is", " ", "not", " ", "specified", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur_", "._", "execute_", "(_", "\"", "CREATE", " ", "USER", " ", "{", "0", "}", " ", "WITH", "OUT", " ", "LOGIN", "\"_", "._", "format_", "(_", "username_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "conn_", "._", "autocommit_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\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 ", " _", "return_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "the", " ", "user", ":", " ", "{", "0", "}'_", "._", "format_", "(_", "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_", "user", "\\u", "remove_", "(_", "username_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Remove", "s", " ", "an", " ", "user", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "Exam", "ple", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "code", "-", "block", "::", " ", "bash", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", " ", "minion", " ", "mss", "ql", ".", "user", "\\u", "remove", " ", "USER", "NAME", " ", "databa", "se", "=", "DB", "NAME", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "'", "databa", "se", "'", " ", "argu", "ment", " ", "is", " ", "mandatory_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "databa", "se", "'_", "not_", "in_", "kwargs_", ":_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "=_", "\\u", "get", "\\u", "connection_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "autocommit_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "=_", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur_", "._", "execute_", "(_", "\"", "DROP", " ", "USER", " ", "{", "0", "}\"_", "._", "format_", "(_", "username_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "autocommit_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\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 ", " _", "return_", "'", "Cou", "ld", " ", "not", " ", "create", " ", "the", " ", "user", ":", " ", "{", "0", "}'_", "._", "format_", "(_", "e_", ")_" ]
[ 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,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contrib/packs/newrelic/sensors/new_relic_app_sensor.py
[ { "content": " def setup(self):\n pass", "metadata": "root.NewRelicHookSensor.setup", "header": "['class', 'NewRelicHookSensor', '(', 'Sensor', ')', ':', '___EOS___']", "index": 84 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "New", "Reli", "c", "Hook", "Sensor_", "(_", "Sensor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\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 ]
Redundant comparison
jseidl/virtuaplant/plants/bottle-filling/world.py
[ { "content": "def runWorld():\n pygame.init()\n screen = pygame.display.set_mode((SCREEN_WIDTH, SCREEN_HEIGHT))\n pygame.display.set_caption(\"Bottle-Filling Factory - World View - VirtuaPlant\")\n clock = pygame.time.Clock()\n running = True\n\n space = pymunk.Space()\n space.gravity = (0.0, -900.0)\n\n # Limit switch with bottle bottom\n space.add_collision_handler(0x1, 0x2, begin=bottle_in_place)\n # Level sensor with water\n space.add_collision_handler(0x4, 0x5, begin=level_ok)\n # Level sensor with ground\n space.add_collision_handler(0x4, 0x6, begin=no_collision)\n # Limit switch with ground\n space.add_collision_handler(0x1, 0x6, begin=no_collision)\n # Limit switch with bottle side\n space.add_collision_handler(0x1, 0x3, begin=no_collision)\n # Level sensor with bottle side\n space.add_collision_handler(0x4, 0x3, begin=no_collision)\n # Bottle in with bottle sides and bottom\n space.add_collision_handler(0x7, 0x2, begin=no_collision, separate=add_new_bottle)\n space.add_collision_handler(0x7, 0x3, begin=no_collision)\n\n base = add_base(space)\n nozzle = add_nozzle(space)\n limit_switch = add_limit_switch(space)\n level_sensor = add_level_sensor(space)\n bottle_in = add_bottle_in_sensor(space)\n \n global bottles\n bottles.append(add_bottle(space))\n\n balls = []\n\n ticks_to_next_ball = 1\n\n fontBig = pygame.font.SysFont(None, 40)\n fontMedium = pygame.font.SysFont(None, 26)\n fontSmall = pygame.font.SysFont(None, 18)\n\n while running:\n clock.tick(FPS)\n\n for event in pygame.event.get():\n if event.type == QUIT:\n running = False\n elif event.type == KEYDOWN and event.key == K_ESCAPE:\n running = False\n\n screen.fill(THECOLORS[\"white\"])\n \n if PLCGetTag(PLC_TAG_RUN):\n\n # Motor Logic\n if (PLCGetTag(PLC_TAG_LIMIT_SWITCH) == 1):\n PLCSetTag(PLC_TAG_MOTOR, 0)\n \n if (PLCGetTag(PLC_TAG_LEVEL_SENSOR) == 1):\n PLCSetTag(PLC_TAG_MOTOR, 1)\n \n ticks_to_next_ball -= 1\n \n if not PLCGetTag(PLC_TAG_LIMIT_SWITCH):\n PLCSetTag(PLC_TAG_MOTOR, 1)\n\n if ticks_to_next_ball <= 0 and PLCGetTag(PLC_TAG_NOZZLE):\n ticks_to_next_ball = 1\n ball_shape = add_ball(space)\n balls.append(ball_shape)\n\n # Move the bottles\n if PLCGetTag(PLC_TAG_MOTOR) == 1:\n for bottle in bottles:\n bottle[0].body.position.x += 0.25\n else:\n PLCSetTag(PLC_TAG_MOTOR, 0)\n\n # Draw water balls\n # Remove off-screen balls\n balls_to_remove = []\n for ball in balls:\n if ball.body.position.y < 150 or ball.body.position.x > SCREEN_WIDTH+150:\n balls_to_remove.append(ball)\n\n draw_ball(screen, ball)\n\n for ball in balls_to_remove:\n space.remove(ball, ball.body)\n balls.remove(ball)\n\n # Draw bottles\n for bottle in bottles:\n if bottle[0].body.position.x > SCREEN_WIDTH+150 or bottle[0].body.position.y < 150:\n space.remove(bottle, bottle[0].body)\n bottles.remove(bottle)\n continue\n draw_lines(screen, bottle)\n\n # Draw the base and nozzle\n draw_polygon(screen, base)\n draw_polygon(screen, nozzle)\n # Draw the limit switch\n draw_ball(screen, limit_switch, THECOLORS['green'])\n # Draw the level sensor\n draw_ball(screen, level_sensor, THECOLORS['red'])\n\n title = fontMedium.render(str(\"Bottle-filling factory\"), 1, THECOLORS['deepskyblue'])\n name = fontBig.render(str(\"VirtuaPlant\"), 1, THECOLORS['gray20'])\n instructions = fontSmall.render(str(\"(press ESC to quit)\"), 1, THECOLORS['gray'])\n screen.blit(title, (10, 40))\n screen.blit(name, (10, 10))\n screen.blit(instructions, (SCREEN_WIDTH-115, 10))\n\n space.step(1/FPS)\n pygame.display.flip()\n\n # Stop reactor if running\n if reactor.running:\n reactor.callFromThread(reactor.stop)", "metadata": "root.runWorld", "header": "['module', '___EOS___']", "index": 201 } ]
[]
[]
0
true
[ "[CLS]_", "Redu", "ndan", "t_", "comparison_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "World_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pygame_", "._", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "screen_", "=_", "pygame_", "._", "display_", "._", "set\\u", "mode_", "(_", "(_", "SCREEN", "\\u", "WIDTH_", ",_", "SCREEN", "\\u", "HEIGHT_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pygame_", "._", "display_", "._", "set\\u", "caption_", "(_", "\"", "Bott", "le", "-", "Fil", "ling", " ", "Factor", "y", " ", "-", " ", "Wor", "ld", " ", "View", " ", "-", " ", "Virt", "ua", "Plant", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clock_", "=_", "pygame_", "._", "time_", "._", "Clock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "running_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "space_", "=_", "pym", "unk", "_", "._", "Space_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "space_", "._", "gravity", "_", "=_", "(_", "0.0_", ",_", "-_", "900", ".0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Limit", " ", "switch", " ", "with", " ", "bottle", " ", "bottom_", "\\u\\u\\uNL\\u\\u\\u_", "space_", "._", "add", "\\u", "colli", "sion", "\\u", "handler_", "(_", "0x1_", ",_", "0x2_", ",_", "begin_", "=_", "bottle", "\\u", "in", "\\u", "place_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Leve", "l", " ", "sensor", " ", "with", " ", "water_", "\\u\\u\\uNL\\u\\u\\u_", "space_", "._", "add", "\\u", "colli", "sion", "\\u", "handler_", "(_", "0x4_", ",_", "0x5", "_", ",_", "begin_", "=_", "level", "\\u", "ok_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Leve", "l", " ", "sensor", " ", "with", " ", "ground_", "\\u\\u\\uNL\\u\\u\\u_", "space_", "._", "add", "\\u", "colli", "sion", "\\u", "handler_", "(_", "0x4_", ",_", "0x6", "_", ",_", "begin_", "=_", "no", "\\u", "collision_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Limit", " ", "switch", " ", "with", " ", "ground_", "\\u\\u\\uNL\\u\\u\\u_", "space_", "._", "add", "\\u", "colli", "sion", "\\u", "handler_", "(_", "0x1_", ",_", "0x6", "_", ",_", "begin_", "=_", "no", "\\u", "collision_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Limit", " ", "switch", " ", "with", " ", "bottle", " ", "side_", "\\u\\u\\uNL\\u\\u\\u_", "space_", "._", "add", "\\u", "colli", "sion", "\\u", "handler_", "(_", "0x1_", ",_", "0x3", "_", ",_", "begin_", "=_", "no", "\\u", "collision_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Leve", "l", " ", "sensor", " ", "with", " ", "bottle", " ", "side_", "\\u\\u\\uNL\\u\\u\\u_", "space_", "._", "add", "\\u", "colli", "sion", "\\u", "handler_", "(_", "0x4_", ",_", "0x3", "_", ",_", "begin_", "=_", "no", "\\u", "collision_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Bott", "le", " ", "in", " ", "with", " ", "bottle", " ", "side", "s", " ", "and", " ", "bottom_", "\\u\\u\\uNL\\u\\u\\u_", "space_", "._", "add", "\\u", "colli", "sion", "\\u", "handler_", "(_", "0x7", "_", ",_", "0x2_", ",_", "begin_", "=_", "no", "\\u", "collision_", ",_", "separate", "_", "=_", "add", "\\u", "new", "\\u", "bottle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "space_", "._", "add", "\\u", "colli", "sion", "\\u", "handler_", "(_", "0x7", "_", ",_", "0x3", "_", ",_", "begin_", "=_", "no", "\\u", "collision_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "base_", "=_", "add", "\\u", "base_", "(_", "space_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "no", "zzle", "_", "=_", "add", "\\u", "no", "zzle", "_", "(_", "space_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit", "\\u", "switch_", "=_", "add", "\\u", "limit", "\\u", "switch_", "(_", "space_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "level", "\\u", "sensor_", "=_", "add", "\\u", "level", "\\u", "sensor_", "(_", "space_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bottle", "\\u", "in_", "=_", "add", "\\u", "bottle", "\\u", "in", "\\u", "sensor_", "(_", "space_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "global_", "bottle", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bottle", "s_", "._", "append_", "(_", "add", "\\u", "bottle_", "(_", "space_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "balls", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tick", "s", "\\u", "to", "\\u", "next", "\\u", "ball_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "font", "Big", "_", "=_", "pygame_", "._", "font_", "._", "Sys", "Font_", "(_", "None_", ",_", "40_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "font", "Medi", "um_", "=_", "pygame_", "._", "font_", "._", "Sys", "Font_", "(_", "None_", ",_", "26_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "font", "Small", "_", "=_", "pygame_", "._", "font_", "._", "Sys", "Font_", "(_", "None_", ",_", "18_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "running_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "clock_", "._", "tick_", "(_", "FPS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "event_", "in_", "pygame_", "._", "event_", "._", "get_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "event_", "._", "type_", "==_", "QUIT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "running_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "event_", "._", "type_", "==_", "KEYDOWN_", "and_", "event_", "._", "key_", "==_", "K", "\\u", "ESCAPE", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "running_", "=_", "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_", "screen_", "._", "fill_", "(_", "THE", "COLORS_", "[_", "\"", "white", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "PLC", "Get", "Tag_", "(_", "PLC", "\\u", "TAG", "\\u", "RUN_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Moto", "r", " ", "Logic_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "PLC", "Get", "Tag_", "(_", "PLC", "\\u", "TAG", "\\u", "LIMIT", "\\u", "SWITCH", "_", ")_", "==_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "PLC", "Set", "Tag_", "(_", "PLC", "\\u", "TAG", "\\u", "MOT", "OR_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "PLC", "Get", "Tag_", "(_", "PLC", "\\u", "TAG", "\\u", "LE", "VEL", "\\u", "SENSOR", "_", ")_", "==_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "PLC", "Set", "Tag_", "(_", "PLC", "\\u", "TAG", "\\u", "MOT", "OR_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tick", "s", "\\u", "to", "\\u", "next", "\\u", "ball_", "-=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "PLC", "Get", "Tag_", "(_", "PLC", "\\u", "TAG", "\\u", "LIMIT", "\\u", "SWITCH", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "PLC", "Set", "Tag_", "(_", "PLC", "\\u", "TAG", "\\u", "MOT", "OR_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tick", "s", "\\u", "to", "\\u", "next", "\\u", "ball_", "<=_", "0_", "and_", "PLC", "Get", "Tag_", "(_", "PLC", "\\u", "TAG", "\\u", "NO", "ZZ", "LE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tick", "s", "\\u", "to", "\\u", "next", "\\u", "ball_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bal", "l\\u", "shape_", "=_", "add", "\\u", "ball_", "(_", "space_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "balls", "_", "._", "append_", "(_", "bal", "l\\u", "shape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Move", " ", "the", " ", "bottle", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "PLC", "Get", "Tag_", "(_", "PLC", "\\u", "TAG", "\\u", "MOT", "OR_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "bottle_", "in_", "bottle", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "bottle_", "[_", "0_", "]_", "._", "body_", "._", "position_", "._", "x_", "+=_", "0.25_", "\\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 ", " _", "PLC", "Set", "Tag_", "(_", "PLC", "\\u", "TAG", "\\u", "MOT", "OR_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Draw", " ", "water", " ", "balls", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remove", " ", "off", "-", "screen", " ", "balls", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "balls", "\\u", "to", "\\u", "remove_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ball_", "in_", "balls", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ball_", "._", "body_", "._", "position_", "._", "y_", "<_", "150_", "or_", "ball_", "._", "body_", "._", "position_", "._", "x_", ">_", "SCREEN", "\\u", "WIDTH_", "+_", "150_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "balls", "\\u", "to", "\\u", "remove_", "._", "append_", "(_", "ball_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "draw", "\\u", "ball_", "(_", "screen_", ",_", "ball_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "ball_", "in_", "balls", "\\u", "to", "\\u", "remove_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "space_", "._", "remove_", "(_", "ball_", ",_", "ball_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "balls", "_", "._", "remove_", "(_", "ball_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Draw", " ", "bottle", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "bottle_", "in_", "bottle", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "bottle_", "[_", "0_", "]_", "._", "body_", "._", "position_", "._", "x_", ">_", "SCREEN", "\\u", "WIDTH_", "+_", "150_", "or_", "bottle_", "[_", "0_", "]_", "._", "body_", "._", "position_", "._", "y_", "<_", "150_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "space_", "._", "remove_", "(_", "bottle_", ",_", "bottle_", "[_", "0_", "]_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bottle", "s_", "._", "remove_", "(_", "bottle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "draw", "\\u", "lines_", "(_", "screen_", ",_", "bottle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Draw", " ", "the", " ", "base", " ", "and", " ", "no", "zzle", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "draw", "\\u", "polygon_", "(_", "screen_", ",_", "base_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "draw", "\\u", "polygon_", "(_", "screen_", ",_", "no", "zzle", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Draw", " ", "the", " ", "limit", " ", "switch_", "\\u\\u\\uNL\\u\\u\\u_", "draw", "\\u", "ball_", "(_", "screen_", ",_", "limit", "\\u", "switch_", ",_", "THE", "COLORS_", "[_", "'", "green", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Draw", " ", "the", " ", "level", " ", "sensor_", "\\u\\u\\uNL\\u\\u\\u_", "draw", "\\u", "ball_", "(_", "screen_", ",_", "level", "\\u", "sensor_", ",_", "THE", "COLORS_", "[_", "'", "red", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "title_", "=_", "font", "Medi", "um_", "._", "render_", "(_", "str_", "(_", "\"", "Bott", "le", "-", "filling", " ", "factor", "y", "\"_", ")_", ",_", "1_", ",_", "THE", "COLORS_", "[_", "'", "deep", "sky", "blue", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "font", "Big", "_", "._", "render_", "(_", "str_", "(_", "\"", "Virt", "ua", "Plant", "\"_", ")_", ",_", "1_", ",_", "THE", "COLORS_", "[_", "'", "gray", "20", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instructions_", "=_", "font", "Small", "_", "._", "render_", "(_", "str_", "(_", "\"(", "press", " ", "ESC", " ", "to", " ", "quit", ")\"_", ")_", ",_", "1_", ",_", "THE", "COLORS_", "[_", "'", "gray", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "screen_", "._", "blit_", "(_", "title_", ",_", "(_", "10_", ",_", "40_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "screen_", "._", "blit_", "(_", "name_", ",_", "(_", "10_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "screen_", "._", "blit_", "(_", "instructions_", ",_", "(_", "SCREEN", "\\u", "WIDTH_", "-_", "115_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "space_", "._", "step_", "(_", "1_", "/_", "FPS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pygame_", "._", "display_", "._", "flip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sto", "p", " ", "react", "or", " ", "if", " ", "running_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "reactor_", "._", "running_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reactor_", "._", "call", "Fro", "m", "Thread_", "(_", "reactor_", "._", "stop_", ")_", "\\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,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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 ]
Except block handles 'BaseException'
reviewboard/reviewboard/reviewboard/diffviewer/models.py
[ { "content": " def recalculate_line_counts(self, tool):\n \"\"\"Recalculates the insert_count and delete_count values.\n\n This will attempt to re-parse the stored diff and fetch the\n line counts through the parser.\n \"\"\"\n logging.debug('Recalculating insert/delete line counts on '\n 'RawFileDiffData %s' % self.pk)\n\n try:\n files = tool.get_parser(self.content).parse()\n\n if len(files) != 1:\n raise DiffParserError(\n 'Got wrong number of files (%d)' % len(files))\n except DiffParserError as e:\n logging.error('Failed to correctly parse stored diff data in '\n 'RawFileDiffData ID %s when trying to get '\n 'insert/delete line counts: %s',\n self.pk, e)\n else:\n file_info = files[0]\n self.insert_count = file_info.insert_count\n self.delete_count = file_info.delete_count\n\n if self.pk:\n self.save(update_fields=['extra_data'])", "metadata": "root.RawFileDiffData.recalculate_line_counts", "header": "['class', 'RawFileDiffData', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 89 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Ra", "w", "File", "Diff", "Data_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "recalc", "ulate", "\\u", "line", "\\u", "counts_", "(_", "self_", ",_", "tool_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Recal", "cula", "tes", " ", "the", " ", "insert", "\\u", "count", " ", "and", " ", "delete", "\\u", "count", " ", "values", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "will", " ", "atte", "mpt", " ", "to", " ", "re", "-", "parse", " ", "the", " ", "store", "d", " ", "diff", " ", "and", " ", "fetch", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "line", " ", "count", "s", " ", "through", " ", "the", " ", "parser", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "debug_", "(_", "'", "Recal", "cula", "ting", " ", "insert", "/", "delete", " ", "line", " ", "count", "s", " ", "on", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ra", "w", "File", "Diff", "Data", " ", "%", "s", "'_", "%_", "self_", "._", "pk_", ")_", "\\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 ", " _", "files_", "=_", "tool_", "._", "get", "\\u", "parser_", "(_", "self_", "._", "content_", ")_", "._", "parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "files_", ")_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Diff", "Parser", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Got", " ", "wrong", " ", "number", " ", "of", " ", "files", " ", "(%", "d", ")'_", "%_", "len_", "(_", "files_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Diff", "Parser", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "'", "Fail", "ed", " ", "to", " ", "correct", "ly", " ", "parse", " ", "store", "d", " ", "diff", " ", "data", " ", "in", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ra", "w", "File", "Diff", "Data", " ", "ID", " ", "%", "s", " ", "whe", "n", " ", "try", "ing", " ", "to", " ", "get", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "insert", "/", "delete", " ", "line", " ", "count", "s", ":", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pk_", ",_", "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 ", " _", "file", "\\u", "info_", "=_", "files_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "insert", "\\u", "count_", "=_", "file", "\\u", "info_", "._", "insert", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "delete", "\\u", "count_", "=_", "file", "\\u", "info_", "._", "delete", "\\u", "count_", "\\u\\u\\uNEWLINE\\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 ]
Unreachable code
mikrosimage/OpenRenderManagement/src/octopus/dispatcher/model/task.py
[ { "content": " def __init__(self, id, name, parent, user, arguments, environment, requirements,\n maxRN, priority, dispatchKey, strategy, nodes={}, tags={}, timer=None):\n Model.__init__(self)\n self.id = int(id) if id else None\n self.name = str(name)\n self.parent = parent\n self.user = str(user)\n self.arguments = arguments\n self.environment = environment\n self.requirements = requirements\n self.maxRN = int(maxRN)\n self.priority = int(priority)\n self.dispatchKey = float(dispatchKey)\n self.strategy = strategy\n self.nodes = nodes.copy()\n self.tasks = []\n self.tags = tags.copy()\n self.completion = 0\n self.status = 0\n self._modified = True\n self.creationTime = None\n self.startTime = None\n self.updateTime = None\n self.endTime = None\n self.timer = timer", "metadata": "root.TaskGroup.__init__", "header": "['class', 'TaskGroup', '(', 'Model', ')', ':', '___EOS___']", "index": 32 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Task", "Group_", "(_", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "id_", ",_", "name_", ",_", "parent_", ",_", "user_", ",_", "arguments_", ",_", "environment_", ",_", "requirements_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "RN", "_", ",_", "priority_", ",_", "dispatch", "Key_", ",_", "strategy_", ",_", "nodes_", "=_", "{_", "}_", ",_", "tags_", "=_", "{_", "}_", ",_", "timer_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Model_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "id_", "=_", "int_", "(_", "id_", ")_", "if_", "id_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "name_", "=_", "str_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "=_", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user_", "=_", "str_", "(_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "arguments_", "=_", "arguments_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "environment_", "=_", "environment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "requirements_", "=_", "requirements_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "max", "RN", "_", "=_", "int_", "(_", "max", "RN", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "priority_", "=_", "int_", "(_", "priority_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dispatch", "Key_", "=_", "float_", "(_", "dispatch", "Key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "strategy_", "=_", "strategy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "nodes_", "=_", "nodes_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tasks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tags_", "=_", "tags_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "completion_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "modified_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "creati", "on", "Time_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start", "Time_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update", "Time_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "end", "Time_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timer_", "=_", "timer_", "\\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 ]
Variable defined multiple times
BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/tests/unit/virt/test_diagnostics.py
[ { "content": " def test_diagnostics_serialize_default(self):\n diags = diagnostics.Diagnostics()\n expected = {'config_drive': False,\n 'cpu_details': [],\n 'disk_details': [],\n 'driver': None,\n 'hypervisor_os': None,\n 'memory_details': {'maximum': 0, 'used': 0},\n 'nic_details': [],\n 'state': None,\n 'uptime': 0,\n 'version': '1.0'}\n result = diags.serialize()\n self.assertEqual(expected, result)", "metadata": "root.DiagnosticsTests.test_diagnostics_serialize_default", "header": "['class', 'DiagnosticsTests', '(', 'test', '.', 'NoDBTestCase', ')', ':', '___EOS___']", "index": 161 } ]
[]
[]
0
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Diagnostic", "s", "Tests_", "(_", "test_", "._", "No", "DB", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "diagnostics", "\\u", "serialize", "\\u", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "diag", "s_", "=_", "diagnostics", "_", "._", "Diagnostic", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "{_", "'", "config", "\\u", "drive", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cpu", "\\u", "deta", "il", "s", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "disk", "\\u", "deta", "il", "s", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "driver", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hypervisor", "\\u", "os", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "memory", "\\u", "deta", "il", "s", "'_", ":_", "{_", "'", "maxim", "um", "'_", ":_", "0_", ",_", "'", "used", "'_", ":_", "0_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nic", "\\u", "deta", "il", "s", "'_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "state", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "upti", "me", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "'", "1.0", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "diag", "s_", "._", "serialize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "result_", ")_", "\\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 ]
Unused import
tony/tmuxp/tmuxp/log.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\"\"\"Log utilities for tmuxp.\n\ntmuxp.log\n~~~~~~~~~\n\n\"\"\"\nfrom __future__ import absolute_import, division, print_function, \\\n with_statement, unicode_literals\n\nimport logging\nimport time\n\nfrom colorama import Fore, Style\n\nLEVEL_COLORS = {\n 'DEBUG': Fore.BLUE, # Blue\n 'INFO': Fore.GREEN, # Green\n 'WARNING': Fore.YELLOW,\n 'ERROR': Fore.RED,\n 'CRITICAL': Fore.RED\n}\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def default_log_template(self, record):\n \"\"\"Return the prefix for the log message. Template for Formatter.\n\n :param: record: :py:class:`logging.LogRecord` object. this is passed in\n from inside the :py:meth:`logging.Formatter.format` record.\n\n \"\"\"\n\n reset = Style.RESET_ALL\n levelname = (\n LEVEL_COLORS.get(record.levelname) + Style.BRIGHT +\n '(%(levelname)s)'\n + Style.RESET_ALL + ' '\n )\n asctime = (\n '[' + Fore.BLACK + Style.DIM + Style.BRIGHT +\n '%(asctime)s'\n + Fore.RESET + Style.RESET_ALL + ']'\n )\n name = (\n ' ' + Fore.WHITE + Style.DIM + Style.BRIGHT +\n '%(name)s'\n + Fore.RESET + Style.RESET_ALL + ' '\n )\n\n tpl = reset + levelname + asctime + name + reset\n\n return tpl", "metadata": "root.default_log_template", "header": "['module', '___EOS___']", "index": 25 }, { "content": "class LogFormatter(logging.Formatter):\n\n template = default_log_template\n\n", "metadata": "root.LogFormatter", "header": "['module', '___EOS___']", "index": 55 }, { "content": " def __init__(self, color=True, *args, **kwargs):\n logging.Formatter.__init__(self, *args, **kwargs)", "metadata": "root.LogFormatter.__init__", "header": "['class', 'LogFormatter', '(', 'logging', '.', 'Formatter', ')', ':', '___EOS___']", "index": 59 }, { "content": " def format(self, record):\n try:\n record.message = record.getMessage()\n except Exception as e:\n record.message = \"Bad message (%r): %r\" % (e, record.__dict__)\n\n date_format = '%H:%m:%S'\n record.asctime = time.strftime(\n date_format, self.converter(record.created)\n )\n\n prefix = self.template(record) % record.__dict__\n\n formatted = prefix + \" \" + record.message\n return formatted.replace(\"\\n\", \"\\n \")", "metadata": "root.LogFormatter.format", "header": "['class', 'LogFormatter', '(', 'logging', '.', 'Formatter', ')', ':', '___EOS___']", "index": 62 }, { "content": "def debug_log_template(self, record):\n \"\"\" Return the prefix for the log message. Template for Formatter.\n\n :param: record: :py:class:`logging.LogRecord` object. this is passed in\n from inside the :py:meth:`logging.Formatter.format` record.\n\n \"\"\"\n\n reset = Style.RESET_ALL\n levelname = (\n LEVEL_COLORS.get(record.levelname) + Style.BRIGHT +\n '(%(levelname)1.1s)'\n + Style.RESET_ALL + ' '\n )\n asctime = (\n '[' + Fore.BLACK + Style.DIM + Style.BRIGHT +\n '%(asctime)s'\n + Fore.RESET + Style.RESET_ALL + ']'\n )\n name = (\n ' ' + Fore.WHITE + Style.DIM + Style.BRIGHT +\n '%(name)s'\n + Fore.RESET + Style.RESET_ALL + ' '\n )\n module_funcName = (\n Fore.GREEN + Style.BRIGHT +\n '%(module)s.%(funcName)s()'\n )\n lineno = (\n Fore.BLACK + Style.DIM + Style.BRIGHT + ':' + Style.RESET_ALL +\n Fore.CYAN + '%(lineno)d'\n )\n\n tpl = reset + levelname + asctime + name + module_funcName + lineno + reset\n\n return tpl", "metadata": "root.debug_log_template", "header": "['module', '___EOS___']", "index": 79 }, { "content": "class DebugLogFormatter(LogFormatter):\n\n \"\"\"Provides greater technical details than standard log Formatter.\"\"\"\n\n template = debug_log_template", "metadata": "root.DebugLogFormatter", "header": "['module', '___EOS___']", "index": 117 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Log", " ", "util", "iti", "es", " ", "for", " ", "tm", "ux", "p", ".", "\\", "10", ";", "\\", "10", ";", "tm", "ux", "p", ".", "log", "\\", "10", ";", "~~~~~", "~~~", "~", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", ",_", "division_", ",_", "print", "\\u", "function_", ",_", "with", "\\u", "statement_", ",_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "colorama_", "import_", "Fore_", ",_", "Style_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LE", "VEL", "\\u", "COLORS_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "DEBU", "G", "'_", ":_", "Fore_", "._", "BLUE_", ",_", "#", " ", "Blue", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "INFO", "'_", ":_", "Fore_", "._", "GREEN_", ",_", "#", " ", "Green", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "WARN", "ING", "'_", ":_", "Fore_", "._", "YELLOW_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ERROR", "'_", ":_", "Fore_", "._", "RED_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "CRIT", "ICAL", "'_", ":_", "Fore_", "._", "RED_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "default", "\\u", "log", "\\u", "template_", "(_", "self_", ",_", "record_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "prefix", " ", "for", " ", "the", " ", "log", " ", "message", ".", " ", "Templa", "te", " ", "for", " ", "Formatt", "er", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", ":", " ", "record", ":", " ", ":", "py", ":", "class", ":`", "logg", "ing", ".", "Log", "Record", "`", " ", "object", ".", " ", "this", " ", "is", " ", "pass", "ed", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "insi", "de", " ", "the", " ", ":", "py", ":", "meth", ":`", "logg", "ing", ".", "Formatt", "er", ".", "format", "`", " ", "record", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reset_", "=_", "Style_", "._", "RESE", "T", "\\u", "ALL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "level", "name_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "LE", "VEL", "\\u", "COLORS_", "._", "get_", "(_", "record_", "._", "level", "name_", ")_", "+_", "Style_", "._", "BRIGHT", "_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "%", "(", "level", "name", ")", "s", ")'_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "Style_", "._", "RESE", "T", "\\u", "ALL_", "+_", "'", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "asc", "time_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'['_", "+_", "Fore_", "._", "BLACK_", "+_", "Style_", "._", "DIM_", "+_", "Style_", "._", "BRIGHT", "_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "(", "asc", "time", ")", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "Fore_", "._", "RESET_", "+_", "Style_", "._", "RESE", "T", "\\u", "ALL_", "+_", "']'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "'_", "+_", "Fore_", "._", "WHITE_", "+_", "Style_", "._", "DIM_", "+_", "Style_", "._", "BRIGHT", "_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "(", "name", ")", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "Fore_", "._", "RESET_", "+_", "Style_", "._", "RESE", "T", "\\u", "ALL_", "+_", "'", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tpl_", "=_", "reset_", "+_", "level", "name_", "+_", "asc", "time_", "+_", "name_", "+_", "reset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "tpl_", "\\u\\u\\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_", "Log", "Formatter_", "(_", "logging_", "._", "Formatter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template_", "=_", "default", "\\u", "log", "\\u", "template_", "\\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_", "Log", "Formatter_", "(_", "logging_", "._", "Formatter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "color_", "=_", "True_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "Formatter_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Log", "Formatter_", "(_", "logging_", "._", "Formatter_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "format_", "(_", "self_", ",_", "record_", ")_", ":_", "\\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 ", " _", "record_", "._", "message_", "=_", "record_", "._", "get", "Message_", "(_", ")_", "\\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 ", " _", "record_", "._", "message_", "=_", "\"", "Ba", "d", " ", "message", " ", "(%", "r", "):", " ", "%", "r", "\"_", "%_", "(_", "e_", ",_", "record_", "._", "\\u\\u", "dict\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "date", "\\u", "format_", "=_", "'%", "H", ":", "%", "m", ":", "%", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "record_", "._", "asc", "time_", "=_", "time_", "._", "strftime_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "date", "\\u", "format_", ",_", "self_", "._", "converter_", "(_", "record_", "._", "created_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prefix_", "=_", "self_", "._", "template_", "(_", "record_", ")_", "%_", "record_", "._", "\\u\\u", "dict\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "formatted_", "=_", "prefix_", "+_", "\"", " ", "\"_", "+_", "record_", "._", "message_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "formatted_", "._", "replace_", "(_", "\"\\\\", "n", "\"_", ",_", "\"\\\\", "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_", "debug", "\\u", "log", "\\u", "template_", "(_", "self_", ",_", "record_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Return", " ", "the", " ", "prefix", " ", "for", " ", "the", " ", "log", " ", "message", ".", " ", "Templa", "te", " ", "for", " ", "Formatt", "er", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", ":", " ", "record", ":", " ", ":", "py", ":", "class", ":`", "logg", "ing", ".", "Log", "Record", "`", " ", "object", ".", " ", "this", " ", "is", " ", "pass", "ed", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "insi", "de", " ", "the", " ", ":", "py", ":", "meth", ":`", "logg", "ing", ".", "Formatt", "er", ".", "format", "`", " ", "record", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reset_", "=_", "Style_", "._", "RESE", "T", "\\u", "ALL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "level", "name_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "LE", "VEL", "\\u", "COLORS_", "._", "get_", "(_", "record_", "._", "level", "name_", ")_", "+_", "Style_", "._", "BRIGHT", "_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "%", "(", "level", "name", ")", "1.1", "s", ")'_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "Style_", "._", "RESE", "T", "\\u", "ALL_", "+_", "'", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "asc", "time_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'['_", "+_", "Fore_", "._", "BLACK_", "+_", "Style_", "._", "DIM_", "+_", "Style_", "._", "BRIGHT", "_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "(", "asc", "time", ")", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "Fore_", "._", "RESET_", "+_", "Style_", "._", "RESE", "T", "\\u", "ALL_", "+_", "']'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", "'_", "+_", "Fore_", "._", "WHITE_", "+_", "Style_", "._", "DIM_", "+_", "Style_", "._", "BRIGHT", "_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "(", "name", ")", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "Fore_", "._", "RESET_", "+_", "Style_", "._", "RESE", "T", "\\u", "ALL_", "+_", "'", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module", "\\u", "func", "Name_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Fore_", "._", "GREEN_", "+_", "Style_", "._", "BRIGHT", "_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "(", "module", ")", "s", ".", "%", "(", "func", "Name", ")", "s", "()'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lineno_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Fore_", "._", "BLACK_", "+_", "Style_", "._", "DIM_", "+_", "Style_", "._", "BRIGHT", "_", "+_", "':'_", "+_", "Style_", "._", "RESE", "T", "\\u", "ALL_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "Fore_", "._", "CYAN_", "+_", "'%", "(", "linen", "o", ")", "d", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tpl_", "=_", "reset_", "+_", "level", "name_", "+_", "asc", "time_", "+_", "name_", "+_", "module", "\\u", "func", "Name_", "+_", "lineno_", "+_", "reset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "tpl_", "\\u\\u\\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_", "Deb", "ug", "Log", "Formatter_", "(_", "Log", "Formatter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Prov", "ides", " ", "great", "er", " ", "technical", " ", "deta", "il", "s", " ", "than", " ", "standard", " ", "log", " ", "Formatt", "er", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "template_", "=_", "debug", "\\u", "log", "\\u", "template_" ]
[ 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, 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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
openstack/ec2-api/ec2api/tests/unit/test_faults.py
[ { "content": " @mock.patch.object(faults, 'ec2_error_response',\n return_value=FakeResponse())\n def test_fault_call(self, mock_request):\n # Ensure proper EC2 response on faults.\n message = 'test message'\n ex = webob.exc.HTTPNotFound(explanation=message)\n fault = faults.Fault(ex)\n req = wsgi.Request.blank('/test')\n req.GET['AWSAccessKeyId'] = \"test_user_id:test_project_id\"\n fault(req)\n mock_request.assert_called_with(mock.ANY, 'HTTPNotFound',\n message=message, status=ex.status_int)", "metadata": "root.TestFaults.test_fault_call", "header": "['class', 'TestFaults', '(', 'test_base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 44 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Fau", "lts", "_", "(_", "test\\u", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "mock_", "._", "patch_", "._", "object_", "(_", "faults", "_", ",_", "'", "ec", "2", "\\u", "error", "\\u", "response", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "return", "\\u", "value_", "=_", "Fake", "Response_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "fault", "\\u", "call_", "(_", "self_", ",_", "mock", "\\u", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "proper", " ", "EC", "2", " ", "response", " ", "on", " ", "faults", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "'", "test", " ", "message", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ex_", "=_", "webob_", "._", "exc_", "._", "HTTP", "Not", "Found_", "(_", "explanation_", "=_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fault_", "=_", "faults", "_", "._", "Fault_", "(_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "wsgi_", "._", "Request_", "._", "blank_", "(_", "'/", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "GET_", "[_", "'", "AW", "SA", "ccess", "Key", "Id", "'_", "]_", "=_", "\"", "test\\u", "user", "\\u", "id", ":", "test\\u", "project", "\\u", "id", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fault_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mock", "\\u", "request_", "._", "assert", "\\u", "call", "ed", "\\u", "with_", "(_", "mock_", "._", "ANY_", ",_", "'", "HTTP", "Not", "Foun", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "message_", ",_", "status_", "=_", "ex_", "._", "status", "\\u", "int_", ")_" ]
[ 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 ]
Unused import
aldebaran/qibuild/python/qisrc/rebase.py
[ { "content": "## Copyright (c) 2012-2016 Aldebaran Robotics. All rights reserved.\n## Use of this source code is governed by a BSD-style license that can be\n## found in the COPYING file.\n\nfrom qisys import ui\nimport qisys.error\nimport qisys.interact\n\nimport qisrc.manifest\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def rebase_worktree(git_worktree, git_projects, branch=None,\n push=False, dry_run=False):\n if not git_projects:\n return\n upstream_projects = git_worktree.get_projects_on_branch(branch)\n to_push, errors = rebase_projects(git_projects, upstream_projects, branch)\n if errors:\n mess = \"Failed to rebase some projects:\\n\"\n for git_project in errors:\n mess += \" * \" + git_project.src\n mess += \"\\n\"\n raise qisys.error.Error(mess)\n\n if push:\n push_projects(to_push, dry_run=dry_run)", "metadata": "root.rebase_worktree", "header": "['module', '___EOS___']", "index": 10 }, { "content": "def push_projects(git_projects, dry_run=False):\n if not git_projects:\n ui.info(ui.green, \"Nothing to push\")\n return\n ui.info(ui.green, \"Pushing\", len(git_projects), \"projects\")\n for i, git_project in enumerate(git_projects):\n default_branch = git_project.default_branch.name\n remote_branch = git_project.default_branch.remote_branch\n ui.info_count(i, len(git_projects), git_project.src)\n git = qisrc.git.Git(git_project.path)\n if git_project.review:\n push_remote = git_project.review_remote\n else:\n push_remote = git_project.default_remote\n remote_ref = \"%s/%s\" % (push_remote.name, remote_branch)\n to_push = \"%s:%s\" % (default_branch, remote_branch)\n push_args = [push_remote.name, to_push]\n push_args.append(\"--force\")\n if dry_run:\n push_args.append(\"--dry-run\")\n rc, out = git.push(*push_args, raises=False)\n if rc == 0:\n ui.info(out)\n else:\n ui.error(out)", "metadata": "root.push_projects", "header": "['module', '___EOS___']", "index": 26 }, { "content": "def rebase_projects(git_projects, upstream_projects, branch):\n \"\"\" Rebase all the forked project on top of the upstream\n branch\n\n Return a tuple (to_push, errors)\n\n \"\"\"\n ui.info(ui.green, \"Computing list of forked projects ...\")\n forked_projects = get_forked_projects(git_projects, upstream_projects, branch)\n if not forked_projects:\n ui.info(ui.green, \"Nothing to rebase\")\n return list(), list()\n ui.info(ui.green, \"Rebasing forked projects ...\")\n errors = list()\n to_push = list()\n max_src = max(len(x.src) for x in forked_projects)\n for i, git_project in enumerate(forked_projects):\n ui.info_count(i, len(forked_projects),\n git_project.src.ljust(max_src + 2), end=\"\")\n upstream_project = upstream_projects[git_project.src]\n ok, rebased = rebase_project(git_project, upstream_project)\n if not ok:\n errors.append(git_project)\n if rebased:\n to_push.append(git_project)\n\n return to_push, errors", "metadata": "root.rebase_projects", "header": "['module', '___EOS___']", "index": 52 }, { "content": "def get_forked_projects(git_projects, upstream_projects, branch):\n res = list()\n for git_project in git_projects:\n if not git_project.default_remote:\n continue\n if not git_project.default_branch:\n continue\n local_branch = git_project.default_branch.name\n remote_branch = git_project.default_branch.remote_branch\n remote_name = git_project.default_remote.name\n remote_ref = \"%s/%s\" % (remote_name, remote_branch)\n if not git_project.src in upstream_projects:\n ui.info(ui.brown, git_project.src, \"[skipped]\")\n ui.info(\"No match for %s on %s branch\" % (git_project.src, branch))\n continue\n upstream_project = upstream_projects[git_project.src]\n upstream_branch = upstream_project.default_branch.name\n upstream_ref = \"%s/%s\" % (upstream_project.default_remote.name, upstream_branch)\n if remote_ref != upstream_ref:\n res.append(git_project)\n return res", "metadata": "root.get_forked_projects", "header": "['module', '___EOS___']", "index": 80 }, { "content": "def rebase_project(git_project, upstream_project):\n \"\"\" Rebase the development branch of the project on the\n base branch (from upstream_project)\n\n Returns a tuple (ok, should_push)\n\n * ok is True if rebase went well (either the repo was already up-to-date,\n or the rebase happened without conflicts)\n * should_push is True if the repo should be pushed (useful to avoid\n pushing already up-to-date repos)\n \"\"\"\n ok = check_local_branch(git_project)\n if not ok:\n return False, False\n git = qisrc.git.Git(git_project.path)\n local_branch = git_project.default_branch.name\n upstream_branch = upstream_project.default_branch.name\n upstream_ref = \"%s/%s\" % (upstream_project.default_remote.name, upstream_branch)\n status = qisrc.git.get_status(git, local_branch, upstream_ref)\n if status == \"ahead\":\n ui.info(ui.green, \"[OK]\", ui.reset, \"already rebased\")\n return True, False\n if status == \"no-diff\":\n ui.info(ui.green, \"[OK]\", ui.reset, \"no diff\")\n return True, False\n if status == \"behind\":\n rc, out = git.merge(upstream_ref, raises=False)\n if rc != 0:\n ui.info(ui.red, \"[FAILED]\")\n ui.info(ui.red, \"git merge failed\\n\" + out)\n return False, False\n ui.info(ui.green, \"[OK]\", ui.reset, \"fast-forwarded\")\n return True, True\n git.call(\"tag\", \"-f\", \"before-rebase\", raises=False) # suppress output\n rc, out = git.call(\"rebase\", upstream_ref, raises=False)\n if rc == 0:\n ui.info(ui.green, \"[OK]\", ui.reset, \"rebased\")\n return True, True\n else:\n ui.info(ui.red, \"[FAILED]\", ui.reset, \"there was some conflicts\")\n git.call(\"rebase\", \"--abort\", raises=False)\n git.call(\"tag\", \"-d\", \"before-rebase\", raises=False) # suppress output\n return False, False", "metadata": "root.rebase_project", "header": "['module', '___EOS___']", "index": 102 }, { "content": "def check_local_branch(git_project):\n git = qisrc.git.Git(git_project.path)\n rc, out = git.fetch(raises=False)\n if rc != 0:\n ui.info(ui.red, \"[FAILED]\")\n ui.info(ui.red, \"git fetch failed:\\n\" + out)\n return False\n current_branch = git.get_current_branch()\n local_branch = git_project.default_branch.name\n if current_branch != local_branch:\n ui.info(ui.brown, \"[skipped] \", end=\"\")\n ui.info(\"On %s, should be on %s\" % (current_branch, local_branch))\n return False\n return True", "metadata": "root.check_local_branch", "header": "['module', '___EOS___']", "index": 146 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "c", ")", " ", "2012", "-", "2016", " ", "Al", "deb", "aran", " ", "Robot", "ics", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Us", "e", " ", "of", " ", "this", " ", "source", " ", "code", " ", "is", " ", "govern", "ed", " ", "by", " ", "a", " ", "BS", "D", "-", "style", " ", "license", " ", "tha", "t", " ", "can", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "found", " ", "in", " ", "the", " ", "COPY", "ING", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "qi", "sys_", "import_", "ui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "sys_", "._", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "qi", "sys_", "._", "interact", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "qi", "src_", "._", "manifest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "rebase", "\\u", "work", "tree_", "(_", "git", "\\u", "work", "tree_", ",_", "git", "\\u", "projects_", ",_", "branch_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "push_", "=_", "False_", ",_", "dry", "\\u", "run_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "git", "\\u", "projects_", ":_", "\\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_", "ups", "tream", "\\u", "projects_", "=_", "git", "\\u", "work", "tree_", "._", "get", "\\u", "project", "s", "\\u", "on", "\\u", "branch_", "(_", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "push_", ",_", "errors_", "=_", "rebase", "\\u", "projects_", "(_", "git", "\\u", "projects_", ",_", "ups", "tream", "\\u", "projects_", ",_", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mess_", "=_", "\"", "Fail", "ed", " ", "to", " ", "rebase", " ", "some", " ", "project", "s", ":\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "git", "\\u", "project_", "in_", "errors_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mess_", "+=_", "\"", " ", "*", " ", "\"_", "+_", "git", "\\u", "project_", "._", "src_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mess_", "+=_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "qi", "sys_", "._", "error_", "._", "Error_", "(_", "mess_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "push_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "push", "\\u", "projects_", "(_", "to", "\\u", "push_", ",_", "dry", "\\u", "run_", "=_", "dry", "\\u", "run_", ")_", "\\u\\u\\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_", "push", "\\u", "projects_", "(_", "git", "\\u", "projects_", ",_", "dry", "\\u", "run_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "git", "\\u", "projects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ui_", "._", "info_", "(_", "ui_", "._", "green_", ",_", "\"", "Not", "hing", " ", "to", " ", "push", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ui_", "._", "info_", "(_", "ui_", "._", "green_", ",_", "\"", "Push", "ing", "\"_", ",_", "len_", "(_", "git", "\\u", "projects_", ")_", ",_", "\"", "project", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "git", "\\u", "project_", "in_", "enumerate_", "(_", "git", "\\u", "projects_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "\\u", "branch_", "=_", "git", "\\u", "project_", "._", "default", "\\u", "branch_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "branch_", "=_", "git", "\\u", "project_", "._", "default", "\\u", "branch_", "._", "remote", "\\u", "branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ui_", "._", "info", "\\u", "count_", "(_", "i_", ",_", "len_", "(_", "git", "\\u", "projects_", ")_", ",_", "git", "\\u", "project_", "._", "src_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git_", "=_", "qi", "src_", "._", "git_", "._", "Git", "_", "(_", "git", "\\u", "project_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "git", "\\u", "project_", "._", "review_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "push", "\\u", "remote_", "=_", "git", "\\u", "project_", "._", "review", "\\u", "remote_", "\\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 ", " _", "push", "\\u", "remote_", "=_", "git", "\\u", "project_", "._", "default", "\\u", "remote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "remote", "\\u", "ref_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "push", "\\u", "remote_", "._", "name_", ",_", "remote", "\\u", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "push_", "=_", "\"%", "s", ":", "%", "s", "\"_", "%_", "(_", "default", "\\u", "branch_", ",_", "remote", "\\u", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "push", "\\u", "args_", "=_", "[_", "push", "\\u", "remote_", "._", "name_", ",_", "to", "\\u", "push_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "push", "\\u", "args_", "._", "append_", "(_", "\"--", "force", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dry", "\\u", "run_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "push", "\\u", "args_", "._", "append_", "(_", "\"--", "dry", "-", "run", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rc_", ",_", "out_", "=_", "git_", "._", "push_", "(_", "*_", "push", "\\u", "args_", ",_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rc_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ui_", "._", "info_", "(_", "out_", ")_", "\\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 ", " _", "ui_", "._", "error_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rebase", "\\u", "projects_", "(_", "git", "\\u", "projects_", ",_", "ups", "tream", "\\u", "projects_", ",_", "branch_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Reb", "ase", " ", "all", " ", "the", " ", "fork", "ed", " ", "project", " ", "on", " ", "top", " ", "of", " ", "the", " ", "ups", "tream", "\\", "10", ";", " ", " ", " ", " ", "branch", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "tuple", " ", "(", "to", "\\u", "push", ",", " ", "error", "s", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ui_", "._", "info_", "(_", "ui_", "._", "green_", ",_", "\"", "Comp", "uti", "ng", " ", "list", " ", "of", " ", "fork", "ed", " ", "project", "s", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fork", "ed", "\\u", "projects_", "=_", "get", "\\u", "fork", "ed", "\\u", "projects_", "(_", "git", "\\u", "projects_", ",_", "ups", "tream", "\\u", "projects_", ",_", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "fork", "ed", "\\u", "projects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ui_", "._", "info_", "(_", "ui_", "._", "green_", ",_", "\"", "Not", "hing", " ", "to", " ", "rebase", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "list_", "(_", ")_", ",_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ui_", "._", "info_", "(_", "ui_", "._", "green_", ",_", "\"", "Reb", "asin", "g", " ", "fork", "ed", " ", "project", "s", " ", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "to", "\\u", "push_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "src_", "=_", "max_", "(_", "len_", "(_", "x_", "._", "src_", ")_", "for_", "x_", "in_", "fork", "ed", "\\u", "projects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "git", "\\u", "project_", "in_", "enumerate_", "(_", "fork", "ed", "\\u", "projects_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ui_", "._", "info", "\\u", "count_", "(_", "i_", ",_", "len_", "(_", "fork", "ed", "\\u", "projects_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "git", "\\u", "project_", "._", "src_", "._", "ljust_", "(_", "max", "\\u", "src_", "+_", "2_", ")_", ",_", "end_", "=_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ups", "tream", "\\u", "project_", "=_", "ups", "tream", "\\u", "projects_", "[_", "git", "\\u", "project_", "._", "src_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ok_", ",_", "rebase", "d_", "=_", "rebase", "\\u", "project_", "(_", "git", "\\u", "project_", ",_", "ups", "tream", "\\u", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "ok_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "._", "append_", "(_", "git", "\\u", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rebase", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "push_", "._", "append_", "(_", "git", "\\u", "project_", ")_", "\\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_", "to", "\\u", "push_", ",_", "errors_", "\\u\\u\\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", "fork", "ed", "\\u", "projects_", "(_", "git", "\\u", "projects_", ",_", "ups", "tream", "\\u", "projects_", ",_", "branch_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "git", "\\u", "project_", "in_", "git", "\\u", "projects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "git", "\\u", "project_", "._", "default", "\\u", "remote_", ":_", "\\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_", "not_", "git", "\\u", "project_", "._", "default", "\\u", "branch_", ":_", "\\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_", "local", "\\u", "branch_", "=_", "git", "\\u", "project_", "._", "default", "\\u", "branch_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "branch_", "=_", "git", "\\u", "project_", "._", "default", "\\u", "branch_", "._", "remote", "\\u", "branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "name_", "=_", "git", "\\u", "project_", "._", "default", "\\u", "remote_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "remote", "\\u", "ref_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "remote", "\\u", "name_", ",_", "remote", "\\u", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "git", "\\u", "project_", "._", "src_", "in_", "ups", "tream", "\\u", "projects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ui_", "._", "info_", "(_", "ui_", "._", "brow", "n_", ",_", "git", "\\u", "project_", "._", "src_", ",_", "\"[", "skip", "ped", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ui_", "._", "info_", "(_", "\"", "No", " ", "match", " ", "for", " ", "%", "s", " ", "on", " ", "%", "s", " ", "branch", "\"_", "%_", "(_", "git", "\\u", "project_", "._", "src_", ",_", "branch_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ups", "tream", "\\u", "project_", "=_", "ups", "tream", "\\u", "projects_", "[_", "git", "\\u", "project_", "._", "src_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ups", "tream", "\\u", "branch_", "=_", "ups", "tream", "\\u", "project_", "._", "default", "\\u", "branch_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ups", "tream", "\\u", "ref_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "ups", "tream", "\\u", "project_", "._", "default", "\\u", "remote_", "._", "name_", ",_", "ups", "tream", "\\u", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "remote", "\\u", "ref_", "!=_", "ups", "tream", "\\u", "ref_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "._", "append_", "(_", "git", "\\u", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "res_", "\\u\\u\\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_", "rebase", "\\u", "project_", "(_", "git", "\\u", "project_", ",_", "ups", "tream", "\\u", "project_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Reb", "ase", " ", "the", " ", "develop", "ment", " ", "branch", " ", "of", " ", "the", " ", "project", " ", "on", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "base", " ", "branch", " ", "(", "from", " ", "ups", "tream", "\\u", "project", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "tuple", " ", "(", "ok", ",", " ", "shou", "ld", "\\u", "push", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "ok", " ", "is", " ", "Tru", "e", " ", "if", " ", "rebase", " ", "wen", "t", " ", "well", " ", "(", "eit", "her", " ", "the", " ", "repo", " ", "was", " ", "alr", "ead", "y", " ", "up", "-", "to", "-", "date", ",", "\\", "10", ";", " ", " ", "or", " ", "the", " ", "rebase", " ", "happ", "ened", " ", "with", "out", " ", "confl", "icts", ")", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "shou", "ld", "\\u", "push", " ", "is", " ", "Tru", "e", " ", "if", " ", "the", " ", "repo", " ", "shou", "ld", " ", "be", " ", "pushed", " ", "(", "usef", "ul", " ", "to", " ", "avoid", "\\", "10", ";", " ", " ", "push", "ing", " ", "alr", "ead", "y", " ", "up", "-", "to", "-", "date", " ", "repos", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ok_", "=_", "check", "\\u", "local", "\\u", "branch_", "(_", "git", "\\u", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "ok_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", ",_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "git_", "=_", "qi", "src_", "._", "git_", "._", "Git", "_", "(_", "git", "\\u", "project_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "branch_", "=_", "git", "\\u", "project_", "._", "default", "\\u", "branch_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ups", "tream", "\\u", "branch_", "=_", "ups", "tream", "\\u", "project_", "._", "default", "\\u", "branch_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ups", "tream", "\\u", "ref_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "ups", "tream", "\\u", "project_", "._", "default", "\\u", "remote_", "._", "name_", ",_", "ups", "tream", "\\u", "branch_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "qi", "src_", "._", "git_", "._", "get", "\\u", "status_", "(_", "git_", ",_", "local", "\\u", "branch_", ",_", "ups", "tream", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "status_", "==_", "\"", "ahe", "ad", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ui_", "._", "info_", "(_", "ui_", "._", "green_", ",_", "\"[", "OK", "]\"_", ",_", "ui_", "._", "reset_", ",_", "\"", "alr", "ead", "y", " ", "rebase", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", ",_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "status_", "==_", "\"", "no", "-", "diff", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ui_", "._", "info_", "(_", "ui_", "._", "green_", ",_", "\"[", "OK", "]\"_", ",_", "ui_", "._", "reset_", ",_", "\"", "no", " ", "diff", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", ",_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "status_", "==_", "\"", "beh", "ind", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rc_", ",_", "out_", "=_", "git_", "._", "merge_", "(_", "ups", "tream", "\\u", "ref_", ",_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rc_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ui_", "._", "info_", "(_", "ui_", "._", "red_", ",_", "\"[", "FAIL", "ED", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ui_", "._", "info_", "(_", "ui_", "._", "red_", ",_", "\"", "git", " ", "merge", " ", "fail", "ed", "\\\\", "n", "\"_", "+_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", ",_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ui_", "._", "info_", "(_", "ui_", "._", "green_", ",_", "\"[", "OK", "]\"_", ",_", "ui_", "._", "reset_", ",_", "\"", "fast", "-", "forwarded", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", ",_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "git_", "._", "call_", "(_", "\"", "tag", "\"_", ",_", "\"-", "f", "\"_", ",_", "\"", "bef", "ore", "-", "rebase", "\"_", ",_", "raises_", "=_", "False_", ")_", "#", " ", "suppress", " ", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rc_", ",_", "out_", "=_", "git_", "._", "call_", "(_", "\"", "rebase", "\"_", ",_", "ups", "tream", "\\u", "ref_", ",_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rc_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ui_", "._", "info_", "(_", "ui_", "._", "green_", ",_", "\"[", "OK", "]\"_", ",_", "ui_", "._", "reset_", ",_", "\"", "rebase", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", ",_", "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 ", " _", "ui_", "._", "info_", "(_", "ui_", "._", "red_", ",_", "\"[", "FAIL", "ED", "]\"_", ",_", "ui_", "._", "reset_", ",_", "\"", "there", " ", "was", " ", "some", " ", "confl", "icts", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git_", "._", "call_", "(_", "\"", "rebase", "\"_", ",_", "\"--", "abort", "\"_", ",_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git_", "._", "call_", "(_", "\"", "tag", "\"_", ",_", "\"-", "d", "\"_", ",_", "\"", "bef", "ore", "-", "rebase", "\"_", ",_", "raises_", "=_", "False_", ")_", "#", " ", "suppress", " ", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", ",_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "local", "\\u", "branch_", "(_", "git", "\\u", "project_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "git_", "=_", "qi", "src_", "._", "git_", "._", "Git", "_", "(_", "git", "\\u", "project_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rc_", ",_", "out_", "=_", "git_", "._", "fetch_", "(_", "raises_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rc_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ui_", "._", "info_", "(_", "ui_", "._", "red_", ",_", "\"[", "FAIL", "ED", "]\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ui_", "._", "info_", "(_", "ui_", "._", "red_", ",_", "\"", "git", " ", "fetch", " ", "fail", "ed", ":\\\\", "n", "\"_", "+_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "\\u", "branch_", "=_", "git_", "._", "get", "\\u", "current", "\\u", "branch_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "branch_", "=_", "git", "\\u", "project_", "._", "default", "\\u", "branch_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current", "\\u", "branch_", "!=_", "local", "\\u", "branch_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ui_", "._", "info_", "(_", "ui_", "._", "brow", "n_", ",_", "\"[", "skip", "ped", "]", " ", "\"_", ",_", "end_", "=_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ui_", "._", "info_", "(_", "\"", "On", " ", "%", "s", ",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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, 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 ]
Unnecessary pass
saltstack/salt/salt/modules/shadow.py
[ { "content": "# -*- coding: utf-8 -*-\n'''\nManage the shadow file on Linux systems\n\n.. important::\n If you feel that Salt should be using this module to manage passwords on a\n minion, and it is using a different module (or gives an error similar to\n *'shadow.info' is not available*), see :ref:`here\n <module-provider-override>`.\n'''\nfrom __future__ import absolute_import\n\n# Import python libs\nimport os\nimport datetime\ntry:\n import spwd\nexcept ImportError:\n pass\n\n# Import salt libs\nimport salt.utils\nfrom salt.exceptions import CommandExecutionError\ntry:\n import salt.utils.pycrypto\n HAS_CRYPT = True\nexcept ImportError:\n HAS_CRYPT = False\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 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Manage", " ", "the", " ", "shadow", " ", "file", " ", "on", " ", "Lin", "ux", " ", "system", "s", "\\", "10", ";", "\\", "10", ";", "..", " ", "importa", "nt", "::", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "you", " ", "feel", " ", "tha", "t", " ", "Sal", "t", " ", "shou", "ld", " ", "be", " ", "usi", "ng", " ", "this", " ", "module", " ", "to", " ", "manage", " ", "passwords", " ", "on", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "minion", ",", " ", "and", " ", "it", " ", "is", " ", "usi", "ng", " ", "a", " ", "different", " ", "module", " ", "(", "or", " ", "give", "s", " ", "an", " ", "error", " ", "similar", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "*'", "shadow", ".", "info", "'", " ", "is", " ", "not", " ", "avail", "able", "*)", ",", " ", "see", " ", ":", "ref", ":`", "here", "\\", "10", ";", " ", " ", " ", " ", "<", "module", "-", "provide", "r", "-", "override", ">`", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\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", " ", "python", " ", "libs_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sp", "wd_", "\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "salt", " ", "libs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "salt_", "._", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "salt_", "._", "exceptions_", "import_", "Command", "Execut", "ion", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "salt_", "._", "utils_", "._", "pyc", "rypt", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HAS", "\\u", "CRYPT", "_", "=_", "True_", "\\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 ", " _", "HAS", "\\u", "CRYPT", "_", "=_", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
An assert statement has a side-effect
alex/tracebin/client/tests/test_hook.py
[ { "content": " def test_inlined_function(self):\n def f(i):\n return i - 1\n def main():\n i = 1500\n while i > 0:\n i = f(i)\n i\n\n with tracebin.record() as recorder:\n main()\n\n [trace] = recorder.traces\n [entry, preamble, loop] = trace.sections\n assert len(loop.chunks) == 10\n\n assert loop.chunks[0].get_op_names() == [\"label\"]\n assert loop.chunks[1].sourcelines == [\n \"\"\" def main():\\n\"\"\",\n \"\"\" i = 1500\\n\"\"\",\n \"\"\" while i > 0:\\n\"\"\",\n ]\n assert loop.chunks[2].get_op_names() == [\"debug_merge_point\", \"debug_merge_point\", \"debug_merge_point\", \"int_gt\", \"guard_true\", \"debug_merge_point\"]\n assert loop.chunks[3].sourcelines == [\n \"\"\" i = f(i)\\n\"\"\",\n ]\n assert loop.chunks[4].get_op_names() == [\"debug_merge_point\", \"debug_merge_point\", \"debug_merge_point\", \"force_token\"]\n assert loop.chunks[5].sourcelines == [\n \"\"\" def f(i):\\n\"\"\",\n \"\"\" return i - 1\\n\"\"\",\n ]\n assert loop.chunks[5].linenos == [122, 123]\n assert loop.chunks[6].get_op_names() == [\"debug_merge_point\", \"debug_merge_point\", \"debug_merge_point\", \"int_sub\", \"debug_merge_point\"]\n assert loop.chunks[7].get_op_names() == [\"debug_merge_point\"]\n assert loop.chunks[8].sourcelines == [\n \"\"\" i\\n\"\"\",\n ]\n if self.thread_spawned():\n assert loop.chunks[9].get_op_names() == [\"debug_merge_point\", \"debug_merge_point\", \"debug_merge_point\", \"guard_not_invalidated\", \"getfield_raw\", \"int_sub\", \"setfield_raw\", \"int_lt\", \"guard_false\", \"debug_merge_point\", \"jump\"]\n else:\n assert loop.chunks[9].get_op_names() == [\"debug_merge_point\", \"debug_merge_point\", \"debug_merge_point\", \"guard_not_invalidated\", \"getfield_raw\", \"int_lt\", \"guard_false\", \"debug_merge_point\", \"jump\"]", "metadata": "root.TestHook.test_inlined_function", "header": "['class', 'TestHook', '(', 'object', ')', ':', '___EOS___']", "index": 120 } ]
[]
[]
0
true
[ "[CLS]_", "An", "_", "assert_", "statement_", "has_", "a_", "side_", "-_", "effect_", "[SEP]_", "class_", "Test", "Hook_", "(_", "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_", "test\\u", "inline", "d\\u", "function_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "f_", "(_", "i_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "i_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "1500_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "i_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "f_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "trace", "bin_", "._", "record_", "(_", ")_", "as_", "recorder_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[_", "trace_", "]_", "=_", "recorder_", "._", "traces_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[_", "entry_", ",_", "preamble_", ",_", "loop_", "]_", "=_", "trace_", "._", "sections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "loop_", "._", "chunks_", ")_", "==_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "loop_", "._", "chunks_", "[_", "0_", "]_", "._", "get", "\\u", "op", "\\u", "names_", "(_", ")_", "==_", "[_", "\"", "label", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "loop_", "._", "chunks_", "[_", "1_", "]_", "._", "source", "lines_", "==_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", " ", " ", " ", "def", " ", "main", "():", "\\\\", "n", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", " ", " ", " ", "i", " ", "=", " ", "150", "0", "\\\\", "n", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", " ", " ", " ", "whi", "le", " ", "i", " ", ">", " ", "0", ":\\\\", "n", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "loop_", "._", "chunks_", "[_", "2_", "]_", "._", "get", "\\u", "op", "\\u", "names_", "(_", ")_", "==_", "[_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", ",_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", ",_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", ",_", "\"", "int\\u", "gt", "\"_", ",_", "\"", "guard", "\\u", "true", "\"_", ",_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "loop_", "._", "chunks_", "[_", "3_", "]_", "._", "source", "lines_", "==_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", " ", " ", " ", "i", " ", "=", " ", "f", "(", "i", ")\\\\", "n", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "loop_", "._", "chunks_", "[_", "4_", "]_", "._", "get", "\\u", "op", "\\u", "names_", "(_", ")_", "==_", "[_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", ",_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", ",_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", ",_", "\"", "force", "\\u", "token", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "loop_", "._", "chunks_", "[_", "5_", "]_", "._", "source", "lines_", "==_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", " ", " ", " ", "def", " ", "f", "(", "i", "):", "\\\\", "n", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", " ", " ", " ", "return", " ", "i", " ", "-", " ", "1", "\\\\", "n", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "loop_", "._", "chunks_", "[_", "5_", "]_", "._", "linen", "os_", "==_", "[_", "122_", ",_", "123_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "loop_", "._", "chunks_", "[_", "6_", "]_", "._", "get", "\\u", "op", "\\u", "names_", "(_", ")_", "==_", "[_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", ",_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", ",_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", ",_", "\"", "int\\u", "sub", "\"_", ",_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "loop_", "._", "chunks_", "[_", "7_", "]_", "._", "get", "\\u", "op", "\\u", "names_", "(_", ")_", "==_", "[_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "loop_", "._", "chunks_", "[_", "8_", "]_", "._", "source", "lines_", "==_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", " ", " ", " ", "i", "\\\\", "n", "\"\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "thread", "\\u", "spawne", "d_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "loop_", "._", "chunks_", "[_", "9_", "]_", "._", "get", "\\u", "op", "\\u", "names_", "(_", ")_", "==_", "[_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", ",_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", ",_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", ",_", "\"", "guard", "\\u", "not", "\\u", "invalidate", "d", "\"_", ",_", "\"", "getf", "iel", "d\\u", "raw", "\"_", ",_", "\"", "int\\u", "sub", "\"_", ",_", "\"", "setf", "iel", "d\\u", "raw", "\"_", ",_", "\"", "int\\u", "lt", "\"_", ",_", "\"", "guard", "\\u", "fal", "se", "\"_", ",_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", ",_", "\"", "jump", "\"_", "]_", "\\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_", "loop_", "._", "chunks_", "[_", "9_", "]_", "._", "get", "\\u", "op", "\\u", "names_", "(_", ")_", "==_", "[_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", ",_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", ",_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", ",_", "\"", "guard", "\\u", "not", "\\u", "invalidate", "d", "\"_", ",_", "\"", "getf", "iel", "d\\u", "raw", "\"_", ",_", "\"", "int\\u", "lt", "\"_", ",_", "\"", "guard", "\\u", "fal", "se", "\"_", ",_", "\"", "debug", "\\u", "merge", "\\u", "point", "\"_", ",_", "\"", "jump", "\"_", "]_", "\\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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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, 2, 2, 2, 2, 2, 2 ]
Unnecessary delete statement in function
deanhiller/databus/webapp/play1.3.x/python/Lib/threading.py
[ { "content": " def __bootstrap_inner(self):\n try:\n self.__ident = _get_ident()\n self.__started.set()\n _active_limbo_lock.acquire()\n _active[self.__ident] = self\n del _limbo[self]\n _active_limbo_lock.release()\n if __debug__:\n self._note(\"%s.__bootstrap(): thread started\", self)\n\n if _trace_hook:\n self._note(\"%s.__bootstrap(): registering trace hook\", self)\n _sys.settrace(_trace_hook)\n if _profile_hook:\n self._note(\"%s.__bootstrap(): registering profile hook\", self)\n _sys.setprofile(_profile_hook)\n\n try:\n self.run()\n except SystemExit:\n if __debug__:\n self._note(\"%s.__bootstrap(): raised SystemExit\", self)\n except:\n if __debug__:\n self._note(\"%s.__bootstrap(): unhandled exception\", self)\n # If sys.stderr is no more (most likely from interpreter\n # shutdown) use self.__stderr. Otherwise still use sys (as in\n # _sys) in case sys.stderr was redefined since the creation of\n # self.\n if _sys:\n _sys.stderr.write(\"Exception in thread %s:\\n%s\\n\" %\n (self.name, _format_exc()))\n else:\n # Do the best job possible w/o a huge amt. of code to\n # approximate a traceback (code ideas from\n # Lib/traceback.py)\n exc_type, exc_value, exc_tb = self.__exc_info()\n try:\n print>>self.__stderr, (\n \"Exception in thread \" + self.name +\n \" (most likely raised during interpreter shutdown):\")\n print>>self.__stderr, (\n \"Traceback (most recent call last):\")\n while exc_tb:\n print>>self.__stderr, (\n ' File \"%s\", line %s, in %s' %\n (exc_tb.tb_frame.f_code.co_filename,\n exc_tb.tb_lineno,\n exc_tb.tb_frame.f_code.co_name))\n exc_tb = exc_tb.tb_next\n print>>self.__stderr, (\"%s: %s\" % (exc_type, exc_value))\n # Make sure that exc_tb gets deleted since it is a memory\n # hog; deleting everything else is just for thoroughness\n finally:\n del exc_type, exc_value, exc_tb\n else:\n if __debug__:\n self._note(\"%s.__bootstrap(): normal return\", self)\n finally:\n # Prevent a race in\n # test_threading.test_no_refcycle_through_target when\n # the exception keeps the target alive past when we\n # assert that it's dead.\n self.__exc_clear()\n finally:\n with _active_limbo_lock:\n self.__stop()\n try:\n # We don't call self.__delete() because it also\n # grabs _active_limbo_lock.\n del _active[_get_ident()]\n except:\n pass", "metadata": "root.Thread.__bootstrap_inner", "header": "['class', 'Thread', '(', '_Verbose', ')', ':', '___EOS___']", "index": 502 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "delete_", "statement_", "in_", "function_", "[SEP]_", "class_", "Thread_", "(_", "\\u", "Verbos", "e_", ")_", ":_", "\\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", "boots", "trap", "\\u", "inner_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "ident_", "=_", "\\u", "get", "\\u", "ident_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "started_", "._", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "active", "\\u", "limb", "o", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "active_", "[_", "self_", "._", "\\u\\u", "ident_", "]_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "\\u", "limb", "o_", "[_", "self_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "active", "\\u", "limb", "o", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "note_", "(_", "\"%", "s", ".\\u", "\\u", "boots", "trap", "():", " ", "thread", " ", "start", "ed", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "trace", "\\u", "hook_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "note_", "(_", "\"%", "s", ".\\u", "\\u", "boots", "trap", "():", " ", "register", "ing", " ", "trace", " ", "hook", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "sys_", "._", "sett", "race_", "(_", "\\u", "trace", "\\u", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "profile", "\\u", "hook_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "note_", "(_", "\"%", "s", ".\\u", "\\u", "boots", "trap", "():", " ", "register", "ing", " ", "profile", " ", "hook", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "sys_", "._", "setp", "rofile", "_", "(_", "\\u", "profile", "\\u", "hook_", ")_", "\\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 ", " _", "self_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "System", "Exit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "note_", "(_", "\"%", "s", ".\\u", "\\u", "boots", "trap", "():", " ", "raise", "d", " ", "System", "Exi", "t", "\"_", ",_", "self_", ")_", "\\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 ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "note_", "(_", "\"%", "s", ".\\u", "\\u", "boots", "trap", "():", " ", "unhandled", " ", "exception", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "sys", ".", "std", "err", " ", "is", " ", "no", " ", "more", " ", "(", "most", " ", "like", "ly", " ", "from", " ", "interpreter_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shut", "down", ")", " ", "use", " ", "self", ".\\u", "\\u", "std", "err", ".", " ", " ", "Ot", "her", "wis", "e", " ", "still", " ", "use", " ", "sys", " ", "(", "as", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\\u", "sys", ")", " ", "in", " ", "case", " ", "sys", ".", "std", "err", " ", "was", " ", "rede", "fined", " ", "sinc", "e", " ", "the", " ", "creati", "on", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "sys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "sys_", "._", "stderr_", "._", "write_", "(_", "\"", "Except", "ion", " ", "in", " ", "thread", " ", "%", "s", ":\\\\", "n", "%", "s", "\\\\", "n", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "name_", ",_", "\\u", "format\\u", "exc_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Do", " ", "the", " ", "best", " ", "job", " ", "possib", "le", " ", "w", "/", "o", " ", "a", " ", "huge", " ", "amt", ".", " ", "of", " ", "code", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "approximate", " ", "a", " ", "traceback", " ", "(", "code", " ", "idea", "s", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Lib", "/", "traceback", ".", "py", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "exc", "\\u", "tb_", "=_", "self_", "._", "\\u\\u", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", ">>_", "self_", "._", "\\u\\u", "stderr_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Except", "ion", " ", "in", " ", "thread", " ", "\"_", "+_", "self_", "._", "name_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "(", "most", " ", "like", "ly", " ", "raise", "d", " ", "dur", "ing", " ", "interprete", "r", " ", "shut", "down", "):\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", ">>_", "self_", "._", "\\u\\u", "stderr_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", "):\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "exc", "\\u", "tb_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", ">>_", "self_", "._", "\\u\\u", "stderr_", ",_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", " ", " ", "File", " ", "\"%", "s", "\",", " ", "line", " ", "%", "s", ",", " ", "in", " ", "%", "s", "'_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "exc", "\\u", "tb_", "._", "tb", "\\u", "frame_", "._", "f", "\\u", "code_", "._", "co", "\\u", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exc", "\\u", "tb_", "._", "tb", "\\u", "lineno_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "exc", "\\u", "tb_", "._", "tb", "\\u", "frame_", "._", "f", "\\u", "code_", "._", "co", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exc", "\\u", "tb_", "=_", "exc", "\\u", "tb_", "._", "tb", "\\u", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", ">>_", "self_", "._", "\\u\\u", "stderr_", ",_", "(_", "\"%", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "tha", "t", " ", "exc", "\\u", "tb", " ", "gets", " ", "delete", "d", " ", "sinc", "e", " ", "it", " ", "is", " ", "a", " ", "memory_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "hog", ";", " ", "delet", "ing", " ", "every", "thing", " ", "else", " ", "is", " ", "just", " ", "for", " ", "thor", "ou", "gh", "ness_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "del_", "exc", "\\u", "type_", ",_", "exc", "\\u", "value_", ",_", "exc", "\\u", "tb_", "\\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 ", " _", "if_", "\\u\\u", "debug", "\\u\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "note_", "(_", "\"%", "s", ".\\u", "\\u", "boots", "trap", "():", " ", "normal", " ", "return", "\"_", ",_", "self_", ")_", "\\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_", "#", " ", "Prev", "ent", " ", "a", " ", "race", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test\\u", "thread", "ing", ".", "test\\u", "no", "\\u", "ref", "cycle", "\\u", "through", "\\u", "target", " ", "when_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "exception", " ", "keep", "s", " ", "the", " ", "target", " ", "alive", " ", "past", " ", "whe", "n", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assert", " ", "tha", "t", " ", "it", "'", "s", " ", "dead", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "exc", "\\u", "clear_", "(_", ")_", "\\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 ", " _", "with_", "\\u", "active", "\\u", "limb", "o", "\\u", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "don", "'", "t", " ", "call", " ", "self", ".\\u", "\\u", "delete", "()", " ", "bec", "aus", "e", " ", "it", " ", "als", "o_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "gra", "bs", " ", "\\u", "active", "\\u", "limb", "o", "\\u", "lock", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "del_", "\\u", "active_", "[_", "\\u", "get", "\\u", "ident_", "(_", ")_", "]_", "\\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_" ]
[ 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,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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 ]
Unused import
google/grr/grr/gui/plugins/semantic.py
[ { "content": "#!/usr/bin/env python\n\"\"\"This file contains specialized renderers for semantic values.\n\nOther files may also contain specialized renderers for semantic types relevant\nto their function, but here we include the most basic and common renderers.\n\"\"\"\n\nimport itertools\nimport urllib\n\nimport logging\n\nfrom grr.gui import renderers\nfrom grr.gui.plugins import forms\nfrom grr.lib import aff4\nfrom grr.lib import rdfvalue\nfrom grr.lib import utils\nfrom grr.lib.aff4_objects import aff4_grr\nfrom grr.lib.rdfvalues import crypto as rdf_crypto\nfrom grr.lib.rdfvalues import protodict as rdf_protodict\nfrom grr.lib.rdfvalues import structs as rdf_structs\n\n\n# Caches for FindRendererForObject(), We can have a renderer for a repeated\n# member by extending RDFValueArrayRenderer and a renderer for a single item by\n# extending RDFValueRenderer.\nrepeated_renderer_cache = {}\nsemantic_renderer_cache = {}\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": "def FindRendererForObject(rdf_obj):\n \"\"\"Find the appropriate renderer for an RDFValue object.\"\"\"\n # Rebuild the cache if needed.\n if not semantic_renderer_cache:\n for cls in RDFValueRenderer.classes.values():\n if aff4.issubclass(cls, RDFValueArrayRenderer):\n repeated_renderer_cache[cls.classname] = cls\n\n elif aff4.issubclass(cls, RDFValueRenderer):\n semantic_renderer_cache[cls.classname] = cls\n\n rdf_obj_classname = rdf_obj.__class__.__name__\n\n # Try to find an RDFValueArray renderer for repeated types. This allows\n # renderers to be specified for repeated fields.\n if isinstance(rdf_obj, rdf_protodict.RDFValueArray):\n return repeated_renderer_cache.get(\n rdf_obj_classname, RDFValueArrayRenderer)(rdf_obj)\n\n if isinstance(rdf_obj, rdf_structs.RepeatedFieldHelper):\n rdf_obj_classname = rdf_obj.type_descriptor.type.__name__\n return repeated_renderer_cache.get(\n rdf_obj_classname, RDFValueArrayRenderer)(rdf_obj)\n\n # If it is a semantic proto, we just use the RDFProtoRenderer.\n if isinstance(rdf_obj, rdf_structs.RDFProtoStruct):\n return semantic_renderer_cache.get(\n rdf_obj_classname, RDFProtoRenderer)(rdf_obj)\n\n # If it is a semantic value, we just use the RDFValueRenderer.\n if isinstance(rdf_obj, rdfvalue.RDFValue):\n return semantic_renderer_cache.get(\n rdf_obj_classname, RDFValueRenderer)(rdf_obj)\n\n elif isinstance(rdf_obj, dict):\n return DictRenderer(rdf_obj)\n\n # Default renderer.\n return RDFValueRenderer(rdf_obj)", "metadata": "root.FindRendererForObject", "header": "['module', '___EOS___']", "index": 30 }, { "content": "class RDFValueColumn(renderers.TableColumn):\n \"\"\"A column to store an RDFValue in a Table.\"\"\"\n", "metadata": "root.RDFValueColumn", "header": "['module', '___EOS___']", "index": 71 }, { "content": " def RenderRow(self, index, request, row_options=None):\n \"\"\"Render the RDFValue stored at the specific index.\"\"\"\n value = self.rows.get(index)\n if value is None:\n return \"\"\n\n if row_options is not None:\n row_options[\"row_id\"] = index\n\n if self.renderer:\n renderer = self.renderer(value)\n else:\n renderer = FindRendererForObject(value)\n\n # Intantiate the renderer and return the HTML\n if renderer:\n result = renderer.RawHTML(request)\n else:\n result = utils.SmartStr(value)\n\n return result", "metadata": "root.RDFValueColumn.RenderRow", "header": "['class', 'RDFValueColumn', '(', 'renderers', '.', 'TableColumn', ')', ':', '___EOS___']", "index": 74 }, { "content": "class AttributeColumn(RDFValueColumn):\n \"\"\"A table column which can be filled from an AFF4Object.\"\"\"\n\n", "metadata": "root.AttributeColumn", "header": "['module', '___EOS___']", "index": 97 }, { "content": " def __init__(self, name, **kwargs):\n # Locate the attribute\n self.attribute = aff4.Attribute.GetAttributeByName(name)\n super(AttributeColumn, self).__init__(name, **kwargs)", "metadata": "root.AttributeColumn.__init__", "header": "['class', 'AttributeColumn', '(', 'RDFValueColumn', ')', ':', '___EOS___']", "index": 100 }, { "content": " def AddRowFromFd(self, index, fd):\n \"\"\"Add a new value from the fd.\"\"\"\n value = fd.Get(self.attribute)\n try:\n # Unpack flows that are stored inside tasks.\n value = value.Payload()\n except AttributeError:\n pass\n if value is not None:\n self.rows[index] = value", "metadata": "root.AttributeColumn.AddRowFromFd", "header": "['class', 'AttributeColumn', '(', 'RDFValueColumn', ')', ':', '___EOS___']", "index": 105 }, { "content": "class RDFValueRenderer(renderers.TemplateRenderer):\n \"\"\"These are abstract classes for rendering RDFValues.\"\"\"\n\n # This specifies the name of the RDFValue object we will render.\n classname = \"\"\n\n layout_template = renderers.Template(\"\"\"\n{{this.proxy|escape}}\n\"\"\")\n\n", "metadata": "root.RDFValueRenderer", "header": "['module', '___EOS___']", "index": 117 }, { "content": " def __init__(self, proxy=None, **kwargs):\n \"\"\"Constructor.\n\n This class renders a specific AFF4 object which we delegate.\n\n Args:\n proxy: The RDFValue class we delegate.\n **kwargs: passthrough to baseclass.\n \"\"\"\n self.proxy = proxy\n super(RDFValueRenderer, self).__init__(**kwargs)", "metadata": "root.RDFValueRenderer.__init__", "header": "['class', 'RDFValueRenderer', '(', 'renderers', '.', 'TemplateRenderer', ')', ':', '___EOS___']", "index": 127 }, { "content": " @classmethod\n def RendererForRDFValue(cls, rdfvalue_cls_name):\n \"\"\"Returns the class of the RDFValueRenderer which renders rdfvalue_cls.\"\"\"\n for candidate in cls.classes.values():\n if (aff4.issubclass(candidate, RDFValueRenderer) and\n candidate.classname == rdfvalue_cls_name):\n return candidate", "metadata": "root.RDFValueRenderer.RendererForRDFValue", "header": "['class', 'RDFValueRenderer', '(', 'renderers', '.', 'TemplateRenderer', ')', ':', '___EOS___']", "index": 139 }, { "content": "class ValueRenderer(RDFValueRenderer):\n \"\"\"A renderer which renders an RDFValue in machine readable format.\"\"\"\n\n layout_template = renderers.Template(\"\"\"\n<span type='{{this.rdfvalue_type|escape}}' rdfvalue='{{this.value|escape}}'>\n {{this.rendered_value|safe}}\n</span>\n\"\"\")\n", "metadata": "root.ValueRenderer", "header": "['module', '___EOS___']", "index": 148 }, { "content": " def Layout(self, request, response):\n self.rdfvalue_type = self.proxy.__class__.__name__\n try:\n self.value = self.proxy.SerializeToString()\n except AttributeError:\n self.value = utils.SmartStr(self.proxy)\n\n renderer = FindRendererForObject(self.proxy)\n self.rendered_value = renderer.RawHTML(request)\n return super(ValueRenderer, self).Layout(request, response)", "metadata": "root.ValueRenderer.Layout", "header": "['class', 'ValueRenderer', '(', 'RDFValueRenderer', ')', ':', '___EOS___']", "index": 157 }, { "content": "class SubjectRenderer(RDFValueRenderer):\n \"\"\"A special renderer for Subject columns.\"\"\"\n classname = \"Subject\"\n\n layout_template = renderers.Template(\"\"\"\n<span type=subject aff4_path='{{this.aff4_path|escape}}'\n tree_node_id='{{this.tree_node_id|escape}}'>\n {{this.basename|escape}}\n</span>\n\"\"\")\n", "metadata": "root.SubjectRenderer", "header": "['module', '___EOS___']", "index": 169 }, { "content": " def Layout(self, request, response):\n if not self.proxy:\n return\n\n aff4_path = request.REQ.get(\"aff4_path\", \"\")\n aff4_path = rdfvalue.RDFURN(aff4_path)\n self.basename = self.proxy.RelativeName(aff4_path) or self.proxy\n self.aff4_path = self.proxy\n self.tree_node_id = renderers.DeriveIDFromPath(\n \"/\".join(self.aff4_path.Split()[1:]))\n\n return super(SubjectRenderer, self).Layout(request, response)", "metadata": "root.SubjectRenderer.Layout", "header": "['class', 'SubjectRenderer', '(', 'RDFValueRenderer', ')', ':', '___EOS___']", "index": 180 }, { "content": "class RDFBytesRenderer(RDFValueRenderer):\n \"\"\"A renderer for RDFBytes.\"\"\"\n classname = \"RDFBytes\"\n", "metadata": "root.RDFBytesRenderer", "header": "['module', '___EOS___']", "index": 194 }, { "content": " def Layout(self, request, response):\n self.proxy = utils.SmartStr(self.proxy).encode(\"string-escape\")\n super(RDFBytesRenderer, self).Layout(request, response)", "metadata": "root.RDFBytesRenderer.Layout", "header": "['class', 'RDFBytesRenderer', '(', 'RDFValueRenderer', ')', ':', '___EOS___']", "index": 198 }, { "content": "class LiteralExpressionRenderer(RDFBytesRenderer):\n classname = \"LiteralExpression\"", "metadata": "root.LiteralExpressionRenderer", "header": "['module', '___EOS___']", "index": 203 }, { "content": "class RDFURNRenderer(RDFValueRenderer):\n \"\"\"A special renderer for RDFURNs.\"\"\"\n\n classname = \"RDFURN\"\n\n layout_template = renderers.Template(\"\"\"\n{% if this.href %}\n<a href='#{{this.href|escape}}'\n onclick='grr.loadFromHash(\"{{this.href|escape}}\");'>\n {{this.proxy|escape}}\n</a>\n{% else %}\n{{this.proxy|escape}}\n{% endif %}\n\"\"\")\n", "metadata": "root.RDFURNRenderer", "header": "['module', '___EOS___']", "index": 207 }, { "content": " def Layout(self, request, response):\n client, rest = self.proxy.Split(2)\n if aff4_grr.VFSGRRClient.CLIENT_ID_RE.match(client):\n h = dict(main=\"VirtualFileSystemView\",\n c=client,\n tab=\"AFF4Stats\",\n t=renderers.DeriveIDFromPath(rest))\n self.href = urllib.urlencode(sorted(h.items()))\n\n super(RDFURNRenderer, self).Layout(request, response)", "metadata": "root.RDFURNRenderer.Layout", "header": "['class', 'RDFURNRenderer', '(', 'RDFValueRenderer', ')', ':', '___EOS___']", "index": 223 }, { "content": "class RDFProtoRenderer(RDFValueRenderer):\n \"\"\"Nicely render protobuf based RDFValues.\n\n Its possible to override specific fields in the protobuf by providing a method\n like:\n\n translate_method_name(self, value)\n\n which is expected to return a safe html unicode object reflecting the value in\n the value field.\n \"\"\"\n name = \"\"\n\n # The field which holds the protobuf\n proxy_field = \"data\"\n\n # {{value}} comes from the translator so its assumed to be safe.\n layout_template = renderers.Template(\"\"\"\n<table class='proto_table'>\n<tbody>\n{% for key, desc, value in this.result %}\n<tr>\n <td class=\"proto_key\">\n {% if desc %}\n <abbr title='{{desc|escape}}'>\n {{key|escape}}\n </abbr>\n {% else %}\n {{key|escape}}\n {% endif %}\n </td>\n <td class=\"proto_value\">\n {{value|safe}}\n </td>\n</tr>\n{% endfor %}\n</tbody>\n</table>\n\"\"\")\n\n # This is a translation dispatcher for rendering special fields.\n translator = {}\n\n translator_error_template = renderers.Template(\"<pre>{{value|escape}}</pre>\")\n\n\n hrb_template = renderers.Template(\"{{value|filesizeformat}}\")\n\n\n pre_template = renderers.Template(\"<pre>{{value|escape}}</pre>\")\n\n", "metadata": "root.RDFProtoRenderer", "header": "['module', '___EOS___']", "index": 235 }, { "content": " def Ignore(self, unused_descriptor, unused_value):\n \"\"\"A handler for ignoring a value.\"\"\"\n return None", "metadata": "root.RDFProtoRenderer.Ignore", "header": "['class', 'RDFProtoRenderer', '(', 'RDFValueRenderer', ')', ':', '___EOS___']", "index": 280 }, { "content": " def HumanReadableBytes(self, _, value):\n \"\"\"Format byte values using human readable units.\"\"\"\n return self.FormatFromTemplate(self.hrb_template, value=value)", "metadata": "root.RDFProtoRenderer.HumanReadableBytes", "header": "['class', 'RDFProtoRenderer', '(', 'RDFValueRenderer', ')', ':', '___EOS___']", "index": 286 }, { "content": " def Pre(self, _, value):\n return self.FormatFromTemplate(self.pre_template, value=value)", "metadata": "root.RDFProtoRenderer.Pre", "header": "['class', 'RDFProtoRenderer', '(', 'RDFValueRenderer', ')', ':', '___EOS___']", "index": 292 }, { "content": " def Layout(self, request, response):\n \"\"\"Render the protobuf as a table.\"\"\"\n self.result = []\n for descriptor, value in self.proxy.ListSetFields():\n name = descriptor.name\n friendly_name = descriptor.friendly_name or name\n\n # Try to translate the value if there is a special translator for it.\n if name in self.translator:\n try:\n value = self.translator[name](self, request, value)\n if value is not None:\n self.result.append((friendly_name, descriptor.description, value))\n\n # If the translation fails for whatever reason, just output the string\n # value literally (after escaping)\n except KeyError:\n value = self.FormatFromTemplate(self.translator_error_template,\n value=value)\n except Exception as e: # pylint: disable=broad-except\n logging.warn(\"Failed to render {0}. Err: {1}\".format(name, e))\n value = \"\"\n\n else:\n renderer = FindRendererForObject(value)\n\n self.result.append((friendly_name, descriptor.description,\n renderer.RawHTML(request)))\n\n return super(RDFProtoRenderer, self).Layout(request, response)", "metadata": "root.RDFProtoRenderer.Layout", "header": "['class', 'RDFProtoRenderer', '(', 'RDFValueRenderer', ')', ':', '___EOS___']", "index": 295 }, { "content": "class RDFValueArrayRenderer(RDFValueRenderer):\n \"\"\"Renders arrays of RDFValues.\"\"\"\n\n # {{entry}} comes from the individual rdfvalue renderers so it is assumed to\n # be safe.\n layout_template = renderers.Template(\"\"\"\n<table class='proto_table'>\n<tbody>\n{% for entry in this.data %}\n<tr class=\"proto_separator\"></tr>\n<tr>\n <td>{{entry|safe}}</td>\n</tr>\n{% endfor %}\n{% if this.next_start %}\n<tr class=\"proto_separator\"></tr>\n<tr>\n <td><div id=\"{{unique}}\"> (<a>Additional data available</a>) </div></td>\n</tr>\n{% endif %}\n</tbody>\n</table>\n\"\"\")\n", "metadata": "root.RDFValueArrayRenderer", "header": "['module', '___EOS___']", "index": 327 }, { "content": " def Layout(self, request, response):\n \"\"\"Render the protobuf as a table.\"\"\"\n # Remove these from the request in case we need to pass it to another\n # renderer.\n start = int(request.REQ.pop(\"start\", 0))\n length = int(request.REQ.pop(\"length\", 10))\n\n # We can get called again to render from an existing cache.\n cache = request.REQ.pop(\"cache\", None)\n if cache:\n self.cache = aff4.FACTORY.Open(cache, token=request.token)\n self.proxy = rdf_protodict.RDFValueArray(self.cache.Read(1000000))\n\n else:\n # We need to create a cache if this is too long.\n if len(self.proxy) > length:\n # Make a cache\n with aff4.FACTORY.Create(None, \"TempMemoryFile\",\n token=request.token) as self.cache:\n data = rdf_protodict.RDFValueArray()\n data.Extend(self.proxy)\n self.cache.Write(data.SerializeToString())\n\n self.data = []\n\n self.next_start = 0\n for i, element in enumerate(self.proxy):\n if i < start:\n continue\n\n elif len(self.data) > length:\n self.next_start = i\n self.length = 100\n break\n\n renderer = FindRendererForObject(element)\n if renderer:\n try:\n self.data.append(renderer.RawHTML(request))\n except Exception as e: # pylint: disable=broad-except\n logging.error(\n \"Unable to render %s with %s: %s\", type(element), renderer, e)\n\n response = super(RDFValueArrayRenderer, self).Layout(request, response)\n if self.next_start:\n response = self.CallJavascript(response, \"RDFValueArrayRenderer.Layout\",\n next_start=self.next_start,\n cache_urn=self.cache.urn,\n array_length=self.length)\n return response", "metadata": "root.RDFValueArrayRenderer.Layout", "header": "['class', 'RDFValueArrayRenderer', '(', 'RDFValueRenderer', ')', ':', '___EOS___']", "index": 351 }, { "content": "class DictRenderer(RDFValueRenderer):\n \"\"\"Renders dicts.\"\"\"\n\n classname = \"Dict\"\n # Keys to filter from the output.\n filter_keys = None\n\n # {{value}} comes from the translator so its assumed to be safe.\n layout_template = renderers.Template(\"\"\"\n{% if this.data %}\n<table class='proto_table'>\n<tbody>\n {% for key, value in this.data %}\n <tr>\n <td class=\"proto_key\">{{key|escape}}</td><td class=\"proto_value\">\n {{value|safe}}\n </td>\n </tr>\n {% endfor %}\n</tbody>\n</table>\n{% endif %}\n\"\"\")\n\n translator_error_template = renderers.Template(\"<pre>{{value|escape}}</pre>\")\n\n", "metadata": "root.DictRenderer", "header": "['module', '___EOS___']", "index": 403 }, { "content": " def __init__(self, proxy=None, filter_keys=None, **kwargs):\n self.filter_keys = filter_keys or []\n super(DictRenderer, self).__init__(proxy=proxy, **kwargs)", "metadata": "root.DictRenderer.__init__", "header": "['class', 'DictRenderer', '(', 'RDFValueRenderer', ')', ':', '___EOS___']", "index": 429 }, { "content": " def Layout(self, request, response):\n \"\"\"Render the protodict as a table.\"\"\"\n self.data = []\n\n for key, value in sorted(self.proxy.items()):\n rendered_value = None\n\n if key in self.filter_keys:\n continue\n try:\n renderer = FindRendererForObject(value)\n if renderer:\n rendered_value = renderer.RawHTML(request)\n else:\n raise TypeError(\"Unknown renderer\")\n\n # If the translation fails for whatever reason, just output the string\n # value literally (after escaping)\n except TypeError:\n rendered_value = self.FormatFromTemplate(self.translator_error_template,\n value=value)\n except Exception as e: # pylint: disable=broad-except\n logging.warn(\"Failed to render {0}. Err: {1}\".format(type(value), e))\n\n if rendered_value is not None:\n self.data.append((key, rendered_value))\n\n return super(DictRenderer, self).Layout(request, response)", "metadata": "root.DictRenderer.Layout", "header": "['class', 'DictRenderer', '(', 'RDFValueRenderer', ')', ':', '___EOS___']", "index": 433 }, { "content": "class ListRenderer(RDFValueArrayRenderer):\n classname = \"list\"", "metadata": "root.ListRenderer", "header": "['module', '___EOS___']", "index": 463 }, { "content": "class IconRenderer(RDFValueRenderer):\n width = 0\n layout_template = renderers.Template(\"\"\"\n<div class=\"centered\">\n<img class='grr-icon {{this.proxy.icon}}'\n src='/static/images/{{this.proxy.icon}}.png'\n alt='{{this.proxy.description}}' title='{{this.proxy.description}}'\n /></div>\"\"\")", "metadata": "root.IconRenderer", "header": "['module', '___EOS___']", "index": 467 }, { "content": "class RDFValueCollectionRenderer(renderers.TableRenderer):\n \"\"\"Renderer for RDFValueCollection objects.\"\"\"\n\n post_parameters = [\"aff4_path\"]\n size = 0\n show_total_count = True\n layout_template = \"\"\"\n{% if this.size > 0 %}\n {% if this.show_total_count %}\n <h5>{{this.size}} Entries</h5>\n {% endif %}\n{% endif %}\n\"\"\" + renderers.TableRenderer.layout_template\n\n\n", "metadata": "root.RDFValueCollectionRenderer", "header": "['module', '___EOS___']", "index": 477 }, { "content": " def __init__(self, **kwargs):\n super(RDFValueCollectionRenderer, self).__init__(**kwargs)\n self.AddColumn(RDFValueColumn(\"Value\", width=\"100%\"))", "metadata": "root.RDFValueCollectionRenderer.__init__", "header": "['class', 'RDFValueCollectionRenderer', '(', 'renderers', '.', 'TableRenderer', ')', ':', '___EOS___']", "index": 491 }, { "content": " def BuildTable(self, start_row, end_row, request):\n \"\"\"Builds a table of rdfvalues.\"\"\"\n try:\n aff4_path = self.state.get(\"aff4_path\") or request.REQ.get(\"aff4_path\")\n collection = aff4.FACTORY.Open(aff4_path,\n aff4_type=\"RDFValueCollection\",\n token=request.token)\n except IOError:\n return\n\n try:\n self.size = len(collection)\n except AttributeError:\n self.show_total_count = False\n\n row_index = start_row\n for value in itertools.islice(collection, start_row, end_row):\n self.AddCell(row_index, \"Value\", value)\n row_index += 1", "metadata": "root.RDFValueCollectionRenderer.BuildTable", "header": "['class', 'RDFValueCollectionRenderer', '(', 'renderers', '.', 'TableRenderer', ')', ':', '___EOS___']", "index": 495 }, { "content": " def Layout(self, request, response, aff4_path=None):\n if aff4_path:\n self.state[\"aff4_path\"] = str(aff4_path)\n collection = aff4.FACTORY.Create(aff4_path, mode=\"r\",\n aff4_type=\"RDFValueCollection\",\n token=request.token)\n\n try:\n self.size = len(collection)\n except AttributeError:\n self.show_total_count = False\n\n return super(RDFValueCollectionRenderer, self).Layout(\n request, response)", "metadata": "root.RDFValueCollectionRenderer.Layout", "header": "['class', 'RDFValueCollectionRenderer', '(', 'renderers', '.', 'TableRenderer', ')', ':', '___EOS___']", "index": 515 }, { "content": "class FlowStateRenderer(DictRenderer):\n \"\"\"A Flow state is similar to a dict.\"\"\"\n classname = \"FlowState\"", "metadata": "root.FlowStateRenderer", "header": "['module', '___EOS___']", "index": 531 }, { "content": "class DataObjectRenderer(DictRenderer):\n \"\"\"A flow data object is also similar to a dict.\"\"\"\n classname = \"DataObject\"", "metadata": "root.DataObjectRenderer", "header": "['module', '___EOS___']", "index": 536 }, { "content": "class AES128KeyFormRenderer(forms.StringTypeFormRenderer):\n \"\"\"Renders an encryption key.\"\"\"\n\n type = rdf_crypto.AES128Key\n\n layout_template = \"\"\"\n<div class=\"form-group\">\n\"\"\" + forms.TypeDescriptorFormRenderer.default_description_view + \"\"\"\n <div class=\"controls\">\n <input id='{{this.prefix}}'\n type=text value='{{ this.default|escape }}'\n onchange=\"grr.forms.inputOnChange(this)\"\n />\n </div>\n</div>\n\"\"\"\n", "metadata": "root.AES128KeyFormRenderer", "header": "['module', '___EOS___']", "index": 541 }, { "content": " def Layout(self, request, response):\n self.default = str(self.descriptor.type().Generate())\n response = super(AES128KeyFormRenderer, self).Layout(request, response)\n return self.CallJavascript(response, \"AES128KeyFormRenderer.Layout\",\n prefix=self.prefix)", "metadata": "root.AES128KeyFormRenderer.Layout", "header": "['class', 'AES128KeyFormRenderer', '(', 'forms', '.', 'StringTypeFormRenderer', ')', ':', '___EOS___']", "index": 558 }, { "content": "class ClientURNRenderer(RDFValueRenderer):\n \"\"\"A renderer for a client id.\"\"\"\n\n classname = \"ClientURN\"\n\n layout_template = renderers.Template(\"\"\"\n<a href='#{{this.hash|escape}}' onclick='grr.loadFromHash(\n \"{{this.hash|escape}}\");'>\n {{this.proxy|escape}}\n</a>\n\n<div id=\"ClientInfo_{{unique|escape}}\" class=\"modal fade\" role=\"dialog\"\n aria-hidden=\"true\">\n <div class=\"modal-dialog\">\n <div class=\"modal-content\">\n <div class=\"modal-header\">\n <button type=\"button\" class=\"close\"\n aria-hidden=\"true\" data-dismiss=\"modal\">\n &times;\n </button>\n <h4 class=\"modal-title\">Client {{this.proxy}}</h4>\n </div>\n <div id=\"ClientInfoContent_{{unique|escape}}\" class=\"modal-body\"/></div>\n </div>\n </div>\n</div>\n\n<button\n class=\"btn btn-default btn-xs\" id=\"ClientInfoButton_{{unique}}\">\n <span class=\"glyphicon glyphicon-info-sign\"></span>\n</button>\n\"\"\")\n\n ajax_template = renderers.Template(\"\"\"\n{{this.summary|safe}}\n\"\"\")\n\n", "metadata": "root.ClientURNRenderer", "header": "['module', '___EOS___']", "index": 565 }, { "content": " def Layout(self, request, response):\n h = dict(main=\"HostInformation\", c=self.proxy)\n self.hash = urllib.urlencode(sorted(h.items()))\n response = super(ClientURNRenderer, self).Layout(request, response)\n return self.CallJavascript(response, \"Layout\",\n urn=utils.SmartStr(self.proxy))", "metadata": "root.ClientURNRenderer.Layout", "header": "['class', 'ClientURNRenderer', '(', 'RDFValueRenderer', ')', ':', '___EOS___']", "index": 602 }, { "content": " def RenderAjax(self, request, response):\n self.urn = request.REQ.get(\"urn\")\n if self.urn:\n fd = aff4.FACTORY.Open(self.urn, token=request.token)\n self.summary = FindRendererForObject(fd.GetSummary()).RawHTML(request)\n\n return super(ClientURNRenderer, self).RenderAjax(request, response)", "metadata": "root.ClientURNRenderer.RenderAjax", "header": "['class', 'ClientURNRenderer', '(', 'RDFValueRenderer', ')', ':', '___EOS___']", "index": 609 }, { "content": "class KeyValueFormRenderer(forms.TypeDescriptorFormRenderer):\n \"\"\"A renderer for a Dict's KeyValue protobuf.\"\"\"\n type = rdf_protodict.KeyValue\n\n layout_template = renderers.Template(\"\"\"<div class=\"form-group\">\n<div id=\"{{unique}}\" class=\"control input-append\">\n <input id='{{this.prefix}}_key'\n type=text\n{% if this.default %}\n value='{{ this.default.key|escape }}'\n{% endif %}\n onchange=\"grr.forms.inputOnChange(this)\"\n class=\"unset\"/>\n <input id='{{this.prefix}}_value'\n type=text\n{% if this.default %}\n value='{{ this.default.value|escape }}'\n{% endif %}\n onchange=\"grr.forms.inputOnChange(this)\"\n class=\"unset\"/>\n\n <div class=\"btn-group\">\n <button class=\"btn btn-default dropdown-toggle\" data-toggle=\"dropdown\">\n <span class=\"Type\">Auto</span> <span class=\"caret\"></span>\n </button>\n\n <ul class=\"dropdown-menu\" data-name=\"{{this.prefix}}_type\">\n <li><a data-type=\"String\">String</a></li>\n <li><a data-type=\"Integer\">Integer</a></li>\n <li><a data-type=\"Bytes\">Bytes</a></li>\n <li><a data-type=\"Float\">Float</a></li>\n <li><a data-type=\"Boolean\">Boolean</a></li>\n </ul>\n </div>\n </div>\n</div>\n\"\"\")\n\n\n", "metadata": "root.KeyValueFormRenderer", "header": "['module', '___EOS___']", "index": 618 }, { "content": " def Layout(self, request, response):\n response = super(KeyValueFormRenderer, self).Layout(request, response)\n return self.CallJavascript(response, \"Layout\")", "metadata": "root.KeyValueFormRenderer.Layout", "header": "['class', 'KeyValueFormRenderer', '(', 'forms', '.', 'TypeDescriptorFormRenderer', ')', ':', '___EOS___']", "index": 656 }, { "content": " def GuessValueType(self, value):\n \"\"\"Get the type of value.\"\"\"\n if value in [\"None\", \"none\", None]:\n return None\n\n if value in [\"True\", \"true\", \"yes\"]:\n return True\n\n if value in [\"False\", \"false\", \"no\"]:\n return False\n\n try:\n return int(value)\n except (TypeError, ValueError):\n try:\n return float(value)\n except (TypeError, ValueError):\n try:\n return value.decode(\"utf8\")\n except UnicodeDecodeError:\n return value", "metadata": "root.KeyValueFormRenderer.GuessValueType", "header": "['class', 'KeyValueFormRenderer', '(', 'forms', '.', 'TypeDescriptorFormRenderer', ')', ':', '___EOS___']", "index": 660 }, { "content": " def ParseArgs(self, request):\n \"\"\"Parse the request into a KeyValue proto.\"\"\"\n key = request.REQ.get(\"%s_key\" % self.prefix)\n value = request.REQ.get(\"%s_value\" % self.prefix)\n value_type = request.REQ.get(\"%s_type\" % self.prefix)\n\n if key is None:\n return\n\n result = rdf_protodict.KeyValue()\n result.k.SetValue(key)\n\n # Automatically try to detect the value\n if value_type is None:\n value = self.GuessValueType(value)\n elif value_type == \"Integer\":\n value = int(value)\n elif value_type == \"Float\":\n value = float(value)\n elif value_type == \"Boolean\":\n if value in [\"True\", \"true\", \"yes\", \"1\"]:\n value = True\n\n elif value in [\"False\", \"false\", \"no\", \"0\"]:\n value = False\n\n else:\n raise ValueError(\"Value %s is not a boolean\" % value)\n elif value_type == \"String\":\n value = value.decode(\"utf8\")\n\n result.v.SetValue(value)\n\n return result", "metadata": "root.KeyValueFormRenderer.ParseArgs", "header": "['class', 'KeyValueFormRenderer', '(', 'forms', '.', 'TypeDescriptorFormRenderer', ')', ':', '___EOS___']", "index": 682 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Thi", "s", " ", "file", " ", "contain", "s", " ", "specialize", "d", " ", "render", "ers", " ", "for", " ", "sema", "ntic", " ", "values", ".", "\\", "10", ";", "\\", "10", ";", "Ot", "her", " ", "files", " ", "may", " ", "als", "o", " ", "contain", " ", "specialize", "d", " ", "render", "ers", " ", "for", " ", "sema", "ntic", " ", "types", " ", "rele", "van", "t", "\\", "10", ";", "to", " ", "thei", "r", " ", "function", ",", " ", "but", " ", "here", " ", "we", " ", "include", " ", "the", " ", "most", " ", "basic", " ", "and", " ", "common", " ", "render", "ers", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "grr_", "._", "gui_", "import_", "renderers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "gui_", "._", "plugins_", "import_", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "aff4", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "rdfvalue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "._", "aff4", "\\u", "objects_", "import_", "aff4", "\\u", "grr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "._", "rdf", "values_", "import_", "crypto_", "as_", "rdf", "\\u", "crypto_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "._", "rdf", "values_", "import_", "proto", "dict_", "as_", "rdf", "\\u", "proto", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "grr_", "._", "lib_", "._", "rdf", "values_", "import_", "structs_", "as_", "rdf", "\\u", "structs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cache", "s", " ", "for", " ", "Fin", "d", "Render", "er", "For", "Object", "()", ",", " ", "We", " ", "can", " ", "have", " ", "a", " ", "render", "er", " ", "for", " ", "a", " ", "repeated_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "member", " ", "by", " ", "extend", "ing", " ", "RDF", "Value", "Array", "Render", "er", " ", "and", " ", "a", " ", "render", "er", " ", "for", " ", "a", " ", "single", " ", "item", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "extend", "ing", " ", "RDF", "Value", "Render", "er", "._", "\\u\\u\\uNL\\u\\u\\u_", "repeated", "\\u", "render", "er", "\\u", "cache_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sema", "ntic", "\\u", "render", "er", "\\u", "cache_", "=_", "{_", "}_", "\\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_", "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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\\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_", "Fin", "d", "Render", "er", "For", "Object_", "(_", "rdf", "\\u", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fin", "d", " ", "the", " ", "appropr", "iate", " ", "render", "er", " ", "for", " ", "an", " ", "RDF", "Value", " ", "object", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Reb", "uild", " ", "the", " ", "cache", " ", "if", " ", "need", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "sema", "ntic", "\\u", "render", "er", "\\u", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "cls_", "in_", "RDF", "Value", "Renderer_", "._", "classes_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "aff4", "_", "._", "issubclass_", "(_", "cls_", ",_", "RDF", "Value", "Array", "Renderer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repeated", "\\u", "render", "er", "\\u", "cache_", "[_", "cls_", "._", "classname_", "]_", "=_", "cls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "aff4", "_", "._", "issubclass_", "(_", "cls_", ",_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sema", "ntic", "\\u", "render", "er", "\\u", "cache_", "[_", "cls_", "._", "classname_", "]_", "=_", "cls_", "\\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_", "rdf", "\\u", "obj", "\\u", "classname_", "=_", "rdf", "\\u", "obj_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "find", " ", "an", " ", "RDF", "Value", "Array", " ", "render", "er", " ", "for", " ", "repeated", " ", "types", ".", " ", "Thi", "s", " ", "allow", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "render", "ers", " ", "to", " ", "be", " ", "specified", " ", "for", " ", "repeated", " ", "fields", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "rdf", "\\u", "obj_", ",_", "rdf", "\\u", "proto", "dict_", "._", "RDF", "Value", "Array_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "repeated", "\\u", "render", "er", "\\u", "cache_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "rdf", "\\u", "obj", "\\u", "classname_", ",_", "RDF", "Value", "Array", "Renderer_", ")_", "(_", "rdf", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "rdf", "\\u", "obj_", ",_", "rdf", "\\u", "structs_", "._", "Repeat", "ed", "Field", "Helper_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rdf", "\\u", "obj", "\\u", "classname_", "=_", "rdf", "\\u", "obj_", "._", "type", "\\u", "descriptor_", "._", "type_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "repeated", "\\u", "render", "er", "\\u", "cache_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "rdf", "\\u", "obj", "\\u", "classname_", ",_", "RDF", "Value", "Array", "Renderer_", ")_", "(_", "rdf", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "it", " ", "is", " ", "a", " ", "sema", "ntic", " ", "proto", ",", " ", "we", " ", "just", " ", "use", " ", "the", " ", "RDF", "Proto", "Render", "er", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "rdf", "\\u", "obj_", ",_", "rdf", "\\u", "structs_", "._", "RDF", "Proto", "Struct_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sema", "ntic", "\\u", "render", "er", "\\u", "cache_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "rdf", "\\u", "obj", "\\u", "classname_", ",_", "RDF", "Proto", "Renderer_", ")_", "(_", "rdf", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "it", " ", "is", " ", "a", " ", "sema", "ntic", " ", "value", ",", " ", "we", " ", "just", " ", "use", " ", "the", " ", "RDF", "Value", "Render", "er", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "rdf", "\\u", "obj_", ",_", "rdfvalue_", "._", "RDF", "Value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "sema", "ntic", "\\u", "render", "er", "\\u", "cache_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "rdf", "\\u", "obj", "\\u", "classname_", ",_", "RDF", "Value", "Renderer_", ")_", "(_", "rdf", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "rdf", "\\u", "obj_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Dict", "Renderer_", "(_", "rdf", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Default", " ", "render", "er", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "RDF", "Value", "Renderer_", "(_", "rdf", "\\u", "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_", "RDF", "Value", "Column_", "(_", "renderers_", "._", "Table", "Column_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "column", " ", "to", " ", "store", " ", "an", " ", "RDF", "Value", " ", "in", " ", "a", " ", "Table", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value", "Column_", "(_", "renderers_", "._", "Table", "Column_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Render", "Row_", "(_", "self_", ",_", "index_", ",_", "request_", ",_", "row", "\\u", "options_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Render", " ", "the", " ", "RDF", "Value", " ", "store", "d", " ", "at", " ", "the", " ", "specific", " ", "index", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "rows_", "._", "get_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "row", "\\u", "options_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "row", "\\u", "options_", "[_", "\"", "row", "\\u", "id", "\"_", "]_", "=_", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "renderer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "renderer_", "=_", "self_", "._", "renderer_", "(_", "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 ", " _", "renderer_", "=_", "Fin", "d", "Render", "er", "For", "Object_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Int", "antia", "te", " ", "the", " ", "render", "er", " ", "and", " ", "return", " ", "the", " ", "HTML_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "renderer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "renderer_", "._", "Ra", "w", "HTML_", "(_", "request_", ")_", "\\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_", "=_", "utils_", "._", "Sma", "rt", "Str_", "(_", "value_", ")_", "\\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]_", "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_", "Attribute", "Column_", "(_", "RDF", "Value", "Column_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "table", " ", "column", " ", "whi", "ch", " ", "can", " ", "be", " ", "filled", " ", "from", " ", "an", " ", "AFF", "4", "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_", "[SEP]_", "class_", "Attribute", "Column_", "(_", "RDF", "Value", "Column_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Locat", "e", " ", "the", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "attribute_", "=_", "aff4", "_", "._", "Attribute_", "._", "Get", "Attribute", "By", "Name_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Attribute", "Column_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "name_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Attribute", "Column_", "(_", "RDF", "Value", "Column_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Add", "Row", "Fro", "m", "Fd", "_", "(_", "self_", ",_", "index_", ",_", "fd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Add", " ", "a", " ", "new", " ", "value", " ", "from", " ", "the", " ", "fd", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "fd_", "._", "Get_", "(_", "self_", "._", "attribute_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Unpack", " ", "flow", "s", " ", "tha", "t", " ", "are", " ", "store", "d", " ", "insi", "de", " ", "task", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "._", "Payload_", "(_", ")_", "\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rows_", "[_", "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_", "RDF", "Value", "Renderer_", "(_", "renderers_", "._", "Templa", "te", "Renderer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", "se", " ", "are", " ", "abstract", " ", "classe", "s", " ", "for", " ", "render", "ing", " ", "RDF", "Value", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "speci", "fie", "s", " ", "the", " ", "name", " ", "of", " ", "the", " ", "RDF", "Value", " ", "object", " ", "we", " ", "will", " ", "render", "._", "\\u\\u\\uNL\\u\\u\\u_", "classname_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "layout", "\\u", "template_", "=_", "renderers_", "._", "Template_", "(_", "\"\"\"", "\\", "10", ";", "{{", "this", ".", "proxy", "|", "escape", "}}\\", "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_", "[SEP]_", "class_", "RDF", "Value", "Renderer_", "(_", "renderers_", "._", "Templa", "te", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "proxy_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Constructor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "class", " ", "render", "s", " ", "a", " ", "specific", " ", "AFF", "4", " ", "object", " ", "whi", "ch", " ", "we", " ", "delegate", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "proxy", ":", " ", "The", " ", "RDF", "Value", " ", "class", " ", "we", " ", "delegate", ".", "\\", "10", ";", " ", " ", "**", "kwarg", "s", ":", " ", "passthrough", " ", "to", " ", "basec", "lass", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "proxy_", "=_", "proxy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "RDF", "Value", "Renderer_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value", "Renderer_", "(_", "renderers_", "._", "Templa", "te", "Renderer_", ")_", ":_", "\\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_", "Render", "er", "For", "RDF", "Value_", "(_", "cls_", ",_", "rdf", "value", "\\u", "cls", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "class", " ", "of", " ", "the", " ", "RDF", "Value", "Render", "er", " ", "whi", "ch", " ", "render", "s", " ", "rdf", "value", "\\u", "cls", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "candidate_", "in_", "cls_", "._", "classes_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "aff4", "_", "._", "issubclass_", "(_", "candidate_", ",_", "RDF", "Value", "Renderer_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "candidate_", "._", "classname_", "==_", "rdf", "value", "\\u", "cls", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "candidate_", "\\u\\u\\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_", "Value", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "render", "er", " ", "whi", "ch", " ", "render", "s", " ", "an", " ", "RDF", "Value", " ", "in", " ", "machine", " ", "reada", "ble", " ", "format", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "layout", "\\u", "template_", "=_", "renderers_", "._", "Template_", "(_", "\"\"\"", "\\", "10", ";<", "span", " ", "type", "='", "{{", "this", ".", "rdf", "value", "\\u", "type", "|", "escape", "}}", "'", " ", "rdf", "value", "='", "{{", "this", ".", "value", "|", "escape", "}}", "'>", "\\", "10", ";", " ", " ", "{{", "this", ".", "render", "ed", "\\u", "value", "|", "safe", "}}\\", "10", ";<", "/", "span", ">", "\\", "10", ";\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Value", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Layout_", "(_", "self_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rdf", "value", "\\u", "type_", "=_", "self_", "._", "proxy_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "value_", "=_", "self_", "._", "proxy_", "._", "Seriali", "ze", "To", "String_", "(_", ")_", "\\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 ", " _", "self_", "._", "value_", "=_", "utils_", "._", "Sma", "rt", "Str_", "(_", "self_", "._", "proxy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "renderer_", "=_", "Fin", "d", "Render", "er", "For", "Object_", "(_", "self_", "._", "proxy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "render", "ed", "\\u", "value_", "=_", "renderer_", "._", "Ra", "w", "HTML_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Value", "Renderer_", ",_", "self_", ")_", "._", "Layout_", "(_", "request_", ",_", "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_", "Sub", "ject", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "special", " ", "render", "er", " ", "for", " ", "Sub", "ject", " ", "column", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classname_", "=_", "\"", "Sub", "ject", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "layout", "\\u", "template_", "=_", "renderers_", "._", "Template_", "(_", "\"\"\"", "\\", "10", ";<", "span", " ", "type", "=", "subject", " ", "aff4", "\\u", "path", "='", "{{", "this", ".", "aff4", "\\u", "path", "|", "escape", "}}", "'", "\\", "10", ";", " ", " ", "tree", "\\u", "node", "\\u", "id", "='", "{{", "this", ".", "tree", "\\u", "node", "\\u", "id", "|", "escape", "}}", "'>", "\\", "10", ";", " ", " ", "{{", "this", ".", "basen", "ame", "|", "escape", "}}\\", "10", ";<", "/", "span", ">", "\\", "10", ";\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sub", "ject", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Layout_", "(_", "self_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "proxy_", ":_", "\\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_", "aff4", "\\u", "path_", "=_", "request_", "._", "REQ_", "._", "get_", "(_", "\"", "aff4", "\\u", "path", "\"_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aff4", "\\u", "path_", "=_", "rdfvalue_", "._", "RDF", "URN", "_", "(_", "aff4", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "basename_", "=_", "self_", "._", "proxy_", "._", "Relative", "Name_", "(_", "aff4", "\\u", "path_", ")_", "or_", "self_", "._", "proxy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "aff4", "\\u", "path_", "=_", "self_", "._", "proxy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tree", "\\u", "node", "\\u", "id_", "=_", "renderers_", "._", "Derive", "IDF", "rom", "Path_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/\"_", "._", "join_", "(_", "self_", "._", "aff4", "\\u", "path_", "._", "Split_", "(_", ")_", "[_", "1_", ":_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "super_", "(_", "Sub", "ject", "Renderer_", ",_", "self_", ")_", "._", "Layout_", "(_", "request_", ",_", "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_", "RDF", "Byte", "s", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "render", "er", " ", "for", " ", "RDF", "Byte", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classname_", "=_", "\"", "RDF", "Byte", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Byte", "s", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Layout_", "(_", "self_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "proxy_", "=_", "utils_", "._", "Sma", "rt", "Str_", "(_", "self_", "._", "proxy_", ")_", "._", "encode_", "(_", "\"", "string", "-", "escape", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "RDF", "Byte", "s", "Renderer_", ",_", "self_", ")_", "._", "Layout_", "(_", "request_", ",_", "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_", "Lite", "ral", "Expression", "Renderer_", "(_", "RDF", "Byte", "s", "Renderer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "classname_", "=_", "\"", "Lite", "ral", "Expression", "\"_", "\\u\\u\\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_", "RDF", "URN", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "special", " ", "render", "er", " ", "for", " ", "RDF", "URN", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "classname_", "=_", "\"", "RDF", "URN", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "layout", "\\u", "template_", "=_", "renderers_", "._", "Template_", "(_", "\"\"\"", "\\", "10", ";", "{%", " ", "if", " ", "this", ".", "href", " ", "%}", "\\", "10", ";<", "a", " ", "href", "='", "#{", "{", "this", ".", "href", "|", "escape", "}}", "'", "\\", "10", ";", " ", " ", "onc", "lick", "='", "grr", ".", "load", "Fro", "m", "Hash", "(\"", "{{", "this", ".", "href", "|", "escape", "}}", "\");", "'>", "\\", "10", ";", " ", " ", "{{", "this", ".", "proxy", "|", "escape", "}}\\", "10", ";<", "/", "a", ">", "\\", "10", ";", "{%", " ", "else", " ", "%}", "\\", "10", ";", "{{", "this", ".", "proxy", "|", "escape", "}}\\", "10", ";", "{%", " ", "endi", "f", " ", "%}", "\\", "10", ";\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "RDF", "URN", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Layout_", "(_", "self_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client_", ",_", "rest_", "=_", "self_", "._", "proxy_", "._", "Split_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "aff4", "\\u", "grr_", "._", "VFS", "GR", "RC", "lient_", "._", "CLIENT", "\\u", "ID", "\\u", "RE_", "._", "match_", "(_", "client_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", "=_", "dict_", "(_", "main_", "=_", "\"", "Virt", "ual", "File", "System", "View", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "client_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tab_", "=_", "\"", "AFF", "4", "Stat", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "renderers_", "._", "Derive", "IDF", "rom", "Path_", "(_", "rest_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "href_", "=_", "urllib_", "._", "urlencode_", "(_", "sorted_", "(_", "h_", "._", "items_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "RDF", "URN", "Renderer_", ",_", "self_", ")_", "._", "Layout_", "(_", "request_", ",_", "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_", "RDF", "Proto", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Nic", "el", "y", " ", "render", " ", "proto", "buf", " ", "based", " ", "RDF", "Value", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "It", "s", " ", "possib", "le", " ", "to", " ", "override", " ", "specific", " ", "fields", " ", "in", " ", "the", " ", "proto", "buf", " ", "by", " ", "provi", "ding", " ", "a", " ", "method", "\\", "10", ";", " ", " ", "like", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", "translat", "e\\u", "method", "\\u", "name", "(", "self", ",", " ", "value", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", "whi", "ch", " ", "is", " ", "expected", " ", "to", " ", "return", " ", "a", " ", "safe", " ", "html", " ", "unicode", " ", "object", " ", "reflect", "ing", " ", "the", " ", "value", " ", "in", "\\", "10", ";", " ", " ", "the", " ", "value", " ", "field", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "field", " ", "whi", "ch", " ", "hold", "s", " ", "the", " ", "protobuf_", "\\u\\u\\uNL\\u\\u\\u_", "proxy", "\\u", "field_", "=_", "\"", "data", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "{{", "value", "}}", " ", "come", "s", " ", "from", " ", "the", " ", "translator", " ", "so", " ", "its", " ", "assume", "d", " ", "to", " ", "be", " ", "safe", "._", "\\u\\u\\uNL\\u\\u\\u_", "layout", "\\u", "template_", "=_", "renderers_", "._", "Template_", "(_", "\"\"\"", "\\", "10", ";<", "table", " ", "class", "='", "proto", "\\u", "table", "'>", "\\", "10", ";<", "tbo", "dy", ">", "\\", "10", ";", "{%", " ", "for", " ", "key", ",", " ", "desc", ",", " ", "value", " ", "in", " ", "this", ".", "result", " ", "%}", "\\", "10", ";<", "tr", ">", "\\", "10", ";", " ", " ", "<", "td", " ", "class", "=\"", "proto", "\\u", "key", "\">", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "if", " ", "desc", " ", "%}", "\\", "10", ";", " ", " ", "<", "abb", "r", " ", "title", "='", "{{", "desc", "|", "escape", "}}", "'>", "\\", "10", ";", " ", " ", " ", " ", "{{", "key", "|", "escape", "}}\\", "10", ";", " ", " ", "</", "abb", "r", ">", "\\", "10", ";", " ", " ", " ", " ", "{%", " ", "else", " ", "%}", "\\", "10", ";", " ", " ", "{{", "key", "|", "escape", "}}\\", "10", ";", " ", " ", " ", " ", "{%", " ", "endi", "f", " ", "%}", "\\", "10", ";", " ", " ", "</", "td", ">", "\\", "10", ";", " ", " ", "<", "td", " ", "class", "=\"", "proto", "\\u", "value", "\">", "\\", "10", ";", " ", " ", "{{", "value", "|", "safe", "}}\\", "10", ";", " ", " ", "</", "td", ">", "\\", "10", ";<", "/", "tr", ">", "\\", "10", ";", "{%", " ", "endf", "or", " ", "%}", "\\", "10", ";<", "/", "tbo", "dy", ">", "\\", "10", ";<", "/", "table", ">", "\\", "10", ";\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "a", " ", "translatio", "n", " ", "dispatcher", " ", "for", " ", "render", "ing", " ", "special", " ", "fields", "._", "\\u\\u\\uNL\\u\\u\\u_", "translator_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "translator", "\\u", "error", "\\u", "template_", "=_", "renderers_", "._", "Template_", "(_", "\"<", "pre", ">", "{{", "value", "|", "escape", "}}", "</", "pre", ">\"_", ")_", "\\u\\u\\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_", "hr", "b", "\\u", "template_", "=_", "renderers_", "._", "Template_", "(_", "\"{", "{", "value", "|", "files", "ize", "format", "}}\"_", ")_", "\\u\\u\\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_", "pre", "\\u", "template_", "=_", "renderers_", "._", "Template_", "(_", "\"<", "pre", ">", "{{", "value", "|", "escape", "}}", "</", "pre", ">\"_", ")_", "\\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_", "RDF", "Proto", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Ignor", "e_", "(_", "self_", ",_", "unu", "sed", "\\u", "descriptor_", ",_", "unu", "sed", "\\u", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "handler", " ", "for", " ", "ign", "orin", "g", " ", "a", " ", "value", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Proto", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Huma", "n", "Read", "able", "Bytes_", "(_", "self_", ",_", "\\u_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Format", " ", "byte", " ", "values", " ", "usi", "ng", " ", "human", " ", "reada", "ble", " ", "unit", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "Format", "Fro", "m", "Template_", "(_", "self_", "._", "hr", "b", "\\u", "template_", ",_", "value_", "=_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Proto", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Pre", "_", "(_", "self_", ",_", "\\u_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "Format", "Fro", "m", "Template_", "(_", "self_", "._", "pre", "\\u", "template_", ",_", "value_", "=_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Proto", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Layout_", "(_", "self_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Render", " ", "the", " ", "proto", "buf", " ", "as", " ", "a", " ", "table", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "descriptor_", ",_", "value_", "in_", "self_", "._", "proxy_", "._", "List", "Set", "Fields_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "descriptor_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frie", "ndl", "y", "\\u", "name_", "=_", "descriptor_", "._", "frie", "ndl", "y", "\\u", "name_", "or_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "translat", "e", " ", "the", " ", "value", " ", "if", " ", "there", " ", "is", " ", "a", " ", "special", " ", "translator", " ", "for", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "name_", "in_", "self_", "._", "translator_", ":_", "\\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_", "=_", "self_", "._", "translator_", "[_", "name_", "]_", "(_", "self_", ",_", "request_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "result_", "._", "append_", "(_", "(_", "frie", "ndl", "y", "\\u", "name_", ",_", "descriptor_", "._", "description_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "translatio", "n", " ", "fail", "s", " ", "for", " ", "what", "ever", " ", "reason", ",", " ", "just", " ", "output", " ", "the", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "value", " ", "literal", "ly", " ", "(", "after", " ", "esca", "ping", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "Format", "Fro", "m", "Template_", "(_", "self_", "._", "translator", "\\u", "error", "\\u", "template_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "#", " ", "pylint", ":", " ", "disable", "=", "broad", "-", "except_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warn_", "(_", "\"", "Fail", "ed", " ", "to", " ", "render", " ", "{", "0", "}.", " ", "Err", ":", " ", "{", "1", "}\"_", "._", "format_", "(_", "name_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "\"\"_", "\\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 ", " _", "renderer_", "=_", "Fin", "d", "Render", "er", "For", "Object_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "result_", "._", "append_", "(_", "(_", "frie", "ndl", "y", "\\u", "name_", ",_", "descriptor_", "._", "description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "renderer_", "._", "Ra", "w", "HTML_", "(_", "request_", ")_", ")_", ")_", "\\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_", "super_", "(_", "RDF", "Proto", "Renderer_", ",_", "self_", ")_", "._", "Layout_", "(_", "request_", ",_", "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_", "RDF", "Value", "Array", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Render", "s", " ", "arrays", " ", "of", " ", "RDF", "Value", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "{{", "entry", "}}", " ", "come", "s", " ", "from", " ", "the", " ", "individual", " ", "rdf", "value", " ", "render", "ers", " ", "so", " ", "it", " ", "is", " ", "assume", "d", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "safe", "._", "\\u\\u\\uNL\\u\\u\\u_", "layout", "\\u", "template_", "=_", "renderers_", "._", "Template_", "(_", "\"\"\"", "\\", "10", ";<", "table", " ", "class", "='", "proto", "\\u", "table", "'>", "\\", "10", ";<", "tbo", "dy", ">", "\\", "10", ";", "{%", " ", "for", " ", "entry", " ", "in", " ", "this", ".", "data", " ", "%}", "\\", "10", ";<", "tr", " ", "class", "=\"", "proto", "\\u", "separator", "\">", "</", "tr", ">", "\\", "10", ";<", "tr", ">", "\\", "10", ";", " ", " ", " ", "<", "td", ">", "{{", "entry", "|", "safe", "}}", "</", "td", ">", "\\", "10", ";<", "/", "tr", ">", "\\", "10", ";", "{%", " ", "endf", "or", " ", "%}", "\\", "10", ";", "{%", " ", "if", " ", "this", ".", "next", "\\u", "start", " ", "%}", "\\", "10", ";<", "tr", " ", "class", "=\"", "proto", "\\u", "separator", "\">", "</", "tr", ">", "\\", "10", ";<", "tr", ">", "\\", "10", ";", " ", "<", "td", "><", "div", " ", "id", "=\"", "{{", "unique", "}}", "\">", " ", "(", "<", "a", ">", "Addition", "al", " ", "data", " ", "avail", "able", "</", "a", ">)", " ", "</", "div", "><", "/", "td", ">", "\\", "10", ";<", "/", "tr", ">", "\\", "10", ";", "{%", " ", "endi", "f", " ", "%}", "\\", "10", ";<", "/", "tbo", "dy", ">", "\\", "10", ";<", "/", "table", ">", "\\", "10", ";\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value", "Array", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Layout_", "(_", "self_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Render", " ", "the", " ", "proto", "buf", " ", "as", " ", "a", " ", "table", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Remove", " ", "these", " ", "from", " ", "the", " ", "request", " ", "in", " ", "case", " ", "we", " ", "need", " ", "to", " ", "pass", " ", "it", " ", "to", " ", "anot", "her_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "render", "er", "._", "\\u\\u\\uNL\\u\\u\\u_", "start_", "=_", "int_", "(_", "request_", "._", "REQ_", "._", "pop_", "(_", "\"", "start", "\"_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "length_", "=_", "int_", "(_", "request_", "._", "REQ_", "._", "pop_", "(_", "\"", "length", "\"_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "can", " ", "get", " ", "call", "ed", " ", "again", " ", "to", " ", "render", " ", "from", " ", "an", " ", "exist", "ing", " ", "cache", "._", "\\u\\u\\uNL\\u\\u\\u_", "cache_", "=_", "request_", "._", "REQ_", "._", "pop_", "(_", "\"", "cache", "\"_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "cache_", "=_", "aff4", "_", "._", "FACTORY", "_", "._", "Open_", "(_", "cache_", ",_", "token_", "=_", "request_", "._", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "proxy_", "=_", "rdf", "\\u", "proto", "dict_", "._", "RDF", "Value", "Array_", "(_", "self_", "._", "cache_", "._", "Read_", "(_", "1000000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "to", " ", "create", " ", "a", " ", "cache", " ", "if", " ", "this", " ", "is", " ", "too", " ", "long", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "self_", "._", "proxy_", ")_", ">_", "length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "aff4", "_", "._", "FACTORY", "_", "._", "Create_", "(_", "None_", ",_", "\"", "Temp", "Memo", "ry", "File", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token_", "=_", "request_", "._", "token_", ")_", "as_", "self_", "._", "cache_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "rdf", "\\u", "proto", "dict_", "._", "RDF", "Value", "Array_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "._", "Extend", "_", "(_", "self_", "._", "proxy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "cache_", "._", "Write_", "(_", "data_", "._", "Seriali", "ze", "To", "String_", "(_", ")_", ")_", "\\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_", "self_", "._", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "next", "\\u", "start_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "element_", "in_", "enumerate_", "(_", "self_", "._", "proxy_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "<_", "start_", ":_", "\\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_", "elif_", "len_", "(_", "self_", "._", "data_", ")_", ">_", "length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "next", "\\u", "start_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "length_", "=_", "100_", "\\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_", "renderer_", "=_", "Fin", "d", "Render", "er", "For", "Object_", "(_", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "renderer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data_", "._", "append_", "(_", "renderer_", "._", "Ra", "w", "HTML_", "(_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "#", " ", "pylint", ":", " ", "disable", "=", "broad", "-", "except_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Una", "ble", " ", "to", " ", "render", " ", "%", "s", " ", "with", " ", "%", "s", ":", " ", "%", "s", "\"_", ",_", "type_", "(_", "element_", ")_", ",_", "renderer_", ",_", "e_", ")_", "\\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_", "response_", "=_", "super_", "(_", "RDF", "Value", "Array", "Renderer_", ",_", "self_", ")_", "._", "Layout_", "(_", "request_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "next", "\\u", "start_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "self_", "._", "Call", "Javascript", "_", "(_", "response_", ",_", "\"", "RDF", "Value", "Array", "Render", "er", ".", "Lay", "out", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "next", "\\u", "start_", "=_", "self_", "._", "next", "\\u", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "\\u", "urn_", "=_", "self_", "._", "cache_", "._", "urn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "array", "\\u", "length_", "=_", "self_", "._", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "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_", "Dict", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Render", "s", " ", "dict", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "classname_", "=_", "\"", "Dict", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Keys", " ", "to", " ", "filter", " ", "from", " ", "the", " ", "output", "._", "\\u\\u\\uNL\\u\\u\\u_", "filter", "\\u", "keys_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "{{", "value", "}}", " ", "come", "s", " ", "from", " ", "the", " ", "translator", " ", "so", " ", "its", " ", "assume", "d", " ", "to", " ", "be", " ", "safe", "._", "\\u\\u\\uNL\\u\\u\\u_", "layout", "\\u", "template_", "=_", "renderers_", "._", "Template_", "(_", "\"\"\"", "\\", "10", ";", "{%", " ", "if", " ", "this", ".", "data", " ", "%}", "\\", "10", ";<", "table", " ", "class", "='", "proto", "\\u", "table", "'>", "\\", "10", ";<", "tbo", "dy", ">", "\\", "10", ";", " ", " ", "{%", " ", "for", " ", "key", ",", " ", "value", " ", "in", " ", "this", ".", "data", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "<", "tr", ">", "\\", "10", ";", " ", " ", "<", "td", " ", "class", "=\"", "proto", "\\u", "key", "\">", "{{", "key", "|", "escape", "}}", "</", "td", "><", "td", " ", "class", "=\"", "proto", "\\u", "value", "\">", "\\", "10", ";", " ", " ", " ", " ", "{{", "value", "|", "safe", "}}\\", "10", ";", " ", " ", "</", "td", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "tr", ">", "\\", "10", ";", " ", " ", "{%", " ", "endf", "or", " ", "%}", "\\", "10", ";<", "/", "tbo", "dy", ">", "\\", "10", ";<", "/", "table", ">", "\\", "10", ";", "{%", " ", "endi", "f", " ", "%}", "\\", "10", ";\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "translator", "\\u", "error", "\\u", "template_", "=_", "renderers_", "._", "Template_", "(_", "\"<", "pre", ">", "{{", "value", "|", "escape", "}}", "</", "pre", ">\"_", ")_", "\\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_", "Dict", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "proxy_", "=_", "None_", ",_", "filter", "\\u", "keys_", "=_", "None_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "filter", "\\u", "keys_", "=_", "filter", "\\u", "keys_", "or_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Dict", "Renderer_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "proxy_", "=_", "proxy_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dict", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Layout_", "(_", "self_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Render", " ", "the", " ", "proto", "dict", " ", "as", " ", "a", " ", "table", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "sorted_", "(_", "self_", "._", "proxy_", "._", "items_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "render", "ed", "\\u", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "key_", "in_", "self_", "._", "filter", "\\u", "keys_", ":_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "renderer_", "=_", "Fin", "d", "Render", "er", "For", "Object_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "renderer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "render", "ed", "\\u", "value_", "=_", "renderer_", "._", "Ra", "w", "HTML_", "(_", "request_", ")_", "\\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_", "Type", "Error_", "(_", "\"", "Un", "know", "n", " ", "render", "er", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "translatio", "n", " ", "fail", "s", " ", "for", " ", "what", "ever", " ", "reason", ",", " ", "just", " ", "output", " ", "the", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "value", " ", "literal", "ly", " ", "(", "after", " ", "esca", "ping", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "render", "ed", "\\u", "value_", "=_", "self_", "._", "Format", "Fro", "m", "Template_", "(_", "self_", "._", "translator", "\\u", "error", "\\u", "template_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "e_", ":_", "#", " ", "pylint", ":", " ", "disable", "=", "broad", "-", "except_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warn_", "(_", "\"", "Fail", "ed", " ", "to", " ", "render", " ", "{", "0", "}.", " ", "Err", ":", " ", "{", "1", "}\"_", "._", "format_", "(_", "type_", "(_", "value_", ")_", ",_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "render", "ed", "\\u", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data_", "._", "append_", "(_", "(_", "key_", ",_", "render", "ed", "\\u", "value_", ")_", ")_", "\\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_", "super_", "(_", "Dict", "Renderer_", ",_", "self_", ")_", "._", "Layout_", "(_", "request_", ",_", "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_", "List", "Renderer_", "(_", "RDF", "Value", "Array", "Renderer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "classname_", "=_", "\"", "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_", "class_", "Ico", "n", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "width_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout", "\\u", "template_", "=_", "renderers_", "._", "Template_", "(_", "\"\"\"", "\\", "10", ";<", "div", " ", "class", "=\"", "centered", "\">", "\\", "10", ";<", "img", " ", "class", "='", "grr", "-", "icon", " ", "{{", "this", ".", "proxy", ".", "icon", "}}", "'", "\\", "10", ";", " ", "src", "='", "/", "static", "/", "images", "/{", "{", "this", ".", "proxy", ".", "icon", "}}", ".", "png", "'", "\\", "10", ";", " ", "alt", "='", "{{", "this", ".", "proxy", ".", "description", "}}", "'", " ", "title", "='", "{{", "this", ".", "proxy", ".", "description", "}}", "'", "\\", "10", ";", " ", "/>", "</", "div", ">\"\"\"_", ")_", "\\u\\u\\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_", "RDF", "Value", "Collecti", "on", "Renderer_", "(_", "renderers_", "._", "Table", "Renderer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Render", "er", " ", "for", " ", "RDF", "Value", "Collecti", "on", " ", "object", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "parameters_", "=_", "[_", "\"", "aff4", "\\u", "path", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "\\u", "total", "\\u", "count_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "layout", "\\u", "template_", "=_", "\"\"\"", "\\", "10", ";", "{%", " ", "if", " ", "this", ".", "size", " ", ">", " ", "0", " ", "%}", "\\", "10", ";", " ", " ", "{%", " ", "if", " ", "this", ".", "show", "\\u", "total", "\\u", "count", " ", "%}", "\\", "10", ";", " ", " ", " ", " ", "<", "h5", ">", "{{", "this", ".", "size", "}}", " ", "Entr", "ies", "</", "h5", ">", "\\", "10", ";", " ", " ", "{%", " ", "endi", "f", " ", "%}", "\\", "10", ";", "{%", " ", "endi", "f", " ", "%}", "\\", "10", ";\"\"\"_", "+_", "renderers_", "._", "Table", "Renderer_", "._", "layout", "\\u", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "RDF", "Value", "Collecti", "on", "Renderer_", "(_", "renderers_", "._", "Table", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "RDF", "Value", "Collecti", "on", "Renderer_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Add", "Column_", "(_", "RDF", "Value", "Column_", "(_", "\"", "Value", "\"_", ",_", "width_", "=_", "\"", "100", "%\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value", "Collecti", "on", "Renderer_", "(_", "renderers_", "._", "Table", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Build", "Table_", "(_", "self_", ",_", "start", "\\u", "row_", ",_", "end", "\\u", "row_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Build", "s", " ", "a", " ", "table", " ", "of", " ", "rdf", "values", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "aff4", "\\u", "path_", "=_", "self_", "._", "state_", "._", "get_", "(_", "\"", "aff4", "\\u", "path", "\"_", ")_", "or_", "request_", "._", "REQ_", "._", "get_", "(_", "\"", "aff4", "\\u", "path", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "collection_", "=_", "aff4", "_", "._", "FACTORY", "_", "._", "Open_", "(_", "aff4", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aff4", "\\u", "type_", "=_", "\"", "RDF", "Value", "Collecti", "on", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token_", "=_", "request_", "._", "token_", ")_", "\\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_", "\\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 ", " _", "self_", "._", "size_", "=_", "len_", "(_", "collection_", ")_", "\\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 ", " _", "self_", "._", "show", "\\u", "total", "\\u", "count_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "row", "\\u", "index_", "=_", "start", "\\u", "row_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "value_", "in_", "itertools_", "._", "islice_", "(_", "collection_", ",_", "start", "\\u", "row_", ",_", "end", "\\u", "row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Add", "Cell_", "(_", "row", "\\u", "index_", ",_", "\"", "Value", "\"_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row", "\\u", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "RDF", "Value", "Collecti", "on", "Renderer_", "(_", "renderers_", "._", "Table", "Renderer_", ")_", ":_", "\\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_", "Layout_", "(_", "self_", ",_", "request_", ",_", "response_", ",_", "aff4", "\\u", "path_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "aff4", "\\u", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "state_", "[_", "\"", "aff4", "\\u", "path", "\"_", "]_", "=_", "str_", "(_", "aff4", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "collection_", "=_", "aff4", "_", "._", "FACTORY", "_", "._", "Create_", "(_", "aff4", "\\u", "path_", ",_", "mode_", "=_", "\"", "r", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aff4", "\\u", "type_", "=_", "\"", "RDF", "Value", "Collecti", "on", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "token_", "=_", "request_", "._", "token_", ")_", "\\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 ", " _", "self_", "._", "size_", "=_", "len_", "(_", "collection_", ")_", "\\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 ", " _", "self_", "._", "show", "\\u", "total", "\\u", "count_", "=_", "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_", "return_", "super_", "(_", "RDF", "Value", "Collecti", "on", "Renderer_", ",_", "self_", ")_", "._", "Layout_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "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_", "Flow", "State", "Renderer_", "(_", "Dict", "Renderer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "Flow", " ", "state", " ", "is", " ", "similar", " ", "to", " ", "a", " ", "dict", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classname_", "=_", "\"", "Flow", "State", "\"_", "\\u\\u\\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_", "Data", "Object", "Renderer_", "(_", "Dict", "Renderer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "flow", " ", "data", " ", "object", " ", "is", " ", "als", "o", " ", "similar", " ", "to", " ", "a", " ", "dict", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "classname_", "=_", "\"", "Data", "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_", "class_", "AE", "S1", "2", "8", "Key", "Form", "Renderer_", "(_", "forms_", "._", "String", "Type", "Form", "Renderer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Render", "s", " ", "an", " ", "encrypt", "ion", " ", "key", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "rdf", "\\u", "crypto_", "._", "AE", "S1", "2", "8", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "layout", "\\u", "template_", "=_", "\"\"\"", "\\", "10", ";<", "div", " ", "class", "=\"", "form", "-", "group", "\">", "\\", "10", ";\"\"\"_", "+_", "forms_", "._", "Type", "Descrip", "tor", "Form", "Renderer_", "._", "default", "\\u", "description", "\\u", "view_", "+_", "\"\"\"", "\\", "10", ";", " ", " ", "<", "div", " ", "class", "=\"", "controls", "\">", "\\", "10", ";", " ", " ", " ", " ", "<", "input", " ", "id", "='", "{{", "this", ".", "prefix", "}}", "'", "\\", "10", ";", " ", " ", "type", "=", "text", " ", "value", "='", "{{", " ", "this", ".", "default", "|", "escape", " ", "}}", "'", "\\", "10", ";", " ", " ", "onchange", "=\"", "grr", ".", "forms", ".", "input", "On", "Change", "(", "this", ")\"", "\\", "10", ";", " ", " ", " ", " ", "/>", "\\", "10", ";", " ", " ", "</", "div", ">", "\\", "10", ";<", "/", "div", ">", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "AE", "S1", "2", "8", "Key", "Form", "Renderer_", "(_", "forms_", "._", "String", "Type", "Form", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Layout_", "(_", "self_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "default_", "=_", "str_", "(_", "self_", "._", "descriptor_", "._", "type_", "(_", ")_", "._", "Generate", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "super_", "(_", "AE", "S1", "2", "8", "Key", "Form", "Renderer_", ",_", "self_", ")_", "._", "Layout_", "(_", "request_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "Call", "Javascript", "_", "(_", "response_", ",_", "\"", "AE", "S1", "2", "8", "Key", "Form", "Render", "er", ".", "Lay", "out", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prefix_", "=_", "self_", "._", "prefix_", ")_", "\\u\\u\\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_", "Client", "URN", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "render", "er", " ", "for", " ", "a", " ", "client", " ", "id", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "classname_", "=_", "\"", "Client", "URN", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "layout", "\\u", "template_", "=_", "renderers_", "._", "Template_", "(_", "\"\"\"", "\\", "10", ";<", "a", " ", "href", "='", "#{", "{", "this", ".", "hash", "|", "escape", "}}", "'", " ", "onc", "lick", "='", "grr", ".", "load", "Fro", "m", "Hash", "(", "\\", "10", ";", " ", " ", " ", " ", "\"{", "{", "this", ".", "hash", "|", "escape", "}}", "\");", "'>", "\\", "10", ";", " ", " ", "{{", "this", ".", "proxy", "|", "escape", "}}\\", "10", ";<", "/", "a", ">", "\\", "10", ";", "\\", "10", ";<", "div", " ", "id", "=\"", "Client", "Info", "\\u{", "{", "unique", "|", "escape", "}}", "\"", " ", "class", "=\"", "modal", " ", "fade", "\"", " ", "role", "=\"", "dialog", "\"", "\\", "10", ";", " ", "aria", "-", "hidden", "=\"", "true", "\">", "\\", "10", ";", " ", " ", "<", "div", " ", "class", "=\"", "modal", "-", "dialog", "\">", "\\", "10", ";", " ", " ", " ", "<", "div", " ", "class", "=\"", "modal", "-", "content", "\">", "\\", "10", ";", " ", " ", " ", " ", "<", "div", " ", "class", "=\"", "modal", "-", "header", "\">", "\\", "10", ";", " ", "<", "button", " ", "type", "=\"", "button", "\"", " ", "class", "=\"", "close", "\"", "\\", "10", ";", " ", " ", " ", "aria", "-", "hidden", "=\"", "true", "\"", " ", "data", "-", "dismiss", "=\"", "modal", "\">", "\\", "10", ";", " ", " ", "&", "times", ";", "\\", "10", ";", " ", "</", "button", ">", "\\", "10", ";", " ", "<", "h", "4", " ", "class", "=\"", "modal", "-", "title", "\">", "Client", " ", "{{", "this", ".", "proxy", "}}", "</", "h", "4", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "div", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "div", " ", "id", "=\"", "Client", "Info", "Conten", "t", "\\u{", "{", "unique", "|", "escape", "}}", "\"", " ", "class", "=\"", "modal", "-", "body", "\"/><", "/", "div", ">", "\\", "10", ";", " ", " ", " ", "</", "div", ">", "\\", "10", ";", " ", " ", "</", "div", ">", "\\", "10", ";<", "/", "div", ">", "\\", "10", ";", "\\", "10", ";<", "button", "\\", "10", ";", " ", "class", "=\"", "btn", " ", "btn", "-", "default", " ", "btn", "-", "xs", "\"", " ", "id", "=\"", "Client", "Info", "Butt", "on", "\\u{", "{", "unique", "}}", "\">", "\\", "10", ";", " ", "<", "span", " ", "class", "=\"", "glyph", "icon", " ", "glyph", "icon", "-", "info", "-", "sign", "\">", "</", "span", ">", "\\", "10", ";<", "/", "button", ">", "\\", "10", ";\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "aja", "x", "\\u", "template_", "=_", "renderers_", "._", "Template_", "(_", "\"\"\"", "\\", "10", ";", "{{", "this", ".", "summar", "y", "|", "safe", "}}\\", "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_", "[SEP]_", "class_", "Client", "URN", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Layout_", "(_", "self_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "h_", "=_", "dict_", "(_", "main_", "=_", "\"", "Host", "Information", "\"_", ",_", "c_", "=_", "self_", "._", "proxy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hash_", "=_", "urllib_", "._", "urlencode_", "(_", "sorted_", "(_", "h_", "._", "items_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "super_", "(_", "Client", "URN", "Renderer_", ",_", "self_", ")_", "._", "Layout_", "(_", "request_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "Call", "Javascript", "_", "(_", "response_", ",_", "\"", "Lay", "out", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "urn_", "=_", "utils_", "._", "Sma", "rt", "Str_", "(_", "self_", "._", "proxy_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Client", "URN", "Renderer_", "(_", "RDF", "Value", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Render", "Ajax", "_", "(_", "self_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "urn_", "=_", "request_", "._", "REQ_", "._", "get_", "(_", "\"", "urn", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "urn_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fd_", "=_", "aff4", "_", "._", "FACTORY", "_", "._", "Open_", "(_", "self_", "._", "urn_", ",_", "token_", "=_", "request_", "._", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "summary_", "=_", "Fin", "d", "Render", "er", "For", "Object_", "(_", "fd_", "._", "Get", "Summary_", "(_", ")_", ")_", "._", "Ra", "w", "HTML_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Client", "URN", "Renderer_", ",_", "self_", ")_", "._", "Render", "Ajax", "_", "(_", "request_", ",_", "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_", "Key", "Value", "Form", "Renderer_", "(_", "forms_", "._", "Type", "Descrip", "tor", "Form", "Renderer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "render", "er", " ", "for", " ", "a", " ", "Dict", "'", "s", " ", "Key", "Value", " ", "proto", "buf", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type_", "=_", "rdf", "\\u", "proto", "dict_", "._", "Key", "Value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "layout", "\\u", "template_", "=_", "renderers_", "._", "Template_", "(_", "\"\"\"", "<", "div", " ", "class", "=\"", "form", "-", "group", "\">", "\\", "10", ";<", "div", " ", "id", "=\"", "{{", "unique", "}}", "\"", " ", "class", "=\"", "control", " ", "input", "-", "append", "\">", "\\", "10", ";", " ", "<", "input", " ", "id", "='", "{{", "this", ".", "prefix", "}}\\", "uk", "ey", "'", "\\", "10", ";", " ", " ", "type", "=", "text", "\\", "10", ";", "{%", " ", "if", " ", "this", ".", "default", " ", "%}", "\\", "10", ";", " ", " ", "value", "='", "{{", " ", "this", ".", "default", ".", "key", "|", "escape", " ", "}}", "'", "\\", "10", ";", "{%", " ", "endi", "f", " ", "%}", "\\", "10", ";", " ", " ", "onchange", "=\"", "grr", ".", "forms", ".", "input", "On", "Change", "(", "this", ")\"", "\\", "10", ";", " ", " ", "class", "=\"", "unse", "t", "\"/>", "\\", "10", ";", " ", "<", "input", " ", "id", "='", "{{", "this", ".", "prefix", "}}\\", "uv", "alu", "e", "'", "\\", "10", ";", " ", " ", "type", "=", "text", "\\", "10", ";", "{%", " ", "if", " ", "this", ".", "default", " ", "%}", "\\", "10", ";", " ", " ", "value", "='", "{{", " ", "this", ".", "default", ".", "value", "|", "escape", " ", "}}", "'", "\\", "10", ";", "{%", " ", "endi", "f", " ", "%}", "\\", "10", ";", " ", " ", "onchange", "=\"", "grr", ".", "forms", ".", "input", "On", "Change", "(", "this", ")\"", "\\", "10", ";", " ", " ", "class", "=\"", "unse", "t", "\"/>", "\\", "10", ";", "\\", "10", ";", " ", "<", "div", " ", "class", "=\"", "btn", "-", "group", "\">", "\\", "10", ";", " ", " ", "<", "button", " ", "class", "=\"", "btn", " ", "btn", "-", "default", " ", "dropdown", "-", "toggle", "\"", " ", "data", "-", "toggle", "=\"", "dropdown", "\">", "\\", "10", ";", " ", " ", " ", " ", "<", "span", " ", "class", "=\"", "Type", "\">", "Auto", "</", "span", ">", " ", " ", "<", "span", " ", "class", "=\"", "caret", "\">", "</", "span", ">", "\\", "10", ";", " ", " ", "</", "button", ">", "\\", "10", ";", "\\", "10", ";", " ", " ", "<", "ul", " ", "class", "=\"", "dropdown", "-", "menu", "\"", " ", "data", "-", "name", "=\"", "{{", "this", ".", "prefix", "}}\\", "ut", "ype", "\">", "\\", "10", ";", " ", " ", " ", "<", "li", "><", "a", " ", "data", "-", "type", "=\"", "String", "\">", "String", "</", "a", "><", "/", "li", ">", "\\", "10", ";", " ", " ", " ", "<", "li", "><", "a", " ", "data", "-", "type", "=\"", "Integer", "\">", "Integer", "</", "a", "><", "/", "li", ">", "\\", "10", ";", " ", " ", " ", "<", "li", "><", "a", " ", "data", "-", "type", "=\"", "Byte", "s", "\">", "Byte", "s", "</", "a", "><", "/", "li", ">", "\\", "10", ";", " ", " ", " ", "<", "li", "><", "a", " ", "data", "-", "type", "=\"", "Float", "\">", "Float", "</", "a", "><", "/", "li", ">", "\\", "10", ";", " ", " ", " ", "<", "li", "><", "a", " ", "data", "-", "type", "=\"", "Boo", "lean", "\">", "Boo", "lean", "</", "a", "><", "/", "li", ">", "\\", "10", ";", " ", " ", "</", "ul", ">", "\\", "10", ";", " ", "</", "div", ">", "\\", "10", ";", " ", "</", "div", ">", "\\", "10", ";<", "/", "div", ">", "\\", "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_", "Key", "Value", "Form", "Renderer_", "(_", "forms_", "._", "Type", "Descrip", "tor", "Form", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Layout_", "(_", "self_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "super_", "(_", "Key", "Value", "Form", "Renderer_", ",_", "self_", ")_", "._", "Layout_", "(_", "request_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "Call", "Javascript", "_", "(_", "response_", ",_", "\"", "Lay", "out", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Key", "Value", "Form", "Renderer_", "(_", "forms_", "._", "Type", "Descrip", "tor", "Form", "Renderer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Guess", "Value", "Type_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "type", " ", "of", " ", "value", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "in_", "[_", "\"", "Non", "e", "\"_", ",_", "\"", "none", "\"_", ",_", "None_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "in_", "[_", "\"", "Tru", "e", "\"_", ",_", "\"", "true", "\"_", ",_", "\"", "ye", "s", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "in_", "[_", "\"", "Fal", "se", "\"_", ",_", "\"", "fal", "se", "\"_", ",_", "\"", "no", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Value", "Error_", ")_", ":_", "\\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_", "float_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Value", "Error_", ")_", ":_", "\\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_", "value_", "._", "decode_", "(_", "\"", "utf", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Decode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Key", "Value", "Form", "Renderer_", "(_", "forms_", "._", "Type", "Descrip", "tor", "Form", "Renderer_", ")_", ":_", "\\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_", "Pars", "e", "Args_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "e", " ", "the", " ", "request", " ", "int", "o", " ", "a", " ", "Key", "Value", " ", "proto", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "request_", "._", "REQ_", "._", "get_", "(_", "\"%", "s", "\\u", "key", "\"_", "%_", "self_", "._", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "request_", "._", "REQ_", "._", "get_", "(_", "\"%", "s", "\\u", "value", "\"_", "%_", "self_", "._", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value", "\\u", "type_", "=_", "request_", "._", "REQ_", "._", "get_", "(_", "\"%", "s", "\\u", "type", "\"_", "%_", "self_", "._", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "key_", "is_", "None_", ":_", "\\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_", "result_", "=_", "rdf", "\\u", "proto", "dict_", "._", "Key", "Value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "k_", "._", "Set", "Value_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Automat", "ical", "ly", " ", "try", " ", "to", " ", "detect", " ", "the", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "value", "\\u", "type_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "Guess", "Value", "Type_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "value", "\\u", "type_", "==_", "\"", "Integer", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "int_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "value", "\\u", "type_", "==_", "\"", "Float", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "float_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "value", "\\u", "type_", "==_", "\"", "Boo", "lean", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "in_", "[_", "\"", "Tru", "e", "\"_", ",_", "\"", "true", "\"_", ",_", "\"", "ye", "s", "\"_", ",_", "\"", "1", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "value_", "in_", "[_", "\"", "Fal", "se", "\"_", ",_", "\"", "fal", "se", "\"_", ",_", "\"", "no", "\"_", ",_", "\"", "0", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Value", " ", "%", "s", " ", "is", " ", "not", " ", "a", " ", "boolean", "\"_", "%_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "value", "\\u", "type_", "==_", "\"", "String", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_",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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 ]
Unused import
smart-on-fhir/client-py/fhirclient/models/orderresponse_tests.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Generated from FHIR 1.0.2.7202 on 2016-03-23.\n# 2016, SMART Health IT.\n\n\nimport os\nimport io\nimport unittest\nimport json\nfrom . import orderresponse\nfrom .fhirdate import FHIRDate\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class OrderResponseTests(unittest.TestCase):\n \n ", "metadata": "root.OrderResponseTests", "header": "['module', '___EOS___']", "index": 15 }, { "content": " def instantiate_from(self, filename):\n datadir = os.environ.get('FHIR_UNITTEST_DATADIR') or ''\n with io.open(os.path.join(datadir, filename), 'r', encoding='utf-8') as handle:\n js = json.load(handle)\n self.assertEqual(\"OrderResponse\", js[\"resourceType\"])\n return orderresponse.OrderResponse(js)", "metadata": "root.OrderResponseTests.instantiate_from", "header": "['class', 'OrderResponseTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 16 }, { "content": " def testOrderResponse1(self):\n inst = self.instantiate_from(\"orderresponse-example.json\")\n self.assertIsNotNone(inst, \"Must have instantiated a OrderResponse instance\")\n self.implOrderResponse1(inst)\n \n js = inst.as_json()\n self.assertEqual(\"OrderResponse\", js[\"resourceType\"])\n inst2 = orderresponse.OrderResponse(js)\n self.implOrderResponse1(inst2)", "metadata": "root.OrderResponseTests.testOrderResponse1", "header": "['class', 'OrderResponseTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 23 }, { "content": " def implOrderResponse1(self, inst):\n self.assertEqual(inst.date.date, FHIRDate(\"2012-12-28T13:10:56+11:00\").date)\n self.assertEqual(inst.date.as_json(), \"2012-12-28T13:10:56+11:00\")\n self.assertEqual(inst.id, \"example\")\n self.assertEqual(inst.orderStatus, \"completed\")\n self.assertEqual(inst.text.div, \"<div>Lab Report completed at 13:10 28-Dec 2012</div>\")\n self.assertEqual(inst.text.status, \"generated\")", "metadata": "root.OrderResponseTests.implOrderResponse1", "header": "['class', 'OrderResponseTests', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 33 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Generate", "d", " ", "from", " ", "FH", "IR", " ", "1.0", ".2", ".7", "202", " ", "on", " ", "2016", "-0", "3", "-", "23.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "2016", ",", " ", "SMA", "RT", " ", "Health", " ", "IT", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "order", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "fh", "ir", "date_", "import_", "FH", "IR", "Date_", "\\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_", "Order", "Respons", "e", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Order", "Respons", "e", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "instantiate", "\\u", "from_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "datadir_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "FH", "IR", "\\u", "UNIT", "TEST", "\\u", "DATA", "DIR", "'_", ")_", "or_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "io_", "._", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "datadir_", ",_", "filename_", ")_", ",_", "'", "r", "'_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", "as_", "handle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "js_", "=_", "json_", "._", "load_", "(_", "handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "Order", "Respons", "e", "\"_", ",_", "js_", "[_", "\"", "resource", "Type", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "order", "response_", "._", "Order", "Response_", "(_", "js_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Order", "Respons", "e", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Order", "Respons", "e1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inst_", "=_", "self_", "._", "instantiate", "\\u", "from_", "(_", "\"", "order", "response", "-", "example", ".", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not", "None_", "(_", "inst_", ",_", "\"", "Mus", "t", " ", "have", " ", "instantiate", "d", " ", "a", " ", "Order", "Respons", "e", " ", "instance", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "impl", "Order", "Respons", "e1_", "(_", "inst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "js_", "=_", "inst_", "._", "as", "\\u", "json_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\"", "Order", "Respons", "e", "\"_", ",_", "js_", "[_", "\"", "resource", "Type", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inst", "2_", "=_", "order", "response_", "._", "Order", "Response_", "(_", "js_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "impl", "Order", "Respons", "e1_", "(_", "inst", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Order", "Respons", "e", "Tests_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "impl", "Order", "Respons", "e1_", "(_", "self_", ",_", "inst_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "inst_", "._", "date_", "._", "date_", ",_", "FH", "IR", "Date_", "(_", "\"", "2012", "-1", "2", "-", "2", "8", "T1", "3", ":", "10", ":", "56", "+", "11", ":", "00", "\"_", ")_", "._", "date_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "inst_", "._", "date_", "._", "as", "\\u", "json_", "(_", ")_", ",_", "\"", "2012", "-1", "2", "-", "2", "8", "T1", "3", ":", "10", ":", "56", "+", "11", ":", "00", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "inst_", "._", "id_", ",_", "\"", "example", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "inst_", "._", "order", "Status_", ",_", "\"", "complete", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "inst_", "._", "text_", "._", "div_", ",_", "\"<", "div", ">", "Lab", " ", "Report", " ", "complete", "d", " ", "at", " ", "13", ":", "10", " ", "2", "8", "-", "De", "c", " ", "2012", "</", "div", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "inst_", "._", "text_", "._", "status_", ",_", "\"", "generat", "ed", "\"_", ")_" ]
[ 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 ]
Unused import
nii-cloud/dodai-compute/nova/api/openstack/create_instance_helper.py
[ { "content": "# Copyright 2011 OpenStack LLC.\n# Copyright 2011 Piston Cloud Computing, Inc.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\nimport base64\n\nfrom webob import exc\nfrom xml.dom import minidom\n\nfrom nova import exception\nfrom nova import flags\nfrom nova import log as logging\nimport nova.image\nfrom nova import quota\nfrom nova import utils\n\nfrom nova.compute import instance_types\nfrom nova.api.openstack import common\nfrom nova.api.openstack import wsgi\nfrom nova.rpc.common import RemoteError\n\nLOG = logging.getLogger('nova.api.openstack.create_instance_helper')\nFLAGS = flags.FLAGS\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CreateFault(exception.NovaException):\n message = _(\"Invalid parameters given to create_instance.\")\n", "metadata": "root.CreateFault", "header": "['module', '___EOS___']", "index": 37 }, { "content": " def __init__(self, fault):\n self.fault = fault\n super(CreateFault, self).__init__()", "metadata": "root.CreateFault.__init__", "header": "['class', 'CreateFault', '(', 'exception', '.', 'NovaException', ')', ':', '___EOS___']", "index": 40 }, { "content": "class CreateInstanceHelper(object):\n \"\"\"This is the base class for OS API Controllers that\n are capable of creating instances (currently Servers and Zones).\n\n Once we stabilize the Zones portion of the API we may be able\n to move this code back into servers.py\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.CreateInstanceHelper", "header": "['module', '___EOS___']", "index": 45 }, { "content": " def __init__(self, controller):\n \"\"\"We need the image service to create an instance.\"\"\"\n self.controller = controller\n self._image_service = utils.import_object(FLAGS.image_service)\n super(CreateInstanceHelper, self).__init__()", "metadata": "root.CreateInstanceHelper.__init__", "header": "['class', 'CreateInstanceHelper', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": " def create_instance(self, req, body, create_method):\n \"\"\"Creates a new server for the given user. The approach\n used depends on the create_method. For example, the standard\n POST /server call uses compute.api.create(), while\n POST /zones/server uses compute.api.create_all_at_once().\n\n The problem is, both approaches return different values (i.e.\n [instance dicts] vs. reservation_id). So the handling of the\n return type from this method is left to the caller.\n \"\"\"\n if not body:\n raise exc.HTTPUnprocessableEntity()\n\n if not 'server' in body:\n raise exc.HTTPUnprocessableEntity()\n\n context = req.environ['nova.context']\n server_dict = body['server']\n password = self.controller._get_server_admin_password(server_dict)\n\n if not 'name' in server_dict:\n msg = _(\"Server name is not defined\")\n raise exc.HTTPBadRequest(explanation=msg)\n\n name = server_dict['name']\n self._validate_server_name(name)\n name = name.strip()\n\n image_href = self.controller._image_ref_from_req_data(body)\n # If the image href was generated by nova api, strip image_href\n # down to an id and use the default glance connection params\n\n if str(image_href).startswith(req.application_url):\n image_href = image_href.split('/').pop()\n try:\n image_service, image_id = nova.image.get_image_service(context,\n image_href)\n kernel_id, ramdisk_id = self._get_kernel_ramdisk_from_image(\n req, image_service, image_id)\n images = set([str(x['id']) for x in image_service.index(context)])\n assert str(image_id) in images\n except Exception, e:\n msg = _(\"Cannot find requested image %(image_href)s: %(e)s\" %\n locals())\n raise exc.HTTPBadRequest(explanation=msg)\n\n personality = server_dict.get('personality')\n config_drive = server_dict.get('config_drive')\n\n injected_files = []\n if personality:\n injected_files = self._get_injected_files(personality)\n\n sg_names = []\n security_groups = server_dict.get('security_groups')\n if security_groups is not None:\n sg_names = [sg['name'] for sg in security_groups if sg.get('name')]\n if not sg_names:\n sg_names.append('default')\n\n sg_names = list(set(sg_names))\n\n requested_networks = server_dict.get('networks')\n if requested_networks is not None:\n requested_networks = self._get_requested_networks(\n requested_networks)\n\n try:\n flavor_id = self.controller._flavor_id_from_req_data(body)\n except ValueError as error:\n msg = _(\"Invalid flavorRef provided.\")\n raise exc.HTTPBadRequest(explanation=msg)\n\n zone_blob = server_dict.get('blob')\n\n # optional openstack extensions:\n key_name = server_dict.get('key_name')\n user_data = server_dict.get('user_data')\n self._validate_user_data(user_data)\n\n availability_zone = server_dict.get('availability_zone')\n name = server_dict['name']\n self._validate_server_name(name)\n name = name.strip()\n\n reservation_id = server_dict.get('reservation_id')\n min_count = server_dict.get('min_count')\n max_count = server_dict.get('max_count')\n # min_count and max_count are optional. If they exist, they come\n # in as strings. We want to default 'min_count' to 1, and default\n # 'max_count' to be 'min_count'.\n min_count = int(min_count) if min_count else 1\n max_count = int(max_count) if max_count else min_count\n if min_count > max_count:\n min_count = max_count\n\n try:\n inst_type = \\\n instance_types.get_instance_type_by_flavor_id(flavor_id)\n extra_values = {\n 'instance_type': inst_type,\n 'image_ref': image_href,\n 'config_drive': config_drive,\n 'password': password}\n\n return (extra_values,\n create_method(context,\n inst_type,\n image_id,\n kernel_id=kernel_id,\n ramdisk_id=ramdisk_id,\n display_name=name,\n display_description=name,\n key_name=key_name,\n metadata=server_dict.get('metadata', {}),\n access_ip_v4=server_dict.get('accessIPv4'),\n access_ip_v6=server_dict.get('accessIPv6'),\n injected_files=injected_files,\n admin_password=password,\n zone_blob=zone_blob,\n reservation_id=reservation_id,\n min_count=min_count,\n max_count=max_count,\n requested_networks=requested_networks,\n security_group=sg_names,\n user_data=user_data,\n availability_zone=availability_zone,\n config_drive=config_drive,))\n except quota.QuotaError as error:\n self._handle_quota_error(error)\n except exception.ImageNotFound as error:\n msg = _(\"Can not find requested image\")\n raise exc.HTTPBadRequest(explanation=msg)\n except exception.FlavorNotFound as error:\n msg = _(\"Invalid flavorRef provided.\")\n raise exc.HTTPBadRequest(explanation=msg)\n except exception.KeypairNotFound as error:\n msg = _(\"Invalid key_name provided.\")\n raise exc.HTTPBadRequest(explanation=msg)\n except exception.SecurityGroupNotFound as error:\n raise exc.HTTPBadRequest(explanation=unicode(error))\n except RemoteError as err:\n msg = \"%(err_type)s: %(err_msg)s\" % \\\n {'err_type': err.exc_type, 'err_msg': err.value}\n raise exc.HTTPBadRequest(explanation=msg)\n # Let the caller deal with unhandled exceptions.", "metadata": "root.CreateInstanceHelper.create_instance", "header": "['class', 'CreateInstanceHelper', '(', 'object', ')', ':', '___EOS___']", "index": 59 }, { "content": " def _handle_quota_error(self, error):\n \"\"\"\n Reraise quota errors as api-specific http exceptions\n \"\"\"\n if error.code == \"OnsetFileLimitExceeded\":\n expl = _(\"Personality file limit exceeded\")\n raise exc.HTTPRequestEntityTooLarge(explanation=error.message,\n headers={'Retry-After': 0})\n if error.code == \"OnsetFilePathLimitExceeded\":\n expl = _(\"Personality file path too long\")\n raise exc.HTTPRequestEntityTooLarge(explanation=error.message,\n headers={'Retry-After': 0})\n if error.code == \"OnsetFileContentLimitExceeded\":\n expl = _(\"Personality file content too long\")\n raise exc.HTTPRequestEntityTooLarge(explanation=error.message,\n headers={'Retry-After': 0})\n if error.code == \"InstanceLimitExceeded\":\n expl = _(\"Instance quotas have been exceeded\")\n raise exc.HTTPRequestEntityTooLarge(explanation=error.message,\n headers={'Retry-After': 0})\n # if the original error is okay, just reraise it\n raise error", "metadata": "root.CreateInstanceHelper._handle_quota_error", "header": "['class', 'CreateInstanceHelper', '(', 'object', ')', ':', '___EOS___']", "index": 206 }, { "content": " def _deserialize_create(self, request):\n \"\"\"\n Deserialize a create request\n\n Overrides normal behavior in the case of xml content\n \"\"\"\n if request.content_type == \"application/xml\":\n deserializer = ServerXMLDeserializer()\n return deserializer.deserialize(request.body)\n else:\n return self._deserialize(request.body, request.get_content_type())", "metadata": "root.CreateInstanceHelper._deserialize_create", "header": "['class', 'CreateInstanceHelper', '(', 'object', ')', ':', '___EOS___']", "index": 229 }, { "content": " def _validate_server_name(self, value):\n if not isinstance(value, basestring):\n msg = _(\"Server name is not a string or unicode\")\n raise exc.HTTPBadRequest(explanation=msg)\n\n if value.strip() == '':\n msg = _(\"Server name is an empty string\")\n raise exc.HTTPBadRequest(explanation=msg)", "metadata": "root.CreateInstanceHelper._validate_server_name", "header": "['class', 'CreateInstanceHelper', '(', 'object', ')', ':', '___EOS___']", "index": 241 }, { "content": " def _get_kernel_ramdisk_from_image(self, req, image_service, image_id):\n \"\"\"Fetch an image from the ImageService, then if present, return the\n associated kernel and ramdisk image IDs.\n \"\"\"\n context = req.environ['nova.context']\n image_meta = image_service.show(context, image_id)\n # NOTE(sirp): extracted to a separate method to aid unit-testing, the\n # new method doesn't need a request obj or an ImageService stub\n kernel_id, ramdisk_id = self._do_get_kernel_ramdisk_from_image(\n image_meta)\n return kernel_id, ramdisk_id", "metadata": "root.CreateInstanceHelper._get_kernel_ramdisk_from_image", "header": "['class', 'CreateInstanceHelper', '(', 'object', ')', ':', '___EOS___']", "index": 250 }, { "content": " @staticmethod\n def _do_get_kernel_ramdisk_from_image(image_meta):\n \"\"\"Given an ImageService image_meta, return kernel and ramdisk image\n ids if present.\n\n This is only valid for `ami` style images.\n \"\"\"\n image_id = image_meta['id']\n if image_meta['status'] != 'active':\n raise exception.ImageUnacceptable(image_id=image_id,\n reason=_(\"status is not active\"))\n\n if image_meta.get('container_format') != 'ami':\n return None, None\n\n try:\n kernel_id = image_meta['properties']['kernel_id']\n except KeyError:\n raise exception.KernelNotFoundForImage(image_id=image_id)\n\n try:\n ramdisk_id = image_meta['properties']['ramdisk_id']\n except KeyError:\n ramdisk_id = None\n\n return kernel_id, ramdisk_id", "metadata": "root.CreateInstanceHelper._do_get_kernel_ramdisk_from_image", "header": "['class', 'CreateInstanceHelper', '(', 'object', ')', ':', '___EOS___']", "index": 262 }, { "content": " def _get_injected_files(self, personality):\n \"\"\"\n Create a list of injected files from the personality attribute\n\n At this time, injected_files must be formatted as a list of\n (file_path, file_content) pairs for compatibility with the\n underlying compute service.\n \"\"\"\n injected_files = []\n\n for item in personality:\n try:\n path = item['path']\n contents = item['contents']\n except KeyError as key:\n expl = _('Bad personality format: missing %s') % key\n raise exc.HTTPBadRequest(explanation=expl)\n except TypeError:\n expl = _('Bad personality format')\n raise exc.HTTPBadRequest(explanation=expl)\n try:\n contents = base64.b64decode(contents)\n except TypeError:\n expl = _('Personality content for %s cannot be decoded') % path\n raise exc.HTTPBadRequest(explanation=expl)\n injected_files.append((path, contents))\n return injected_files", "metadata": "root.CreateInstanceHelper._get_injected_files", "header": "['class', 'CreateInstanceHelper', '(', 'object', ')', ':', '___EOS___']", "index": 289 }, { "content": " def _get_server_admin_password_old_style(self, server):\n \"\"\" Determine the admin password for a server on creation \"\"\"\n return utils.generate_password(16)", "metadata": "root.CreateInstanceHelper._get_server_admin_password_old_style", "header": "['class', 'CreateInstanceHelper', '(', 'object', ')', ':', '___EOS___']", "index": 317 }, { "content": " def _get_server_admin_password_new_style(self, server):\n \"\"\" Determine the admin password for a server on creation \"\"\"\n password = server.get('adminPass')\n\n if password is None:\n return utils.generate_password(16)\n if not isinstance(password, basestring) or password == '':\n msg = _(\"Invalid adminPass\")\n raise exc.HTTPBadRequest(explanation=msg)\n return password", "metadata": "root.CreateInstanceHelper._get_server_admin_password_new_style", "header": "['class', 'CreateInstanceHelper', '(', 'object', ')', ':', '___EOS___']", "index": 321 }, { "content": " def _get_requested_networks(self, requested_networks):\n \"\"\"\n Create a list of requested networks from the networks attribute\n \"\"\"\n networks = []\n for network in requested_networks:\n try:\n network_uuid = network['uuid']\n\n if not utils.is_uuid_like(network_uuid):\n msg = _(\"Bad networks format: network uuid is not in\"\n \" proper format (%s)\") % network_uuid\n raise exc.HTTPBadRequest(explanation=msg)\n\n #fixed IP address is optional\n #if the fixed IP address is not provided then\n #it will use one of the available IP address from the network\n address = network.get('fixed_ip', None)\n if address is not None and not utils.is_valid_ipv4(address):\n msg = _(\"Invalid fixed IP address (%s)\") % address\n raise exc.HTTPBadRequest(explanation=msg)\n # check if the network id is already present in the list,\n # we don't want duplicate networks to be passed\n # at the boot time\n for id, ip in networks:\n if id == network_uuid:\n expl = _(\"Duplicate networks (%s) are not allowed\")\\\n % network_uuid\n raise exc.HTTPBadRequest(explanation=expl)\n\n networks.append((network_uuid, address))\n except KeyError as key:\n expl = _('Bad network format: missing %s') % key\n raise exc.HTTPBadRequest(explanation=expl)\n except TypeError:\n expl = _('Bad networks format')\n raise exc.HTTPBadRequest(explanation=expl)\n\n return networks", "metadata": "root.CreateInstanceHelper._get_requested_networks", "header": "['class', 'CreateInstanceHelper', '(', 'object', ')', ':', '___EOS___']", "index": 332 }, { "content": " def _validate_user_data(self, user_data):\n \"\"\"Check if the user_data is encoded properly\"\"\"\n if not user_data:\n return\n try:\n user_data = base64.b64decode(user_data)\n except TypeError:\n expl = _('Userdata content cannot be decoded')\n raise exc.HTTPBadRequest(explanation=expl)", "metadata": "root.CreateInstanceHelper._validate_user_data", "header": "['class', 'CreateInstanceHelper', '(', 'object', ')', ':', '___EOS___']", "index": 372 }, { "content": "class ServerXMLDeserializer(wsgi.XMLDeserializer):\n \"\"\"\n Deserializer to handle xml-formatted server create requests.\n\n Handles standard server attributes as well as optional metadata\n and personality attributes\n \"\"\"\n\n metadata_deserializer = common.MetadataXMLDeserializer()\n\n\n", "metadata": "root.ServerXMLDeserializer", "header": "['module', '___EOS___']", "index": 383 }, { "content": " def create(self, string):\n \"\"\"Deserialize an xml-formatted server create request\"\"\"\n dom = minidom.parseString(string)\n server = self._extract_server(dom)\n return {'body': {'server': server}}", "metadata": "root.ServerXMLDeserializer.create", "header": "['class', 'ServerXMLDeserializer', '(', 'wsgi', '.', 'XMLDeserializer', ')', ':', '___EOS___']", "index": 393 }, { "content": " def _extract_server(self, node):\n \"\"\"Marshal the server attribute of a parsed request\"\"\"\n server = {}\n server_node = self.find_first_child_named(node, 'server')\n\n attributes = [\"name\", \"imageId\", \"flavorId\", \"adminPass\"]\n for attr in attributes:\n if server_node.getAttribute(attr):\n server[attr] = server_node.getAttribute(attr)\n\n metadata_node = self.find_first_child_named(server_node, \"metadata\")\n server[\"metadata\"] = self.metadata_deserializer.extract_metadata(\n metadata_node)\n\n server[\"personality\"] = self._extract_personality(server_node)\n\n return server", "metadata": "root.ServerXMLDeserializer._extract_server", "header": "['class', 'ServerXMLDeserializer', '(', 'wsgi', '.', 'XMLDeserializer', ')', ':', '___EOS___']", "index": 399 }, { "content": " def _extract_personality(self, server_node):\n \"\"\"Marshal the personality attribute of a parsed request\"\"\"\n node = self.find_first_child_named(server_node, \"personality\")\n personality = []\n if node is not None:\n for file_node in self.find_children_named(node, \"file\"):\n item = {}\n if file_node.hasAttribute(\"path\"):\n item[\"path\"] = file_node.getAttribute(\"path\")\n item[\"contents\"] = self.extract_text(file_node)\n personality.append(item)\n return personality", "metadata": "root.ServerXMLDeserializer._extract_personality", "header": "['class', 'ServerXMLDeserializer', '(', 'wsgi', '.', 'XMLDeserializer', ')', ':', '___EOS___']", "index": 417 }, { "content": "class ServerXMLDeserializerV11(wsgi.MetadataXMLDeserializer):\n \"\"\"\n Deserializer to handle xml-formatted server create requests.\n\n Handles standard server attributes as well as optional metadata\n and personality attributes\n \"\"\"\n\n metadata_deserializer = common.MetadataXMLDeserializer()\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.ServerXMLDeserializerV11", "header": "['module', '___EOS___']", "index": 431 }, { "content": " def action(self, string):\n dom = minidom.parseString(string)\n action_node = dom.childNodes[0]\n action_name = action_node.tagName\n\n action_deserializer = {\n 'createImage': self._action_create_image,\n 'createBackup': self._action_create_backup,\n 'changePassword': self._action_change_password,\n 'reboot': self._action_reboot,\n 'rebuild': self._action_rebuild,\n 'resize': self._action_resize,\n 'confirmResize': self._action_confirm_resize,\n 'revertResize': self._action_revert_resize,\n }.get(action_name, self.default)\n\n action_data = action_deserializer(action_node)\n\n return {'body': {action_name: action_data}}", "metadata": "root.ServerXMLDeserializerV11.action", "header": "['class', 'ServerXMLDeserializerV11', '(', 'wsgi', '.', 'MetadataXMLDeserializer', ')', ':', '___EOS___']", "index": 441 }, { "content": " def _action_create_image(self, node):\n return self._deserialize_image_action(node, ('name',))", "metadata": "root.ServerXMLDeserializerV11._action_create_image", "header": "['class', 'ServerXMLDeserializerV11', '(', 'wsgi', '.', 'MetadataXMLDeserializer', ')', ':', '___EOS___']", "index": 461 }, { "content": " def _action_create_backup(self, node):\n attributes = ('name', 'backup_type', 'rotation')\n return self._deserialize_image_action(node, attributes)", "metadata": "root.ServerXMLDeserializerV11._action_create_backup", "header": "['class', 'ServerXMLDeserializerV11', '(', 'wsgi', '.', 'MetadataXMLDeserializer', ')', ':', '___EOS___']", "index": 464 }, { "content": " def _action_change_password(self, node):\n if not node.hasAttribute(\"adminPass\"):\n raise AttributeError(\"No adminPass was specified in request\")\n return {\"adminPass\": node.getAttribute(\"adminPass\")}", "metadata": "root.ServerXMLDeserializerV11._action_change_password", "header": "['class', 'ServerXMLDeserializerV11', '(', 'wsgi', '.', 'MetadataXMLDeserializer', ')', ':', '___EOS___']", "index": 468 }, { "content": " def _action_reboot(self, node):\n if not node.hasAttribute(\"type\"):\n raise AttributeError(\"No reboot type was specified in request\")\n return {\"type\": node.getAttribute(\"type\")}", "metadata": "root.ServerXMLDeserializerV11._action_reboot", "header": "['class', 'ServerXMLDeserializerV11', '(', 'wsgi', '.', 'MetadataXMLDeserializer', ')', ':', '___EOS___']", "index": 473 }, { "content": " def _action_rebuild(self, node):\n rebuild = {}\n if node.hasAttribute(\"name\"):\n rebuild['name'] = node.getAttribute(\"name\")\n\n metadata_node = self.find_first_child_named(node, \"metadata\")\n if metadata_node is not None:\n rebuild[\"metadata\"] = self.extract_metadata(metadata_node)\n\n personality = self._extract_personality(node)\n if personality is not None:\n rebuild[\"personality\"] = personality\n\n if not node.hasAttribute(\"imageRef\"):\n raise AttributeError(\"No imageRef was specified in request\")\n rebuild[\"imageRef\"] = node.getAttribute(\"imageRef\")\n\n return rebuild", "metadata": "root.ServerXMLDeserializerV11._action_rebuild", "header": "['class', 'ServerXMLDeserializerV11', '(', 'wsgi', '.', 'MetadataXMLDeserializer', ')', ':', '___EOS___']", "index": 478 }, { "content": " def _action_resize(self, node):\n if not node.hasAttribute(\"flavorRef\"):\n raise AttributeError(\"No flavorRef was specified in request\")\n return {\"flavorRef\": node.getAttribute(\"flavorRef\")}", "metadata": "root.ServerXMLDeserializerV11._action_resize", "header": "['class', 'ServerXMLDeserializerV11', '(', 'wsgi', '.', 'MetadataXMLDeserializer', ')', ':', '___EOS___']", "index": 497 }, { "content": " def _action_confirm_resize(self, node):\n return None", "metadata": "root.ServerXMLDeserializerV11._action_confirm_resize", "header": "['class', 'ServerXMLDeserializerV11', '(', 'wsgi', '.', 'MetadataXMLDeserializer', ')', ':', '___EOS___']", "index": 502 }, { "content": " def _action_revert_resize(self, node):\n return None", "metadata": "root.ServerXMLDeserializerV11._action_revert_resize", "header": "['class', 'ServerXMLDeserializerV11', '(', 'wsgi', '.', 'MetadataXMLDeserializer', ')', ':', '___EOS___']", "index": 505 }, { "content": " def _deserialize_image_action(self, node, allowed_attributes):\n data = {}\n for attribute in allowed_attributes:\n value = node.getAttribute(attribute)\n if value:\n data[attribute] = value\n metadata_node = self.find_first_child_named(node, 'metadata')\n if metadata_node is not None:\n metadata = self.metadata_deserializer.extract_metadata(\n metadata_node)\n data['metadata'] = metadata\n return data", "metadata": "root.ServerXMLDeserializerV11._deserialize_image_action", "header": "['class', 'ServerXMLDeserializerV11', '(', 'wsgi', '.', 'MetadataXMLDeserializer', ')', ':', '___EOS___']", "index": 508 }, { "content": " def create(self, string):\n \"\"\"Deserialize an xml-formatted server create request\"\"\"\n dom = minidom.parseString(string)\n server = self._extract_server(dom)\n return {'body': {'server': server}}", "metadata": "root.ServerXMLDeserializerV11.create", "header": "['class', 'ServerXMLDeserializerV11', '(', 'wsgi', '.', 'MetadataXMLDeserializer', ')', ':', '___EOS___']", "index": 521 }, { "content": " def _extract_server(self, node):\n \"\"\"Marshal the server attribute of a parsed request\"\"\"\n server = {}\n server_node = self.find_first_child_named(node, 'server')\n\n attributes = [\"name\", \"imageRef\", \"flavorRef\", \"adminPass\",\n \"accessIPv4\", \"accessIPv6\"]\n for attr in attributes:\n if server_node.getAttribute(attr):\n server[attr] = server_node.getAttribute(attr)\n\n metadata_node = self.find_first_child_named(server_node, \"metadata\")\n if metadata_node is not None:\n server[\"metadata\"] = self.extract_metadata(metadata_node)\n\n personality = self._extract_personality(server_node)\n if personality is not None:\n server[\"personality\"] = personality\n\n networks = self._extract_networks(server_node)\n if networks is not None:\n server[\"networks\"] = networks\n\n security_groups = self._extract_security_groups(server_node)\n if security_groups is not None:\n server[\"security_groups\"] = security_groups\n\n return server", "metadata": "root.ServerXMLDeserializerV11._extract_server", "header": "['class', 'ServerXMLDeserializerV11', '(', 'wsgi', '.', 'MetadataXMLDeserializer', ')', ':', '___EOS___']", "index": 527 }, { "content": " def _extract_personality(self, server_node):\n \"\"\"Marshal the personality attribute of a parsed request\"\"\"\n node = self.find_first_child_named(server_node, \"personality\")\n if node is not None:\n personality = []\n for file_node in self.find_children_named(node, \"file\"):\n item = {}\n if file_node.hasAttribute(\"path\"):\n item[\"path\"] = file_node.getAttribute(\"path\")\n item[\"contents\"] = self.extract_text(file_node)\n personality.append(item)\n return personality\n else:\n return None", "metadata": "root.ServerXMLDeserializerV11._extract_personality", "header": "['class', 'ServerXMLDeserializerV11', '(', 'wsgi', '.', 'MetadataXMLDeserializer', ')', ':', '___EOS___']", "index": 556 }, { "content": " def _extract_networks(self, server_node):\n \"\"\"Marshal the networks attribute of a parsed request\"\"\"\n node = self.find_first_child_named(server_node, \"networks\")\n if node is not None:\n networks = []\n for network_node in self.find_children_named(node,\n \"network\"):\n item = {}\n if network_node.hasAttribute(\"uuid\"):\n item[\"uuid\"] = network_node.getAttribute(\"uuid\")\n if network_node.hasAttribute(\"fixed_ip\"):\n item[\"fixed_ip\"] = network_node.getAttribute(\"fixed_ip\")\n networks.append(item)\n return networks\n else:\n return None", "metadata": "root.ServerXMLDeserializerV11._extract_networks", "header": "['class', 'ServerXMLDeserializerV11', '(', 'wsgi', '.', 'MetadataXMLDeserializer', ')', ':', '___EOS___']", "index": 571 }, { "content": " def _extract_security_groups(self, server_node):\n \"\"\"Marshal the security_groups attribute of a parsed request\"\"\"\n node = self.find_first_child_named(server_node, \"security_groups\")\n if node is not None:\n security_groups = []\n for sg_node in self.find_children_named(node, \"security_group\"):\n item = {}\n name_node = self.find_first_child_named(sg_node, \"name\")\n if name_node:\n item[\"name\"] = self.extract_text(name_node)\n security_groups.append(item)\n return security_groups\n else:\n return None", "metadata": "root.ServerXMLDeserializerV11._extract_security_groups", "header": "['class', 'ServerXMLDeserializerV11', '(', 'wsgi', '.', 'MetadataXMLDeserializer', ')', ':', '___EOS___']", "index": 588 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2011", " ", "Open", "Stack", " ", "LLC", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2011", " ", "Pi", "ston", " ", "Cloud", " ", "Comp", "uti", "ng", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "WITH", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ations_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "webob_", "import_", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xml_", "._", "dom_", "import_", "minidom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nova_", "import_", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "flags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "log_", "as_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nova_", "._", "image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "quota_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nova_", "._", "compute_", "import_", "instance", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "api_", "._", "openstack_", "import_", "common_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "api_", "._", "openstack_", "import_", "wsgi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "rpc_", "._", "common_", "import_", "Remo", "te", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "nova", ".", "api", ".", "openst", "ack", ".", "create", "\\u", "instance", "\\u", "help", "er", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "FLAGS_", "=_", "flags_", "._", "FLAGS_", "\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Creat", "e", "Fault_", "(_", "exception_", "._", "Nov", "a", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "\\u_", "(_", "\"", "Inva", "lid", " ", "parameter", "s", " ", "give", "n", " ", "to", " ", "create", "\\u", "instance", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Fault_", "(_", "exception_", "._", "Nov", "a", "Exception_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "fault_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fault_", "=_", "fault_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Creat", "e", "Fault_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Creat", "e", "Insta", "nce", "Helper_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "is", " ", "the", " ", "base", " ", "class", " ", "for", " ", "OS", " ", "API", " ", "Controlle", "rs", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "capable", " ", "of", " ", "creati", "ng", " ", "instance", "s", " ", "(", "currentl", "y", " ", "Server", "s", " ", "and", " ", "Zon", "es", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "On", "ce", " ", "we", " ", "stab", "iliz", "e", " ", "the", " ", "Zon", "es", " ", "porti", "on", " ", "of", " ", "the", " ", "API", " ", "we", " ", "may", " ", "be", " ", "able", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "move", " ", "this", " ", "code", " ", "back", " ", "int", "o", " ", "server", "s", ".", "py", "\\", "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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Creat", "e", "Insta", "nce", "Helper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "controller_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "We", " ", "need", " ", "the", " ", "image", " ", "service", " ", "to", " ", "create", " ", "an", " ", "instance", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "controller_", "=_", "controller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "image", "\\u", "service_", "=_", "utils_", "._", "import", "\\u", "object_", "(_", "FLAGS_", "._", "image", "\\u", "service_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Creat", "e", "Insta", "nce", "Helper_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Insta", "nce", "Helper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "\\u", "instance_", "(_", "self_", ",_", "req_", ",_", "body_", ",_", "create", "\\u", "method_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "a", " ", "new", " ", "server", " ", "for", " ", "the", " ", "give", "n", " ", "user", ".", " ", "The", " ", "appro", "ach", "\\", "10", ";", " ", " ", " ", " ", "used", " ", "depend", "s", " ", "on", " ", "the", " ", "create", "\\u", "method", ".", " ", "For", " ", "example", ",", " ", "the", " ", "standard", "\\", "10", ";", " ", " ", " ", " ", "POST", " ", "/", "server", " ", "call", " ", "use", "s", " ", "compute", ".", "api", ".", "create", "()", ",", " ", "whi", "le", "\\", "10", ";", " ", " ", " ", " ", "POST", " ", "/", "zone", "s", "/", "server", " ", "use", "s", " ", "compute", ".", "api", ".", "create", "\\u", "all", "\\u", "at", "\\u", "onc", "e", "()", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "problem", " ", "is", ",", " ", "bot", "h", " ", "appro", "ache", "s", " ", "return", " ", "different", " ", "values", " ", "(", "i", ".", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "[", "instance", " ", "dict", "s", "]", " ", "vs", ".", " ", "reserva", "tion", "\\u", "id", ").", " ", "So", " ", "the", " ", "handling", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "type", " ", "from", " ", "this", " ", "method", " ", "is", " ", "left", " ", "to", " ", "the", " ", "caller", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "body_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "HTTP", "Unp", "rocess", "able", "Entity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "'", "server", "'_", "in_", "body_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "HTTP", "Unp", "rocess", "able", "Entity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "req_", "._", "environ_", "[_", "'", "nova", ".", "context", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "\\u", "dict_", "=_", "body_", "[_", "'", "server", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "self_", "._", "controller_", "._", "\\u", "get", "\\u", "server", "\\u", "admin", "\\u", "password_", "(_", "server", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "'", "name", "'_", "in_", "server", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\\u_", "(_", "\"", "Server", " ", "name", " ", "is", " ", "not", " ", "defin", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name_", "=_", "server", "\\u", "dict_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "validat", "e\\u", "server", "\\u", "name_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "name_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "href_", "=_", "self_", "._", "controller_", "._", "\\u", "image", "\\u", "ref", "\\u", "from", "\\u", "req", "\\u", "data_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "image", " ", "href", " ", "was", " ", "generat", "ed", " ", "by", " ", "nova", " ", "api", ",", " ", "strip", " ", "image", "\\u", "href_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "down", " ", "to", " ", "an", " ", "id", " ", "and", " ", "use", " ", "the", " ", "default", " ", "gla", "nce", " ", "connecti", "on", " ", "params_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "str_", "(_", "image", "\\u", "href_", ")_", "._", "startswith_", "(_", "req_", "._", "applica", "tion", "\\u", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image", "\\u", "href_", "=_", "image", "\\u", "href_", "._", "split_", "(_", "'/'_", ")_", "._", "pop_", "(_", ")_", "\\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 ", " _", "image", "\\u", "service_", ",_", "image", "\\u", "id_", "=_", "nova_", "._", "image_", "._", "get", "\\u", "image", "\\u", "service_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "href_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kernel", "\\u", "id_", ",_", "ramdisk", "\\u", "id_", "=_", "self_", "._", "\\u", "get", "\\u", "kernel", "\\u", "ramdisk", "\\u", "from", "\\u", "image_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "req_", ",_", "image", "\\u", "service_", ",_", "image", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "images_", "=_", "set_", "(_", "[_", "str_", "(_", "x_", "[_", "'", "id", "'_", "]_", ")_", "for_", "x_", "in_", "image", "\\u", "service_", "._", "index_", "(_", "context_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "str_", "(_", "image", "\\u", "id_", ")_", "in_", "images_", "\\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 ", " _", "msg_", "=_", "\\u_", "(_", "\"", "Cann", "ot", " ", "find", " ", "request", "ed", " ", "image", " ", "%", "(", "image", "\\u", "href", ")", "s", ":", " ", "%", "(", "e", ")", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "locals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "personality", "_", "=_", "server", "\\u", "dict_", "._", "get_", "(_", "'", "personality", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config", "\\u", "drive_", "=_", "server", "\\u", "dict_", "._", "get_", "(_", "'", "config", "\\u", "drive", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "injected", "\\u", "files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "personality", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "injected", "\\u", "files_", "=_", "self_", "._", "\\u", "get", "\\u", "injected", "\\u", "files_", "(_", "personality", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sg", "\\u", "names_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "security", "\\u", "groups_", "=_", "server", "\\u", "dict_", "._", "get_", "(_", "'", "security", "\\u", "group", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "security", "\\u", "groups_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg", "\\u", "names_", "=_", "[_", "sg_", "[_", "'", "name", "'_", "]_", "for_", "sg_", "in_", "security", "\\u", "groups_", "if_", "sg_", "._", "get_", "(_", "'", "name", "'_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "sg", "\\u", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sg", "\\u", "names_", "._", "append_", "(_", "'", "default", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sg", "\\u", "names_", "=_", "list_", "(_", "set_", "(_", "sg", "\\u", "names_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request", "ed", "\\u", "networks_", "=_", "server", "\\u", "dict_", "._", "get_", "(_", "'", "network", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request", "ed", "\\u", "networks_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request", "ed", "\\u", "networks_", "=_", "self_", "._", "\\u", "get", "\\u", "request", "ed", "\\u", "networks_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request", "ed", "\\u", "networks_", ")_", "\\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 ", " _", "flavor", "\\u", "id_", "=_", "self_", "._", "controller_", "._", "\\u", "flavor", "\\u", "id", "\\u", "from", "\\u", "req", "\\u", "data_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", "as_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\\u_", "(_", "\"", "Inva", "lid", " ", "flavor", "Ref", " ", "provided", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "zone", "\\u", "blob_", "=_", "server", "\\u", "dict_", "._", "get_", "(_", "'", "blob", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "option", "al", " ", "openst", "ack", " ", "extensi", "ons", ":_", "\\u\\u\\uNL\\u\\u\\u_", "key", "\\u", "name_", "=_", "server", "\\u", "dict_", "._", "get_", "(_", "'", "key", "\\u", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "data_", "=_", "server", "\\u", "dict_", "._", "get_", "(_", "'", "user", "\\u", "data", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "validat", "e\\u", "user", "\\u", "data_", "(_", "user", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "avail", "abilit", "y", "\\u", "zone_", "=_", "server", "\\u", "dict_", "._", "get_", "(_", "'", "avail", "abilit", "y", "\\u", "zone", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "server", "\\u", "dict_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "validat", "e\\u", "server", "\\u", "name_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "name_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reserva", "tion", "\\u", "id_", "=_", "server", "\\u", "dict_", "._", "get_", "(_", "'", "reserva", "tion", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "count_", "=_", "server", "\\u", "dict_", "._", "get_", "(_", "'", "min", "\\u", "count", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "count_", "=_", "server", "\\u", "dict_", "._", "get_", "(_", "'", "max", "\\u", "count", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "min", "\\u", "count", " ", "and", " ", "max", "\\u", "count", " ", "are", " ", "option", "al", ".", " ", " ", "If", " ", "the", "y", " ", "exist", ",", " ", "the", "y", " ", "come", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "as", " ", "string", "s", ".", " ", " ", "We", " ", "want", " ", "to", " ", "default", " ", "'", "min", "\\u", "count", "'", " ", "to", " ", "1", ",", " ", "and", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "'", "max", "\\u", "count", "'", " ", "to", " ", "be", " ", "'", "min", "\\u", "count", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "count_", "=_", "int_", "(_", "min", "\\u", "count_", ")_", "if_", "min", "\\u", "count_", "else_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "count_", "=_", "int_", "(_", "max", "\\u", "count_", ")_", "if_", "max", "\\u", "count_", "else_", "min", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "min", "\\u", "count_", ">_", "max", "\\u", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "min", "\\u", "count_", "=_", "max", "\\u", "count_", "\\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 ", " _", "inst", "\\u", "type_", "=_", "instance", "\\u", "types_", "._", "get", "\\u", "instance", "\\u", "type", "\\u", "by", "\\u", "flavor", "\\u", "id_", "(_", "flavor", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "values_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "type", "'_", ":_", "inst", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "image", "\\u", "ref", "'_", ":_", "image", "\\u", "href_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "config", "\\u", "drive", "'_", ":_", "config", "\\u", "drive_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "password_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "extra", "\\u", "values_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "create", "\\u", "method_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "inst", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kernel", "\\u", "id_", "=_", "kernel", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ramdisk", "\\u", "id_", "=_", "ramdisk", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "display", "\\u", "name_", "=_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "display", "\\u", "description_", "=_", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "key", "\\u", "name_", "=_", "key", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "metadata_", "=_", "server", "\\u", "dict_", "._", "get_", "(_", "'", "metadata", "'_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "access", "\\u", "ip", "\\u", "v4_", "=_", "server", "\\u", "dict_", "._", "get_", "(_", "'", "access", "IP", "v", "4", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "access", "\\u", "ip", "\\u", "v6_", "=_", "server", "\\u", "dict_", "._", "get_", "(_", "'", "access", "IP", "v6", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "injected", "\\u", "files_", "=_", "injected", "\\u", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "admin", "\\u", "password_", "=_", "password_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zone", "\\u", "blob_", "=_", "zone", "\\u", "blob_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reserva", "tion", "\\u", "id_", "=_", "reserva", "tion", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "min", "\\u", "count_", "=_", "min", "\\u", "count_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "count_", "=_", "max", "\\u", "count_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "ed", "\\u", "networks_", "=_", "request", "ed", "\\u", "networks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "security", "\\u", "group_", "=_", "sg", "\\u", "names_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user", "\\u", "data_", "=_", "user", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "avail", "abilit", "y", "\\u", "zone_", "=_", "avail", "abilit", "y", "\\u", "zone_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config", "\\u", "drive_", "=_", "config", "\\u", "drive_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "quota_", "._", "Quota", "Error_", "as_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "handle", "\\u", "quot", "a", "\\u", "error_", "(_", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exception_", "._", "Image", "Not", "Found_", "as_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\\u_", "(_", "\"", "Can", " ", "not", " ", "find", " ", "request", "ed", " ", "image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exception_", "._", "Fla", "vor", "Not", "Found_", "as_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\\u_", "(_", "\"", "Inva", "lid", " ", "flavor", "Ref", " ", "provided", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exception_", "._", "Keyp", "air", "Not", "Found_", "as_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\\u_", "(_", "\"", "Inva", "lid", " ", "key", "\\u", "name", " ", "provided", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exception_", "._", "Secur", "it", "y", "Group", "Not", "Found_", "as_", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "unicode_", "(_", "error_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Remo", "te", "Error_", "as_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\"%", "(", "err", "\\u", "type", ")", "s", ":", " ", "%", "(", "err", "\\u", "msg", ")", "s", "\"_", "%_", "{_", "'", "err", "\\u", "type", "'_", ":_", "err_", "._", "exc", "\\u", "type_", ",_", "'", "err", "\\u", "msg", "'_", ":_", "err_", "._", "value_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Let", " ", "the", " ", "caller", " ", "deal", " ", "with", " ", "unhandled", " ", "exception", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Insta", "nce", "Helper_", "(_", "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", "handle", "\\u", "quot", "a", "\\u", "error_", "(_", "self_", ",_", "error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Re", "raise", " ", "quot", "a", " ", "error", "s", " ", "as", " ", "api", "-", "specific", " ", "http", " ", "exception", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "error_", "._", "code_", "==_", "\"", "On", "set", "File", "Limit", "Exce", "eded", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expl", "_", "=_", "\\u_", "(_", "\"", "Persona", "lit", "y", " ", "file", " ", "limit", " ", "exceed", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Request", "Entit", "y", "Too", "Large", "_", "(_", "explanation_", "=_", "error_", "._", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "{_", "'", "Retr", "y", "-", "Af", "ter", "'_", ":_", "0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "error_", "._", "code_", "==_", "\"", "On", "set", "File", "Path", "Limit", "Exce", "eded", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expl", "_", "=_", "\\u_", "(_", "\"", "Persona", "lit", "y", " ", "file", " ", "path", " ", "too", " ", "long", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Request", "Entit", "y", "Too", "Large", "_", "(_", "explanation_", "=_", "error_", "._", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "{_", "'", "Retr", "y", "-", "Af", "ter", "'_", ":_", "0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "error_", "._", "code_", "==_", "\"", "On", "set", "File", "Conten", "t", "Limit", "Exce", "eded", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expl", "_", "=_", "\\u_", "(_", "\"", "Persona", "lit", "y", " ", "file", " ", "content", " ", "too", " ", "long", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Request", "Entit", "y", "Too", "Large", "_", "(_", "explanation_", "=_", "error_", "._", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "{_", "'", "Retr", "y", "-", "Af", "ter", "'_", ":_", "0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "error_", "._", "code_", "==_", "\"", "Insta", "nce", "Limit", "Exce", "eded", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expl", "_", "=_", "\\u_", "(_", "\"", "Insta", "nce", " ", "quotas", " ", "have", " ", "bee", "n", " ", "exceed", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Request", "Entit", "y", "Too", "Large", "_", "(_", "explanation_", "=_", "error_", "._", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "{_", "'", "Retr", "y", "-", "Af", "ter", "'_", ":_", "0_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "original", " ", "error", " ", "is", " ", "oka", "y", ",", " ", "just", " ", "reraise", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Insta", "nce", "Helper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "deserialize", "\\u", "create_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Deserializ", "e", " ", "a", " ", "create", " ", "request", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Override", "s", " ", "normal", " ", "behavior", " ", "in", " ", "the", " ", "case", " ", "of", " ", "xml", " ", "content", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "content", "\\u", "type_", "==_", "\"", "applica", "tion", "/", "xml", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deserializer_", "=_", "Server", "XML", "Deserializ", "er_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "deserializer_", "._", "deserialize_", "(_", "request_", "._", "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 ", " _", "return_", "self_", "._", "\\u", "deserialize_", "(_", "request_", "._", "body_", ",_", "request_", "._", "get", "\\u", "content", "\\u", "type_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Insta", "nce", "Helper_", "(_", "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", "validat", "e\\u", "server", "\\u", "name_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\\u_", "(_", "\"", "Server", " ", "name", " ", "is", " ", "not", " ", "a", " ", "string", " ", "or", " ", "unicode", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "._", "strip_", "(_", ")_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\\u_", "(_", "\"", "Server", " ", "name", " ", "is", " ", "an", " ", "empty", " ", "string", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Insta", "nce", "Helper_", "(_", "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", "get", "\\u", "kernel", "\\u", "ramdisk", "\\u", "from", "\\u", "image_", "(_", "self_", ",_", "req_", ",_", "image", "\\u", "service_", ",_", "image", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fe", "tch", " ", "an", " ", "image", " ", "from", " ", "the", " ", "Image", "Service", ",", " ", "then", " ", "if", " ", "presen", "t", ",", " ", "return", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "associate", "d", " ", "kernel", " ", "and", " ", "ramdisk", " ", "image", " ", "ID", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "req_", "._", "environ_", "[_", "'", "nova", ".", "context", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "meta_", "=_", "image", "\\u", "service_", "._", "show_", "(_", "context_", ",_", "image", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "sir", "p", "):", " ", "extracted", " ", "to", " ", "a", " ", "separate", " ", "method", " ", "to", " ", "aid", " ", "unit", "-", "testi", "ng", ",", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "new", " ", "method", " ", "doe", "sn", "'", "t", " ", "need", " ", "a", " ", "request", " ", "obj", " ", "or", " ", "an", " ", "Image", "Service", " ", "stub_", "\\u\\u\\uNL\\u\\u\\u_", "kernel", "\\u", "id_", ",_", "ramdisk", "\\u", "id_", "=_", "self_", "._", "\\u", "do", "\\u", "get", "\\u", "kernel", "\\u", "ramdisk", "\\u", "from", "\\u", "image_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "kernel", "\\u", "id_", ",_", "ramdisk", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Insta", "nce", "Helper_", "(_", "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", "do", "\\u", "get", "\\u", "kernel", "\\u", "ramdisk", "\\u", "from", "\\u", "image_", "(_", "image", "\\u", "meta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Give", "n", " ", "an", " ", "Image", "Service", " ", "image", "\\u", "meta", ",", " ", "return", " ", "kernel", " ", "and", " ", "ramdisk", " ", "image", "\\", "10", ";", " ", " ", " ", " ", "ids", " ", "if", " ", "presen", "t", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "only", " ", "valid", " ", "for", " ", "`", "ami", "`", " ", "style", " ", "images", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "id_", "=_", "image", "\\u", "meta_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "image", "\\u", "meta_", "[_", "'", "status", "'_", "]_", "!=_", "'", "active", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Image", "Una", "cce", "ptable", "_", "(_", "image", "\\u", "id_", "=_", "image", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "reason_", "=_", "\\u_", "(_", "\"", "status", " ", "is", " ", "not", " ", "active", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "image", "\\u", "meta_", "._", "get_", "(_", "'", "container", "\\u", "format", "'_", ")_", "!=_", "'", "ami", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", ",_", "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 ", " _", "kernel", "\\u", "id_", "=_", "image", "\\u", "meta_", "[_", "'", "proper", "ties", "'_", "]_", "[_", "'", "kernel", "\\u", "id", "'_", "]_", "\\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_", "exception_", "._", "Kern", "el", "Not", "Foun", "d", "For", "Image_", "(_", "image", "\\u", "id_", "=_", "image", "\\u", "id_", ")_", "\\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 ", " _", "ramdisk", "\\u", "id_", "=_", "image", "\\u", "meta_", "[_", "'", "proper", "ties", "'_", "]_", "[_", "'", "ramdisk", "\\u", "id", "'_", "]_", "\\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 ", " _", "ramdisk", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "kernel", "\\u", "id_", ",_", "ramdisk", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Insta", "nce", "Helper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "injected", "\\u", "files_", "(_", "self_", ",_", "personality", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "list", " ", "of", " ", "injected", " ", "files", " ", "from", " ", "the", " ", "personality", " ", "attribute", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "At", " ", "this", " ", "time", ",", " ", "injected", "\\u", "files", " ", "must", " ", "be", " ", "format", "ted", " ", "as", " ", "a", " ", "list", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "(", "file", "\\u", "path", ",", " ", "file", "\\u", "content", ")", " ", "pair", "s", " ", "for", " ", "compatibility", " ", "with", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "underl", "ying", " ", "compute", " ", "service", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "injected", "\\u", "files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "item_", "in_", "personality", "_", ":_", "\\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 ", " _", "path_", "=_", "item_", "[_", "'", "path", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contents_", "=_", "item_", "[_", "'", "content", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", "as_", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expl", "_", "=_", "\\u_", "(_", "'", "Ba", "d", " ", "personality", " ", "format", ":", " ", "missi", "ng", " ", "%", "s", "'_", ")_", "%_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "expl", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expl", "_", "=_", "\\u_", "(_", "'", "Ba", "d", " ", "personality", " ", "format", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "expl", "_", ")_", "\\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 ", " _", "contents_", "=_", "base64_", "._", "b64decode_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expl", "_", "=_", "\\u_", "(_", "'", "Persona", "lit", "y", " ", "content", " ", "for", " ", "%", "s", " ", "cann", "ot", " ", "be", " ", "decode", "d", "'_", ")_", "%_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "expl", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "injected", "\\u", "files_", "._", "append_", "(_", "(_", "path_", ",_", "contents_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "injected", "\\u", "files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Insta", "nce", "Helper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "server", "\\u", "admin", "\\u", "password", "\\u", "old", "\\u", "style_", "(_", "self_", ",_", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Det", "erm", "ine", " ", "the", " ", "admin", " ", "password", " ", "for", " ", "a", " ", "server", " ", "on", " ", "creati", "on", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "utils_", "._", "generat", "e\\u", "password_", "(_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Insta", "nce", "Helper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "server", "\\u", "admin", "\\u", "password", "\\u", "new", "\\u", "style_", "(_", "self_", ",_", "server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Det", "erm", "ine", " ", "the", " ", "admin", " ", "password", " ", "for", " ", "a", " ", "server", " ", "on", " ", "creati", "on", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "server_", "._", "get_", "(_", "'", "admin", "Pass", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "password_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "utils_", "._", "generat", "e\\u", "password_", "(_", "16_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "password_", ",_", "basestring_", ")_", "or_", "password_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "\\u_", "(_", "\"", "Inva", "lid", " ", "admin", "Pass", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "password_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Insta", "nce", "Helper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "request", "ed", "\\u", "networks_", "(_", "self_", ",_", "request", "ed", "\\u", "networks_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "list", " ", "of", " ", "request", "ed", " ", "network", "s", " ", "from", " ", "the", " ", "network", "s", " ", "attribute", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "networks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "network_", "in_", "request", "ed", "\\u", "networks_", ":_", "\\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 ", " _", "network", "\\u", "uuid_", "=_", "network_", "[_", "'", "uuid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "utils_", "._", "is", "\\u", "uuid", "\\u", "like_", "(_", "network", "\\u", "uuid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "msg_", "=_", "\\u_", "(_", "\"", "Ba", "d", " ", "network", "s", " ", "format", ":", " ", "network", " ", "uuid", " ", "is", " ", "not", " ", "in", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "proper", " ", "format", " ", "(%", "s", ")\"_", ")_", "%_", "network", "\\u", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "fixed", " ", "IP", " ", "address", " ", "is", " ", "optional_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "the", " ", "fixed", " ", "IP", " ", "address", " ", "is", " ", "not", " ", "provided", " ", "then_", "\\u\\u\\uNL\\u\\u\\u_", "#", "it", " ", "will", " ", "use", " ", "one", " ", "of", " ", "the", " ", "avail", "able", " ", "IP", " ", "address", " ", "from", " ", "the", " ", "network_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "address_", "=_", "network_", "._", "get_", "(_", "'", "fixed", "\\u", "ip", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "address_", "is_", "not_", "None_", "and_", "not_", "utils_", "._", "is", "\\u", "valid", "\\u", "ipv4_", "(_", "address_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "msg_", "=_", "\\u_", "(_", "\"", "Inva", "lid", " ", "fixed", " ", "IP", " ", "address", " ", "(%", "s", ")\"_", ")_", "%_", "address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "the", " ", "network", " ", "id", " ", "is", " ", "alr", "ead", "y", " ", "presen", "t", " ", "in", " ", "the", " ", "list", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "don", "'", "t", " ", "want", " ", "duplicat", "e", " ", "network", "s", " ", "to", " ", "be", " ", "passed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "at", " ", "the", " ", "boot", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "id_", ",_", "ip_", "in_", "networks_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "id_", "==_", "network", "\\u", "uuid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "expl", "_", "=_", "\\u_", "(_", "\"", "Duplicate", " ", "network", "s", " ", "(%", "s", ")", " ", "are", " ", "not", " ", "allow", "ed", "\"_", ")_", "%_", "network", "\\u", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "expl", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "networks_", "._", "append_", "(_", "(_", "network", "\\u", "uuid_", ",_", "address_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", "as_", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expl", "_", "=_", "\\u_", "(_", "'", "Ba", "d", " ", "network", " ", "format", ":", " ", "missi", "ng", " ", "%", "s", "'_", ")_", "%_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "expl", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expl", "_", "=_", "\\u_", "(_", "'", "Ba", "d", " ", "network", "s", " ", "format", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "expl", "_", ")_", "\\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_", "networks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Creat", "e", "Insta", "nce", "Helper_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "validat", "e\\u", "user", "\\u", "data_", "(_", "self_", ",_", "user", "\\u", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "if", " ", "the", " ", "user", "\\u", "data", " ", "is", " ", "encode", "d", " ", "proper", "ly", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "user", "\\u", "data_", ":_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "data_", "=_", "base64_", "._", "b64decode_", "(_", "user", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expl", "_", "=_", "\\u_", "(_", "'", "User", "data", " ", "content", " ", "cann", "ot", " ", "be", " ", "decode", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "._", "HTTP", "Ba", "d", "Request_", "(_", "explanation_", "=_", "expl", "_", ")_", "\\u\\u\\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_", "Server", "XML", "Deserializ", "er_", "(_", "wsgi_", "._", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Deserializ", "er", " ", "to", " ", "handle", " ", "xml", "-", "format", "ted", " ", "server", " ", "create", " ", "request", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Handle", "s", " ", "standard", " ", "server", " ", "attribute", "s", " ", "as", " ", "well", " ", "as", " ", "option", "al", " ", "metadata", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "personality", " ", "attribute", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metadata", "\\u", "deserializer_", "=_", "common_", "._", "Meta", "data", "XML", "Deserializ", "er_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Server", "XML", "Deserializ", "er_", "(_", "wsgi_", "._", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", "self_", ",_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Deserializ", "e", " ", "an", " ", "xml", "-", "format", "ted", " ", "server", " ", "create", " ", "request", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dom_", "=_", "minidom_", "._", "parse", "String_", "(_", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "=_", "self_", "._", "\\u", "extract", "\\u", "server_", "(_", "dom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "'", "body", "'_", ":_", "{_", "'", "server", "'_", ":_", "server_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "XML", "Deserializ", "er_", "(_", "wsgi_", "._", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "extract", "\\u", "server_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Mars", "hal", " ", "the", " ", "server", " ", "attribute", " ", "of", " ", "a", " ", "parsed", " ", "request", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "\\u", "node_", "=_", "self_", "._", "find", "\\u", "first", "\\u", "child", "\\u", "named_", "(_", "node_", ",_", "'", "server", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "attributes_", "=_", "[_", "\"", "name", "\"_", ",_", "\"", "image", "Id", "\"_", ",_", "\"", "flavor", "Id", "\"_", ",_", "\"", "admin", "Pass", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "attr_", "in_", "attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "server", "\\u", "node_", "._", "get", "Attribute_", "(_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "[_", "attr_", "]_", "=_", "server", "\\u", "node_", "._", "get", "Attribute_", "(_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "metadata", "\\u", "node_", "=_", "self_", "._", "find", "\\u", "first", "\\u", "child", "\\u", "named_", "(_", "server", "\\u", "node_", ",_", "\"", "metadata", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "[_", "\"", "metadata", "\"_", "]_", "=_", "self_", "._", "metadata", "\\u", "deserializer_", "._", "extract", "\\u", "metadata_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "metadata", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "server_", "[_", "\"", "personality", "\"_", "]_", "=_", "self_", "._", "\\u", "extract", "\\u", "personality", "_", "(_", "server", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "XML", "Deserializ", "er_", "(_", "wsgi_", "._", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "extract", "\\u", "personality", "_", "(_", "self_", ",_", "server", "\\u", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Mars", "hal", " ", "the", " ", "personality", " ", "attribute", " ", "of", " ", "a", " ", "parsed", " ", "request", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "self_", "._", "find", "\\u", "first", "\\u", "child", "\\u", "named_", "(_", "server", "\\u", "node_", ",_", "\"", "personality", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "personality", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "node_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "file", "\\u", "node_", "in_", "self_", "._", "find", "\\u", "child", "ren", "\\u", "named_", "(_", "node_", ",_", "\"", "file", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "file", "\\u", "node_", "._", "has", "Attribute_", "(_", "\"", "path", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "item_", "[_", "\"", "path", "\"_", "]_", "=_", "file", "\\u", "node_", "._", "get", "Attribute_", "(_", "\"", "path", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "item_", "[_", "\"", "content", "s", "\"_", "]_", "=_", "self_", "._", "extract", "\\u", "text_", "(_", "file", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "personality", "_", "._", "append_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "personality", "_", "\\u\\u\\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_", "Server", "XML", "Deserializ", "er", "V1", "1_", "(_", "wsgi_", "._", "Meta", "data", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Deserializ", "er", " ", "to", " ", "handle", " ", "xml", "-", "format", "ted", " ", "server", " ", "create", " ", "request", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Handle", "s", " ", "standard", " ", "server", " ", "attribute", "s", " ", "as", " ", "well", " ", "as", " ", "option", "al", " ", "metadata", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "personality", " ", "attribute", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "metadata", "\\u", "deserializer_", "=_", "common_", "._", "Meta", "data", "XML", "Deserializ", "er_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Server", "XML", "Deserializ", "er", "V1", "1_", "(_", "wsgi_", "._", "Meta", "data", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "action_", "(_", "self_", ",_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dom_", "=_", "minidom_", "._", "parse", "String_", "(_", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "\\u", "node_", "=_", "dom_", "._", "child", "Nodes_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action", "\\u", "name_", "=_", "action", "\\u", "node_", "._", "tag", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "action", "\\u", "deserializer_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "create", "Image", "'_", ":_", "self_", "._", "\\u", "action", "\\u", "create", "\\u", "image_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "create", "Back", "up", "'_", ":_", "self_", "._", "\\u", "action", "\\u", "create", "\\u", "backup_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "change", "Passw", "ord", "'_", ":_", "self_", "._", "\\u", "action", "\\u", "change", "\\u", "password_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rebo", "ot", "'_", ":_", "self_", "._", "\\u", "action", "\\u", "reboot_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rebu", "ild", "'_", ":_", "self_", "._", "\\u", "action", "\\u", "rebuild_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resiz", "e", "'_", ":_", "self_", "._", "\\u", "action", "\\u", "resize_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "confirm", "Resize", "'_", ":_", "self_", "._", "\\u", "action", "\\u", "confirm", "\\u", "resize_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "revert", "Resize", "'_", ":_", "self_", "._", "\\u", "action", "\\u", "revert", "\\u", "resize_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "._", "get_", "(_", "action", "\\u", "name_", ",_", "self_", "._", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "action", "\\u", "data_", "=_", "action", "\\u", "deserializer_", "(_", "action", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "'", "body", "'_", ":_", "{_", "action", "\\u", "name_", ":_", "action", "\\u", "data_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "XML", "Deserializ", "er", "V1", "1_", "(_", "wsgi_", "._", "Meta", "data", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "action", "\\u", "create", "\\u", "image_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "deserialize", "\\u", "image", "\\u", "action_", "(_", "node_", ",_", "(_", "'", "name", "'_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "XML", "Deserializ", "er", "V1", "1_", "(_", "wsgi_", "._", "Meta", "data", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "action", "\\u", "create", "\\u", "backup_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attributes_", "=_", "(_", "'", "name", "'_", ",_", "'", "backup", "\\u", "type", "'_", ",_", "'", "rotati", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "deserialize", "\\u", "image", "\\u", "action_", "(_", "node_", ",_", "attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "XML", "Deserializ", "er", "V1", "1_", "(_", "wsgi_", "._", "Meta", "data", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "action", "\\u", "change", "\\u", "password_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "node_", "._", "has", "Attribute_", "(_", "\"", "admin", "Pass", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Attribute", "Error_", "(_", "\"", "No", " ", "admin", "Pass", " ", "was", " ", "specified", " ", "in", " ", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "\"", "admin", "Pass", "\"_", ":_", "node_", "._", "get", "Attribute_", "(_", "\"", "admin", "Pass", "\"_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "XML", "Deserializ", "er", "V1", "1_", "(_", "wsgi_", "._", "Meta", "data", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "action", "\\u", "reboot_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "node_", "._", "has", "Attribute_", "(_", "\"", "type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Attribute", "Error_", "(_", "\"", "No", " ", "rebo", "ot", " ", "type", " ", "was", " ", "specified", " ", "in", " ", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "\"", "type", "\"_", ":_", "node_", "._", "get", "Attribute_", "(_", "\"", "type", "\"_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "XML", "Deserializ", "er", "V1", "1_", "(_", "wsgi_", "._", "Meta", "data", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "action", "\\u", "rebuild_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rebuild_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "node_", "._", "has", "Attribute_", "(_", "\"", "name", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rebuild_", "[_", "'", "name", "'_", "]_", "=_", "node_", "._", "get", "Attribute_", "(_", "\"", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "metadata", "\\u", "node_", "=_", "self_", "._", "find", "\\u", "first", "\\u", "child", "\\u", "named_", "(_", "node_", ",_", "\"", "metadata", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "metadata", "\\u", "node_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rebuild_", "[_", "\"", "metadata", "\"_", "]_", "=_", "self_", "._", "extract", "\\u", "metadata_", "(_", "metadata", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "personality", "_", "=_", "self_", "._", "\\u", "extract", "\\u", "personality", "_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "personality", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rebuild_", "[_", "\"", "personality", "\"_", "]_", "=_", "personality", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "node_", "._", "has", "Attribute_", "(_", "\"", "image", "Ref", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Attribute", "Error_", "(_", "\"", "No", " ", "image", "Ref", " ", "was", " ", "specified", " ", "in", " ", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rebuild_", "[_", "\"", "image", "Ref", "\"_", "]_", "=_", "node_", "._", "get", "Attribute_", "(_", "\"", "image", "Ref", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "rebuild_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "XML", "Deserializ", "er", "V1", "1_", "(_", "wsgi_", "._", "Meta", "data", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "action", "\\u", "resize_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "node_", "._", "has", "Attribute_", "(_", "\"", "flavor", "Ref", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Attribute", "Error_", "(_", "\"", "No", " ", "flavor", "Ref", " ", "was", " ", "specified", " ", "in", " ", "request", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "{_", "\"", "flavor", "Ref", "\"_", ":_", "node_", "._", "get", "Attribute_", "(_", "\"", "flavor", "Ref", "\"_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "XML", "Deserializ", "er", "V1", "1_", "(_", "wsgi_", "._", "Meta", "data", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "action", "\\u", "confirm", "\\u", "resize_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "XML", "Deserializ", "er", "V1", "1_", "(_", "wsgi_", "._", "Meta", "data", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "action", "\\u", "revert", "\\u", "resize_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "XML", "Deserializ", "er", "V1", "1_", "(_", "wsgi_", "._", "Meta", "data", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "deserialize", "\\u", "image", "\\u", "action_", "(_", "self_", ",_", "node_", ",_", "allow", "ed", "\\u", "attributes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "attribute_", "in_", "allow", "ed", "\\u", "attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "node_", "._", "get", "Attribute_", "(_", "attribute_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "attribute_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "metadata", "\\u", "node_", "=_", "self_", "._", "find", "\\u", "first", "\\u", "child", "\\u", "named_", "(_", "node_", ",_", "'", "metadata", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "metadata", "\\u", "node_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "metadata_", "=_", "self_", "._", "metadata", "\\u", "deserializer_", "._", "extract", "\\u", "metadata_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "metadata", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "metadata", "'_", "]_", "=_", "metadata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "XML", "Deserializ", "er", "V1", "1_", "(_", "wsgi_", "._", "Meta", "data", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create_", "(_", "self_", ",_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Deserializ", "e", " ", "an", " ", "xml", "-", "format", "ted", " ", "server", " ", "create", " ", "request", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dom_", "=_", "minidom_", "._", "parse", "String_", "(_", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "=_", "self_", "._", "\\u", "extract", "\\u", "server_", "(_", "dom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "'", "body", "'_", ":_", "{_", "'", "server", "'_", ":_", "server_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "XML", "Deserializ", "er", "V1", "1_", "(_", "wsgi_", "._", "Meta", "data", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "extract", "\\u", "server_", "(_", "self_", ",_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Mars", "hal", " ", "the", " ", "server", " ", "attribute", " ", "of", " ", "a", " ", "parsed", " ", "request", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "\\u", "node_", "=_", "self_", "._", "find", "\\u", "first", "\\u", "child", "\\u", "named_", "(_", "node_", ",_", "'", "server", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "attributes_", "=_", "[_", "\"", "name", "\"_", ",_", "\"", "image", "Ref", "\"_", ",_", "\"", "flavor", "Ref", "\"_", ",_", "\"", "admin", "Pass", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "access", "IP", "v", "4", "\"_", ",_", "\"", "access", "IP", "v6", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "attr_", "in_", "attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "server", "\\u", "node_", "._", "get", "Attribute_", "(_", "attr_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "[_", "attr_", "]_", "=_", "server", "\\u", "node_", "._", "get", "Attribute_", "(_", "attr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "metadata", "\\u", "node_", "=_", "self_", "._", "find", "\\u", "first", "\\u", "child", "\\u", "named_", "(_", "server", "\\u", "node_", ",_", "\"", "metadata", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "metadata", "\\u", "node_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "[_", "\"", "metadata", "\"_", "]_", "=_", "self_", "._", "extract", "\\u", "metadata_", "(_", "metadata", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "personality", "_", "=_", "self_", "._", "\\u", "extract", "\\u", "personality", "_", "(_", "server", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "personality", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "[_", "\"", "personality", "\"_", "]_", "=_", "personality", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "networks_", "=_", "self_", "._", "\\u", "extract", "\\u", "networks_", "(_", "server", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "networks_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "[_", "\"", "network", "s", "\"_", "]_", "=_", "networks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "security", "\\u", "groups_", "=_", "self_", "._", "\\u", "extract", "\\u", "security", "\\u", "groups_", "(_", "server", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "security", "\\u", "groups_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server_", "[_", "\"", "security", "\\u", "group", "s", "\"_", "]_", "=_", "security", "\\u", "groups_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "XML", "Deserializ", "er", "V1", "1_", "(_", "wsgi_", "._", "Meta", "data", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "extract", "\\u", "personality", "_", "(_", "self_", ",_", "server", "\\u", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Mars", "hal", " ", "the", " ", "personality", " ", "attribute", " ", "of", " ", "a", " ", "parsed", " ", "request", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "self_", "._", "find", "\\u", "first", "\\u", "child", "\\u", "named_", "(_", "server", "\\u", "node_", ",_", "\"", "personality", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "node_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "personality", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "file", "\\u", "node_", "in_", "self_", "._", "find", "\\u", "child", "ren", "\\u", "named_", "(_", "node_", ",_", "\"", "file", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "file", "\\u", "node_", "._", "has", "Attribute_", "(_", "\"", "path", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "item_", "[_", "\"", "path", "\"_", "]_", "=_", "file", "\\u", "node_", "._", "get", "Attribute_", "(_", "\"", "path", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "item_", "[_", "\"", "content", "s", "\"_", "]_", "=_", "self_", "._", "extract", "\\u", "text_", "(_", "file", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "personality", "_", "._", "append_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "personality", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "XML", "Deserializ", "er", "V1", "1_", "(_", "wsgi_", "._", "Meta", "data", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "extract", "\\u", "networks_", "(_", "self_", ",_", "server", "\\u", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Mars", "hal", " ", "the", " ", "network", "s", " ", "attribute", " ", "of", " ", "a", " ", "parsed", " ", "request", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "self_", "._", "find", "\\u", "first", "\\u", "child", "\\u", "named_", "(_", "server", "\\u", "node_", ",_", "\"", "network", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "node_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "networks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "network", "\\u", "node_", "in_", "self_", "._", "find", "\\u", "child", "ren", "\\u", "named_", "(_", "node_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "network", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "network", "\\u", "node_", "._", "has", "Attribute_", "(_", "\"", "uuid", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "item_", "[_", "\"", "uuid", "\"_", "]_", "=_", "network", "\\u", "node_", "._", "get", "Attribute_", "(_", "\"", "uuid", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "network", "\\u", "node_", "._", "has", "Attribute_", "(_", "\"", "fixed", "\\u", "ip", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "item_", "[_", "\"", "fixed", "\\u", "ip", "\"_", "]_", "=_", "network", "\\u", "node_", "._", "get", "Attribute_", "(_", "\"", "fixed", "\\u", "ip", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "networks_", "._", "append_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "networks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Server", "XML", "Deserializ", "er", "V1", "1_", "(_", "wsgi_", "._", "Meta", "data", "XML", "Deserializ", "er_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "extract", "\\u", "security", "\\u", "groups_", "(_", "self_", ",_", "server", "\\u", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Mars", "hal", " ", "the", " ", "security", "\\u", "group", "s", " ", "attribute", " ", "of", " ", "a", " ", "parsed", " ", "request", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "=_", "self_", "._", "find", "\\u", "first", "\\u", "child", "\\u", "named_", "(_", "server", "\\u", "node_", ",_", "\"", "security", "\\u", "group", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "node_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "security", "\\u", "groups_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "sg", "\\u", "node_", "in_", "self_", "._", "find", "\\u", "child", "ren", "\\u", "named_", "(_", "node_", ",_", "\"", "security", "\\u", "group", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name", "\\u", "node_", "=_", "self_", "._", "find", "\\u", "first", "\\u", "child", "\\u", "named_", "(_", "sg", "\\u", "node_", ",_", "\"", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name", "\\u", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "item_", "[_", "\"", "name", "\"_", "]_", "=_", "self_", "._", "extract", "\\u", "text_", "(_", "name", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "security", "\\u", "groups_", "._", "append_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "security", "\\u", "groups_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT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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 ]
Unused import
VisTrails/VisTrails/vistrails/tests/resources/console_mode_test.py
[ { "content": "###############################################################################\n##\n## Copyright (C) 2014-2016, New York University.\n## Copyright (C) 2011-2014, NYU-Poly.\n## Copyright (C) 2006-2011, University of Utah.\n## All rights reserved.\n## Contact: contact@vistrails.org\n##\n## This file is part of VisTrails.\n##\n## \"Redistribution and use in source and binary forms, with or without\n## modification, are permitted provided that the following conditions are met:\n##\n## - Redistributions of source code must retain the above copyright notice,\n## this list of conditions and the following disclaimer.\n## - Redistributions in binary form must reproduce the above copyright\n## notice, this list of conditions and the following disclaimer in the\n## documentation and/or other materials provided with the distribution.\n## - Neither the name of the New York University nor the names of its\n## contributors may be used to endorse or promote products derived from\n## this software without specific prior written permission.\n##\n## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n## AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,\n## THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n## PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR\n## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n## EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n## PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;\n## OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,\n## WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR\n## OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF\n## ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\"\n##\n###############################################################################\n\n\"\"\"Testing package for console_mode\"\"\"\n\n##############################################################################\nimport vistrails.core.modules\nimport vistrails.core.modules.module_registry\nfrom vistrails.core.modules.vistrails_module import Module, ModuleError, NotCacheable\nfrom vistrails.core.modules.basic_modules import Float, Integer\n\nidentifier = 'org.vistrails.vistrails.console_mode_test'\nversion = '0.9.1'\nname = 'Console Mode Tests'\nold_identifiers = ['edu.utah.sci.vistrails.console_mode_test']\n\n\n\n\n\n\n\n\n##############################################################################\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestTupleExecution(Module):\n", "metadata": "root.TestTupleExecution", "header": "['module', '___EOS___']", "index": 49 }, { "content": " def compute(self):\n v1, v2 = self.get_input('input')\n self.set_output('output', v1 + v2)", "metadata": "root.TestTupleExecution.compute", "header": "['class', 'TestTupleExecution', '(', 'Module', ')', ':', '___EOS___']", "index": 51 }, { "content": "class TestDynamicModuleError(Module):\n\n", "metadata": "root.TestDynamicModuleError", "header": "['module', '___EOS___']", "index": 56 }, { "content": " def compute(self):\n c = TestDynamicModuleError()\n c.die()", "metadata": "root.TestDynamicModuleError.compute", "header": "['class', 'TestDynamicModuleError', '(', 'Module', ')', ':', '___EOS___']", "index": 58 }, { "content": " def die(self):\n raise ModuleError(self, \"I died!\")", "metadata": "root.TestDynamicModuleError.die", "header": "['class', 'TestDynamicModuleError', '(', 'Module', ')', ':', '___EOS___']", "index": 62 }, { "content": "class TestChangeVistrail(NotCacheable, Module):\n", "metadata": "root.TestChangeVistrail", "header": "['module', '___EOS___']", "index": 65 }, { "content": " def compute(self):\n if self.has_input('foo'):\n v1 = self.get_input('foo')\n else:\n v1 = 0\n if v1 != 12:\n self.change_parameter('foo', v1 + 1)", "metadata": "root.TestChangeVistrail.compute", "header": "['class', 'TestChangeVistrail', '(', 'NotCacheable', ',', 'Module', ')', ':', '___EOS___']", "index": 67 }, { "content": "class TestCustomNamed(Module):\n\n pass", "metadata": "root.TestCustomNamed", "header": "['module', '___EOS___']", "index": 75 }, { "content": "class TestOptionalPorts(Module):\n\n pass", "metadata": "root.TestOptionalPorts", "header": "['module', '___EOS___']", "index": 80 }, { "content": "def initialize():\n reg = vistrails.core.modules.module_registry.get_module_registry()\n reg.add_module(TestTupleExecution)\n reg.add_input_port(TestTupleExecution, 'input', [Float, Float])\n reg.add_output_port(TestTupleExecution, 'output', (Float, 'output'))\n reg.add_module(TestDynamicModuleError)\n reg.add_module(TestChangeVistrail)\n reg.add_input_port(TestChangeVistrail, 'foo', Integer)\n\n reg.add_module(TestCustomNamed, name='different name')\n reg.add_input_port(TestCustomNamed, 'input', Float)\n\n reg.add_module(TestOptionalPorts)\n reg.add_input_port(TestOptionalPorts, 'foo', Float, optional=True)\n reg.add_output_port(TestOptionalPorts, 'foo', Float, optional=True)", "metadata": "root.initialize", "header": "['module', '___EOS___']", "index": 86 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "C", ")", " ", "2014", "-", "2016", ",", " ", "New", " ", "Yo", "rk", " ", "Univers", "it", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "C", ")", " ", "2011", "-", "2014", ",", " ", "NY", "U", "-", "Poly", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Copy", "right", " ", "(", "C", ")", " ", "2006", "-", "2011", ",", " ", "Univers", "it", "y", " ", "of", " ", "Ut", "ah", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Conta", "ct", ":", " ", "contact", "@", "vist", "rail", "s", ".", "org_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Vis", "Trail", "s", "._", "\\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", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", "-", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", "-", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", "-", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "the", " ", "New", " ", "Yo", "rk", " ", "Univers", "it", "y", " ", "nor", " ", "the", " ", "names", " ", "of", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "contributor", "s", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products", " ", "derive", "d", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "writt", "en", " ", "permissi", "on", "._", "\\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", " ", "\"", "AS", " ", "IS", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ER", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "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_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Test", "ing", " ", "package", " ", "for", " ", "console", "\\u", "mode", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "vist", "rail", "s_", "._", "core_", "._", "modules_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "vist", "rail", "s_", "._", "core_", "._", "modules_", "._", "module", "\\u", "registry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vist", "rail", "s_", "._", "core_", "._", "modules_", "._", "vist", "rail", "s", "\\u", "module_", "import_", "Module_", ",_", "Modul", "e", "Error_", ",_", "Not", "Cache", "able_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "vist", "rail", "s_", "._", "core_", "._", "modules_", "._", "basic", "\\u", "modules_", "import_", "Float_", ",_", "Integer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "identifier_", "=_", "'", "org", ".", "vist", "rail", "s", ".", "vist", "rail", "s", ".", "console", "\\u", "mode", "\\u", "test", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "'", "0.", "9.1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "Cons", "ole", " ", "Mode", " ", "Test", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "identifiers_", "=_", "[_", "'", "edu", ".", "uta", "h", ".", "sci", ".", "vist", "rail", "s", ".", "console", "\\u", "mode", "\\u", "test", "'_", "]_", "\\u\\u\\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_", "\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Tup", "le", "Execution_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Tup", "le", "Execution_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v1_", ",_", "v2_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "input", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "output", "'_", ",_", "v1_", "+_", "v2_", ")_", "\\u\\u\\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", "Dynamic", "Modul", "e", "Error_", "(_", "Module_", ")_", ":_", "\\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", "Dynamic", "Modul", "e", "Error_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "Test", "Dynamic", "Modul", "e", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "die_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Dynamic", "Modul", "e", "Error_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "die_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Modul", "e", "Error_", "(_", "self_", ",_", "\"", "I", " ", "die", "d", "!\"_", ")_", "\\u\\u\\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", "Change", "Vis", "trail_", "(_", "Not", "Cache", "able_", ",_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Change", "Vis", "trail_", "(_", "Not", "Cache", "able_", ",_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "foo", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v1_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "foo", "'_", ")_", "\\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 ", " _", "v1_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "v1_", "!=_", "12_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "change", "\\u", "parameter_", "(_", "'", "foo", "'_", ",_", "v1_", "+_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Custom", "Name", "d_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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_", "Test", "Optio", "nal", "Ports_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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_", "def_", "initialize_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "=_", "vist", "rail", "s_", "._", "core_", "._", "modules_", "._", "module", "\\u", "registry_", "._", "get", "\\u", "module", "\\u", "registry_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "module_", "(_", "Test", "Tup", "le", "Execution_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "Test", "Tup", "le", "Execution_", ",_", "'", "input", "'_", ",_", "[_", "Float_", ",_", "Float_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "Test", "Tup", "le", "Execution_", ",_", "'", "output", "'_", ",_", "(_", "Float_", ",_", "'", "output", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "module_", "(_", "Test", "Dynamic", "Modul", "e", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "module_", "(_", "Test", "Change", "Vis", "trail_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "Test", "Change", "Vis", "trail_", ",_", "'", "foo", "'_", ",_", "Integer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "module_", "(_", "Test", "Custom", "Name", "d_", ",_", "name_", "=_", "'", "different", " ", "name", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "Test", "Custom", "Name", "d_", ",_", "'", "input", "'_", ",_", "Float_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "module_", "(_", "Test", "Optio", "nal", "Ports_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "Test", "Optio", "nal", "Ports_", ",_", "'", "foo", "'_", ",_", "Float_", ",_", "optional_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "Test", "Optio", "nal", "Ports_", ",_", "'", "foo", "'_", ",_", "Float_", ",_", "optional_", "=_", "True_", ")_" ]
[ 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Missing call to `__init__` during object initialization
sassoftware/conary/conary/dbstore/sqlerrors.py
[ { "content": " def __init__(self, msg, *args, **kw):\n \"\"\"\n A database error occurred. A possible causes is incorrect SQL\n statement input.\n \"\"\"\n self.msg = str(msg)\n self.args = args\n self.kw = kw", "metadata": "root.DatabaseError.__init__", "header": "['class', 'DatabaseError', '(', 'Exception', ')', ':', '___EOS___']", "index": 18 }, { "content": "class ReadOnlyDatabase(DatabaseError):\n pass", "metadata": "root.ReadOnlyDatabase", "header": "['module', '___EOS___']", "index": 46 } ]
[]
[]
0
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "class_", "Databa", "se", "Error_", "(_", "Exception_", ")_", ":_", "\\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_", ",_", "msg_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "databa", "se", " ", "error", " ", "occur", "red", ".", " ", " ", "A", " ", "possib", "le", " ", "caus", "es", " ", "is", " ", "incorrect", " ", "SQL", "\\", "10", ";", " ", " ", " ", " ", "statem", "ent", " ", "input", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "msg_", "=_", "str_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "kw_", "=_", "kw_", "\\u\\u\\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_", "Read", "On", "ly", "Database_", "(_", "Databa", "se", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
sassoftware/conary/conary_test/libtest/cfgtest.py
[ { "content": "#\n# Copyright (c) SAS Institute Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\nimport os\nimport pickle\nimport cPickle\nimport re\nfrom testrunner import testhelp\nimport shutil\n\nimport tempfile\nfrom StringIO import StringIO\n\n#conary\n#from conary.conarycfg import *\nfrom conary.conarycfg import (\n CfgFingerPrintMap,\n CfgFlavor,\n CfgLabel,\n )\nfrom conary.lib import cfgtypes\nfrom conary.lib.cfg import (\n ConfigFile,\n ConfigSection,\n ParseError,\n SectionedConfigFile,\n )\nfrom conary.lib.cfgtypes import (\n CfgBool,\n CfgEnum,\n CfgEnumDict,\n CfgInt,\n CfgList,\n CfgPath,\n CfgQuotedLineList,\n CfgRegExpList,\n CfgString,\n CfgEnvironmentError\n )\nfrom conary import versions\n\n\n\n\n# This has to be at module level or pickle can't find it.\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ConfigTest(testhelp.TestCase):\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.ConfigTest", "header": "['module', '___EOS___']", "index": 56 }, { "content": " def _getDisplayLines(self, cfg):\n out = StringIO()\n cfg.display(out)\n lines = out.getvalue()\n # remove extra formatting spaces \n lines = re.sub(' +', ' ', lines)\n # remove ending \\n to avoid an extra '' in the resulting list\n lines = lines[:-1]\n return lines.split('\\n')", "metadata": "root.ConfigTest._getDisplayLines", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 58 }, { "content": " def _getFileLines(self, cfg, includeDocs=True):\n out = StringIO()\n cfg._write(out, cfg._displayOptions, includeDocs=includeDocs)\n lines = out.getvalue()\n # remove extra formatting spaces \n lines = re.sub(' +', ' ', lines)\n # remove ending \\n to avoid an extra '' in the resulting list\n lines = lines[:-1]\n return lines.split('\\n')", "metadata": "root.ConfigTest._getFileLines", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 68 }, { "content": " def testConfigComments(self):\n class TestCfgFile(ConfigFile):\n foo = None\n\n cfg = TestCfgFile()\n assert(cfg.foo == None)\n cfg.configLine('foo newval#comment')\n assert(cfg.foo == 'newval')\n cfg.configLine('foo newval#comment')\n assert(cfg.foo == 'newval')\n cfg.configLine(r'foo newval\\#comment')\n assert(cfg.foo == 'newval#comment')\n cfg.configLine(r'foo newval\\\\#comment')\n assert(cfg.foo == 'newval\\\\')", "metadata": "root.ConfigTest.testConfigComments", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 78 }, { "content": " def testConfigBool(self):\n class TestCfgFile(ConfigFile):\n foo = (CfgBool, False) \n\n cfg = TestCfgFile()\n assert(cfg.foo == False)\n assert(cfg['foo'] == False)\n cfg.configLine('foo True')\n assert(cfg.foo == True)\n cfg.foo = False\n assert(cfg.foo == False)\n cfg.configLine('foo True')\n assert(cfg.foo == True)\n assert(self._getDisplayLines(cfg) == ['foo True'])", "metadata": "root.ConfigTest.testConfigBool", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 93 }, { "content": " def testConfigPath(self):\n class TestCfgFile(ConfigFile):\n foo = (CfgPath, False) \n\n oldEnv = os.environ.get('FOOBAR', None)\n oldHome = os.environ.get('HOME', None)\n os.environ['FOOBAR'] = 'foobar'\n os.environ['HOME'] = '/tmp'\n try:\n cfg = TestCfgFile()\n cfg.configLine('foo $FOOBAR/bash')\n assert(self._getDisplayLines(cfg) == ['foo $FOOBAR/bash'])\n\n cfg = TestCfgFile()\n cfg.configLine('foo ~/bash')\n assert(self._getDisplayLines(cfg) == ['foo ~/bash'])\n cfg.setDisplayOptions(expandPaths=True)\n assert(self._getDisplayLines(cfg) == ['foo %s/bash' % os.environ['HOME']])\n finally:\n if oldEnv is None:\n del os.environ['FOOBAR']\n else:\n os.environ['FOOBAR'] = oldEnv\n if oldHome is None:\n del os.environ['HOME']\n else:\n os.environ['HOME'] = oldHome", "metadata": "root.ConfigTest.testConfigPath", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 108 }, { "content": " def testConfigPathCache(self):\n oldHome = os.environ.get('HOME', None)\n oldEnv = os.environ.get('FOOBAR', None)\n try:\n os.environ['HOME'] = '/tmp'\n p = cfgtypes.Path('~/foo')\n assert(p == '/tmp/foo')\n os.environ['HOME'] = '/tmp2'\n p = cfgtypes.Path('~/foo')\n assert(p == '/tmp2/foo')\n\n os.environ['FOOBAR'] = '/tmp'\n p = cfgtypes.Path('$FOOBAR/foo')\n assert(p == '/tmp/foo')\n os.environ['FOOBAR'] = '/tmp2'\n p = cfgtypes.Path('$FOOBAR/foo')\n assert(p == '/tmp2/foo')\n finally:\n if oldEnv is None:\n del os.environ['FOOBAR']\n else:\n os.environ['FOOBAR'] = oldEnv\n if oldHome is None:\n del os.environ['HOME']\n else:\n os.environ['HOME'] = oldHome", "metadata": "root.ConfigTest.testConfigPathCache", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 136 }, { "content": " def testConfigInt(self):\n class TestCfgFile(ConfigFile):\n foo = (CfgInt, 0) \n\n cfg = TestCfgFile()\n assert(cfg.foo == 0)\n cfg.configLine('foo 1 # bar')\n assert(cfg.foo == 1)\n assert(self._getDisplayLines(cfg) == ['foo 1'])", "metadata": "root.ConfigTest.testConfigInt", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 165 }, { "content": " def testConfigRegExp(self):\n class TestCfgFile(ConfigFile):\n foo = CfgRegExpList\n\n cfg = TestCfgFile()\n assert(cfg.foo == [])\n cfg.configLine('foo re1.* re2.*# comments')\n assert([x[0] for x in cfg.foo] == ['re1.*', 're2.*'])\n lines = self._getDisplayLines(cfg)\n lines.remove('foo re1.*')\n lines.remove('foo re2.*')\n assert(not lines)", "metadata": "root.ConfigTest.testConfigRegExp", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 175 }, { "content": " def testConfigLabel(self):\n class TestCfgFile(ConfigFile):\n foo = (CfgLabel, versions.Label('localhost@local:local'))\n\n cfg = TestCfgFile()\n assert(cfg.foo.asString() == 'localhost@local:local')\n cfg.configLine('foo conary.rpath.com@rpl:devel')\n assert(cfg.foo.asString() == 'conary.rpath.com@rpl:devel')", "metadata": "root.ConfigTest.testConfigLabel", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 188 }, { "content": " def testConfigFlavor(self):\n class TestCfgFile(ConfigFile):\n foo = CfgFlavor\n\n cfg = TestCfgFile()\n assert(str(cfg.foo) == '')\n cfg.configLine('foo ~foo1, ~!foo2, foo3, foo4, foo5, foo6, foo7, foo8, foo9, foo10, foo11, foo12, foo13')\n assert(str(cfg.foo) == '~foo1,foo10,foo11,foo12,foo13,'\n '~!foo2,foo3,foo4,foo5,foo6,foo7,foo8,foo9')\n cfg.setDisplayOptions(prettyPrint=True)\n lines = self._getDisplayLines(cfg)\n lines.remove('foo ~foo1, foo10, foo11, foo12, foo13, ~!foo2, foo3,')\n lines.remove(' foo4, foo5, foo6, foo7, foo8, foo9')\n assert(not lines)\n cfg.setDisplayOptions(prettyPrint=False)\n lines = self._getDisplayLines(cfg)\n lines.remove('foo ~foo1, foo10, foo11, foo12, foo13, ~!foo2, foo3, foo4, foo5, foo6, foo7, foo8, foo9')", "metadata": "root.ConfigTest.testConfigFlavor", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 197 }, { "content": " def testConfigString(self):\n class TestCfgFile(ConfigFile):\n foo = CfgString\n\n cfg = TestCfgFile()\n assert(cfg.foo == None)\n cfg.configLine('foo blah blah')\n assert(cfg.foo == 'blah blah')", "metadata": "root.ConfigTest.testConfigString", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 215 }, { "content": " def testConfigStringList(self):\n class TestCfgFile(ConfigFile):\n foo = (CfgList(CfgString), ['default'])\n\n cfg = TestCfgFile()\n assert(cfg.foo == ['default'])\n cfg.foo.append('bar')\n assert(cfg.foo == ['default', 'bar'])\n cfg.configLine('foo blah blah')\n assert(cfg.foo == ['default', 'bar', 'blah blah'])\n cfg.configLine('foo more')\n assert(cfg.foo == ['default', 'bar', 'blah blah', 'more'])\n lines = self._getDisplayLines(cfg)\n assert(lines == ['foo default', 'foo bar', 'foo blah blah', 'foo more'])", "metadata": "root.ConfigTest.testConfigStringList", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 224 }, { "content": " def testConfigQuotedLineList(self):\n class TestCfgFile(ConfigFile):\n foo = (CfgQuotedLineList(CfgString), ['default'])\n\n cfg = TestCfgFile()\n assert(cfg.foo == ['default'])\n cfg.configLine(\"foo 'bar bam' blah bz\")\n assert(cfg.foo == ['bar bam', 'blah', 'bz'])\n lines = self._getDisplayLines(cfg)\n assert(lines == [\"foo 'bar bam' 'blah' 'bz'\"])", "metadata": "root.ConfigTest.testConfigQuotedLineList", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 239 }, { "content": " def testConfigLabelList(self):\n defaultLabel = versions.Label('conary.rpath.com@rpl:devel')\n localLabel = versions.Label('localhost@rpl:devel')\n\n class TestCfgFile(ConfigFile):\n foo = (CfgList(CfgLabel), [defaultLabel])\n\n cfg = TestCfgFile()\n assert(cfg.foo == [defaultLabel])\n cfg.configLine('foo localhost@rpl:devel')\n assert(cfg.foo == [localLabel])\n cfg.configLine('foo conary.rpath.com@rpl:devel')\n assert(cfg.foo == [localLabel, defaultLabel])\n lines = self._getDisplayLines(cfg)\n assert(lines == ['foo localhost@rpl:devel', \n 'foo conary.rpath.com@rpl:devel'])", "metadata": "root.ConfigTest.testConfigLabelList", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 250 }, { "content": " def testDocs(self):\n class TestCfgFile(ConfigFile):\n foo = (CfgString, '/tmp/foo', \"Bogus Path\")\n\n cfg = TestCfgFile()\n cfg.foo == '/tmp/foo'\n lines = self._getFileLines(cfg)\n assert(lines == ['# foo (Default: /tmp/foo)', \n '# Bogus Path', \n 'foo /tmp/foo'])", "metadata": "root.ConfigTest.testDocs", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 267 }, { "content": " def testLineOrigins(self):\n class TestCfgFile(ConfigFile):\n foo = (CfgString, '/tmp/foo')\n bar = (CfgList(CfgString), None)\n bam = (CfgString, '')\n cfg = TestCfgFile()\n cfg.configLine('foo /bar', fileName='/blah', lineno=32)\n cfg.configLine('foo /bam', fileName='/blah', lineno=33)\n cfg.configLine('bar one', fileName='<override>', lineno='<No Line>')\n cfg.configLine('bar two', fileName='blam', lineno=3)\n cfg.setDisplayOptions(showLineOrigins=True)\n lines = self._getFileLines(cfg, includeDocs=False)\n assert(lines == ['bam ',\n '# bar: <override> blam',\n 'bar one',\n 'bar two',\n '# foo: /blah',\n 'foo /bam'])", "metadata": "root.ConfigTest.testLineOrigins", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 278 }, { "content": " def testCfgEnum(self):\n class TestCfgEnum(CfgEnum):\n # exersice enum list codepath\n validValues = ['FOO', 'BAR', 'BAZ']\n\n class TestCfgFile(ConfigFile):\n foo = (TestCfgEnum(), 'BAR')\n\n cfg = TestCfgFile()\n self.assertFalse(cfg.foo != 'BAR',\n 'Initial value not set to default')\n\n cfg.configLine('foo baz')\n self.assertFalse(cfg.foo != 'BAZ',\n 'Enum value not translated to validValue')\n\n tCfg = TestCfgEnum()\n self.assertFalse(tCfg.format('FOO', {}) != 'FOO',\n \"validValue not translated to origValue\")\n\n self.assertRaises(ParseError, tCfg.parseString, 'splart')\n self.assertRaises(ParseError, tCfg.format, 'foo', {})\n\n self.assertFalse(tCfg.parseString('bar') != 'BAR',\n \"Enum value translating not case insensitive\")\n\n self.assertFalse(tCfg.validValues != \\\n {'baz': 'BAZ', 'foo': 'FOO', 'bar': 'BAR'},\n \"validValues Dict incorrect\")\n self.assertFalse(tCfg.origName != \\\n {'BAZ': 'BAZ', 'FOO': 'FOO', 'BAR': 'BAR'},\n \"origValues Dict incorrect\")", "metadata": "root.ConfigTest.testCfgEnum", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 297 }, { "content": " def testCfgEnum2(self):\n class TestCfgEnum(CfgEnum):\n # exercise enum dict codepath\n validValues = {'FOO': 1, 'BAR': 2, 'BAZ': 3}\n\n class TestCfgFile(ConfigFile):\n foo = (TestCfgEnum(), 2)\n\n testEnum = TestCfgEnum()\n self.assertFalse(testEnum.parseString('foo') != 1,\n \"string not parsed correctly\")\n\n self.assertFalse(testEnum.format(1, {}) != 'FOO',\n \"Enumerated value was not translated to original value\")\n\n tCfg = TestCfgEnum()\n self.assertFalse(tCfg.validValues != \\\n {'baz': 3, 'foo': 1, 'bar': 2},\n \"validValues Dict incorrect\")\n self.assertFalse(tCfg.origName != \\\n {3: 'BAZ', 1: 'FOO', 2: 'BAR'},\n \"origValues Dict incorrect\")", "metadata": "root.ConfigTest.testCfgEnum2", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 330 }, { "content": " def testConfigEnumDict(self):\n class CfgEnumDictFoo(CfgEnumDict):\n validValues = {'key1': ('val1', 'val2'), 'key2': ('val3', 'val4')}\n\n class TestCfgFile(ConfigFile):\n foo = CfgEnumDictFoo\n\n cfg = TestCfgFile()\n cfg.configLine('foo key1 val1')\n cfg.configLine('foo key2 val3')\n assert(cfg.foo == {'key1' : 'val1', 'key2' : 'val3'})", "metadata": "root.ConfigTest.testConfigEnumDict", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 353 }, { "content": " def testRegularExp(self):\n class TestCfgFile(ConfigFile):\n foo = CfgRegExpList\n\n cfg = TestCfgFile()\n cfg.configLine('foo bar.*')\n cfg.configLine('foo baz.*')\n assert(cfg.foo.match('bar'))\n assert(cfg.foo.match('baz'))\n assert(not cfg.foo.match('blammo'))", "metadata": "root.ConfigTest.testRegularExp", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 365 }, { "content": " def testFingerprintMap(self):\n class TestCfgFile(ConfigFile):\n foo = CfgFingerPrintMap\n\n cfg = TestCfgFile()\n cfg.configLine('foo .* None')\n assert (cfg.foo == [('.*', None)])\n self.assertRaises(ParseError, cfg.configLine, 'foo * None')", "metadata": "root.ConfigTest.testFingerprintMap", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 376 }, { "content": " def testSectionedCfg(self):\n class TestCfgSection(ConfigSection):\n foo = CfgBool\n\n class TestCfgFile(SectionedConfigFile):\n bar = TestCfgSection, None, 'Docs'\n\n cfg = TestCfgFile()\n self.assertRaises(ParseError, cfg.configLine, 'bar')\n self.assertRaises(ParseError, cfg.configLine, 'foo')\n assert(not cfg.bar.foo)\n cfg.configLine('[bar]')\n cfg.configLine('foo True')\n assert(cfg.bar.foo)", "metadata": "root.ConfigTest.testSectionedCfg", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 385 }, { "content": " def testIncludeConfigFile(self):\n class TestCfgFile(ConfigFile):\n bam = CfgBool\n biff = CfgBool\n\n dir = tempfile.mkdtemp()\n _home = os.getenv('HOME', '')\n try:\n open('%s/foo' % dir, 'w').write('inCLUDEconFIGFile bar\\n'\n 'includeCONFIGfile ~/baz\\n')\n open('%s/bar' % dir, 'w').write('bam True\\n')\n\n os.mkdir(os.path.join(dir, 'abode'))\n open('%s/abode/baz' % dir, 'w').write('biff True\\n')\n os.environ['HOME'] = os.path.join(dir, 'abode')\n\n cfg = TestCfgFile()\n assert(not cfg.bam)\n cfg.read('%s/foo' % dir)\n assert(cfg.bam and cfg.biff)\n finally:\n os.environ['HOME'] = _home\n shutil.rmtree(dir)", "metadata": "root.ConfigTest.testIncludeConfigFile", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 400 }, { "content": " def testIncludeConfigFileFails(self):\n class TestCfgFile(ConfigFile):\n bam = CfgBool\n\n dir = tempfile.mkdtemp()\n try:\n open('%s/foo' % dir, 'w').write('inCLUDEconFIGFile http://nonesuchrediculoushostexists//bar\\n')\n cfg = TestCfgFile()\n assert(not cfg.bam)\n try:\n cfg.read('%s/foo' % dir)\n assert(0)\n except Exception, e:\n if 'failure in name resolution' in str(e):\n raise testhelp.SkipTestException('requires default route')\n desc, sep, err = str(e).partition('bar: ')\n self.assertEqual(desc, \"%s/foo:1: when processing \"\n \"inCLUDEconFIGFile: Error reading config file \"\n \"http://nonesuchrediculoushostexists//\" %dir)\n self.assertIn(err, [\n \"Name or service not known\",\n \"No address associated with hostname\"])\n\n cfg = TestCfgFile()\n cfg.ignoreUrlIncludes()\n cfg.read('%s/foo' % dir)\n cfg = TestCfgFile()\n cfg.ignoreUrlIncludes()\n cfg.ignoreUrlIncludes(False)\n self.assertRaises(Exception, cfg.read,'%s/foo' % dir)\n cfg = TestCfgFile()\n cfg.setIgnoreErrors()\n cfg.read('%s/foo' % dir)\n finally:\n shutil.rmtree(dir)", "metadata": "root.ConfigTest.testIncludeConfigFileFails", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 424 }, { "content": " def testLimitKeys(self):\n class TestCfgFile(ConfigFile):\n foo = (CfgString, 'foo')\n bar = (CfgString, 'bar')\n cfg = TestCfgFile()\n cfg.limitToKeys('foo')\n cfg.configLine('bar bam')\n assert(cfg.bar == 'bar')\n cfg.configLine('foo bam')\n assert(cfg.foo == 'bam')\n cfg.limitToKeys(False)\n cfg.configLine('bar bam')\n assert(cfg.bar == 'bam')", "metadata": "root.ConfigTest.testLimitKeys", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 460 }, { "content": " def testStringListOverrideDefault(self):\n class TestCfgFile(ConfigFile):\n bam = CfgList(CfgString, default=['foo'])\n dir = tempfile.mkdtemp()\n try:\n open('%s/foo' % dir, 'w').write('bam foo\\nbam bar\\n')\n cfg = TestCfgFile()\n cfg.read('%s/foo' % dir)\n assert(cfg.bam == ['foo', 'bar'])\n finally:\n shutil.rmtree(dir)", "metadata": "root.ConfigTest.testStringListOverrideDefault", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 474 }, { "content": " def testDefaultFlag(self):\n class TestCfgFile(ConfigFile):\n foo = (CfgString, 'foo')\n cfg = TestCfgFile()\n assert cfg.isDefault('foo')\n\n cfg['foo'] = 'bar'\n assert not cfg.isDefault('foo')\n\n cfg.resetToDefault('foo')\n self.assertEquals(cfg.foo, 'foo')\n assert cfg.isDefault('foo')\n\n cfg.foo = 'bar'\n assert not cfg.isDefault('foo')", "metadata": "root.ConfigTest.testDefaultFlag", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 486 }, { "content": " def testReadFileDoesntExist(self):\n class TestCfgFile(ConfigFile):\n foo = (CfgString, 'foo')\n cfg = TestCfgFile()\n ex = self.assertRaises(CfgEnvironmentError, cfg.read,\n '/tmp/doesntexist/foo', exception=True)\n assert(str(ex) == \"Error reading config file /tmp/doesntexist/foo: No \"\n \"such file or directory\")", "metadata": "root.ConfigTest.testReadFileDoesntExist", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 502 }, { "content": " def testPickle(self):\n cfg = PickleTestConfig()\n cfg.bar.append(3)\n cfg.addListener('foo', lambda x: None)\n\n sio = StringIO()\n cfg.store(sio)\n reference = sio.getvalue()\n\n for mod in (pickle, cPickle):\n for level in (0, 1, 2):\n pickled = mod.dumps(cfg, level)\n restored = mod.loads(pickled)\n\n sio = StringIO()\n restored.store(sio)\n self.assertEquals(sio.getvalue(), reference)", "metadata": "root.ConfigTest.testPickle", "header": "['class', 'ConfigTest', '(', 'testhelp', '.', 'TestCase', ')', ':', '___EOS___']", "index": 511 }, { "content": "class PickleTestConfig(ConfigFile):\n foo = (CfgList(CfgInt), [1])\n bar = (CfgList(CfgInt), [2])", "metadata": "root.PickleTestConfig", "header": "['module', '___EOS___']", "index": 531 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "SAS", " ", "Institut", "e", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "Pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "testrun", "ner_", "import_", "testh", "elp", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cona", "ry_", "\\u\\u\\uNL\\u\\u\\u_", "#", "from", " ", "cona", "ry", ".", "cona", "ry", "cfg", " ", "import", " ", "*_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "cona", "ry_", "._", "cona", "ry", "cfg_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Cf", "g", "Fin", "ger", "Print", "Map_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cf", "g", "Flavor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cf", "g", "Label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cona", "ry_", "._", "lib_", "import_", "cfg", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cona", "ry_", "._", "lib_", "._", "cfg_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Config", "File_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Config", "Section_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Pars", "e", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Sect", "ione", "d", "Config", "File_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cona", "ry_", "._", "lib_", "._", "cfg", "types_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Cf", "g", "Bool_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cf", "g", "Enum_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cf", "g", "Enum", "Dict_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cf", "g", "Int_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cf", "g", "List_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cf", "g", "Path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cf", "g", "Quote", "d", "Line", "List_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cf", "g", "Reg", "Exp", "List_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cf", "g", "String_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Cf", "g", "Environ", "ment", "Error_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cona", "ry_", "import_", "versions_", "\\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_", "#", " ", "Thi", "s", " ", "has", " ", "to", " ", "be", " ", "at", " ", "module", " ", "level", " ", "or", " ", "pickle", " ", "can", "'", "t", " ", "find", " ", "it", "._", "\\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_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\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u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "get", "Display", "Lines_", "(_", "self_", ",_", "cfg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "display_", "(_", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "out_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "extra", " ", "format", "ting", " ", "space", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "re_", "._", "sub_", "(_", "'", " ", "+'_", ",_", "'", " ", "'_", ",_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "ending", " ", "\\\\", "n", " ", "to", " ", "avoid", " ", "an", " ", "extra", " ", "''", " ", "in", " ", "the", " ", "result", "ing", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "lines_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "lines_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "File", "Lines_", "(_", "self_", ",_", "cfg_", ",_", "include", "Docs", "_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "\\u", "write_", "(_", "out_", ",_", "cfg_", "._", "\\u", "display", "Options_", ",_", "include", "Docs", "_", "=_", "include", "Docs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "out_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "extra", " ", "format", "ting", " ", "space", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "re_", "._", "sub_", "(_", "'", " ", "+'_", ",_", "'", " ", "'_", ",_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "ending", " ", "\\\\", "n", " ", "to", " ", "avoid", " ", "an", " ", "extra", " ", "''", " ", "in", " ", "the", " ", "result", "ing", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "lines_", "=_", "lines_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "lines_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Config", "Comments_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "newval", "#", "comment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "'", "newval", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "newval", "#", "comment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "'", "newval", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "r", "'", "foo", " ", "newval", "\\\\", "#", "comment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "'", "newval", "#", "comment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "r", "'", "foo", " ", "newval", "\\\\\\\\", "#", "comment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "'", "newval", "\\\\\\\\'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Config", "Bool_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "(_", "Cf", "g", "Bool_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "[_", "'", "foo", "'_", "]_", "==_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "Tru", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "foo_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "Tru", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "self_", "._", "\\u", "get", "Display", "Lines_", "(_", "cfg_", ")_", "==_", "[_", "'", "foo", " ", "Tru", "e", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Config", "Path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "(_", "Cf", "g", "Path_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "Env_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "FOO", "BAR", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "Home_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "HOM", "E", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "FOO", "BAR", "'_", "]_", "=_", "'", "fooba", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "HOM", "E", "'_", "]_", "=_", "'/", "tmp", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "$", "FOO", "BAR", "/", "bash", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "self_", "._", "\\u", "get", "Display", "Lines_", "(_", "cfg_", ")_", "==_", "[_", "'", "foo", " ", "$", "FOO", "BAR", "/", "bash", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "~", "/", "bash", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "self_", "._", "\\u", "get", "Display", "Lines_", "(_", "cfg_", ")_", "==_", "[_", "'", "foo", " ", "~", "/", "bash", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "set", "Display", "Options_", "(_", "expand", "Paths_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "self_", "._", "\\u", "get", "Display", "Lines_", "(_", "cfg_", ")_", "==_", "[_", "'", "foo", " ", "%", "s", "/", "bash", "'_", "%_", "os_", "._", "environ_", "[_", "'", "HOM", "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 ", " _", "if_", "old", "Env_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "os_", "._", "environ_", "[_", "'", "FOO", "BAR", "'_", "]_", "\\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 ", " _", "os_", "._", "environ_", "[_", "'", "FOO", "BAR", "'_", "]_", "=_", "old", "Env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "old", "Home_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "os_", "._", "environ_", "[_", "'", "HOM", "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 ", " _", "os_", "._", "environ_", "[_", "'", "HOM", "E", "'_", "]_", "=_", "old", "Home_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "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", "Config", "Path", "Cache_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "Home_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "HOM", "E", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "Env_", "=_", "os_", "._", "environ_", "._", "get_", "(_", "'", "FOO", "BAR", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "environ_", "[_", "'", "HOM", "E", "'_", "]_", "=_", "'/", "tmp", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "cfg", "types_", "._", "Path_", "(_", "'", "~", "/", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "p_", "==_", "'/", "tmp", "/", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "HOM", "E", "'_", "]_", "=_", "'/", "tmp", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "cfg", "types_", "._", "Path_", "(_", "'", "~", "/", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "p_", "==_", "'/", "tmp", "2", "/", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "FOO", "BAR", "'_", "]_", "=_", "'/", "tmp", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "cfg", "types_", "._", "Path_", "(_", "'$", "FOO", "BAR", "/", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "p_", "==_", "'/", "tmp", "/", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "FOO", "BAR", "'_", "]_", "=_", "'/", "tmp", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "cfg", "types_", "._", "Path_", "(_", "'$", "FOO", "BAR", "/", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "p_", "==_", "'/", "tmp", "2", "/", "foo", "'_", ")_", "\\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_", "old", "Env_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "os_", "._", "environ_", "[_", "'", "FOO", "BAR", "'_", "]_", "\\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 ", " _", "os_", "._", "environ_", "[_", "'", "FOO", "BAR", "'_", "]_", "=_", "old", "Env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "old", "Home_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "os_", "._", "environ_", "[_", "'", "HOM", "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 ", " _", "os_", "._", "environ_", "[_", "'", "HOM", "E", "'_", "]_", "=_", "old", "Home_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "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", "Config", "Int_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "(_", "Cf", "g", "Int_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "1", " ", "#", " ", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "self_", "._", "\\u", "get", "Display", "Lines_", "(_", "cfg_", ")_", "==_", "[_", "'", "foo", " ", "1", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Config", "Reg", "Exp_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "Cf", "g", "Reg", "Exp", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "re", "1", ".*", " ", "re", "2", ".*", "#", " ", "comment", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "[_", "x_", "[_", "0_", "]_", "for_", "x_", "in_", "cfg_", "._", "foo_", "]_", "==_", "[_", "'", "re", "1", ".*'_", ",_", "'", "re", "2", ".*'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "self_", "._", "\\u", "get", "Display", "Lines_", "(_", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "._", "remove_", "(_", "'", "foo", " ", "re", "1", ".*'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "._", "remove_", "(_", "'", "foo", " ", "re", "2", ".*'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "not_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Config", "Label_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "(_", "Cf", "g", "Label_", ",_", "versions_", "._", "Label_", "(_", "'", "local", "host", "@", "local", ":", "local", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "._", "as", "String_", "(_", ")_", "==_", "'", "local", "host", "@", "local", ":", "local", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "cona", "ry", ".", "rpath", ".", "com", "@", "rpl", ":", "deve", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "._", "as", "String_", "(_", ")_", "==_", "'", "cona", "ry", ".", "rpath", ".", "com", "@", "rpl", ":", "deve", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Config", "Flavor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "Cf", "g", "Flavor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "str_", "(_", "cfg_", "._", "foo_", ")_", "==_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "~", "foo", "1", ",", " ", "~", "!", "foo", "2", ",", " ", "foo", "3", ",", " ", "foo", "4", ",", " ", "foo", "5", ",", " ", "foo", "6", ",", " ", "foo", "7", ",", " ", "foo", "8", ",", " ", "foo", "9", ",", " ", "foo", "10", ",", " ", "foo", "11", ",", " ", "foo", "1", "2", ",", " ", "foo", "13", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "str_", "(_", "cfg_", "._", "foo_", ")_", "==_", "'", "~", "foo", "1", ",", "foo", "10", ",", "foo", "11", ",", "foo", "1", "2", ",", "foo", "13", ",'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "~", "!", "foo", "2", ",", "foo", "3", ",", "foo", "4", ",", "foo", "5", ",", "foo", "6", ",", "foo", "7", ",", "foo", "8", ",", "foo", "9", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "set", "Display", "Options_", "(_", "pretty", "Print_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "self_", "._", "\\u", "get", "Display", "Lines_", "(_", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "._", "remove_", "(_", "'", "foo", " ", "~", "foo", "1", ",", " ", "foo", "10", ",", " ", "foo", "11", ",", " ", "foo", "1", "2", ",", " ", "foo", "13", ",", " ", "~", "!", "foo", "2", ",", " ", "foo", "3", ",'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "._", "remove_", "(_", "'", " ", "foo", "4", ",", " ", "foo", "5", ",", " ", "foo", "6", ",", " ", "foo", "7", ",", " ", "foo", "8", ",", " ", "foo", "9", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "not_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "set", "Display", "Options_", "(_", "pretty", "Print_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "self_", "._", "\\u", "get", "Display", "Lines_", "(_", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "._", "remove_", "(_", "'", "foo", " ", "~", "foo", "1", ",", " ", "foo", "10", ",", " ", "foo", "11", ",", " ", "foo", "1", "2", ",", " ", "foo", "13", ",", " ", "~", "!", "foo", "2", ",", " ", "foo", "3", ",", " ", "foo", "4", ",", " ", "foo", "5", ",", " ", "foo", "6", ",", " ", "foo", "7", ",", " ", "foo", "8", ",", " ", "foo", "9", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Config", "String_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "Cf", "g", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "bla", "h", " ", "bla", "h", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "'", "bla", "h", " ", "bla", "h", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Config", "String", "List_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "(_", "Cf", "g", "List_", "(_", "Cf", "g", "String_", ")_", ",_", "[_", "'", "default", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "[_", "'", "default", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "foo_", "._", "append_", "(_", "'", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "[_", "'", "default", "'_", ",_", "'", "bar", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "bla", "h", " ", "bla", "h", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "[_", "'", "default", "'_", ",_", "'", "bar", "'_", ",_", "'", "bla", "h", " ", "bla", "h", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "more", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "[_", "'", "default", "'_", ",_", "'", "bar", "'_", ",_", "'", "bla", "h", " ", "bla", "h", "'_", ",_", "'", "more", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "self_", "._", "\\u", "get", "Display", "Lines_", "(_", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "lines_", "==_", "[_", "'", "foo", " ", "default", "'_", ",_", "'", "foo", " ", "bar", "'_", ",_", "'", "foo", " ", "bla", "h", " ", "bla", "h", "'_", ",_", "'", "foo", " ", "more", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Config", "Quote", "d", "Line", "List_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "(_", "Cf", "g", "Quote", "d", "Line", "List_", "(_", "Cf", "g", "String_", ")_", ",_", "[_", "'", "default", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "[_", "'", "default", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "\"", "foo", " ", "'", "bar", " ", "bam", "'", " ", "bla", "h", " ", " ", " ", " ", " ", "bz", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "[_", "'", "bar", " ", "bam", "'_", ",_", "'", "bla", "h", "'_", ",_", "'", "bz", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "self_", "._", "\\u", "get", "Display", "Lines_", "(_", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "lines_", "==_", "[_", "\"", "foo", " ", "'", "bar", " ", "bam", "'", " ", "'", "bla", "h", "'", " ", "'", "bz", "'\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Config", "Label", "List_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "default", "Label_", "=_", "versions_", "._", "Label_", "(_", "'", "cona", "ry", ".", "rpath", ".", "com", "@", "rpl", ":", "deve", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "Label_", "=_", "versions_", "._", "Label_", "(_", "'", "local", "host", "@", "rpl", ":", "deve", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "(_", "Cf", "g", "List_", "(_", "Cf", "g", "Label_", ")_", ",_", "[_", "default", "Label_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "[_", "default", "Label_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "local", "host", "@", "rpl", ":", "deve", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "[_", "local", "Label_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "cona", "ry", ".", "rpath", ".", "com", "@", "rpl", ":", "deve", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "[_", "local", "Label_", ",_", "default", "Label_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "self_", "._", "\\u", "get", "Display", "Lines_", "(_", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "lines_", "==_", "[_", "'", "foo", " ", "local", "host", "@", "rpl", ":", "deve", "l", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foo", " ", "cona", "ry", ".", "rpath", ".", "com", "@", "rpl", ":", "deve", "l", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Docs", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "(_", "Cf", "g", "String_", ",_", "'/", "tmp", "/", "foo", "'_", ",_", "\"", "Bo", "gus", " ", "Path", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "foo_", "==_", "'/", "tmp", "/", "foo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "self_", "._", "\\u", "get", "File", "Lines_", "(_", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "lines_", "==_", "[_", "'#", " ", "foo", " ", "(", "Default", ":", " ", "/", "tmp", "/", "foo", ")'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'#", " ", "Bo", "gus", " ", "Path", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foo", " ", "/", "tmp", "/", "foo", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Line", "Orig", "ins_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "(_", "Cf", "g", "String_", ",_", "'/", "tmp", "/", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar_", "=_", "(_", "Cf", "g", "List_", "(_", "Cf", "g", "String_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bam_", "=_", "(_", "Cf", "g", "String_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "/", "bar", "'_", ",_", "file", "Name_", "=_", "'/", "bla", "h", "'_", ",_", "lineno_", "=_", "32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "/", "bam", "'_", ",_", "file", "Name_", "=_", "'/", "bla", "h", "'_", ",_", "lineno_", "=_", "33_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "bar", " ", "one", "'_", ",_", "file", "Name_", "=_", "'<", "override", ">'_", ",_", "lineno_", "=_", "'<", "No", " ", "Line", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "bar", " ", "two", "'_", ",_", "file", "Name_", "=_", "'", "bla", "m", "'_", ",_", "lineno_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "set", "Display", "Options_", "(_", "show", "Line", "Orig", "ins_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "self_", "._", "\\u", "get", "File", "Lines_", "(_", "cfg_", ",_", "include", "Docs", "_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "lines_", "==_", "[_", "'", "bam", " ", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'#", " ", "bar", ":", " ", "<", "override", ">", " ", "bla", "m", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bar", " ", "one", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bar", " ", "two", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'#", " ", "foo", ":", " ", "/", "bla", "h", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foo", " ", "/", "bam", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Cf", "g", "Enum_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "Enum_", "(_", "Cf", "g", "Enum_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "exe", "rsi", "ce", " ", "enum", " ", "list", " ", "code", "path_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "valid", "Values_", "=_", "[_", "'", "FOO", "'_", ",_", "'", "BAR", "'_", ",_", "'", "BA", "Z", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "(_", "Test", "Cf", "g", "Enum_", "(_", ")_", ",_", "'", "BAR", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "cfg_", "._", "foo_", "!=_", "'", "BAR", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Initial", " ", "value", " ", "not", " ", "set", " ", "to", " ", "default", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "ba", "z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "cfg_", "._", "foo_", "!=_", "'", "BA", "Z", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Enum", " ", "value", " ", "not", " ", "translat", "ed", " ", "to", " ", "valid", "Value", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t", "Cfg_", "=_", "Test", "Cf", "g", "Enum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "t", "Cfg_", "._", "format_", "(_", "'", "FOO", "'_", ",_", "{_", "}_", ")_", "!=_", "'", "FOO", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "valid", "Value", " ", "not", " ", "translat", "ed", " ", "to", " ", "orig", "Value", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Pars", "e", "Error_", ",_", "t", "Cfg_", "._", "parse", "String_", ",_", "'", "spla", "rt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Pars", "e", "Error_", ",_", "t", "Cfg_", "._", "format_", ",_", "'", "foo", "'_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "t", "Cfg_", "._", "parse", "String_", "(_", "'", "bar", "'_", ")_", "!=_", "'", "BAR", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Enum", " ", "value", " ", "translat", "ing", " ", "not", " ", "case", " ", "inse", "nsitive", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "t", "Cfg_", "._", "valid", "Values_", "!=_", "{_", "'", "ba", "z", "'_", ":_", "'", "BA", "Z", "'_", ",_", "'", "foo", "'_", ":_", "'", "FOO", "'_", ",_", "'", "bar", "'_", ":_", "'", "BAR", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "valid", "Value", "s", " ", "Dict", " ", "incorrect", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "t", "Cfg_", "._", "orig", "Name_", "!=_", "{_", "'", "BA", "Z", "'_", ":_", "'", "BA", "Z", "'_", ",_", "'", "FOO", "'_", ":_", "'", "FOO", "'_", ",_", "'", "BAR", "'_", ":_", "'", "BAR", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "orig", "Value", "s", " ", "Dict", " ", "incorrect", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Cf", "g", "Enum", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "Enum_", "(_", "Cf", "g", "Enum_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "exercise", " ", "enum", " ", "dict", " ", "code", "path_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "valid", "Values_", "=_", "{_", "'", "FOO", "'_", ":_", "1_", ",_", "'", "BAR", "'_", ":_", "2_", ",_", "'", "BA", "Z", "'_", ":_", "3_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "(_", "Test", "Cf", "g", "Enum_", "(_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test", "Enum_", "=_", "Test", "Cf", "g", "Enum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "test", "Enum_", "._", "parse", "String_", "(_", "'", "foo", "'_", ")_", "!=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "string", " ", "not", " ", "parsed", " ", "correct", "ly", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "test", "Enum_", "._", "format_", "(_", "1_", ",_", "{_", "}_", ")_", "!=_", "'", "FOO", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Enumerate", "d", " ", "value", " ", "was", " ", "not", " ", "translat", "ed", " ", "to", " ", "original", " ", "value", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t", "Cfg_", "=_", "Test", "Cf", "g", "Enum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "t", "Cfg_", "._", "valid", "Values_", "!=_", "{_", "'", "ba", "z", "'_", ":_", "3_", ",_", "'", "foo", "'_", ":_", "1_", ",_", "'", "bar", "'_", ":_", "2_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "valid", "Value", "s", " ", "Dict", " ", "incorrect", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "t", "Cfg_", "._", "orig", "Name_", "!=_", "{_", "3_", ":_", "'", "BA", "Z", "'_", ",_", "1_", ":_", "'", "FOO", "'_", ",_", "2_", ":_", "'", "BAR", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "orig", "Value", "s", " ", "Dict", " ", "incorrect", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Config", "Enum", "Dict_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Cf", "g", "Enum", "Dict", "Foo_", "(_", "Cf", "g", "Enum", "Dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "valid", "Values_", "=_", "{_", "'", "key", "1", "'_", ":_", "(_", "'", "val", "1", "'_", ",_", "'", "val", "2", "'_", ")_", ",_", "'", "key", "2", "'_", ":_", "(_", "'", "val", "3", "'_", ",_", "'", "val", "4", "'_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "Cf", "g", "Enum", "Dict", "Foo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "key", "1", " ", "val", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "key", "2", " ", "val", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "{_", "'", "key", "1", "'_", ":_", "'", "val", "1", "'_", ",_", "'", "key", "2", "'_", ":_", "'", "val", "3", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Regula", "r", "Exp_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "Cf", "g", "Reg", "Exp", "List_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "bar", ".*'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "ba", "z", ".*'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "._", "match_", "(_", "'", "bar", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "._", "match_", "(_", "'", "ba", "z", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "not_", "cfg_", "._", "foo_", "._", "match_", "(_", "'", "bla", "mmo", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Fingerprint", "Map_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "Cf", "g", "Fin", "ger", "Print", "Map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", ".*", " ", "Non", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "[_", "(_", "'.*'_", ",_", "None_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Pars", "e", "Error_", ",_", "cfg_", "._", "config", "Line_", ",_", "'", "foo", " ", "*", " ", "Non", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Sect", "ione", "d", "Cfg_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "Section_", "(_", "Config", "Section_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "Cf", "g", "Bool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Cf", "g", "File_", "(_", "Sect", "ione", "d", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bar_", "=_", "Test", "Cf", "g", "Section_", ",_", "None_", ",_", "'", "Docs", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Pars", "e", "Error_", ",_", "cfg_", "._", "config", "Line_", ",_", "'", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Pars", "e", "Error_", ",_", "cfg_", "._", "config", "Line_", ",_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "not_", "cfg_", "._", "bar_", "._", "foo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'[", "bar", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "Tru", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "bar_", "._", "foo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Include", "Config", "File_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bam_", "=_", "Cf", "g", "Bool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bi", "ff_", "=_", "Cf", "g", "Bool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dir_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "home_", "=_", "os_", "._", "getenv_", "(_", "'", "HOM", "E", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "open_", "(_", "'%", "s", "/", "foo", "'_", "%_", "dir_", ",_", "'", "w", "'_", ")_", "._", "write_", "(_", "'", "in", "CL", "UD", "Econ", "FI", "GF", "ile", " ", "bar", "\\\\", "n", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "include", "CONFIG", "file", " ", "~", "/", "ba", "z", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "'%", "s", "/", "bar", "'_", "%_", "dir_", ",_", "'", "w", "'_", ")_", "._", "write_", "(_", "'", "bam", " ", "Tru", "e", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "dir_", ",_", "'", "abo", "de", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "'%", "s", "/", "abo", "de", "/", "ba", "z", "'_", "%_", "dir_", ",_", "'", "w", "'_", ")_", "._", "write_", "(_", "'", "bi", "ff", " ", "Tru", "e", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "HOM", "E", "'_", "]_", "=_", "os_", "._", "path_", "._", "join_", "(_", "dir_", ",_", "'", "abo", "de", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "not_", "cfg_", "._", "bam_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "read_", "(_", "'%", "s", "/", "foo", "'_", "%_", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "bam_", "and_", "cfg_", "._", "bi", "ff_", ")_", "\\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 ", " _", "os_", "._", "environ_", "[_", "'", "HOM", "E", "'_", "]_", "=_", "\\u", "home_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "rmtree_", "(_", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "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", "Include", "Config", "File", "Fail", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bam_", "=_", "Cf", "g", "Bool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dir_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "open_", "(_", "'%", "s", "/", "foo", "'_", "%_", "dir_", ",_", "'", "w", "'_", ")_", "._", "write_", "(_", "'", "in", "CL", "UD", "Econ", "FI", "GF", "ile", " ", "http", "://", "none", "suc", "hre", "dic", "ulo", "ush", "ost", "exist", "s", "//", "bar", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "not_", "cfg_", "._", "bam_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cfg_", "._", "read_", "(_", "'%", "s", "/", "foo", "'_", "%_", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "0_", ")_", "\\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 ", " _", "if_", "'", "fail", "ure", " ", "in", " ", "name", " ", "resolu", "tion", "'_", "in_", "str_", "(_", "e_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "testh", "elp", "_", "._", "Ski", "p", "Test", "Exception_", "(_", "'", "require", "s", " ", "default", " ", "route", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "desc_", ",_", "sep_", ",_", "err_", "=_", "str_", "(_", "e_", ")_", "._", "partition_", "(_", "'", "bar", ":", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "desc_", ",_", "\"%", "s", "/", "foo", ":", "1", ":", " ", "whe", "n", " ", "process", "ing", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "in", "CL", "UD", "Econ", "FI", "GF", "ile", ":", " ", "Error", " ", "readi", "ng", " ", "config", " ", "file", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "http", "://", "none", "suc", "hre", "dic", "ulo", "ush", "ost", "exist", "s", "//", "\"_", "%_", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "err_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Name", " ", "or", " ", "service", " ", "not", " ", "know", "n", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "No", " ", "address", " ", "associate", "d", " ", "with", " ", "host", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "ignore", "Ur", "l", "Includes", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "read_", "(_", "'%", "s", "/", "foo", "'_", "%_", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "ignore", "Ur", "l", "Includes", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "ignore", "Ur", "l", "Includes", "_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Exception_", ",_", "cfg_", "._", "read_", ",_", "'%", "s", "/", "foo", "'_", "%_", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "set", "Ignor", "e", "Errors_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "read_", "(_", "'%", "s", "/", "foo", "'_", "%_", "dir_", ")_", "\\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 ", " _", "shutil_", "._", "rmtree_", "(_", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "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", "Limit", "Keys_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "(_", "Cf", "g", "String_", ",_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar_", "=_", "(_", "Cf", "g", "String_", ",_", "'", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "limit", "To", "Keys_", "(_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "bar", " ", "bam", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "bar_", "==_", "'", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "foo", " ", "bam", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "foo_", "==_", "'", "bam", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "limit", "To", "Keys_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "config", "Line_", "(_", "'", "bar", " ", "bam", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "bar_", "==_", "'", "bam", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "String", "List", "Override", "Default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bam_", "=_", "Cf", "g", "List_", "(_", "Cf", "g", "String_", ",_", "default_", "=_", "[_", "'", "foo", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "dir_", "=_", "tempfile_", "._", "mkdtemp_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "open_", "(_", "'%", "s", "/", "foo", "'_", "%_", "dir_", ",_", "'", "w", "'_", ")_", "._", "write_", "(_", "'", "bam", " ", "foo", "\\\\", "nba", "m", " ", "bar", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "read_", "(_", "'%", "s", "/", "foo", "'_", "%_", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "cfg_", "._", "bam_", "==_", "[_", "'", "foo", "'_", ",_", "'", "bar", "'_", "]_", ")_", "\\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 ", " _", "shutil_", "._", "rmtree_", "(_", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "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", "Default", "Flag_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "(_", "Cf", "g", "String_", ",_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cfg_", "._", "is", "Default_", "(_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cfg_", "[_", "'", "foo", "'_", "]_", "=_", "'", "bar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "cfg_", "._", "is", "Default_", "(_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cfg_", "._", "reset", "To", "Default_", "(_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "cfg_", "._", "foo_", ",_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "cfg_", "._", "is", "Default_", "(_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cfg_", "._", "foo_", "=_", "'", "bar", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "cfg_", "._", "is", "Default_", "(_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Read", "File", "Do", "esn", "t", "Exist_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Test", "Cf", "g", "File_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "(_", "Cf", "g", "String_", ",_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cfg_", "=_", "Test", "Cf", "g", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ex_", "=_", "self_", "._", "assert", "Raises_", "(_", "Cf", "g", "Environ", "ment", "Error_", ",_", "cfg_", "._", "read_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "tmp", "/", "doesnt", "exist", "/", "foo", "'_", ",_", "exception_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "str_", "(_", "ex_", ")_", "==_", "\"", "Error", " ", "readi", "ng", " ", "config", " ", "file", " ", "/", "tmp", "/", "doesnt", "exist", "/", "foo", ":", " ", "No", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "suc", "h", " ", "file", " ", "or", " ", "director", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Config", "Test_", "(_", "testh", "elp", "_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pickle_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cfg_", "=_", "Pickl", "e", "Test", "Config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "bar_", "._", "append_", "(_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "add", "Listener_", "(_", "'", "foo", "'_", ",_", "lambda_", "x_", ":_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sio_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cfg_", "._", "store_", "(_", "sio_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reference_", "=_", "sio_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "mod_", "in_", "(_", "pickle_", ",_", "c", "Pickle_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "level_", "in_", "(_", "0_", ",_", "1_", ",_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pickled", "_", "=_", "mod_", "._", "dumps_", "(_", "cfg_", ",_", "level_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "restore", "d_", "=_", "mod_", "._", "loads_", "(_", "pickled", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sio_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "restore", "d_", "._", "store_", "(_", "sio_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "sio_", "._", "getvalue_", "(_", ")_", ",_", "reference_", ")_", "\\u\\u\\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_", "Pickl", "e", "Test", "Config_", "(_", "Config", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "foo_", "=_", "(_", "Cf", "g", "List_", "(_", "Cf", "g", "Int_", ")_", ",_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\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, 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, 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 ]
First parameter of a method is not named 'self'
cournape/Bento/bento/backends/yaku_backend.py
[ { "content": " def post_recurse(self):\n self.yaku_context.path = self._old_path\n super(ConfigureYakuContext, self).post_recurse()", "metadata": "root.ConfigureYakuContext.post_recurse", "header": "['class', 'ConfigureYakuContext', '(', 'ConfigureContext', ')', ':', '___EOS___']", "index": 53 } ]
[]
[]
0
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Configure", "Ya", "ku", "Context_", "(_", "Configure", "Context_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post", "\\u", "recurse_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "yak", "u\\u", "context_", "._", "path_", "=_", "self_", "._", "\\u", "old", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Configure", "Ya", "ku", "Context_", ",_", "self_", ")_", "._", "post", "\\u", "recurse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
openelections/openelections-core/openelex/base/load.py
[ { "content": "import datetime\nimport json\nfrom os.path import join\nimport re\n\nimport unicodecsv\n\nfrom openelex.models import RawResult\nfrom .state import StateBase\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BaseLoader(StateBase):\n \"\"\"\n Base class for loading results data into MongoDB\n Intended to be subclassed in state-specific load.py modules.\n Reads from cached resources inside each state directory.\n\n Subclasses should create RawResult models and only do minimal\n cleaning such as:\n\n * Strip leading/trailing whitespace from values\n * Convert votes from string to integer\n\n All other cleaning or transformation of values should be\n done by creating transforms.\n\n \"\"\"\n\n\n\n\n\n # TODO: Decide if we can remove this.\n\n # Private methods\n\n\n", "metadata": "root.BaseLoader", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def __init__(self):\n super(BaseLoader, self).__init__()\n\n if not hasattr(self, 'datasource'):\n raise AttributeError(\"Your loader class must define a datasource attribute\")", "metadata": "root.BaseLoader.__init__", "header": "['class', 'BaseLoader', '(', 'StateBase', ')', ':', '___EOS___']", "index": 28 }, { "content": " def run(self, mapping):\n \"\"\"\n Load a data file's results into the data store.\n\n Initializes some metadata attributes on the instance and then\n call ``load()`` to create the RawResult model instances in the\n data store.\n\n Arguments:\n\n mapping (dict): A mapping, as returned by Datasource.mappings() that\n includes election metadata, most importantly, a\n ``generated_filename`` value that contains the filename of the\n data to be loaded.\n\n \"\"\"\n self.mapping = mapping\n self.source = mapping['generated_filename']\n self.timestamp = datetime.datetime.now()\n self.election_id = mapping['election']\n\n self.delete_previously_loaded()\n self.load()", "metadata": "root.BaseLoader.run", "header": "['class', 'BaseLoader', '(', 'StateBase', ')', ':', '___EOS___']", "index": 34 }, { "content": " def delete_previously_loaded(self):\n \"\"\"\n Deletes previously loaded RawResult records for a particular\n data file.\n \"\"\"\n print(\"LOAD: %s\" % self.source)\n # Reload raw results fresh every time\n result_count = RawResult.objects.filter(source=self.source).count()\n if result_count > 0:\n print(\"\\tDeleting %s previously loaded raw results\" % result_count)\n RawResult.objects.filter(source=self.source).delete()", "metadata": "root.BaseLoader.delete_previously_loaded", "header": "['class', 'BaseLoader', '(', 'StateBase', ')', ':', '___EOS___']", "index": 58 }, { "content": " def load(self):\n \"\"\"\n Creates records in the data store for each result in the data file.\n\n This should load the data fields in a way that is as close as possible\n to the original data file. Only basic data cleaning and transforming\n should be done here, such as stripping leading or trailing whitespace\n or converting number strings to numeric data types.\n\n This should be implemented in state-specific sublcasses.\n\n \"\"\"\n raise NotImplementedError(\"Your loader class must implement a load method\")", "metadata": "root.BaseLoader.load", "header": "['class', 'BaseLoader', '(', 'StateBase', ')', ':', '___EOS___']", "index": 70 }, { "content": " def jurisdiction_mappings(self, headers):\n \"\"\"\n Given a tuple of headers, returns a JSON object of jurisdictional\n mappings based on OCD ids\"\n \"\"\"\n filename = join(self.mappings_dir, self.state+'.csv')\n with open(filename, 'rU') as csvfile:\n reader = unicodecsv.DictReader(csvfile, fieldnames = headers)\n mappings = json.dumps([row for row in reader])\n return json.loads(mappings)", "metadata": "root.BaseLoader.jurisdiction_mappings", "header": "['class', 'BaseLoader', '(', 'StateBase', ')', ':', '___EOS___']", "index": 85 }, { "content": " @property\n def _file_handle(self):\n return open(join(self.cache.abspath, self.source), 'rU')", "metadata": "root.BaseLoader._file_handle", "header": "['class', 'BaseLoader', '(', 'StateBase', ')', ':', '___EOS___']", "index": 98 }, { "content": " @property\n def _xls_file_path(self):\n return join(self.cache.abspath, self.source)", "metadata": "root.BaseLoader._xls_file_path", "header": "['class', 'BaseLoader', '(', 'StateBase', ')', ':', '___EOS___']", "index": 102 }, { "content": " def _build_common_election_kwargs(self):\n \"\"\"\n Returns a dictionary of fields derived from the OpenElex API\n and common to all RawResults.\n\n This dictionary can be used to specify some of the keyword\n arguments when constructing new RawResult records in a\n load implementation.\n \"\"\"\n year = int(re.search(r'\\d{4}', self.election_id).group())\n elecs = self.datasource.elections(year)[year]\n # Get election metadata by matching on election slug\n elec_meta = [e for e in elecs if e['slug'] == self.election_id][0]\n kwargs = {\n 'created': self.timestamp,\n 'updated': self.timestamp,\n 'source': self.source,\n 'election_id': self.election_id,\n 'state': self.state.upper(),\n 'start_date': datetime.datetime.strptime(elec_meta['start_date'], \"%Y-%m-%d\"),\n 'end_date': datetime.datetime.strptime(elec_meta['end_date'], \"%Y-%m-%d\"),\n 'election_type': elec_meta['race_type'],\n 'primary_type': elec_meta['primary_type'],\n 'result_type': elec_meta['result_type'],\n 'special': elec_meta['special'],\n }\n return kwargs", "metadata": "root.BaseLoader._build_common_election_kwargs", "header": "['class', 'BaseLoader', '(', 'StateBase', ')', ':', '___EOS___']", "index": 106 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "join_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unicode", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "opene", "lex_", "._", "models_", "import_", "Ra", "w", "Result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "state_", "import_", "State", "Base_", "\\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_", "Base", "Loader_", "(_", "State", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Base", " ", "class", " ", "for", " ", "load", "ing", " ", "results", " ", "data", " ", "int", "o", " ", "Mon", "go", "DB", "\\", "10", ";", " ", " ", " ", " ", "Inten", "ded", " ", "to", " ", "be", " ", "subclass", "ed", " ", "in", " ", "state", "-", "specific", " ", "load", ".", "py", " ", "module", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Read", "s", " ", "from", " ", "cache", "d", " ", "resource", "s", " ", "insi", "de", " ", "each", " ", "state", " ", "director", "y", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Subc", "lasse", "s", " ", "shou", "ld", " ", "create", " ", "Ra", "w", "Result", " ", "model", "s", " ", "and", " ", "only", " ", "do", " ", "minima", "l", "\\", "10", ";", " ", " ", " ", " ", "clean", "ing", " ", "suc", "h", " ", "as", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "Strip", " ", "lead", "ing", "/", "trail", "ing", " ", "whitespace", " ", "from", " ", "values", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "Convert", " ", "vote", "s", " ", "from", " ", "string", " ", "to", " ", "integ", "er", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "All", " ", "other", " ", "clean", "ing", " ", "or", " ", "transformation", " ", "of", " ", "values", " ", "shou", "ld", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "don", "e", " ", "by", " ", "creati", "ng", " ", "transform", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Deci", "de", " ", "if", " ", "we", " ", "can", " ", "remove", " ", "this", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Priva", "te", " ", "methods_", "\\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_", "Base", "Loader_", "(_", "State", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Base", "Loader_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "self_", ",_", "'", "datas", "ource", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Attribute", "Error_", "(_", "\"", "You", "r", " ", "load", "er", " ", "class", " ", "must", " ", "defin", "e", " ", "a", " ", "datas", "ource", " ", "attribute", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Loader_", "(_", "State", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "mapping_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Load", " ", "a", " ", "data", " ", "file", "'", "s", " ", "results", " ", "int", "o", " ", "the", " ", "data", " ", "store", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Initializ", "es", " ", "some", " ", "metadata", " ", "attribute", "s", " ", "on", " ", "the", " ", "instance", " ", "and", " ", "then", "\\", "10", ";", " ", " ", " ", " ", "call", " ", "``", "load", "()``", " ", "to", " ", "create", " ", "the", " ", "Ra", "w", "Result", " ", "model", " ", "instance", "s", " ", "in", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "data", " ", "store", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "ument", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", "mapping", " ", "(", "dict", "):", " ", "A", " ", "mapping", ",", " ", "as", " ", "return", "ed", " ", "by", " ", "Datas", "ource", ".", "mapping", "s", "()", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "include", "s", " ", "election", " ", "metadata", ",", " ", "most", " ", "importa", "ntl", "y", ",", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "``", "generat", "ed", "\\u", "filename", "``", " ", "value", " ", "tha", "t", " ", "contain", "s", " ", "the", " ", "filename", " ", "of", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "data", " ", "to", " ", "be", " ", "load", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mapping_", "=_", "mapping_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "source_", "=_", "mapping_", "[_", "'", "generat", "ed", "\\u", "filename", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "timestamp_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "election", "\\u", "id_", "=_", "mapping_", "[_", "'", "election", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "delete", "\\u", "previ", "ously", "\\u", "loaded_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Loader_", "(_", "State", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "previ", "ously", "\\u", "loaded_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Delete", "s", " ", "previ", "ously", " ", "load", "ed", " ", "Ra", "w", "Result", " ", "record", "s", " ", "for", " ", "a", " ", "partic", "ular", "\\", "10", ";", " ", " ", " ", " ", "data", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "\"", "LOAD", ":", " ", "%", "s", "\"_", "%_", "self_", "._", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Relo", "ad", " ", "raw", " ", "results", " ", "fresh", " ", "every", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "result", "\\u", "count_", "=_", "Ra", "w", "Result_", "._", "objects_", "._", "filter_", "(_", "source_", "=_", "self_", "._", "source_", ")_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result", "\\u", "count_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"\\\\", "t", "Del", "eti", "ng", " ", "%", "s", " ", "previ", "ously", " ", "load", "ed", " ", "raw", " ", "results", "\"_", "%_", "result", "\\u", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Ra", "w", "Result_", "._", "objects_", "._", "filter_", "(_", "source_", "=_", "self_", "._", "source_", ")_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Loader_", "(_", "State", "Base_", ")_", ":_", "\\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_", "load_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "record", "s", " ", "in", " ", "the", " ", "data", " ", "store", " ", "for", " ", "each", " ", "result", " ", "in", " ", "the", " ", "data", " ", "file", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "shou", "ld", " ", "load", " ", "the", " ", "data", " ", "fields", " ", "in", " ", "a", " ", "way", " ", "tha", "t", " ", "is", " ", "as", " ", "close", " ", "as", " ", "possib", "le", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "original", " ", "data", " ", "file", ".", " ", " ", "On", "ly", " ", "basic", " ", "data", " ", "clean", "ing", " ", "and", " ", "transform", "ing", "\\", "10", ";", " ", " ", " ", " ", "shou", "ld", " ", "be", " ", "don", "e", " ", "here", ",", " ", "suc", "h", " ", "as", " ", "strip", "ping", " ", "lead", "ing", " ", "or", " ", "trail", "ing", " ", "whitespace", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "convert", "ing", " ", "number", " ", "string", "s", " ", "to", " ", "numeri", "c", " ", "data", " ", "types", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "shou", "ld", " ", "be", " ", "implemented", " ", "in", " ", "state", "-", "specific", " ", "subl", "cass", "es", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "You", "r", " ", "load", "er", " ", "class", " ", "must", " ", "implement", " ", "a", " ", "load", " ", "method", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Loader_", "(_", "State", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "jur", "isdi", "ction", "\\u", "mappings_", "(_", "self_", ",_", "headers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "a", " ", "tuple", " ", "of", " ", "header", "s", ",", " ", "return", "s", " ", "a", " ", "JSO", "N", " ", "object", " ", "of", " ", "jur", "isdi", "ction", "al", "\\", "10", ";", " ", " ", " ", " ", "mapping", "s", " ", "based", " ", "on", " ", "OC", "D", " ", "ids", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "join_", "(_", "self_", "._", "mapping", "s", "\\u", "dir_", ",_", "self_", "._", "state_", "+_", "'.", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "filename_", ",_", "'", "r", "U", "'_", ")_", "as_", "csvfile_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "unicode", "csv_", "._", "Dict", "Reader_", "(_", "csvfile_", ",_", "fieldnames_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mappings_", "=_", "json_", "._", "dumps_", "(_", "[_", "row_", "for_", "row_", "in_", "reader_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "json_", "._", "loads_", "(_", "mappings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Loader_", "(_", "State", "Base_", ")_", ":_", "\\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_", "\\u", "file", "\\u", "handle_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "open_", "(_", "join_", "(_", "self_", "._", "cache_", "._", "abspath_", ",_", "self_", "._", "source_", ")_", ",_", "'", "r", "U", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Loader_", "(_", "State", "Base_", ")_", ":_", "\\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_", "\\u", "xls", "\\u", "file", "\\u", "path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "join_", "(_", "self_", "._", "cache_", "._", "abspath_", ",_", "self_", "._", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Loader_", "(_", "State", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "build", "\\u", "common", "\\u", "election", "\\u", "kwargs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "dictionar", "y", " ", "of", " ", "fields", " ", "derive", "d", " ", "from", " ", "the", " ", "Open", "Ele", "x", " ", "API", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "common", " ", "to", " ", "all", " ", "Ra", "w", "Result", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "dictionar", "y", " ", "can", " ", "be", " ", "used", " ", "to", " ", "speci", "fy", " ", "some", " ", "of", " ", "the", " ", "keyw", "ord", "\\", "10", ";", " ", " ", " ", " ", "argu", "ment", "s", " ", "whe", "n", " ", "constructi", "ng", " ", "new", " ", "Ra", "w", "Result", " ", "record", "s", " ", "in", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "load", " ", "implementation", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "year_", "=_", "int_", "(_", "re_", "._", "search_", "(_", "r", "'\\\\", "d", "{", "4", "}'_", ",_", "self_", "._", "election", "\\u", "id_", ")_", "._", "group_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elec", "s_", "=_", "self_", "._", "datasource_", "._", "election", "s_", "(_", "year_", ")_", "[_", "year_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "election", " ", "metadata", " ", "by", " ", "matchi", "ng", " ", "on", " ", "election", " ", "slug_", "\\u\\u\\uNL\\u\\u\\u_", "elec", "\\u", "meta_", "=_", "[_", "e_", "for_", "e_", "in_", "elec", "s_", "if_", "e_", "[_", "'", "slug", "'_", "]_", "==_", "self_", "._", "election", "\\u", "id_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "self_", "._", "timestamp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "update", "d", "'_", ":_", "self_", "._", "timestamp_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "'_", ":_", "self_", "._", "source_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "election", "\\u", "id", "'_", ":_", "self_", "._", "election", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "state", "'_", ":_", "self_", "._", "state_", "._", "upper_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "\\u", "date", "'_", ":_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "elec", "\\u", "meta_", "[_", "'", "start", "\\u", "date", "'_", "]_", ",_", "\"%", "Y", "-%", "m", "-%", "d", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "end", "\\u", "date", "'_", ":_", "datetime_", "._", "datetime_", "._", "strptime_", "(_", "elec", "\\u", "meta_", "[_", "'", "end", "\\u", "date", "'_", "]_", ",_", "\"%", "Y", "-%", "m", "-%", "d", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "election", "\\u", "type", "'_", ":_", "elec", "\\u", "meta_", "[_", "'", "race", "\\u", "type", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "primary", "\\u", "type", "'_", ":_", "elec", "\\u", "meta_", "[_", "'", "primary", "\\u", "type", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "\\u", "type", "'_", ":_", "elec", "\\u", "meta_", "[_", "'", "result", "\\u", "type", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "special", "'_", ":_", "elec", "\\u", "meta_", "[_", "'", "special", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "kwargs_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Unused import
airbnb/airflow/airflow/contrib/example_dags/example_qubole_operator.py
[ { "content": "from airflow import DAG\nfrom airflow.operators import DummyOperator, PythonOperator, BranchPythonOperator\nfrom airflow.contrib.operators import QuboleOperator\nfrom datetime import datetime, timedelta\nimport filecmp\nimport random\n\nseven_days_ago = datetime.combine(datetime.today() - timedelta(7),\n datetime.min.time())\n\ndefault_args = {\n 'owner': 'airflow',\n 'depends_on_past': False,\n 'start_date': seven_days_ago,\n 'email': ['airflow@airflow.com'],\n 'email_on_failure': False,\n 'email_on_retry': False\n}\n\ndag = DAG('example_qubole_operator', default_args=default_args)\n\n\nt1 = QuboleOperator(\n task_id='hive_show_table',\n command_type='hivecmd',\n query='show tables',\n cluster_label='default',\n fetch_logs=True,\n tags='aiflow_example_run',\n dag=dag)\n\nt2 = QuboleOperator(\n task_id='hive_s3_location',\n command_type=\"hivecmd\",\n script_location=\"s3n://dev.canopydata.com/airflow/show_table.hql\",\n notfiy=True,\n tags='aiflow_example_run',\n trigger_rule=\"all_done\",\n dag=dag)\n\nt3 = PythonOperator(\n task_id='compare_result',\n provide_context=True,\n python_callable=compare_result,\n trigger_rule=\"all_done\",\n dag=dag)\n\nt3.set_upstream(t1)\nt3.set_upstream(t2)\n\noptions = ['hadoop_jar_cmd', 'presto_cmd', 'db_query', 'spark_cmd']\n\nbranching = BranchPythonOperator(\n task_id='branching',\n python_callable=lambda: random.choice(options),\n dag=dag)\nbranching.set_upstream(t3)\n\n\njoin = DummyOperator(\n task_id='join',\n trigger_rule='one_success',\n dag=dag\n)\n\n\nt4 = QuboleOperator(\n task_id='hadoop_jar_cmd',\n command_type='hadoopcmd',\n sub_command='jar s3://paid-qubole/HadoopAPIExamples/jars/hadoop-0.20.1-dev-streaming.jar -mapper wc -numReduceTasks 0 -input s3://paid-qubole/HadoopAPITests/data/3.tsv -output s3://paid-qubole/HadoopAPITests/data/3_wc',\n cluster_label='default',\n fetch_logs=True,\n dag=dag)\n\nt5 = QuboleOperator(\n task_id='pig_cmd',\n command_type=\"pigcmd\",\n script_location=\"s3://paid-qubole/PigAPIDemo/scripts/script1-hadoop-s3-small.pig\",\n parameters=\"key1=value1 key2=value2\",\n trigger_rule=\"all_done\",\n dag=dag)\n\nt4.set_upstream(branching)\nt5.set_upstream(t4)\nt5.set_downstream(join)\n\n\nt6 = QuboleOperator(\n task_id='presto_cmd',\n command_type='prestocmd',\n query='show tables',\n dag=dag)\n\nt7 = QuboleOperator(\n task_id='shell_cmd',\n command_type=\"shellcmd\",\n script_location=\"s3://paid-qubole/ShellDemo/data/excite-small.sh\",\n parameters=\"param1 param2\",\n trigger_rule=\"all_done\",\n dag=dag)\n\nt6.set_upstream(branching)\nt7.set_upstream(t6)\nt7.set_downstream(join)\n\n\nt8 = QuboleOperator(\n task_id='db_query',\n command_type='dbtapquerycmd',\n query='show tables',\n db_tap_id=2064,\n dag=dag)\n\nt9 = QuboleOperator(\n task_id='db_export',\n command_type='dbexportcmd',\n mode=1,\n hive_table='default_qubole_airline_origin_destination',\n db_table='exported_airline_origin_destination',\n partition_spec='dt=20110104-02',\n dbtap_id=2064,\n trigger_rule=\"all_done\",\n dag=dag)\n\nt8.set_upstream(branching)\nt9.set_upstream(t8)\nt9.set_downstream(join)\n\n\nt10 = QuboleOperator(\n task_id='db_import',\n command_type='dbimportcmd',\n mode=1,\n hive_table='default_qubole_airline_origin_destination',\n db_table='exported_airline_origin_destination',\n where_clause='id < 10',\n db_parallelism=2,\n dbtap_id=2064,\n trigger_rule=\"all_done\",\n dag=dag)\n\nprog = '''\nimport scala.math.random\n\nimport org.apache.spark._\n\n/** Computes an approximation to pi */\nobject SparkPi {\n def main(args: Array[String]) {\n val conf = new SparkConf().setAppName(\"Spark Pi\")\n val spark = new SparkContext(conf)\n val slices = if (args.length > 0) args(0).toInt else 2\n val n = math.min(100000L * slices, Int.MaxValue).toInt // avoid overflow\n val count = spark.parallelize(1 until n, slices).map { i =>\n val x = random * 2 - 1\n val y = random * 2 - 1\n if (x*x + y*y < 1) 1 else 0\n }.reduce(_ + _)\n println(\"Pi is roughly \" + 4.0 * count / n)\n spark.stop()\n }\n}\n'''\n\nt11 = QuboleOperator(\n task_id='spark_cmd',\n command_type=\"sparkcmd\",\n program=prog,\n language='python',\n arguments='--class SparkPi',\n tags='aiflow_example_run',\n dag=dag)\n\nt11.set_upstream(branching)\nt11.set_downstream(t10)\nt10.set_downstream(join)\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def compare_result(ds, **kwargs):\n ti = kwargs['ti']\n r1 = t1.get_results(ti)\n r2 = t2.get_results(ti)\n return filecmp.cmp(r1, r2)", "metadata": "root.compare_result", "header": "['module', '___EOS___']", "index": 21 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "airflow_", "import_", "DAG", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "airflow_", "._", "operators_", "import_", "Du", "mm", "y", "Operator_", ",_", "Pyth", "on", "Operator_", ",_", "Branc", "h", "Pyth", "on", "Operator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "airflow_", "._", "contrib_", "._", "operators_", "import_", "Qu", "bol", "e", "Operator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", ",_", "timedelta_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "filec", "mp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "seven", "\\u", "day", "s", "\\u", "ago_", "=_", "datetime_", "._", "combine_", "(_", "datetime_", "._", "today_", "(_", ")_", "-_", "timedelta_", "(_", "7_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datetime_", "._", "min_", "._", "time_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "args_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "owner", "'_", ":_", "'", "airf", "low", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "depend", "s", "\\u", "on", "\\u", "past", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "\\u", "date", "'_", ":_", "seven", "\\u", "day", "s", "\\u", "ago_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "[_", "'", "airf", "low", "@", "airf", "low", ".", "com", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "\\u", "on", "\\u", "fail", "ure", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "\\u", "on", "\\u", "retr", "y", "'_", ":_", "False_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dag_", "=_", "DAG", "_", "(_", "'", "example", "\\u", "qu", "bol", "e\\u", "opera", "tor", "'_", ",_", "default", "\\u", "args_", "=_", "default", "\\u", "args_", ")_", "\\u\\u\\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_", "t1_", "=_", "Qu", "bol", "e", "Operator_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "id_", "=_", "'", "hive", "\\u", "show", "\\u", "table", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "command", "\\u", "type_", "=_", "'", "hive", "cmd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "'", "show", " ", "tables", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "\\u", "label_", "=_", "'", "default", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fetch", "\\u", "logs_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tags_", "=_", "'", "aif", "low", "\\u", "example", "\\u", "run", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dag_", "=_", "dag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t2_", "=_", "Qu", "bol", "e", "Operator_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "id_", "=_", "'", "hive", "\\u", "s3", "\\u", "location", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "command", "\\u", "type_", "=_", "\"", "hive", "cmd", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "script", "\\u", "location_", "=_", "\"", "s3", "n", "://", "dev", ".", "can", "opy", "data", ".", "com", "/", "airf", "low", "/", "show", "\\u", "table", ".", "hq", "l", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "not", "fi", "y_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tags_", "=_", "'", "aif", "low", "\\u", "example", "\\u", "run", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "trigger", "\\u", "rule_", "=_", "\"", "all", "\\u", "don", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dag_", "=_", "dag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t3_", "=_", "Pyth", "on", "Operator_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "id_", "=_", "'", "compare", "\\u", "result", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "provide", "\\u", "context_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "python", "\\u", "callable_", "=_", "compare", "\\u", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "trigger", "\\u", "rule_", "=_", "\"", "all", "\\u", "don", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dag_", "=_", "dag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t3_", "._", "set\\u", "upstream_", "(_", "t1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t3_", "._", "set\\u", "upstream_", "(_", "t2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "[_", "'", "hadoop", "\\u", "jar", "\\u", "cmd", "'_", ",_", "'", "prest", "o", "\\u", "cmd", "'_", ",_", "'", "db", "\\u", "query", "'_", ",_", "'", "spark", "\\u", "cmd", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "branch", "ing_", "=_", "Branc", "h", "Pyth", "on", "Operator_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "id_", "=_", "'", "branch", "ing", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "python", "\\u", "callable_", "=_", "lambda_", ":_", "random_", "._", "choice_", "(_", "options_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dag_", "=_", "dag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch", "ing_", "._", "set\\u", "upstream_", "(_", "t3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "join_", "=_", "Du", "mm", "y", "Operator_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "id_", "=_", "'", "join", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "trigger", "\\u", "rule_", "=_", "'", "one", "\\u", "success", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dag_", "=_", "dag_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t4_", "=_", "Qu", "bol", "e", "Operator_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "id_", "=_", "'", "hadoop", "\\u", "jar", "\\u", "cmd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "command", "\\u", "type_", "=_", "'", "hadoop", "cmd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "sub\\u", "command_", "=_", "'", "jar", " ", "s3", "://", "paid", "-", "qu", "bol", "e", "/", "Had", "oop", "API", "Exam", "ples", "/", "jars", "/", "hadoop", "-0", ".2", "0.", "1", "-", "dev", "-", "stream", "ing", ".", "jar", " ", "-", "mapper", " ", "wc", " ", "-", "num", "Reduce", "Task", "s", " ", "0", " ", "-", "input", " ", "s3", "://", "paid", "-", "qu", "bol", "e", "/", "Had", "oop", "API", "Test", "s", "/", "data", "/", "3", ".", "tsv", " ", "-", "output", " ", "s3", "://", "paid", "-", "qu", "bol", "e", "/", "Had", "oop", "API", "Test", "s", "/", "data", "/", "3", "\\u", "wc", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cluster", "\\u", "label_", "=_", "'", "default", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fetch", "\\u", "logs_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dag_", "=_", "dag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t5", "_", "=_", "Qu", "bol", "e", "Operator_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "id_", "=_", "'", "pig", "\\u", "cmd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "command", "\\u", "type_", "=_", "\"", "pig", "cmd", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "script", "\\u", "location_", "=_", "\"", "s3", "://", "paid", "-", "qu", "bol", "e", "/", "Pi", "g", "API", "Demo", "/", "scripts", "/", "script", "1", "-", "hadoop", "-", "s3", "-", "small", ".", "pig", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parameters_", "=_", "\"", "key", "1", "=", "value", "1", " ", "key", "2", "=", "value", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "trigger", "\\u", "rule_", "=_", "\"", "all", "\\u", "don", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dag_", "=_", "dag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t4_", "._", "set\\u", "upstream_", "(_", "branch", "ing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t5", "_", "._", "set\\u", "upstream_", "(_", "t4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t5", "_", "._", "set\\u", "downstream", "_", "(_", "join_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t6", "_", "=_", "Qu", "bol", "e", "Operator_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "id_", "=_", "'", "prest", "o", "\\u", "cmd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "command", "\\u", "type_", "=_", "'", "prest", "oc", "md", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "'", "show", " ", "tables", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dag_", "=_", "dag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t", "7_", "=_", "Qu", "bol", "e", "Operator_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "id_", "=_", "'", "shell", "\\u", "cmd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "command", "\\u", "type_", "=_", "\"", "shellc", "md", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "script", "\\u", "location_", "=_", "\"", "s3", "://", "paid", "-", "qu", "bol", "e", "/", "Shel", "l", "Demo", "/", "data", "/", "excit", "e-", "small", ".", "sh", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parameters_", "=_", "\"", "param", "1", " ", "param", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "trigger", "\\u", "rule_", "=_", "\"", "all", "\\u", "don", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dag_", "=_", "dag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t6", "_", "._", "set\\u", "upstream_", "(_", "branch", "ing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "7_", "._", "set\\u", "upstream_", "(_", "t6", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "7_", "._", "set\\u", "downstream", "_", "(_", "join_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t", "8_", "=_", "Qu", "bol", "e", "Operator_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "id_", "=_", "'", "db", "\\u", "query", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "command", "\\u", "type_", "=_", "'", "dbt", "ap", "query", "cmd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "'", "show", " ", "tables", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "tap", "\\u", "id_", "=_", "206", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dag_", "=_", "dag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t", "9_", "=_", "Qu", "bol", "e", "Operator_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "id_", "=_", "'", "db", "\\u", "export", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "command", "\\u", "type_", "=_", "'", "dbe", "xpo", "rtc", "md", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hive", "\\u", "table_", "=_", "'", "default", "\\u", "qu", "bol", "e\\u", "air", "line", "\\u", "orig", "in", "\\u", "destinat", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "table_", "=_", "'", "exported", "\\u", "air", "line", "\\u", "orig", "in", "\\u", "destinat", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "partit", "ion", "\\u", "spec_", "=_", "'", "dt", "=", "2011", "010", "4", "-0", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbt", "ap", "\\u", "id_", "=_", "206", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "trigger", "\\u", "rule_", "=_", "\"", "all", "\\u", "don", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dag_", "=_", "dag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t", "8_", "._", "set\\u", "upstream_", "(_", "branch", "ing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "9_", "._", "set\\u", "upstream_", "(_", "t", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "9_", "._", "set\\u", "downstream", "_", "(_", "join_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t1", "0_", "=_", "Qu", "bol", "e", "Operator_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "id_", "=_", "'", "db", "\\u", "import", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "command", "\\u", "type_", "=_", "'", "dbi", "mpor", "tc", "md", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mode_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hive", "\\u", "table_", "=_", "'", "default", "\\u", "qu", "bol", "e\\u", "air", "line", "\\u", "orig", "in", "\\u", "destinat", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "table_", "=_", "'", "exported", "\\u", "air", "line", "\\u", "orig", "in", "\\u", "destinat", "ion", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "where", "\\u", "clause_", "=_", "'", "id", " ", "<", " ", "10", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "parallelism", "_", "=_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dbt", "ap", "\\u", "id_", "=_", "206", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "trigger", "\\u", "rule_", "=_", "\"", "all", "\\u", "don", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dag_", "=_", "dag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prog_", "=_", "'''", "\\", "10", ";", "import", " ", "scala", ".", "math", ".", "random", "\\", "10", ";", "\\", "10", ";", "import", " ", "org", ".", "apa", "che", ".", "spark", ".\\u", "\\", "10", ";", "\\", "10", ";", "/**", " ", "Compute", "s", " ", "an", " ", "approx", "imat", "ion", " ", "to", " ", "pi", " ", "*/", "\\", "10", ";", "object", " ", "Spar", "k", "Pi", " ", "{", "\\", "10", ";", " ", " ", "def", " ", "main", "(", "args", ":", " ", "Array", "[", "String", "])", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "val", " ", "conf", " ", "=", " ", "new", " ", "Spar", "k", "Conf", "()", ".", "set", "App", "Name", "(\"", "Spar", "k", " ", "Pi", "\")", "\\", "10", ";", " ", " ", " ", " ", "val", " ", "spark", " ", "=", " ", "new", " ", "Spar", "k", "Context", "(", "conf", ")", "\\", "10", ";", " ", " ", " ", " ", "val", " ", "slice", "s", " ", "=", " ", "if", " ", "(", "args", ".", "length", " ", ">", " ", "0", ")", " ", "args", "(", "0", ").", "to", "Int", " ", "else", " ", "2", "\\", "10", ";", " ", " ", " ", " ", "val", " ", "n", " ", "=", " ", "math", ".", "min", "(", "100000", "L", " ", "*", " ", "slice", "s", ",", " ", "Int", ".", "Max", "Value", ").", "to", "Int", " ", "//", " ", "avoid", " ", "overflow", "\\", "10", ";", " ", " ", " ", " ", "val", " ", "count", " ", "=", " ", "spark", ".", "paralleliz", "e", "(", "1", " ", "unti", "l", " ", "n", ",", " ", "slice", "s", ").", "map", " ", "{", " ", "i", " ", "=>", "\\", "10", ";", " ", " ", "val", " ", "x", " ", "=", " ", "random", " ", "*", " ", "2", " ", "-", " ", "1", "\\", "10", ";", " ", " ", "val", " ", "y", " ", "=", " ", "random", " ", "*", " ", "2", " ", "-", " ", "1", "\\", "10", ";", " ", " ", "if", " ", "(", "x", "*", "x", " ", "+", " ", "y", "*", "y", " ", "<", " ", "1", ")", " ", "1", " ", "else", " ", "0", "\\", "10", ";", " ", " ", " ", " ", "}.", "reduce", "(\\u", " ", "+", " ", "\\u)", "\\", "10", ";", " ", " ", " ", " ", "println", "(\"", "Pi", " ", "is", " ", "rough", "ly", " ", "\"", " ", "+", " ", "4.0", " ", "*", " ", "count", " ", "/", " ", "n", ")", "\\", "10", ";", " ", " ", " ", " ", "spark", ".", "stop", "()", "\\", "10", ";", " ", " ", "}", "\\", "10", ";}", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t1", "1_", "=_", "Qu", "bol", "e", "Operator_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "id_", "=_", "'", "spark", "\\u", "cmd", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "command", "\\u", "type_", "=_", "\"", "spark", "cmd", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "program_", "=_", "prog_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "language_", "=_", "'", "python", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "arguments_", "=_", "'--", "class", " ", "Spar", "k", "Pi", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tags_", "=_", "'", "aif", "low", "\\u", "example", "\\u", "run", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dag_", "=_", "dag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t1", "1_", "._", "set\\u", "upstream_", "(_", "branch", "ing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1", "1_", "._", "set\\u", "downstream", "_", "(_", "t1", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t1", "0_", "._", "set\\u", "downstream", "_", "(_", "join_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compare", "\\u", "result_", "(_", "ds_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ti_", "=_", "kwargs_", "[_", "'", "ti", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r1_", "=_", "t1_", "._", "get", "\\u", "results_", "(_", "ti_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r2_", "=_", "t2_", "._", "get", "\\u", "results_", "(_", "ti_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "filec", "mp_", "._", "cmp_", "(_", "r1_", ",_", "r2_", ")_", "\\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,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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, 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
home-assistant/home-assistant/homeassistant/components/binary_sensor/mysensors.py
[ { "content": " @property\n def should_poll(self):\n \"\"\"Mysensor gateway pushes its state to HA.\"\"\"\n return False", "metadata": "root.MySensorsBinarySensor.should_poll", "header": "['class', 'MySensorsBinarySensor', '(', 'BinarySensorDevice', ')', ':', '___EOS___']", "index": 89 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "My", "Sensors", "Bin", "ary", "Sensor_", "(_", "Bin", "ary", "Sen", "sor", "Device_", ")_", ":_", "\\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_", "shou", "ld", "\\u", "poll_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Mys", "ens", "or", " ", "gateway", " ", "pushe", "s", " ", "its", " ", "state", " ", "to", " ", "HA", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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 ]
Unreachable code
ardekantur/pyglet/pyglet/media/drivers/openal/lib_openal.py
[ { "content": "# ----------------------------------------------------------------------------\n# pyglet\n# Copyright (c) 2006-2008 Alex Holkner\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 \n# are met:\n#\n# * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n# * Redistributions in binary form must reproduce the above copyright \n# notice, this list of conditions and the following disclaimer in\n# the documentation and/or other materials provided with the\n# distribution.\n# * Neither the name of pyglet nor the names of its\n# contributors may be used to endorse or promote products\n# derived from this software without specific prior written\n# permission.\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\n# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n# POSSIBILITY OF SUCH DAMAGE.\n# ----------------------------------------------------------------------------\n'''Wrapper for openal\n\nGenerated with:\n../tools/wraptypes/wrap.py /usr/include/AL/al.h -lopenal -olib_openal.py\n\n.. Hacked to remove non-existent library functions.\n\nTODO add alGetError check.\n\n.. alListener3i and alListeneriv are present in my OS X 10.4 but not another\n10.4 user's installation. They've also been removed for compatibility.\n'''\n\n__docformat__ = 'restructuredtext'\n__version__ = '$Id$'\n\nimport ctypes\nfrom ctypes import *\nimport sys\n\nimport pyglet.lib\n\n_lib = pyglet.lib.load_library('openal', win32='openal32',\n framework='/System/Library/Frameworks/OpenAL.framework')\n\n_int_types = (c_int16, c_int32)\nif hasattr(ctypes, 'c_int64'):\n # Some builds of ctypes apparently do not have c_int64\n # defined; it's a pretty good bet that these builds do not\n # have 64-bit pointers.\n _int_types += (ctypes.c_int64,)\nfor t in _int_types:\n if sizeof(t) == sizeof(c_size_t):\n c_ptrdiff_t = t\n\n\n\n\nAL_API = 0 \t# /usr/include/AL/al.h:39\nALAPI = 0 \t# /usr/include/AL/al.h:59\nAL_INVALID = -1 \t# /usr/include/AL/al.h:61\nAL_ILLEGAL_ENUM = 0 \t# /usr/include/AL/al.h:62\nAL_ILLEGAL_COMMAND = 0 \t# /usr/include/AL/al.h:63\nALboolean = c_int \t# Better return type than c_char, as generated\nALchar = c_char \t# /usr/include/AL/al.h:73\nALbyte = c_char \t# /usr/include/AL/al.h:76\nALubyte = c_ubyte \t# /usr/include/AL/al.h:79\nALshort = c_short \t# /usr/include/AL/al.h:82\nALushort = c_ushort \t# /usr/include/AL/al.h:85\nALint = c_int \t# /usr/include/AL/al.h:88\nALuint = c_uint \t# /usr/include/AL/al.h:91\nALsizei = c_int \t# /usr/include/AL/al.h:94\nALenum = c_int \t# /usr/include/AL/al.h:97\nALfloat = c_float \t# /usr/include/AL/al.h:100\nALdouble = c_double \t# /usr/include/AL/al.h:103\nALvoid = None \t# /usr/include/AL/al.h:106\nAL_NONE = 0 \t# /usr/include/AL/al.h:112\nAL_FALSE = 0 \t# /usr/include/AL/al.h:115\nAL_TRUE = 1 \t# /usr/include/AL/al.h:118\nAL_SOURCE_RELATIVE = 514 \t# /usr/include/AL/al.h:121\nAL_CONE_INNER_ANGLE = 4097 \t# /usr/include/AL/al.h:130\nAL_CONE_OUTER_ANGLE = 4098 \t# /usr/include/AL/al.h:137\nAL_PITCH = 4099 \t# /usr/include/AL/al.h:145\nAL_POSITION = 4100 \t# /usr/include/AL/al.h:157\nAL_DIRECTION = 4101 \t# /usr/include/AL/al.h:160\nAL_VELOCITY = 4102 \t# /usr/include/AL/al.h:163\nAL_LOOPING = 4103 \t# /usr/include/AL/al.h:171\nAL_BUFFER = 4105 \t# /usr/include/AL/al.h:178\nAL_GAIN = 4106 \t# /usr/include/AL/al.h:191\nAL_MIN_GAIN = 4109 \t# /usr/include/AL/al.h:200\nAL_MAX_GAIN = 4110 \t# /usr/include/AL/al.h:209\nAL_ORIENTATION = 4111 \t# /usr/include/AL/al.h:216\nAL_SOURCE_STATE = 4112 \t# /usr/include/AL/al.h:221\nAL_INITIAL = 4113 \t# /usr/include/AL/al.h:222\nAL_PLAYING = 4114 \t# /usr/include/AL/al.h:223\nAL_PAUSED = 4115 \t# /usr/include/AL/al.h:224\nAL_STOPPED = 4116 \t# /usr/include/AL/al.h:225\nAL_BUFFERS_QUEUED = 4117 \t# /usr/include/AL/al.h:230\nAL_BUFFERS_PROCESSED = 4118 \t# /usr/include/AL/al.h:231\nAL_SEC_OFFSET = 4132 \t# /usr/include/AL/al.h:236\nAL_SAMPLE_OFFSET = 4133 \t# /usr/include/AL/al.h:237\nAL_BYTE_OFFSET = 4134 \t# /usr/include/AL/al.h:238\nAL_SOURCE_TYPE = 4135 \t# /usr/include/AL/al.h:246\nAL_STATIC = 4136 \t# /usr/include/AL/al.h:247\nAL_STREAMING = 4137 \t# /usr/include/AL/al.h:248\nAL_UNDETERMINED = 4144 \t# /usr/include/AL/al.h:249\nAL_FORMAT_MONO8 = 4352 \t# /usr/include/AL/al.h:252\nAL_FORMAT_MONO16 = 4353 \t# /usr/include/AL/al.h:253\nAL_FORMAT_STEREO8 = 4354 \t# /usr/include/AL/al.h:254\nAL_FORMAT_STEREO16 = 4355 \t# /usr/include/AL/al.h:255\nAL_REFERENCE_DISTANCE = 4128 \t# /usr/include/AL/al.h:265\nAL_ROLLOFF_FACTOR = 4129 \t# /usr/include/AL/al.h:273\nAL_CONE_OUTER_GAIN = 4130 \t# /usr/include/AL/al.h:282\nAL_MAX_DISTANCE = 4131 \t# /usr/include/AL/al.h:292\nAL_FREQUENCY = 8193 \t# /usr/include/AL/al.h:300\nAL_BITS = 8194 \t# /usr/include/AL/al.h:301\nAL_CHANNELS = 8195 \t# /usr/include/AL/al.h:302\nAL_SIZE = 8196 \t# /usr/include/AL/al.h:303\nAL_UNUSED = 8208 \t# /usr/include/AL/al.h:310\nAL_PENDING = 8209 \t# /usr/include/AL/al.h:311\nAL_PROCESSED = 8210 \t# /usr/include/AL/al.h:312\nAL_NO_ERROR = 0 \t# /usr/include/AL/al.h:316\nAL_INVALID_NAME = 40961 \t# /usr/include/AL/al.h:321\nAL_INVALID_ENUM = 40962 \t# /usr/include/AL/al.h:326\nAL_INVALID_VALUE = 40963 \t# /usr/include/AL/al.h:331\nAL_INVALID_OPERATION = 40964 \t# /usr/include/AL/al.h:336\nAL_OUT_OF_MEMORY = 40965 \t# /usr/include/AL/al.h:342\nAL_VENDOR = 45057 \t# /usr/include/AL/al.h:346\nAL_VERSION = 45058 \t# /usr/include/AL/al.h:347\nAL_RENDERER = 45059 \t# /usr/include/AL/al.h:348\nAL_EXTENSIONS = 45060 \t# /usr/include/AL/al.h:349\nAL_DOPPLER_FACTOR = 49152 \t# /usr/include/AL/al.h:356\nAL_DOPPLER_VELOCITY = 49153 \t# /usr/include/AL/al.h:361\nAL_SPEED_OF_SOUND = 49155 \t# /usr/include/AL/al.h:366\nAL_DISTANCE_MODEL = 53248 \t# /usr/include/AL/al.h:375\nAL_INVERSE_DISTANCE = 53249 \t# /usr/include/AL/al.h:376\nAL_INVERSE_DISTANCE_CLAMPED = 53250 \t# /usr/include/AL/al.h:377\nAL_LINEAR_DISTANCE = 53251 \t# /usr/include/AL/al.h:378\nAL_LINEAR_DISTANCE_CLAMPED = 53252 \t# /usr/include/AL/al.h:379\nAL_EXPONENT_DISTANCE = 53253 \t# /usr/include/AL/al.h:380\nAL_EXPONENT_DISTANCE_CLAMPED = 53254 \t# /usr/include/AL/al.h:381\n# /usr/include/AL/al.h:386\nalEnable = _lib.alEnable\nalEnable.restype = None\nalEnable.argtypes = [ALenum]\n\n# /usr/include/AL/al.h:388\nalDisable = _lib.alDisable\nalDisable.restype = None\nalDisable.argtypes = [ALenum]\n\n# /usr/include/AL/al.h:390\nalIsEnabled = _lib.alIsEnabled\nalIsEnabled.restype = ALboolean\nalIsEnabled.argtypes = [ALenum]\n\n# /usr/include/AL/al.h:396\nalGetString = _lib.alGetString\nalGetString.restype = POINTER(ALchar)\nalGetString.argtypes = [ALenum]\n\n# /usr/include/AL/al.h:398\nalGetBooleanv = _lib.alGetBooleanv\nalGetBooleanv.restype = None\nalGetBooleanv.argtypes = [ALenum, POINTER(ALboolean)]\n\n# /usr/include/AL/al.h:400\nalGetIntegerv = _lib.alGetIntegerv\nalGetIntegerv.restype = None\nalGetIntegerv.argtypes = [ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:402\nalGetFloatv = _lib.alGetFloatv\nalGetFloatv.restype = None\nalGetFloatv.argtypes = [ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:404\nalGetDoublev = _lib.alGetDoublev\nalGetDoublev.restype = None\nalGetDoublev.argtypes = [ALenum, POINTER(ALdouble)]\n\n# /usr/include/AL/al.h:406\nalGetBoolean = _lib.alGetBoolean\nalGetBoolean.restype = ALboolean\nalGetBoolean.argtypes = [ALenum]\n\n# /usr/include/AL/al.h:408\nalGetInteger = _lib.alGetInteger\nalGetInteger.restype = ALint\nalGetInteger.argtypes = [ALenum]\n\n# /usr/include/AL/al.h:410\nalGetFloat = _lib.alGetFloat\nalGetFloat.restype = ALfloat\nalGetFloat.argtypes = [ALenum]\n\n# /usr/include/AL/al.h:412\nalGetDouble = _lib.alGetDouble\nalGetDouble.restype = ALdouble\nalGetDouble.argtypes = [ALenum]\n\n# /usr/include/AL/al.h:419\nalGetError = _lib.alGetError\nalGetError.restype = ALenum\nalGetError.argtypes = []\n\n# /usr/include/AL/al.h:427\nalIsExtensionPresent = _lib.alIsExtensionPresent\nalIsExtensionPresent.restype = ALboolean\nalIsExtensionPresent.argtypes = [POINTER(ALchar)]\n\n# /usr/include/AL/al.h:429\nalGetProcAddress = _lib.alGetProcAddress\nalGetProcAddress.restype = POINTER(c_void)\nalGetProcAddress.argtypes = [POINTER(ALchar)]\n\n# /usr/include/AL/al.h:431\nalGetEnumValue = _lib.alGetEnumValue\nalGetEnumValue.restype = ALenum\nalGetEnumValue.argtypes = [POINTER(ALchar)]\n\n# /usr/include/AL/al.h:450\nalListenerf = _lib.alListenerf\nalListenerf.restype = None\nalListenerf.argtypes = [ALenum, ALfloat]\n\n# /usr/include/AL/al.h:452\nalListener3f = _lib.alListener3f\nalListener3f.restype = None\nalListener3f.argtypes = [ALenum, ALfloat, ALfloat, ALfloat]\n\n# /usr/include/AL/al.h:454\nalListenerfv = _lib.alListenerfv\nalListenerfv.restype = None\nalListenerfv.argtypes = [ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:456\nalListeneri = _lib.alListeneri\nalListeneri.restype = None\nalListeneri.argtypes = [ALenum, ALint]\n\n# /usr/include/AL/al.h:458\n#alListener3i = _lib.alListener3i\n#alListener3i.restype = None\n#alListener3i.argtypes = [ALenum, ALint, ALint, ALint]\n\n# /usr/include/AL/al.h:460\n#alListeneriv = _lib.alListeneriv\n#alListeneriv.restype = None\n#alListeneriv.argtypes = [ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:465\nalGetListenerf = _lib.alGetListenerf\nalGetListenerf.restype = None\nalGetListenerf.argtypes = [ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:467\nalGetListener3f = _lib.alGetListener3f\nalGetListener3f.restype = None\nalGetListener3f.argtypes = [ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:469\nalGetListenerfv = _lib.alGetListenerfv\nalGetListenerfv.restype = None\nalGetListenerfv.argtypes = [ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:471\nalGetListeneri = _lib.alGetListeneri\nalGetListeneri.restype = None\nalGetListeneri.argtypes = [ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:473\nalGetListener3i = _lib.alGetListener3i\nalGetListener3i.restype = None\nalGetListener3i.argtypes = [ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)]\n\n# /usr/include/AL/al.h:475\nalGetListeneriv = _lib.alGetListeneriv\nalGetListeneriv.restype = None\nalGetListeneriv.argtypes = [ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:512\nalGenSources = _lib.alGenSources\nalGenSources.restype = None\nalGenSources.argtypes = [ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:515\nalDeleteSources = _lib.alDeleteSources\nalDeleteSources.restype = None\nalDeleteSources.argtypes = [ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:518\nalIsSource = _lib.alIsSource\nalIsSource.restype = ALboolean\nalIsSource.argtypes = [ALuint]\n\n# /usr/include/AL/al.h:523\nalSourcef = _lib.alSourcef\nalSourcef.restype = None\nalSourcef.argtypes = [ALuint, ALenum, ALfloat]\n\n# /usr/include/AL/al.h:525\nalSource3f = _lib.alSource3f\nalSource3f.restype = None\nalSource3f.argtypes = [ALuint, ALenum, ALfloat, ALfloat, ALfloat]\n\n# /usr/include/AL/al.h:527\nalSourcefv = _lib.alSourcefv\nalSourcefv.restype = None\nalSourcefv.argtypes = [ALuint, ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:529\nalSourcei = _lib.alSourcei\nalSourcei.restype = None\nalSourcei.argtypes = [ALuint, ALenum, ALint]\n\n# /usr/include/AL/al.h:531\n#alSource3i = _lib.alSource3i\n#alSource3i.restype = None\n#alSource3i.argtypes = [ALuint, ALenum, ALint, ALint, ALint]\n\n# /usr/include/AL/al.h:533\n#alSourceiv = _lib.alSourceiv\n#alSourceiv.restype = None\n#alSourceiv.argtypes = [ALuint, ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:538\nalGetSourcef = _lib.alGetSourcef\nalGetSourcef.restype = None\nalGetSourcef.argtypes = [ALuint, ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:540\nalGetSource3f = _lib.alGetSource3f\nalGetSource3f.restype = None\nalGetSource3f.argtypes = [ALuint, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:542\nalGetSourcefv = _lib.alGetSourcefv\nalGetSourcefv.restype = None\nalGetSourcefv.argtypes = [ALuint, ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:544\nalGetSourcei = _lib.alGetSourcei\nalGetSourcei.restype = None\nalGetSourcei.argtypes = [ALuint, ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:546\n#alGetSource3i = _lib.alGetSource3i\n#alGetSource3i.restype = None\n#alGetSource3i.argtypes = [ALuint, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)]\n\n# /usr/include/AL/al.h:548\nalGetSourceiv = _lib.alGetSourceiv\nalGetSourceiv.restype = None\nalGetSourceiv.argtypes = [ALuint, ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:556\nalSourcePlayv = _lib.alSourcePlayv\nalSourcePlayv.restype = None\nalSourcePlayv.argtypes = [ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:559\nalSourceStopv = _lib.alSourceStopv\nalSourceStopv.restype = None\nalSourceStopv.argtypes = [ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:562\nalSourceRewindv = _lib.alSourceRewindv\nalSourceRewindv.restype = None\nalSourceRewindv.argtypes = [ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:565\nalSourcePausev = _lib.alSourcePausev\nalSourcePausev.restype = None\nalSourcePausev.argtypes = [ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:572\nalSourcePlay = _lib.alSourcePlay\nalSourcePlay.restype = None\nalSourcePlay.argtypes = [ALuint]\n\n# /usr/include/AL/al.h:575\nalSourceStop = _lib.alSourceStop\nalSourceStop.restype = None\nalSourceStop.argtypes = [ALuint]\n\n# /usr/include/AL/al.h:578\nalSourceRewind = _lib.alSourceRewind\nalSourceRewind.restype = None\nalSourceRewind.argtypes = [ALuint]\n\n# /usr/include/AL/al.h:581\nalSourcePause = _lib.alSourcePause\nalSourcePause.restype = None\nalSourcePause.argtypes = [ALuint]\n\n# /usr/include/AL/al.h:586\nalSourceQueueBuffers = _lib.alSourceQueueBuffers\nalSourceQueueBuffers.restype = None\nalSourceQueueBuffers.argtypes = [ALuint, ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:588\nalSourceUnqueueBuffers = _lib.alSourceUnqueueBuffers\nalSourceUnqueueBuffers.restype = None\nalSourceUnqueueBuffers.argtypes = [ALuint, ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:606\nalGenBuffers = _lib.alGenBuffers\nalGenBuffers.restype = None\nalGenBuffers.argtypes = [ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:609\nalDeleteBuffers = _lib.alDeleteBuffers\nalDeleteBuffers.restype = None\nalDeleteBuffers.argtypes = [ALsizei, POINTER(ALuint)]\n\n# /usr/include/AL/al.h:612\nalIsBuffer = _lib.alIsBuffer\nalIsBuffer.restype = ALboolean\nalIsBuffer.argtypes = [ALuint]\n\n# /usr/include/AL/al.h:615\nalBufferData = _lib.alBufferData\nalBufferData.restype = None\nalBufferData.argtypes = [ALuint, ALenum, POINTER(ALvoid), ALsizei, ALsizei]\n\n# /usr/include/AL/al.h:620\nalBufferf = _lib.alBufferf\nalBufferf.restype = None\nalBufferf.argtypes = [ALuint, ALenum, ALfloat]\n\n# /usr/include/AL/al.h:622\nalBuffer3f = _lib.alBuffer3f\nalBuffer3f.restype = None\nalBuffer3f.argtypes = [ALuint, ALenum, ALfloat, ALfloat, ALfloat]\n\n# /usr/include/AL/al.h:624\nalBufferfv = _lib.alBufferfv\nalBufferfv.restype = None\nalBufferfv.argtypes = [ALuint, ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:626\nalBufferi = _lib.alBufferi\nalBufferi.restype = None\nalBufferi.argtypes = [ALuint, ALenum, ALint]\n\n# /usr/include/AL/al.h:628\nalBuffer3i = _lib.alBuffer3i\nalBuffer3i.restype = None\nalBuffer3i.argtypes = [ALuint, ALenum, ALint, ALint, ALint]\n\n# /usr/include/AL/al.h:630\nalBufferiv = _lib.alBufferiv\nalBufferiv.restype = None\nalBufferiv.argtypes = [ALuint, ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:635\nalGetBufferf = _lib.alGetBufferf\nalGetBufferf.restype = None\nalGetBufferf.argtypes = [ALuint, ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:637\nalGetBuffer3f = _lib.alGetBuffer3f\nalGetBuffer3f.restype = None\nalGetBuffer3f.argtypes = [ALuint, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:639\nalGetBufferfv = _lib.alGetBufferfv\nalGetBufferfv.restype = None\nalGetBufferfv.argtypes = [ALuint, ALenum, POINTER(ALfloat)]\n\n# /usr/include/AL/al.h:641\nalGetBufferi = _lib.alGetBufferi\nalGetBufferi.restype = None\nalGetBufferi.argtypes = [ALuint, ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:643\nalGetBuffer3i = _lib.alGetBuffer3i\nalGetBuffer3i.restype = None\nalGetBuffer3i.argtypes = [ALuint, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)]\n\n# /usr/include/AL/al.h:645\nalGetBufferiv = _lib.alGetBufferiv\nalGetBufferiv.restype = None\nalGetBufferiv.argtypes = [ALuint, ALenum, POINTER(ALint)]\n\n# /usr/include/AL/al.h:651\nalDopplerFactor = _lib.alDopplerFactor\nalDopplerFactor.restype = None\nalDopplerFactor.argtypes = [ALfloat]\n\n# /usr/include/AL/al.h:653\nalDopplerVelocity = _lib.alDopplerVelocity\nalDopplerVelocity.restype = None\nalDopplerVelocity.argtypes = [ALfloat]\n\n# /usr/include/AL/al.h:655\nalSpeedOfSound = _lib.alSpeedOfSound\nalSpeedOfSound.restype = None\nalSpeedOfSound.argtypes = [ALfloat]\n\n# /usr/include/AL/al.h:657\nalDistanceModel = _lib.alDistanceModel\nalDistanceModel.restype = None\nalDistanceModel.argtypes = [ALenum]\n\nLPALENABLE = CFUNCTYPE(None, ALenum) \t# /usr/include/AL/al.h:662\nLPALDISABLE = CFUNCTYPE(None, ALenum) \t# /usr/include/AL/al.h:663\nLPALISENABLED = CFUNCTYPE(ALboolean, ALenum) \t# /usr/include/AL/al.h:664\nLPALGETSTRING = CFUNCTYPE(POINTER(ALchar), ALenum) \t# /usr/include/AL/al.h:665\nLPALGETBOOLEANV = CFUNCTYPE(None, ALenum, POINTER(ALboolean)) \t# /usr/include/AL/al.h:666\nLPALGETINTEGERV = CFUNCTYPE(None, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:667\nLPALGETFLOATV = CFUNCTYPE(None, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:668\nLPALGETDOUBLEV = CFUNCTYPE(None, ALenum, POINTER(ALdouble)) \t# /usr/include/AL/al.h:669\nLPALGETBOOLEAN = CFUNCTYPE(ALboolean, ALenum) \t# /usr/include/AL/al.h:670\nLPALGETINTEGER = CFUNCTYPE(ALint, ALenum) \t# /usr/include/AL/al.h:671\nLPALGETFLOAT = CFUNCTYPE(ALfloat, ALenum) \t# /usr/include/AL/al.h:672\nLPALGETDOUBLE = CFUNCTYPE(ALdouble, ALenum) \t# /usr/include/AL/al.h:673\nLPALGETERROR = CFUNCTYPE(ALenum) \t# /usr/include/AL/al.h:674\nLPALISEXTENSIONPRESENT = CFUNCTYPE(ALboolean, POINTER(ALchar)) \t# /usr/include/AL/al.h:675\nLPALGETPROCADDRESS = CFUNCTYPE(POINTER(c_void), POINTER(ALchar)) \t# /usr/include/AL/al.h:676\nLPALGETENUMVALUE = CFUNCTYPE(ALenum, POINTER(ALchar)) \t# /usr/include/AL/al.h:677\nLPALLISTENERF = CFUNCTYPE(None, ALenum, ALfloat) \t# /usr/include/AL/al.h:678\nLPALLISTENER3F = CFUNCTYPE(None, ALenum, ALfloat, ALfloat, ALfloat) \t# /usr/include/AL/al.h:679\nLPALLISTENERFV = CFUNCTYPE(None, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:680\nLPALLISTENERI = CFUNCTYPE(None, ALenum, ALint) \t# /usr/include/AL/al.h:681\nLPALLISTENER3I = CFUNCTYPE(None, ALenum, ALint, ALint, ALint) \t# /usr/include/AL/al.h:682\nLPALLISTENERIV = CFUNCTYPE(None, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:683\nLPALGETLISTENERF = CFUNCTYPE(None, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:684\nLPALGETLISTENER3F = CFUNCTYPE(None, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)) \t# /usr/include/AL/al.h:685\nLPALGETLISTENERFV = CFUNCTYPE(None, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:686\nLPALGETLISTENERI = CFUNCTYPE(None, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:687\nLPALGETLISTENER3I = CFUNCTYPE(None, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)) \t# /usr/include/AL/al.h:688\nLPALGETLISTENERIV = CFUNCTYPE(None, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:689\nLPALGENSOURCES = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:690\nLPALDELETESOURCES = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:691\nLPALISSOURCE = CFUNCTYPE(ALboolean, ALuint) \t# /usr/include/AL/al.h:692\nLPALSOURCEF = CFUNCTYPE(None, ALuint, ALenum, ALfloat) \t# /usr/include/AL/al.h:693\nLPALSOURCE3F = CFUNCTYPE(None, ALuint, ALenum, ALfloat, ALfloat, ALfloat) \t# /usr/include/AL/al.h:694\nLPALSOURCEFV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:695\nLPALSOURCEI = CFUNCTYPE(None, ALuint, ALenum, ALint) \t# /usr/include/AL/al.h:696\nLPALSOURCE3I = CFUNCTYPE(None, ALuint, ALenum, ALint, ALint, ALint) \t# /usr/include/AL/al.h:697\nLPALSOURCEIV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:698\nLPALGETSOURCEF = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:699\nLPALGETSOURCE3F = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)) \t# /usr/include/AL/al.h:700\nLPALGETSOURCEFV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:701\nLPALGETSOURCEI = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:702\nLPALGETSOURCE3I = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)) \t# /usr/include/AL/al.h:703\nLPALGETSOURCEIV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:704\nLPALSOURCEPLAYV = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:705\nLPALSOURCESTOPV = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:706\nLPALSOURCEREWINDV = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:707\nLPALSOURCEPAUSEV = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:708\nLPALSOURCEPLAY = CFUNCTYPE(None, ALuint) \t# /usr/include/AL/al.h:709\nLPALSOURCESTOP = CFUNCTYPE(None, ALuint) \t# /usr/include/AL/al.h:710\nLPALSOURCEREWIND = CFUNCTYPE(None, ALuint) \t# /usr/include/AL/al.h:711\nLPALSOURCEPAUSE = CFUNCTYPE(None, ALuint) \t# /usr/include/AL/al.h:712\nLPALSOURCEQUEUEBUFFERS = CFUNCTYPE(None, ALuint, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:713\nLPALSOURCEUNQUEUEBUFFERS = CFUNCTYPE(None, ALuint, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:714\nLPALGENBUFFERS = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:715\nLPALDELETEBUFFERS = CFUNCTYPE(None, ALsizei, POINTER(ALuint)) \t# /usr/include/AL/al.h:716\nLPALISBUFFER = CFUNCTYPE(ALboolean, ALuint) \t# /usr/include/AL/al.h:717\nLPALBUFFERDATA = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALvoid), ALsizei, ALsizei) \t# /usr/include/AL/al.h:718\nLPALBUFFERF = CFUNCTYPE(None, ALuint, ALenum, ALfloat) \t# /usr/include/AL/al.h:719\nLPALBUFFER3F = CFUNCTYPE(None, ALuint, ALenum, ALfloat, ALfloat, ALfloat) \t# /usr/include/AL/al.h:720\nLPALBUFFERFV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:721\nLPALBUFFERI = CFUNCTYPE(None, ALuint, ALenum, ALint) \t# /usr/include/AL/al.h:722\nLPALBUFFER3I = CFUNCTYPE(None, ALuint, ALenum, ALint, ALint, ALint) \t# /usr/include/AL/al.h:723\nLPALBUFFERIV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:724\nLPALGETBUFFERF = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:725\nLPALGETBUFFER3F = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat), POINTER(ALfloat), POINTER(ALfloat)) \t# /usr/include/AL/al.h:726\nLPALGETBUFFERFV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALfloat)) \t# /usr/include/AL/al.h:727\nLPALGETBUFFERI = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:728\nLPALGETBUFFER3I = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint), POINTER(ALint), POINTER(ALint)) \t# /usr/include/AL/al.h:729\nLPALGETBUFFERIV = CFUNCTYPE(None, ALuint, ALenum, POINTER(ALint)) \t# /usr/include/AL/al.h:730\nLPALDOPPLERFACTOR = CFUNCTYPE(None, ALfloat) \t# /usr/include/AL/al.h:731\nLPALDOPPLERVELOCITY = CFUNCTYPE(None, ALfloat) \t# /usr/include/AL/al.h:732\nLPALSPEEDOFSOUND = CFUNCTYPE(None, ALfloat) \t# /usr/include/AL/al.h:733\nLPALDISTANCEMODEL = CFUNCTYPE(None, ALenum) \t# /usr/include/AL/al.h:734\n\n__all__ = ['AL_API', 'ALAPI', 'AL_INVALID', 'AL_ILLEGAL_ENUM',\n'AL_ILLEGAL_COMMAND', 'ALboolean', 'ALchar', 'ALbyte', 'ALubyte', 'ALshort',\n'ALushort', 'ALint', 'ALuint', 'ALsizei', 'ALenum', 'ALfloat', 'ALdouble',\n'ALvoid', 'AL_NONE', 'AL_FALSE', 'AL_TRUE', 'AL_SOURCE_RELATIVE',\n'AL_CONE_INNER_ANGLE', 'AL_CONE_OUTER_ANGLE', 'AL_PITCH', 'AL_POSITION',\n'AL_DIRECTION', 'AL_VELOCITY', 'AL_LOOPING', 'AL_BUFFER', 'AL_GAIN',\n'AL_MIN_GAIN', 'AL_MAX_GAIN', 'AL_ORIENTATION', 'AL_SOURCE_STATE',\n'AL_INITIAL', 'AL_PLAYING', 'AL_PAUSED', 'AL_STOPPED', 'AL_BUFFERS_QUEUED',\n'AL_BUFFERS_PROCESSED', 'AL_SEC_OFFSET', 'AL_SAMPLE_OFFSET', 'AL_BYTE_OFFSET',\n'AL_SOURCE_TYPE', 'AL_STATIC', 'AL_STREAMING', 'AL_UNDETERMINED',\n'AL_FORMAT_MONO8', 'AL_FORMAT_MONO16', 'AL_FORMAT_STEREO8',\n'AL_FORMAT_STEREO16', 'AL_REFERENCE_DISTANCE', 'AL_ROLLOFF_FACTOR',\n'AL_CONE_OUTER_GAIN', 'AL_MAX_DISTANCE', 'AL_FREQUENCY', 'AL_BITS',\n'AL_CHANNELS', 'AL_SIZE', 'AL_UNUSED', 'AL_PENDING', 'AL_PROCESSED',\n'AL_NO_ERROR', 'AL_INVALID_NAME', 'AL_INVALID_ENUM', 'AL_INVALID_VALUE',\n'AL_INVALID_OPERATION', 'AL_OUT_OF_MEMORY', 'AL_VENDOR', 'AL_VERSION',\n'AL_RENDERER', 'AL_EXTENSIONS', 'AL_DOPPLER_FACTOR', 'AL_DOPPLER_VELOCITY',\n'AL_SPEED_OF_SOUND', 'AL_DISTANCE_MODEL', 'AL_INVERSE_DISTANCE',\n'AL_INVERSE_DISTANCE_CLAMPED', 'AL_LINEAR_DISTANCE',\n'AL_LINEAR_DISTANCE_CLAMPED', 'AL_EXPONENT_DISTANCE',\n'AL_EXPONENT_DISTANCE_CLAMPED', 'alEnable', 'alDisable', 'alIsEnabled',\n'alGetString', 'alGetBooleanv', 'alGetIntegerv', 'alGetFloatv',\n'alGetDoublev', 'alGetBoolean', 'alGetInteger', 'alGetFloat', 'alGetDouble',\n'alGetError', 'alIsExtensionPresent', 'alGetProcAddress', 'alGetEnumValue',\n'alListenerf', 'alListener3f', 'alListenerfv', 'alListeneri', 'alListener3i',\n'alListeneriv', 'alGetListenerf', 'alGetListener3f', 'alGetListenerfv',\n'alGetListeneri', 'alGetListener3i', 'alGetListeneriv', 'alGenSources',\n'alDeleteSources', 'alIsSource', 'alSourcef', 'alSource3f', 'alSourcefv',\n'alSourcei', 'alSource3i', 'alSourceiv', 'alGetSourcef', 'alGetSource3f',\n'alGetSourcefv', 'alGetSourcei', 'alGetSource3i', 'alGetSourceiv',\n'alSourcePlayv', 'alSourceStopv', 'alSourceRewindv', 'alSourcePausev',\n'alSourcePlay', 'alSourceStop', 'alSourceRewind', 'alSourcePause',\n'alSourceQueueBuffers', 'alSourceUnqueueBuffers', 'alGenBuffers',\n'alDeleteBuffers', 'alIsBuffer', 'alBufferData', 'alBufferf', 'alBuffer3f',\n'alBufferfv', 'alBufferi', 'alBuffer3i', 'alBufferiv', 'alGetBufferf',\n'alGetBuffer3f', 'alGetBufferfv', 'alGetBufferi', 'alGetBuffer3i',\n'alGetBufferiv', 'alDopplerFactor', 'alDopplerVelocity', 'alSpeedOfSound',\n'alDistanceModel', 'LPALENABLE', 'LPALDISABLE', 'LPALISENABLED',\n'LPALGETSTRING', 'LPALGETBOOLEANV', 'LPALGETINTEGERV', 'LPALGETFLOATV',\n'LPALGETDOUBLEV', 'LPALGETBOOLEAN', 'LPALGETINTEGER', 'LPALGETFLOAT',\n'LPALGETDOUBLE', 'LPALGETERROR', 'LPALISEXTENSIONPRESENT',\n'LPALGETPROCADDRESS', 'LPALGETENUMVALUE', 'LPALLISTENERF', 'LPALLISTENER3F',\n'LPALLISTENERFV', 'LPALLISTENERI', 'LPALLISTENER3I', 'LPALLISTENERIV',\n'LPALGETLISTENERF', 'LPALGETLISTENER3F', 'LPALGETLISTENERFV',\n'LPALGETLISTENERI', 'LPALGETLISTENER3I', 'LPALGETLISTENERIV',\n'LPALGENSOURCES', 'LPALDELETESOURCES', 'LPALISSOURCE', 'LPALSOURCEF',\n'LPALSOURCE3F', 'LPALSOURCEFV', 'LPALSOURCEI', 'LPALSOURCE3I', 'LPALSOURCEIV',\n'LPALGETSOURCEF', 'LPALGETSOURCE3F', 'LPALGETSOURCEFV', 'LPALGETSOURCEI',\n'LPALGETSOURCE3I', 'LPALGETSOURCEIV', 'LPALSOURCEPLAYV', 'LPALSOURCESTOPV',\n'LPALSOURCEREWINDV', 'LPALSOURCEPAUSEV', 'LPALSOURCEPLAY', 'LPALSOURCESTOP',\n'LPALSOURCEREWIND', 'LPALSOURCEPAUSE', 'LPALSOURCEQUEUEBUFFERS',\n'LPALSOURCEUNQUEUEBUFFERS', 'LPALGENBUFFERS', 'LPALDELETEBUFFERS',\n'LPALISBUFFER', 'LPALBUFFERDATA', 'LPALBUFFERF', 'LPALBUFFER3F',\n'LPALBUFFERFV', 'LPALBUFFERI', 'LPALBUFFER3I', 'LPALBUFFERIV',\n'LPALGETBUFFERF', 'LPALGETBUFFER3F', 'LPALGETBUFFERFV', 'LPALGETBUFFERI',\n'LPALGETBUFFER3I', 'LPALGETBUFFERIV', 'LPALDOPPLERFACTOR',\n'LPALDOPPLERVELOCITY', 'LPALSPEEDOFSOUND', 'LPALDISTANCEMODEL']\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pyglet_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2006", "-", "2008", " ", "Alex", " ", "Hol", "kne", "r_", "\\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", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "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_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyr", "ight", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "the", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "pyg", "let", " ", "nor", " ", "the", " ", "names", " ", "of", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "contributor", "s", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "written_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "permissi", "on", "._", "\\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", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "Wrapper", " ", "for", " ", "opena", "l", "\\", "10", ";", "\\", "10", ";", "Generate", "d", " ", "with", ":", "\\", "10", ";", "..", "/", "tool", "s", "/", "wrap", "types", "/", "wrap", ".", "py", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", " ", "-", "lop", "ena", "l", " ", "-", "oli", "b", "\\u", "opena", "l", ".", "py", "\\", "10", ";", "\\", "10", ";", "..", " ", "Hack", "ed", " ", "to", " ", "remove", " ", "non", "-", "existen", "t", " ", "librar", "y", " ", "function", "s", ".", "\\", "10", ";", "\\", "10", ";", "TOD", "O", " ", "add", " ", "al", "Get", "Error", " ", "check", ".", "\\", "10", ";", "\\", "10", ";", "..", " ", "al", "Listen", "er", "3", "i", " ", "and", " ", "al", "Listen", "eri", "v", " ", "are", " ", "presen", "t", " ", "in", " ", "my", " ", "OS", " ", "X", " ", "10.", "4", " ", "but", " ", "not", " ", "anot", "her", "\\", "10", ";", "10.", "4", " ", "user", "'", "s", " ", "installation", ".", " ", " ", "The", "y", "'", "ve", " ", "als", "o", " ", "bee", "n", " ", "remove", "d", " ", "for", " ", "compatibility", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "docformat", "\\u\\u_", "=_", "'", "restructur", "edt", "ext", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'$", "Id", "$'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "ctypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ctypes_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "pyglet_", "._", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "lib_", "=_", "pyglet_", "._", "lib_", "._", "load", "\\u", "library_", "(_", "'", "opena", "l", "'_", ",_", "win32", "_", "=_", "'", "opena", "l3", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "framework_", "=_", "'/", "System", "/", "Libr", "ary", "/", "Frame", "works", "/", "Open", "AL", ".", "frame", "work", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "int\\u", "types_", "=_", "(_", "c\\u", "int16_", ",_", "c\\u", "int32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "ctypes_", ",_", "'", "c\\u", "int", "64", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Some", " ", "builds", " ", "of", " ", "ctype", "s", " ", "appare", "ntl", "y", " ", "do", " ", "not", " ", "have", " ", "c\\u", "int64_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defin", "ed", ";", " ", "it", "'", "s", " ", "a", " ", "pretty", " ", "good", " ", "bet", " ", "tha", "t", " ", "these", " ", "builds", " ", "do", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "have", " ", "64", "-", "bit", " ", "pointers", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "int\\u", "types_", "+=_", "(_", "ctypes_", "._", "c\\u", "int64_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "t_", "in_", "\\u", "int\\u", "types_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sizeof_", "(_", "t_", ")_", "==_", "sizeof_", "(_", "c\\u", "size", "\\u", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c\\u", "ptr", "diff", "\\u", "t_", "=_", "t_", "\\u\\u\\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_", "AL", "\\u", "API_", "=_", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "39_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "API_", "=_", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "59_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "INVALID", "_", "=_", "-_", "1_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "61_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "ILL", "EGA", "L", "\\u", "ENUM", "_", "=_", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "62_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "ILL", "EGA", "L", "\\u", "COMMAND_", "=_", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "63_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "boolean_", "=_", "c\\u", "int_", "#", " ", "Bet", "ter", " ", "return", " ", "type", " ", "than", " ", "c\\u", "char", ",", " ", "as", " ", "generated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "char_", "=_", "c\\u", "char_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "73_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "byte_", "=_", "c\\u", "char_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "76_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "ubyte_", "=_", "c\\u", "ubyte_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "79_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "short_", "=_", "c\\u", "short_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "82_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "ushort", "_", "=_", "c\\u", "ushort", "_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "85_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "int_", "=_", "c\\u", "int_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "88_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "uint_", "=_", "c\\u", "uint_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "91_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "size", "i_", "=_", "c\\u", "int_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "94_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "enum_", "=_", "c\\u", "int_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "97_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "float_", "=_", "c\\u", "float_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "double_", "=_", "c\\u", "double_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "103_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "void_", "=_", "None_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "106_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "NONE_", "=_", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "112_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "FALSE_", "=_", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "115_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "TRUE_", "=_", "1_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "118_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "SOU", "RC", "E", "\\u", "RELAT", "IVE_", "=_", "514", "_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "121_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "CON", "E", "\\u", "INN", "ER", "\\u", "ANGLE", "_", "=_", "409", "7_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "130_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "CON", "E", "\\u", "OUTE", "R", "\\u", "ANGLE", "_", "=_", "409", "8_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "137_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "PI", "TCH", "_", "=_", "409", "9_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "145_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "POSITION", "_", "=_", "4100", "_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "157_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "DIRECTION", "_", "=_", "410", "1_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "160_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "VEL", "OCI", "TY_", "=_", "410", "2_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "163_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "LOOP", "ING_", "=_", "410", "3_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "171_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "BUFFER_", "=_", "410", "5_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "178_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "GAIN", "_", "=_", "410", "6_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "191_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "MIN", "\\u", "GAIN", "_", "=_", "410", "9_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "200_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "MAX", "\\u", "GAIN", "_", "=_", "411", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "209_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "ORIE", "NTA", "TION_", "=_", "411", "1_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "216_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "SOU", "RC", "E", "\\u", "STATE_", "=_", "4112", "_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "221_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "INITIAL", "_", "=_", "411", "3_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "222_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "PLAY", "ING_", "=_", "411", "4_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "223_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "PAUSE", "D_", "=_", "411", "5_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "224_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "STOPPED", "_", "=_", "411", "6_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "225_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "BUFF", "ERS", "\\u", "QUEUE", "D_", "=_", "411", "7_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "230_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "BUFF", "ERS", "\\u", "PROCESS", "ED_", "=_", "411", "8_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "231_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "SEC", "\\u", "OFFSET_", "=_", "413", "2_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "236_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "SAMPLE", "\\u", "OFFSET_", "=_", "413", "3_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "237_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "BYTE", "\\u", "OFFSET_", "=_", "413", "4_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "238_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "SOU", "RC", "E", "\\u", "TYPE_", "=_", "413", "5_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "246_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "STATI", "C_", "=_", "413", "6_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "247_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "STRE", "AMI", "NG_", "=_", "413", "7_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "248_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "UND", "ET", "ERM", "INE", "D_", "=_", "414", "4_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "249_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "FORMAT", "\\u", "MON", "O", "8_", "=_", "435", "2_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "252_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "FORMAT", "\\u", "MON", "O1", "6_", "=_", "435", "3_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "253_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "FORMAT", "\\u", "STE", "RE", "O", "8_", "=_", "435", "4_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "254_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "FORMAT", "\\u", "STE", "RE", "O1", "6_", "=_", "435", "5_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "255_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "REFERENCE", "\\u", "DISTANCE", "_", "=_", "412", "8_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "265_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "ROLL", "OFF", "\\u", "FACTOR", "_", "=_", "412", "9_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "273", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "CON", "E", "\\u", "OUTE", "R", "\\u", "GAIN", "_", "=_", "413", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "282", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "MAX", "\\u", "DISTANCE", "_", "=_", "413", "1_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "292", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "FREQUENCY", "_", "=_", "819", "3_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "300_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "BITS_", "=_", "819", "4_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "301_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "CHANNELS", "_", "=_", "819", "5_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "302_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "SIZE_", "=_", "819", "6_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "303_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "UN", "USED", "_", "=_", "820", "8_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "310_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "PENDING_", "=_", "820", "9_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "311_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "PROCESS", "ED_", "=_", "821", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "312_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "NO", "\\u", "ERROR_", "=_", "0_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "316", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "INVALID", "\\u", "NAME_", "=_", "409", "61_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "321_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "INVALID", "\\u", "ENUM", "_", "=_", "409", "62_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "326", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "INVALID", "\\u", "VALUE_", "=_", "409", "63_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "331", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "INVALID", "\\u", "OPERATION", "_", "=_", "409", "64_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "336", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "OUT", "\\u", "OF", "\\u", "MEM", "ORY", "_", "=_", "409", "65_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "342", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "VENDOR", "_", "=_", "450", "57_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "346", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "VERSION_", "=_", "450", "58_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "347", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "RENDER", "ER_", "=_", "450", "59_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "348", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "EXTENSIONS_", "=_", "450", "60_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "349", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "DO", "PP", "LER", "\\u", "FACTOR", "_", "=_", "491", "52_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "356", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "DO", "PP", "LER", "\\u", "VEL", "OCI", "TY_", "=_", "491", "53_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "361", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "SPEED", "\\u", "OF", "\\u", "SOUND", "_", "=_", "491", "55_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "366", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "DISTANCE", "\\u", "MODEL_", "=_", "532", "48_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "375_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "INVE", "RSE", "\\u", "DISTANCE", "_", "=_", "532", "49_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "376", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "INVE", "RSE", "\\u", "DISTANCE", "\\u", "CLA", "MPE", "D_", "=_", "532", "50_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "377", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "LINEAR", "\\u", "DISTANCE", "_", "=_", "532", "51_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "378", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "LINEAR", "\\u", "DISTANCE", "\\u", "CLA", "MPE", "D_", "=_", "532", "52_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "379", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "EXP", "ONE", "NT", "\\u", "DISTANCE", "_", "=_", "532", "53_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "380", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AL", "\\u", "EXP", "ONE", "NT", "\\u", "DISTANCE", "\\u", "CLA", "MPE", "D_", "=_", "532", "54_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "381", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "386", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Enable_", "=_", "\\u", "lib_", "._", "al", "Enable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Enable_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Enable_", "._", "argtypes_", "=_", "[_", "AL", "enum_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "388", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Disable_", "=_", "\\u", "lib_", "._", "al", "Disable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Disable_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Disable_", "._", "argtypes_", "=_", "[_", "AL", "enum_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "390", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Is", "Enabled_", "=_", "\\u", "lib_", "._", "al", "Is", "Enabled_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Is", "Enabled_", "._", "restype_", "=_", "AL", "boolean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Is", "Enabled_", "._", "argtypes_", "=_", "[_", "AL", "enum_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "396", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "String_", "=_", "\\u", "lib_", "._", "al", "Get", "String_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "String_", "._", "restype_", "=_", "POINTER_", "(_", "AL", "char_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "String_", "._", "argtypes_", "=_", "[_", "AL", "enum_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "398", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Boo", "lean", "v_", "=_", "\\u", "lib_", "._", "al", "Get", "Boo", "lean", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Boo", "lean", "v_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Boo", "lean", "v_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "boolean_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "400_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Integer", "v_", "=_", "\\u", "lib_", "._", "al", "Get", "Integer", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Integer", "v_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Integer", "v_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "402", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Float", "v_", "=_", "\\u", "lib_", "._", "al", "Get", "Float", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Float", "v_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Float", "v_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "404_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Doub", "lev_", "=_", "\\u", "lib_", "._", "al", "Get", "Doub", "lev_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Doub", "lev_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Doub", "lev_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "double_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "406", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Boolean_", "=_", "\\u", "lib_", "._", "al", "Get", "Boolean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Boolean_", "._", "restype_", "=_", "AL", "boolean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Boolean_", "._", "argtypes_", "=_", "[_", "AL", "enum_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "408", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Integer_", "=_", "\\u", "lib_", "._", "al", "Get", "Integer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Integer_", "._", "restype_", "=_", "AL", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Integer_", "._", "argtypes_", "=_", "[_", "AL", "enum_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "410", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Float_", "=_", "\\u", "lib_", "._", "al", "Get", "Float_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Float_", "._", "restype_", "=_", "AL", "float_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Float_", "._", "argtypes_", "=_", "[_", "AL", "enum_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "412", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Double_", "=_", "\\u", "lib_", "._", "al", "Get", "Double_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Double_", "._", "restype_", "=_", "AL", "double_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Double_", "._", "argtypes_", "=_", "[_", "AL", "enum_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "419", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Error_", "=_", "\\u", "lib_", "._", "al", "Get", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Error_", "._", "restype_", "=_", "AL", "enum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Error_", "._", "argtypes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "427", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Is", "Ext", "ensi", "on", "Present_", "=_", "\\u", "lib_", "._", "al", "Is", "Ext", "ensi", "on", "Present_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Is", "Ext", "ensi", "on", "Present_", "._", "restype_", "=_", "AL", "boolean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Is", "Ext", "ensi", "on", "Present_", "._", "argtypes_", "=_", "[_", "POINTER_", "(_", "AL", "char_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "429", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Proc", "Address_", "=_", "\\u", "lib_", "._", "al", "Get", "Proc", "Address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Proc", "Address_", "._", "restype_", "=_", "POINTER_", "(_", "c\\u", "void_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Proc", "Address_", "._", "argtypes_", "=_", "[_", "POINTER_", "(_", "AL", "char_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "431", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Enum", "Value_", "=_", "\\u", "lib_", "._", "al", "Get", "Enum", "Value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Enum", "Value_", "._", "restype_", "=_", "AL", "enum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Enum", "Value_", "._", "argtypes_", "=_", "[_", "POINTER_", "(_", "AL", "char_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "450_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Listen", "erf", "_", "=_", "\\u", "lib_", "._", "al", "Listen", "erf", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Listen", "erf", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Listen", "erf", "_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "AL", "float_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "452", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Listen", "er", "3f", "_", "=_", "\\u", "lib_", "._", "al", "Listen", "er", "3f", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Listen", "er", "3f", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Listen", "er", "3f", "_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "AL", "float_", ",_", "AL", "float_", ",_", "AL", "float_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "454", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Listen", "erf", "v_", "=_", "\\u", "lib_", "._", "al", "Listen", "erf", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Listen", "erf", "v_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Listen", "erf", "v_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "456_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Listen", "eri", "_", "=_", "\\u", "lib_", "._", "al", "Listen", "eri", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Listen", "eri", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Listen", "eri", "_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "AL", "int_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "458", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Listen", "er", "3", "i", " ", "=", " ", "\\u", "lib", ".", "al", "Listen", "er", "3", "i_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Listen", "er", "3", "i", ".", "rest", "ype", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Listen", "er", "3", "i", ".", "arg", "types", " ", "=", " ", "[", "AL", "enum", ",", " ", "AL", "int", ",", " ", "AL", "int", ",", " ", "AL", "int", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "460", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Listen", "eri", "v", " ", "=", " ", "\\u", "lib", ".", "al", "Listen", "eri", "v_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Listen", "eri", "v", ".", "rest", "ype", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Listen", "eri", "v", ".", "arg", "types", " ", "=", " ", "[", "AL", "enum", ",", " ", "POINTER", "(", "AL", "int", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "465", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Listen", "erf", "_", "=_", "\\u", "lib_", "._", "al", "Get", "Listen", "erf", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "erf", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "erf", "_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "467", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Listen", "er", "3f", "_", "=_", "\\u", "lib_", "._", "al", "Get", "Listen", "er", "3f", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "er", "3f", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "er", "3f", "_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "469", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Listen", "erf", "v_", "=_", "\\u", "lib_", "._", "al", "Get", "Listen", "erf", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "erf", "v_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "erf", "v_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "471", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Listen", "eri", "_", "=_", "\\u", "lib_", "._", "al", "Get", "Listen", "eri", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "eri", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "eri", "_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "473", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Listen", "er", "3", "i_", "=_", "\\u", "lib_", "._", "al", "Get", "Listen", "er", "3", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "er", "3", "i_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "er", "3", "i_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "475", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Listen", "eri", "v_", "=_", "\\u", "lib_", "._", "al", "Get", "Listen", "eri", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "eri", "v_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Listen", "eri", "v_", "._", "argtypes_", "=_", "[_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "512_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Gen", "Sources_", "=_", "\\u", "lib_", "._", "al", "Gen", "Sources_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Gen", "Sources_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Gen", "Sources_", "._", "argtypes_", "=_", "[_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "515", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Delete", "Sources_", "=_", "\\u", "lib_", "._", "al", "Delete", "Sources_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Delete", "Sources_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Delete", "Sources_", "._", "argtypes_", "=_", "[_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "518", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Is", "Source_", "=_", "\\u", "lib_", "._", "al", "Is", "Source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Is", "Source_", "._", "restype_", "=_", "AL", "boolean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Is", "Source_", "._", "argtypes_", "=_", "[_", "AL", "uint_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "523", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "f_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "f_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "f_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "float_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "525", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "3f", "_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "3f", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "3f", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "3f", "_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "float_", ",_", "AL", "float_", ",_", "AL", "float_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "527", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "fv_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "fv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "fv_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "fv_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "529", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "i_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "i_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "i_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "int_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "531", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Sou", "rce", "3", "i", " ", "=", " ", "\\u", "lib", ".", "al", "Sou", "rce", "3", "i_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Sou", "rce", "3", "i", ".", "rest", "ype", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Sou", "rce", "3", "i", ".", "arg", "types", " ", "=", " ", "[", "AL", "uint", ",", " ", "AL", "enum", ",", " ", "AL", "int", ",", " ", "AL", "int", ",", " ", "AL", "int", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "533", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Sou", "rce", "iv", " ", "=", " ", "\\u", "lib", ".", "al", "Sou", "rce", "iv_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Sou", "rce", "iv", ".", "rest", "ype", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Sou", "rce", "iv", ".", "arg", "types", " ", "=", " ", "[", "AL", "uint", ",", " ", "AL", "enum", ",", " ", "POINTER", "(", "AL", "int", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "538", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Sou", "rce", "f_", "=_", "\\u", "lib_", "._", "al", "Get", "Sou", "rce", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "f_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "f_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "540", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Sou", "rce", "3f", "_", "=_", "\\u", "lib_", "._", "al", "Get", "Sou", "rce", "3f", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "3f", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "3f", "_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "542", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Sou", "rce", "fv_", "=_", "\\u", "lib_", "._", "al", "Get", "Sou", "rce", "fv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "fv_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "fv_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "544", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Sou", "rce", "i_", "=_", "\\u", "lib_", "._", "al", "Get", "Sou", "rce", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "i_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "i_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "546", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Get", "Sou", "rce", "3", "i", " ", "=", " ", "\\u", "lib", ".", "al", "Get", "Sou", "rce", "3", "i_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Get", "Sou", "rce", "3", "i", ".", "rest", "ype", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "#", "al", "Get", "Sou", "rce", "3", "i", ".", "arg", "types", " ", "=", " ", "[", "AL", "uint", ",", " ", "AL", "enum", ",", " ", "POINTER", "(", "AL", "int", "),", " ", "POINTER", "(", "AL", "int", "),", " ", "POINTER", "(", "AL", "int", ")]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "548", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Sou", "rce", "iv_", "=_", "\\u", "lib_", "._", "al", "Get", "Sou", "rce", "iv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "iv_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Sou", "rce", "iv_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "556_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Play", "v_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Play", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Play", "v_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Play", "v_", "._", "argtypes_", "=_", "[_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "559", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Sto", "pv_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Sto", "pv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Sto", "pv_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Sto", "pv_", "._", "argtypes_", "=_", "[_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "562", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Re", "wind", "v_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Re", "wind", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Re", "wind", "v_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Re", "wind", "v_", "._", "argtypes_", "=_", "[_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "565", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Pause", "v_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Pause", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Pause", "v_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Pause", "v_", "._", "argtypes_", "=_", "[_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "572", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Play_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Play_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Play_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Play_", "._", "argtypes_", "=_", "[_", "AL", "uint_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "575", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Stop_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Stop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Stop_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Stop_", "._", "argtypes_", "=_", "[_", "AL", "uint_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "578", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Re", "wind_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Re", "wind_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Re", "wind_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Re", "wind_", "._", "argtypes_", "=_", "[_", "AL", "uint_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "581", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Pause", "_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Pause", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Pause", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Pause", "_", "._", "argtypes_", "=_", "[_", "AL", "uint_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "586", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Queue", "Buffers", "_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Queue", "Buffers", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Queue", "Buffers", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Queue", "Buffers", "_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "588", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Sou", "rce", "Un", "queue", "Buffers", "_", "=_", "\\u", "lib_", "._", "al", "Sou", "rce", "Un", "queue", "Buffers", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Un", "queue", "Buffers", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Sou", "rce", "Un", "queue", "Buffers", "_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "606", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Gen", "Buffers", "_", "=_", "\\u", "lib_", "._", "al", "Gen", "Buffers", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Gen", "Buffers", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Gen", "Buffers", "_", "._", "argtypes_", "=_", "[_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "609", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Delete", "Buffers", "_", "=_", "\\u", "lib_", "._", "al", "Delete", "Buffers", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Delete", "Buffers", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Delete", "Buffers", "_", "._", "argtypes_", "=_", "[_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "612", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Is", "Buffer_", "=_", "\\u", "lib_", "._", "al", "Is", "Buffer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Is", "Buffer_", "._", "restype_", "=_", "AL", "boolean_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Is", "Buffer_", "._", "argtypes_", "=_", "[_", "AL", "uint_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "615", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Buffer", "Data_", "=_", "\\u", "lib_", "._", "al", "Buffer", "Data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "Data_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "Data_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "void_", ")_", ",_", "AL", "size", "i_", ",_", "AL", "size", "i_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "620", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Buffer", "f_", "=_", "\\u", "lib_", "._", "al", "Buffer", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "f_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "f_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "float_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "622", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Buffer", "3f", "_", "=_", "\\u", "lib_", "._", "al", "Buffer", "3f", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "3f", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "3f", "_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "float_", ",_", "AL", "float_", ",_", "AL", "float_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "624", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Buffer", "fv_", "=_", "\\u", "lib_", "._", "al", "Buffer", "fv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "fv_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "fv_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "626", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Buffer", "i_", "=_", "\\u", "lib_", "._", "al", "Buffer", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "i_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "i_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "int_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "628", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Buffer", "3", "i_", "=_", "\\u", "lib_", "._", "al", "Buffer", "3", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "3", "i_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "3", "i_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "int_", ",_", "AL", "int_", ",_", "AL", "int_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "630", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Buffer", "iv_", "=_", "\\u", "lib_", "._", "al", "Buffer", "iv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "iv_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Buffer", "iv_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "635", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Buffer", "f_", "=_", "\\u", "lib_", "._", "al", "Get", "Buffer", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "f_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "f_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "637", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Buffer", "3f", "_", "=_", "\\u", "lib_", "._", "al", "Get", "Buffer", "3f", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "3f", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "3f", "_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "639", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Buffer", "fv_", "=_", "\\u", "lib_", "._", "al", "Get", "Buffer", "fv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "fv_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "fv_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "641", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Buffer", "i_", "=_", "\\u", "lib_", "._", "al", "Get", "Buffer", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "i_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "i_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "643", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Buffer", "3", "i_", "=_", "\\u", "lib_", "._", "al", "Get", "Buffer", "3", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "3", "i_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "3", "i_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "645", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Get", "Buffer", "iv_", "=_", "\\u", "lib_", "._", "al", "Get", "Buffer", "iv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "iv_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Get", "Buffer", "iv_", "._", "argtypes_", "=_", "[_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "651", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Do", "ppl", "er", "Factor_", "=_", "\\u", "lib_", "._", "al", "Do", "ppl", "er", "Factor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Do", "ppl", "er", "Factor_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Do", "ppl", "er", "Factor_", "._", "argtypes_", "=_", "[_", "AL", "float_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "653", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Do", "ppl", "er", "Velocity", "_", "=_", "\\u", "lib_", "._", "al", "Do", "ppl", "er", "Velocity", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Do", "ppl", "er", "Velocity", "_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Do", "ppl", "er", "Velocity", "_", "._", "argtypes_", "=_", "[_", "AL", "float_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "655", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Spee", "d", "Of", "Sound_", "=_", "\\u", "lib_", "._", "al", "Spee", "d", "Of", "Sound_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Spee", "d", "Of", "Sound_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Spee", "d", "Of", "Sound_", "._", "argtypes_", "=_", "[_", "AL", "float_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "657", "_", "\\u\\u\\uNL\\u\\u\\u_", "al", "Distan", "ce", "Model_", "=_", "\\u", "lib_", "._", "al", "Distan", "ce", "Model_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Distan", "ce", "Model_", "._", "restype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "Distan", "ce", "Model_", "._", "argtypes_", "=_", "[_", "AL", "enum_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LP", "ALE", "NA", "BLE_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "662", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "DISABLE", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "663", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALI", "SE", "NA", "BL", "ED_", "=_", "CFUNCTYPE_", "(_", "AL", "boolean_", ",_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "664", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "STRING_", "=_", "CFUNCTYPE_", "(_", "POINTER_", "(_", "AL", "char_", ")_", ",_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "665", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "BOOLEAN", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "boolean_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "666_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "INTEG", "ERV", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "667_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "FLOAT", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "668", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "DOUBLE", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "double_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "669", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "BOOLEAN", "_", "=_", "CFUNCTYPE_", "(_", "AL", "boolean_", ",_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "670", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "INTEGER_", "=_", "CFUNCTYPE_", "(_", "AL", "int_", ",_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "671", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "FLOAT_", "=_", "CFUNCTYPE_", "(_", "AL", "float_", ",_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "672", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "DOUBLE_", "=_", "CFUNCTYPE_", "(_", "AL", "double_", ",_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "673", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "ERROR_", "=_", "CFUNCTYPE_", "(_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "674", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALI", "SE", "XT", "ENS", "ION", "PRESENT", "_", "=_", "CFUNCTYPE_", "(_", "AL", "boolean_", ",_", "POINTER_", "(_", "AL", "char_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "675", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "PROC", "ADDRESS_", "=_", "CFUNCTYPE_", "(_", "POINTER_", "(_", "c\\u", "void_", ")_", ",_", "POINTER_", "(_", "AL", "char_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "676", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "ENUM", "VALUE_", "=_", "CFUNCTYPE_", "(_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "char_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "677", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALL", "ISTE", "NER", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "AL", "float_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "678", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALL", "ISTE", "NER", "3", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "AL", "float_", ",_", "AL", "float_", ",_", "AL", "float_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "679", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALL", "ISTE", "NER", "FV", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "680", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALL", "ISTE", "NER", "I_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "AL", "int_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "681", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALL", "ISTE", "NER", "3", "I_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "AL", "int_", ",_", "AL", "int_", ",_", "AL", "int_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "682", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALL", "ISTE", "NER", "IV", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "683", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "LISTEN", "ER", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "684", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "LISTEN", "ER", "3", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "685", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "LISTEN", "ER", "FV", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "686", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "LISTEN", "ERI", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "687", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "LISTEN", "ER", "3", "I_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "688", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "LISTEN", "ERI", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "689", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GEN", "SOURCES", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "690", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "DELET", "ES", "OUR", "CES", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "691", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALI", "SSO", "UR", "CE_", "=_", "CFUNCTYPE_", "(_", "AL", "boolean_", ",_", "AL", "uint_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "692", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "float_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "693", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "3", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "float_", ",_", "AL", "float_", ",_", "AL", "float_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "694", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "FV", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "695", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "I_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "int_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "696", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "3", "I_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "int_", ",_", "AL", "int_", ",_", "AL", "int_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "697", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "IV", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "698", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "SOU", "RC", "EF", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "699", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "SOU", "RC", "E3", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "700_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "SOU", "RC", "EF", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "701", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "SOU", "RC", "EI", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "702", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "SOU", "RC", "E3", "I_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "703", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "SOU", "RC", "EI", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "704", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "PLAY", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "705", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CES", "TOP", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "706", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "RE", "WIND", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "707", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "PAUSE", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "708", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "PLAY", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "709", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CES", "TOP_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "710", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "RE", "WIND", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "711", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "PAUSE", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "712", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "QUEUE", "BUFF", "ERS_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "713", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "OUR", "CE", "UN", "QUEUE", "BUFF", "ERS_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "714", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GEN", "BUFF", "ERS_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "715", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "DELET", "EB", "UFF", "ERS_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "size", "i_", ",_", "POINTER_", "(_", "AL", "uint_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "716", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALI", "SB", "UFF", "ER_", "=_", "CFUNCTYPE_", "(_", "AL", "boolean_", ",_", "AL", "uint_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "717", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALB", "UFF", "ER", "DATA_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "void_", ")_", ",_", "AL", "size", "i_", ",_", "AL", "size", "i_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "718", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALB", "UFF", "ER", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "float_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "719", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALB", "UFF", "ER", "3", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "float_", ",_", "AL", "float_", ",_", "AL", "float_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "720_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALB", "UFF", "ER", "FV", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "721", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALB", "UFF", "ERI", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "int_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "722_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALB", "UFF", "ER", "3", "I_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "AL", "int_", ",_", "AL", "int_", ",_", "AL", "int_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "723", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALB", "UFF", "ERI", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "724", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "BUFF", "ER", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "725", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "BUFF", "ER", "3", "F_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "726", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "BUFF", "ER", "FV", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "float_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "727", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "BUFF", "ERI", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "728", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "BUFF", "ER", "3", "I_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "729", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "GET", "BUFF", "ERI", "V_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "uint_", ",_", "AL", "enum_", ",_", "POINTER_", "(_", "AL", "int_", ")_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "730", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "DO", "PP", "LER", "FACTOR", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "float_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "731", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "DO", "PP", "LER", "VEL", "OCI", "TY_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "float_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "732", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "ALS", "PE", "ED", "OF", "SOUND", "_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "float_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "733", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "AL", "DISTANCE", "MODEL_", "=_", "CFUNCTYPE_", "(_", "None_", ",_", "AL", "enum_", ")_", "#", " ", "/", "usr", "/", "include", "/", "AL", "/", "al", ".", "h", ":", "734", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "[_", "'", "AL", "\\u", "API", "'_", ",_", "'", "AL", "API", "'_", ",_", "'", "AL", "\\u", "INVALID", "'_", ",_", "'", "AL", "\\u", "ILL", "EGA", "L", "\\u", "ENUM", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "ILL", "EGA", "L", "\\u", "COMMA", "ND", "'_", ",_", "'", "AL", "boolean", "'_", ",_", "'", "AL", "char", "'_", ",_", "'", "AL", "byte", "'_", ",_", "'", "AL", "ub", "yte", "'_", ",_", "'", "AL", "short", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "ushort", "'_", ",_", "'", "AL", "int", "'_", ",_", "'", "AL", "uint", "'_", ",_", "'", "AL", "size", "i", "'_", ",_", "'", "AL", "enum", "'_", ",_", "'", "AL", "float", "'_", ",_", "'", "AL", "double", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "voi", "d", "'_", ",_", "'", "AL", "\\u", "NON", "E", "'_", ",_", "'", "AL", "\\u", "FAL", "SE", "'_", ",_", "'", "AL", "\\u", "TRU", "E", "'_", ",_", "'", "AL", "\\u", "SOU", "RC", "E", "\\u", "RELAT", "IV", "E", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "CON", "E", "\\u", "INN", "ER", "\\u", "ANGLE", "'_", ",_", "'", "AL", "\\u", "CON", "E", "\\u", "OUTE", "R", "\\u", "ANGLE", "'_", ",_", "'", "AL", "\\u", "PI", "TCH", "'_", ",_", "'", "AL", "\\u", "POSITION", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "DIRECTION", "'_", ",_", "'", "AL", "\\u", "VEL", "OCI", "TY", "'_", ",_", "'", "AL", "\\u", "LOOP", "ING", "'_", ",_", "'", "AL", "\\u", "BUFF", "ER", "'_", ",_", "'", "AL", "\\u", "GAIN", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "MIN", "\\u", "GAIN", "'_", ",_", "'", "AL", "\\u", "MAX", "\\u", "GAIN", "'_", ",_", "'", "AL", "\\u", "ORIE", "NTA", "TIO", "N", "'_", ",_", "'", "AL", "\\u", "SOU", "RC", "E", "\\u", "STATE", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "INITIAL", "'_", ",_", "'", "AL", "\\u", "PLAY", "ING", "'_", ",_", "'", "AL", "\\u", "PAUSE", "D", "'_", ",_", "'", "AL", "\\u", "STOPPED", "'_", ",_", "'", "AL", "\\u", "BUFF", "ERS", "\\u", "QUEUE", "D", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "BUFF", "ERS", "\\u", "PROCESS", "ED", "'_", ",_", "'", "AL", "\\u", "SEC", "\\u", "OFFSET", "'_", ",_", "'", "AL", "\\u", "SAMPLE", "\\u", "OFFSET", "'_", ",_", "'", "AL", "\\u", "BYTE", "\\u", "OFFSET", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "SOU", "RC", "E", "\\u", "TYPE", "'_", ",_", "'", "AL", "\\u", "STATI", "C", "'_", ",_", "'", "AL", "\\u", "STRE", "AMI", "NG", "'_", ",_", "'", "AL", "\\u", "UND", "ET", "ERM", "INE", "D", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "FORMAT", "\\u", "MON", "O", "8", "'_", ",_", "'", "AL", "\\u", "FORMAT", "\\u", "MON", "O1", "6", "'_", ",_", "'", "AL", "\\u", "FORMAT", "\\u", "STE", "RE", "O", "8", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "FORMAT", "\\u", "STE", "RE", "O1", "6", "'_", ",_", "'", "AL", "\\u", "REFERENCE", "\\u", "DISTANCE", "'_", ",_", "'", "AL", "\\u", "ROLL", "OFF", "\\u", "FACTOR", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "CON", "E", "\\u", "OUTE", "R", "\\u", "GAIN", "'_", ",_", "'", "AL", "\\u", "MAX", "\\u", "DISTANCE", "'_", ",_", "'", "AL", "\\u", "FREQUENCY", "'_", ",_", "'", "AL", "\\u", "BITS", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "CHANNELS", "'_", ",_", "'", "AL", "\\u", "SIZE", "'_", ",_", "'", "AL", "\\u", "UN", "USED", "'_", ",_", "'", "AL", "\\u", "PEND", "ING", "'_", ",_", "'", "AL", "\\u", "PROCESS", "ED", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "NO", "\\u", "ERROR", "'_", ",_", "'", "AL", "\\u", "INVALID", "\\u", "NAME", "'_", ",_", "'", "AL", "\\u", "INVALID", "\\u", "ENUM", "'_", ",_", "'", "AL", "\\u", "INVALID", "\\u", "VALU", "E", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "INVALID", "\\u", "OPERATION", "'_", ",_", "'", "AL", "\\u", "OUT", "\\u", "OF", "\\u", "MEM", "ORY", "'_", ",_", "'", "AL", "\\u", "VENDOR", "'_", ",_", "'", "AL", "\\u", "VERSI", "ON", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "RENDER", "ER", "'_", ",_", "'", "AL", "\\u", "EXTENSION", "S", "'_", ",_", "'", "AL", "\\u", "DO", "PP", "LER", "\\u", "FACTOR", "'_", ",_", "'", "AL", "\\u", "DO", "PP", "LER", "\\u", "VEL", "OCI", "TY", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "SPEED", "\\u", "OF", "\\u", "SOUND", "'_", ",_", "'", "AL", "\\u", "DISTANCE", "\\u", "MODEL", "'_", ",_", "'", "AL", "\\u", "INVE", "RSE", "\\u", "DISTANCE", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "INVE", "RSE", "\\u", "DISTANCE", "\\u", "CLA", "MPE", "D", "'_", ",_", "'", "AL", "\\u", "LINEAR", "\\u", "DISTANCE", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "LINEAR", "\\u", "DISTANCE", "\\u", "CLA", "MPE", "D", "'_", ",_", "'", "AL", "\\u", "EXP", "ONE", "NT", "\\u", "DISTANCE", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AL", "\\u", "EXP", "ONE", "NT", "\\u", "DISTANCE", "\\u", "CLA", "MPE", "D", "'_", ",_", "'", "al", "Enable", "'_", ",_", "'", "al", "Disa", "ble", "'_", ",_", "'", "al", "Is", "Enable", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Get", "String", "'_", ",_", "'", "al", "Get", "Boo", "lean", "v", "'_", ",_", "'", "al", "Get", "Integer", "v", "'_", ",_", "'", "al", "Get", "Float", "v", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Get", "Doub", "lev", "'_", ",_", "'", "al", "Get", "Boo", "lean", "'_", ",_", "'", "al", "Get", "Integer", "'_", ",_", "'", "al", "Get", "Float", "'_", ",_", "'", "al", "Get", "Doub", "le", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Get", "Error", "'_", ",_", "'", "al", "Is", "Ext", "ensi", "on", "Present", "'_", ",_", "'", "al", "Get", "Proc", "Address", "'_", ",_", "'", "al", "Get", "Enum", "Value", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Listen", "erf", "'_", ",_", "'", "al", "Listen", "er", "3f", "'_", ",_", "'", "al", "Listen", "erf", "v", "'_", ",_", "'", "al", "Listen", "eri", "'_", ",_", "'", "al", "Listen", "er", "3", "i", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Listen", "eri", "v", "'_", ",_", "'", "al", "Get", "Listen", "erf", "'_", ",_", "'", "al", "Get", "Listen", "er", "3f", "'_", ",_", "'", "al", "Get", "Listen", "erf", "v", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Get", "Listen", "eri", "'_", ",_", "'", "al", "Get", "Listen", "er", "3", "i", "'_", ",_", "'", "al", "Get", "Listen", "eri", "v", "'_", ",_", "'", "al", "Gen", "Sou", "rce", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Delete", "Sou", "rce", "s", "'_", ",_", "'", "al", "Is", "Sou", "rce", "'_", ",_", "'", "al", "Sou", "rce", "f", "'_", ",_", "'", "al", "Sou", "rce", "3f", "'_", ",_", "'", "al", "Sou", "rce", "fv", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Sou", "rce", "i", "'_", ",_", "'", "al", "Sou", "rce", "3", "i", "'_", ",_", "'", "al", "Sou", "rce", "iv", "'_", ",_", "'", "al", "Get", "Sou", "rce", "f", "'_", ",_", "'", "al", "Get", "Sou", "rce", "3f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Get", "Sou", "rce", "fv", "'_", ",_", "'", "al", "Get", "Sou", "rce", "i", "'_", ",_", "'", "al", "Get", "Sou", "rce", "3", "i", "'_", ",_", "'", "al", "Get", "Sou", "rce", "iv", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Sou", "rce", "Play", "v", "'_", ",_", "'", "al", "Sou", "rce", "Sto", "pv", "'_", ",_", "'", "al", "Sou", "rce", "Re", "wind", "v", "'_", ",_", "'", "al", "Sou", "rce", "Pause", "v", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Sou", "rce", "Play", "'_", ",_", "'", "al", "Sou", "rce", "Sto", "p", "'_", ",_", "'", "al", "Sou", "rce", "Re", "wind", "'_", ",_", "'", "al", "Sou", "rce", "Pause", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Sou", "rce", "Queue", "Buffers", "'_", ",_", "'", "al", "Sou", "rce", "Un", "queue", "Buffers", "'_", ",_", "'", "al", "Gen", "Buffers", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Delete", "Buffers", "'_", ",_", "'", "al", "Is", "Buffer", "'_", ",_", "'", "al", "Buffer", "Data", "'_", ",_", "'", "al", "Buffer", "f", "'_", ",_", "'", "al", "Buffer", "3f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Buffer", "fv", "'_", ",_", "'", "al", "Buffer", "i", "'_", ",_", "'", "al", "Buffer", "3", "i", "'_", ",_", "'", "al", "Buffer", "iv", "'_", ",_", "'", "al", "Get", "Buffer", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Get", "Buffer", "3f", "'_", ",_", "'", "al", "Get", "Buffer", "fv", "'_", ",_", "'", "al", "Get", "Buffer", "i", "'_", ",_", "'", "al", "Get", "Buffer", "3", "i", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Get", "Buffer", "iv", "'_", ",_", "'", "al", "Do", "ppl", "er", "Factor", "'_", ",_", "'", "al", "Do", "ppl", "er", "Velocity", "'_", ",_", "'", "al", "Spee", "d", "Of", "Sound", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "al", "Distan", "ce", "Model", "'_", ",_", "'", "LP", "ALE", "NA", "BL", "E", "'_", ",_", "'", "LP", "AL", "DISABLE", "'_", ",_", "'", "LP", "ALI", "SE", "NA", "BL", "ED", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "STRING", "'_", ",_", "'", "LP", "AL", "GET", "BOOLEAN", "V", "'_", ",_", "'", "LP", "AL", "GET", "INTEG", "ERV", "'_", ",_", "'", "LP", "AL", "GET", "FLOAT", "V", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "DOUBLE", "V", "'_", ",_", "'", "LP", "AL", "GET", "BOOLEAN", "'_", ",_", "'", "LP", "AL", "GET", "INTEG", "ER", "'_", ",_", "'", "LP", "AL", "GET", "FLOAT", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "DOUBLE", "'_", ",_", "'", "LP", "AL", "GET", "ERROR", "'_", ",_", "'", "LP", "ALI", "SE", "XT", "ENS", "ION", "PRESENT", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "PROC", "ADDR", "ESS", "'_", ",_", "'", "LP", "AL", "GET", "ENUM", "VALU", "E", "'_", ",_", "'", "LP", "ALL", "ISTE", "NER", "F", "'_", ",_", "'", "LP", "ALL", "ISTE", "NER", "3", "F", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "ALL", "ISTE", "NER", "FV", "'_", ",_", "'", "LP", "ALL", "ISTE", "NER", "I", "'_", ",_", "'", "LP", "ALL", "ISTE", "NER", "3", "I", "'_", ",_", "'", "LP", "ALL", "ISTE", "NER", "IV", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "LISTEN", "ER", "F", "'_", ",_", "'", "LP", "AL", "GET", "LISTEN", "ER", "3", "F", "'_", ",_", "'", "LP", "AL", "GET", "LISTEN", "ER", "FV", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "LISTEN", "ERI", "'_", ",_", "'", "LP", "AL", "GET", "LISTEN", "ER", "3", "I", "'_", ",_", "'", "LP", "AL", "GET", "LISTEN", "ERI", "V", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GEN", "SOURCES", "'_", ",_", "'", "LP", "AL", "DELET", "ES", "OUR", "CES", "'_", ",_", "'", "LP", "ALI", "SSO", "UR", "CE", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "F", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "ALS", "OUR", "CE", "3", "F", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "FV", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "I", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "3", "I", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "IV", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "SOU", "RC", "EF", "'_", ",_", "'", "LP", "AL", "GET", "SOU", "RC", "E3", "F", "'_", ",_", "'", "LP", "AL", "GET", "SOU", "RC", "EF", "V", "'_", ",_", "'", "LP", "AL", "GET", "SOU", "RC", "EI", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "SOU", "RC", "E3", "I", "'_", ",_", "'", "LP", "AL", "GET", "SOU", "RC", "EI", "V", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "PLAY", "V", "'_", ",_", "'", "LP", "ALS", "OUR", "CES", "TOP", "V", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "ALS", "OUR", "CE", "RE", "WIND", "V", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "PAUSE", "V", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "PLAY", "'_", ",_", "'", "LP", "ALS", "OUR", "CES", "TOP", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "ALS", "OUR", "CE", "RE", "WIND", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "PAUSE", "'_", ",_", "'", "LP", "ALS", "OUR", "CE", "QUEUE", "BUFF", "ERS", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "ALS", "OUR", "CE", "UN", "QUEUE", "BUFF", "ERS", "'_", ",_", "'", "LP", "AL", "GEN", "BUFF", "ERS", "'_", ",_", "'", "LP", "AL", "DELET", "EB", "UFF", "ERS", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "ALI", "SB", "UFF", "ER", "'_", ",_", "'", "LP", "ALB", "UFF", "ER", "DATA", "'_", ",_", "'", "LP", "ALB", "UFF", "ER", "F", "'_", ",_", "'", "LP", "ALB", "UFF", "ER", "3", "F", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "ALB", "UFF", "ER", "FV", "'_", ",_", "'", "LP", "ALB", "UFF", "ERI", "'_", ",_", "'", "LP", "ALB", "UFF", "ER", "3", "I", "'_", ",_", "'", "LP", "ALB", "UFF", "ERI", "V", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "BUFF", "ER", "F", "'_", ",_", "'", "LP", "AL", "GET", "BUFF", "ER", "3", "F", "'_", ",_", "'", "LP", "AL", "GET", "BUFF", "ER", "FV", "'_", ",_", "'", "LP", "AL", "GET", "BUFF", "ERI", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "GET", "BUFF", "ER", "3", "I", "'_", ",_", "'", "LP", "AL", "GET", "BUFF", "ERI", "V", "'_", ",_", "'", "LP", "AL", "DO", "PP", "LER", "FACTOR", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "LP", "AL", "DO", "PP", "LER", "VEL", "OCI", "TY", "'_", ",_", "'", "LP", "ALS", "PE", "ED", "OF", "SOUND", "'_", ",_", "'", "LP", "AL", "DISTANCE", "MODEL", "'_", "]_" ]
[ 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, 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 2, 2, 2, 2 ]
Unused import
nbessi/openerp-conventions/run_tests.py
[ { "content": "# -*- coding: utf-8 -*-\nimport unittest\nimport os\nimport re\nimport sys\nsys.path.insert(0, '.')\n\nV7_TEST_DIR = 'tests.v7'\n\n\n\nif __name__ == \"__main__\":\n suite = collect_tests()\n res = unittest.TextTestRunner(verbosity=1).run(suite)\n # If it was successful, we don't want to exit with code 1\n raise SystemExit(not res.wasSuccessful())\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def collect_tests():\n # list files in directory tests/v7\n # inspired by flake8 source code\n names = os.listdir(V7_TEST_DIR.replace('.', os.path.sep))\n regex = re.compile(\"(?!_+)\\w+\\.py$\")\n join = '.'.join\n # Make a list of the names like 'tests.vx.test_name'\n names = [join([V7_TEST_DIR, f[:-3]]) for f in names if regex.match(f)]\n # we load the testcases as module\n modules = [__import__(name, fromlist=[V7_TEST_DIR]) for name in names]\n suites = [unittest.TestLoader().loadTestsFromModule(m) for m in modules]\n suite = suites.pop()\n for s in suites:\n suite.addTests(s)\n print suite\n return suite", "metadata": "root.collect_tests", "header": "['module', '___EOS___']", "index": 10 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "0_", ",_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "V", "7", "\\u", "TEST", "\\u", "DIR_", "=_", "'", "tests", ".", "v", "7", "'_", "\\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 ", " _", "suite_", "=_", "collect", "\\u", "tests_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "unittest_", "._", "Text", "Test", "Runner_", "(_", "verbosity_", "=_", "1_", ")_", "._", "run_", "(_", "suite_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "it", " ", "was", " ", "success", "ful", ",", " ", "we", " ", "don", "'", "t", " ", "want", " ", "to", " ", "exit", " ", "with", " ", "code", " ", "1_", "\\u\\u\\uNL\\u\\u\\u_", "raise_", "System", "Exit_", "(_", "not_", "res_", "._", "was", "Success", "ful_", "(_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "collect", "\\u", "tests_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "list", " ", "files", " ", "in", " ", "director", "y", " ", "tests", "/", "v", "7_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inspire", "d", " ", "by", " ", "flake", "8", " ", "source", " ", "code_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "names_", "=_", "os_", "._", "listdir_", "(_", "V", "7", "\\u", "TEST", "\\u", "DIR_", "._", "replace_", "(_", "'.'_", ",_", "os_", "._", "path_", "._", "sep_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regex_", "=_", "re_", "._", "compile_", "(_", "\"(?", "!\\u", "+)\\\\", "w", "+\\\\.", "py", "$\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "join_", "=_", "'.'_", "._", "join_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "list", " ", "of", " ", "the", " ", "names", " ", "like", " ", "'", "tests", ".", "vx", ".", "test\\u", "name", "'_", "\\u\\u\\uNL\\u\\u\\u_", "names_", "=_", "[_", "join_", "(_", "[_", "V", "7", "\\u", "TEST", "\\u", "DIR_", ",_", "f_", "[_", ":_", "-_", "3_", "]_", "]_", ")_", "for_", "f_", "in_", "names_", "if_", "regex_", "._", "match_", "(_", "f_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "load", " ", "the", " ", "testcases", " ", "as", " ", "module_", "\\u\\u\\uNL\\u\\u\\u_", "modules_", "=_", "[_", "\\u\\u", "import\\u\\u_", "(_", "name_", ",_", "froml", "ist_", "=_", "[_", "V", "7", "\\u", "TEST", "\\u", "DIR_", "]_", ")_", "for_", "name_", "in_", "names_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suites_", "=_", "[_", "unittest_", "._", "Test", "Loader_", "(_", ")_", "._", "load", "Test", "s", "Fro", "m", "Module_", "(_", "m_", ")_", "for_", "m_", "in_", "modules_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suite_", "=_", "suites_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "s_", "in_", "suites_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suite_", "._", "add", "Tests_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "suite_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "suite_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
mozilla/django-tidings/tidings/tasks.py
[ { "content": "from celery.task import task\n\nfrom tidings.models import Watch\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@task()\ndef claim_watches(user):\n \"\"\"Attach any anonymous watches having a user's email to that user.\n\n Call this from your user registration process if you like.\n\n \"\"\"\n Watch.objects.filter(email=user.email).update(email=None, user=user)", "metadata": "root.claim_watches", "header": "['module', '___EOS___']", "index": 5 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "celery_", "._", "task_", "import_", "task_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "tid", "ings_", "._", "models_", "import_", "Watch", "_", "\\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_", "@_", "task_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "claim", "\\u", "watch", "es_", "(_", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Attach", " ", "any", " ", "anonym", "ous", " ", "watch", "es", " ", "hav", "ing", " ", "a", " ", "user", "'", "s", " ", "email", " ", "to", " ", "tha", "t", " ", "user", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Call", " ", "this", " ", "from", " ", "your", " ", "user", " ", "registration", " ", "process", " ", "if", " ", "you", " ", "like", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Watch", "_", "._", "objects_", "._", "filter_", "(_", "email_", "=_", "user_", "._", "email_", ")_", "._", "update_", "(_", "email_", "=_", "None_", ",_", "user_", "=_", "user_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Testing equality to None
Nordeus/pushkin/pushkin/tests/test_database.py
[ { "content": "def test_message(setup_database):\n # user using serbian language\n database.process_user_login(login_id=12345, language_id=7, platform_id=1, device_id='qwe', device_token='123',\n application_version=1007)\n\n # message with english only translation\n message_1 = database.add_message(message_name='test', language_id=1, message_title='title en',\n message_text='text en')\n localized_message = database.get_localized_message(login_id=12345, message_id=message_1.message_id)\n assert localized_message.message_title == 'title en'\n assert localized_message.message_text == 'text en'\n assert localized_message.language_id == 1\n assert localized_message.message.screen == ''\n\n # adding other translation different from serbian\n message_2 = database.add_message(message_name='test', language_id=0, message_title='title other',\n message_text='text other')\n localized_message = database.get_localized_message(login_id=12345, message_id=message_2.message_id)\n assert localized_message.message_title == 'title en'\n assert localized_message.message_text == 'text en'\n assert localized_message.language_id == 1\n assert localized_message.message.screen == ''\n\n # adding serbian translation\n message_3 = database.add_message(message_name='test', language_id=7, message_title='title sr',\n message_text='text sr')\n localized_message = database.get_localized_message(login_id=12345, message_id=message_3.message_id)\n assert localized_message.message_title == 'title sr'\n assert localized_message.message_text == 'text sr'\n assert localized_message.language_id == 7\n assert localized_message.message.screen == ''\n\n # message with no english neither serbian translation\n bad_message = database.add_message(message_name='test_bad', language_id=0, message_title='title bad',\n message_text='text bad')\n localized_message = database.get_localized_message(login_id=12345, message_id=bad_message.message_id)\n assert localized_message is None\n\n # user doesn't exist\n localized_message = database.get_localized_message(login_id=12346, message_id=message_3.message_id)\n assert localized_message is None\n\n # delete a message\n database.delete_message(message_1.message)\n assert database.get_message('test') is None", "metadata": "root.test_message", "header": "['module', '___EOS___']", "index": 42 } ]
[]
[]
0
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "message_", "(_", "setup", "\\u", "database_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "user", " ", "usi", "ng", " ", "ser", "bian", " ", "language_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "database_", "._", "process", "\\u", "user", "\\u", "login_", "(_", "login", "\\u", "id_", "=_", "12345_", ",_", "language", "\\u", "id_", "=_", "7_", ",_", "platform", "\\u", "id_", "=_", "1_", ",_", "device", "\\u", "id_", "=_", "'", "qwe", "'_", ",_", "device", "\\u", "token_", "=_", "'", "123", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "applica", "tion", "\\u", "version_", "=_", "1007", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "message", " ", "with", " ", "english", " ", "only", " ", "translation_", "\\u\\u\\uNL\\u\\u\\u_", "message", "\\u", "1_", "=_", "database_", "._", "add", "\\u", "message_", "(_", "message", "\\u", "name_", "=_", "'", "test", "'_", ",_", "language", "\\u", "id_", "=_", "1_", ",_", "message", "\\u", "title_", "=_", "'", "title", " ", "en", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message", "\\u", "text_", "=_", "'", "text", " ", "en", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "localized", "\\u", "message_", "=_", "database_", "._", "get", "\\u", "localized", "\\u", "message_", "(_", "login", "\\u", "id_", "=_", "12345_", ",_", "message", "\\u", "id_", "=_", "message", "\\u", "1_", "._", "message", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "message_", "._", "message", "\\u", "title_", "==_", "'", "title", " ", "en", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "message_", "._", "message", "\\u", "text_", "==_", "'", "text", " ", "en", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "message_", "._", "language", "\\u", "id_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "message_", "._", "message_", "._", "screen_", "==_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "addin", "g", " ", "other", " ", "translatio", "n", " ", "different", " ", "from", " ", "ser", "bian", "_", "\\u\\u\\uNL\\u\\u\\u_", "message", "\\u", "2_", "=_", "database_", "._", "add", "\\u", "message_", "(_", "message", "\\u", "name_", "=_", "'", "test", "'_", ",_", "language", "\\u", "id_", "=_", "0_", ",_", "message", "\\u", "title_", "=_", "'", "title", " ", "other", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message", "\\u", "text_", "=_", "'", "text", " ", "other", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "localized", "\\u", "message_", "=_", "database_", "._", "get", "\\u", "localized", "\\u", "message_", "(_", "login", "\\u", "id_", "=_", "12345_", ",_", "message", "\\u", "id_", "=_", "message", "\\u", "2_", "._", "message", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "message_", "._", "message", "\\u", "title_", "==_", "'", "title", " ", "en", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "message_", "._", "message", "\\u", "text_", "==_", "'", "text", " ", "en", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "message_", "._", "language", "\\u", "id_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "message_", "._", "message_", "._", "screen_", "==_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "addin", "g", " ", "ser", "bian", " ", "translation_", "\\u\\u\\uNL\\u\\u\\u_", "message", "\\u", "3_", "=_", "database_", "._", "add", "\\u", "message_", "(_", "message", "\\u", "name_", "=_", "'", "test", "'_", ",_", "language", "\\u", "id_", "=_", "7_", ",_", "message", "\\u", "title_", "=_", "'", "title", " ", "sr", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message", "\\u", "text_", "=_", "'", "text", " ", "sr", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "localized", "\\u", "message_", "=_", "database_", "._", "get", "\\u", "localized", "\\u", "message_", "(_", "login", "\\u", "id_", "=_", "12345_", ",_", "message", "\\u", "id_", "=_", "message", "\\u", "3_", "._", "message", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "message_", "._", "message", "\\u", "title_", "==_", "'", "title", " ", "sr", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "message_", "._", "message", "\\u", "text_", "==_", "'", "text", " ", "sr", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "message_", "._", "language", "\\u", "id_", "==_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "message_", "._", "message_", "._", "screen_", "==_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "message", " ", "with", " ", "no", " ", "english", " ", "nei", "ther", " ", "ser", "bian", " ", "translation_", "\\u\\u\\uNL\\u\\u\\u_", "bad", "\\u", "message_", "=_", "database_", "._", "add", "\\u", "message_", "(_", "message", "\\u", "name_", "=_", "'", "test\\u", "bad", "'_", ",_", "language", "\\u", "id_", "=_", "0_", ",_", "message", "\\u", "title_", "=_", "'", "title", " ", "bad", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message", "\\u", "text_", "=_", "'", "text", " ", "bad", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "localized", "\\u", "message_", "=_", "database_", "._", "get", "\\u", "localized", "\\u", "message_", "(_", "login", "\\u", "id_", "=_", "12345_", ",_", "message", "\\u", "id_", "=_", "bad", "\\u", "message_", "._", "message", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "message_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "user", " ", "doe", "sn", "'", "t", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "localized", "\\u", "message_", "=_", "database_", "._", "get", "\\u", "localized", "\\u", "message_", "(_", "login", "\\u", "id_", "=_", "1234", "6_", ",_", "message", "\\u", "id_", "=_", "message", "\\u", "3_", "._", "message", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "localized", "\\u", "message_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "delete", " ", "a", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "database_", "._", "delete", "\\u", "message_",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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 ]
Except block handles 'BaseException'
zulip/zulip/confirmation/views.py
[ { "content": "def confirm(request, confirmation_key):\n confirmation_key = confirmation_key.lower()\n obj = Confirmation.objects.confirm(confirmation_key)\n confirmed = True\n if not obj:\n # confirmation failed\n confirmed = False\n try:\n # try to get the object we was supposed to confirm\n obj = Confirmation.objects.get(confirmation_key=confirmation_key)\n except Confirmation.DoesNotExist:\n pass\n ctx = {\n 'object': obj,\n 'confirmed': confirmed,\n 'days': getattr(settings, 'EMAIL_CONFIRMATION_DAYS', 10),\n 'key': confirmation_key,\n 'full_name': request.GET.get(\"full_name\", None),\n 'support_email': settings.ZULIP_ADMINISTRATOR,\n 'voyager': settings.VOYAGER\n }\n templates = [\n 'confirmation/confirm.html',\n ]\n if obj:\n # if we have an object, we can use specific template\n templates.insert(0, 'confirmation/confirm_%s.html' % obj._meta.model_name)\n return render_to_response(templates, ctx,\n context_instance=RequestContext(request))", "metadata": "root.confirm", "header": "['module', '___EOS___']", "index": 14 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "confirm_", "(_", "request_", ",_", "confirmation", "\\u", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "confirmation", "\\u", "key_", "=_", "confirmation", "\\u", "key_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "Confirmation", "_", "._", "objects_", "._", "confirm_", "(_", "confirmation", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "confirmed_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "confirmation", " ", "failed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "confirmed_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "try", " ", "to", " ", "get", " ", "the", " ", "object", " ", "we", " ", "was", " ", "supposed", " ", "to", " ", "confirm_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "Confirmation", "_", "._", "objects_", "._", "get_", "(_", "confirmation", "\\u", "key_", "=_", "confirmation", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Confirmation", "_", "._", "Do", "es", "Not", "Exist_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctx_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object", "'_", ":_", "obj_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "confirm", "ed", "'_", ":_", "confirmed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "day", "s", "'_", ":_", "getattr_", "(_", "settings_", ",_", "'", "EMA", "IL", "\\u", "CONFIRM", "ATION", "\\u", "DAY", "S", "'_", ",_", "10_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "confirmation", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "full", "\\u", "name", "'_", ":_", "request_", "._", "GET_", "._", "get_", "(_", "\"", "full", "\\u", "name", "\"_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "support", "\\u", "email", "'_", ":_", "settings_", "._", "ZU", "LI", "P", "\\u", "ADM", "INI", "STRAT", "OR_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "vo", "ya", "ger", "'_", ":_", "settings_", "._", "VO", "YA", "GER", "_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "templates_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "confirmation", "/", "confirm", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "have", " ", "an", " ", "object", ",", " ", "we", " ", "can", " ", "use", " ", "specific", " ", "template_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "templates_", "._", "insert_", "(_", "0_", ",_", "'", "confirmation", "/", "confirm", "\\u", "%", "s", ".", "html", "'_", "%_", "obj_", "._", "\\u", "meta_", "._", "model", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "templates_", ",_", "ctx_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
pvlib/pvlib-python/pvlib/tracking.py
[ { "content": " def get_irradiance(self, dni, ghi, dhi,\n dni_extra=None, airmass=None, model='haydavies',\n **kwargs):\n \"\"\"\n Uses the :func:`irradiance.total_irrad` function to calculate\n the plane of array irradiance components on a tilted surface\n defined by \n ``self.surface_tilt``, ``self.surface_azimuth``, and\n ``self.albedo``.\n \n Parameters\n ----------\n solar_zenith : float or Series.\n Solar zenith angle.\n solar_azimuth : float or Series.\n Solar azimuth angle.\n dni : float or Series\n Direct Normal Irradiance\n ghi : float or Series\n Global horizontal irradiance\n dhi : float or Series\n Diffuse horizontal irradiance\n dni_extra : float or Series\n Extraterrestrial direct normal irradiance\n airmass : float or Series\n Airmass\n model : String\n Irradiance model.\n \n **kwargs\n Passed to :func:`irradiance.total_irrad`.\n \n Returns\n -------\n poa_irradiance : DataFrame\n Column names are: ``total, beam, sky, ground``.\n \"\"\"\n\n surface_tilt = kwargs.pop('surface_tilt', self.surface_tilt)\n surface_azimuth = kwargs.pop('surface_azimuth', self.surface_azimuth)\n \n try:\n solar_zenith = kwargs['solar_zenith']\n except KeyError:\n solar_zenith = self.solar_zenith\n \n try:\n solar_azimuth = kwargs['solar_azimuth']\n except KeyError:\n solar_azimuth = self.solar_azimuth\n\n # not needed for all models, but this is easier\n if dni_extra is None:\n dni_extra = irradiance.extraradiation(solar_zenith.index)\n dni_extra = pd.Series(dni_extra, index=solar_zenith.index)\n\n if airmass is None:\n airmass = atmosphere.relativeairmass(solar_zenith)\n\n return irradiance.total_irrad(surface_tilt,\n surface_azimuth,\n solar_zenith,\n solar_azimuth,\n dni, ghi, dhi,\n dni_extra=dni_extra, airmass=airmass,\n model=model,\n albedo=self.albedo,\n **kwargs)", "metadata": "root.SingleAxisTracker.get_irradiance", "header": "['class', 'SingleAxisTracker', '(', 'PVSystem', ')', ':', '___EOS___']", "index": 67 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Sing", "le", "Axi", "s", "Tracker_", "(_", "PV", "System_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "irr", "adi", "ance_", "(_", "self_", ",_", "dni", "_", ",_", "gh", "i_", ",_", "dh", "i_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dni", "\\u", "extra_", "=_", "None_", ",_", "air", "mass_", "=_", "None_", ",_", "model_", "=_", "'", "hay", "davi", "es", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Us", "es", " ", "the", " ", ":", "func", ":`", "irr", "adi", "anc", "e", ".", "total", "\\u", "irr", "ad", "`", " ", "function", " ", "to", " ", "calcul", "ate", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "plane", " ", "of", " ", "array", " ", "irr", "adi", "anc", "e", " ", "component", "s", " ", "on", " ", "a", " ", "tilt", "ed", " ", "surf", "ace", "\\", "10", ";", " ", " ", " ", " ", "defin", "ed", " ", "by", " ", "\\", "10", ";", " ", " ", " ", " ", "``", "self", ".", "surf", "ace", "\\u", "tilt", "``", ",", " ", "``", "self", ".", "surf", "ace", "\\u", "azimuth", "``", ",", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "``", "self", ".", "albe", "do", "``.", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "solar", "\\u", "zen", "ith", " ", ":", " ", "float", " ", "or", " ", "Serie", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Sol", "ar", " ", "zen", "ith", " ", "angle", ".", "\\", "10", ";", " ", " ", " ", " ", "solar", "\\u", "azimuth", " ", ":", " ", "float", " ", "or", " ", "Serie", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "Sol", "ar", " ", "azimuth", " ", "angle", ".", "\\", "10", ";", " ", " ", " ", " ", "dni", " ", ":", " ", "float", " ", "or", " ", "Serie", "s", "\\", "10", ";", " ", " ", " ", " ", "Direct", " ", "Normal", " ", "Ir", "radian", "ce", "\\", "10", ";", " ", " ", " ", " ", "gh", "i", " ", ":", " ", "float", " ", "or", " ", "Serie", "s", "\\", "10", ";", " ", " ", " ", " ", "Global", " ", "horizon", "tal", " ", "irr", "adi", "anc", "e", "\\", "10", ";", " ", " ", " ", " ", "dh", "i", " ", ":", " ", "float", " ", "or", " ", "Serie", "s", "\\", "10", ";", " ", " ", " ", " ", "Diffus", "e", " ", "horizon", "tal", " ", "irr", "adi", "anc", "e", "\\", "10", ";", " ", " ", " ", " ", "dni", "\\u", "extra", " ", ":", " ", "float", " ", "or", " ", "Serie", "s", "\\", "10", ";", " ", " ", " ", " ", "Extra", "terr", "estr", "ial", " ", "direct", " ", "normal", " ", "irr", "adi", "anc", "e", "\\", "10", ";", " ", " ", " ", " ", "air", "mass", " ", ":", " ", "float", " ", "or", " ", "Serie", "s", "\\", "10", ";", " ", " ", " ", " ", "Air", "mass", "\\", "10", ";", " ", " ", " ", " ", "model", " ", ":", " ", "String", "\\", "10", ";", " ", " ", " ", " ", "Ir", "radian", "ce", " ", "model", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "**", "kwarg", "s", "\\", "10", ";", " ", " ", " ", " ", "Passe", "d", " ", "to", " ", ":", "func", ":`", "irr", "adi", "anc", "e", ".", "total", "\\u", "irr", "ad", "`.", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "po", "a", "\\u", "irr", "adi", "anc", "e", " ", ":", " ", "Data", "Frame", "\\", "10", ";", " ", " ", " ", " ", "Colum", "n", " ", "names", " ", "are", ":", " ", "``", "total", ",", " ", "beam", ",", " ", "sky", ",", " ", "ground", "``.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "surf", "ace", "\\u", "tilt", "_", "=_", "kwargs_", "._", "pop_", "(_", "'", "surf", "ace", "\\u", "tilt", "'_", ",_", "self_", "._", "surf", "ace", "\\u", "tilt", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "surf", "ace", "\\u", "azimuth", "_", "=_", "kwargs_", "._", "pop_", "(_", "'", "surf", "ace", "\\u", "azimuth", "'_", ",_", "self_", "._", "surf", "ace", "\\u", "azimuth", "_", ")_", "\\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 ", " _", "solar", "\\u", "zen", "ith", "_", "=_", "kwargs_", "[_", "'", "solar", "\\u", "zen", "ith", "'_", "]_", "\\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 ", " _", "solar", "\\u", "zen", "ith", "_", "=_", "self_", "._", "solar", "\\u", "zen", "ith", "_", "\\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 ", " _", "solar", "\\u", "azimuth", "_", "=_", "kwargs_", "[_", "'", "solar", "\\u", "azimuth", "'_", "]_", "\\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 ", " _", "solar", "\\u", "azimuth", "_", "=_", "self_", "._", "solar", "\\u", "azimuth", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "need", "ed", " ", "for", " ", "all", " ", "model", "s", ",", " ", "but", " ", "this", " ", "is", " ", "easi", "er_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "dni", "\\u", "extra_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dni", "\\u", "extra_", "=_", "irr", "adi", "ance_", "._", "extra", "radiation", "_", "(_", "solar", "\\u", "zen", "ith", "_", "._", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dni", "\\u", "extra_", "=_", "pd_", "._", "Series_", "(_", "dni", "\\u", "extra_", ",_", "index_", "=_", "solar", "\\u", "zen", "ith", "_", "._", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "air", "mass_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "air", "mass_", "=_", "atmospher", "e_", "._", "relative", "air", "mass_", "(_", "solar", "\\u", "zen", "ith", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "irr", "adi", "ance_", "._", "total", "\\u", "irr", "ad_", "(_", "surf", "ace", "\\u", "tilt", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "surf", "ace", "\\u", "azimuth", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "solar", "\\u", "zen", "ith", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "solar", "\\u", "azimuth", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dni", "_", ",_", "gh", "i_", ",_", "dh", "i_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dni", "\\u", "extra_", "=_", "dni", "\\u", "extra_", ",_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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 ]
Unused import
rlpy/rlpy/examples/tutorial/run_parametersearch.py
[ { "content": "from rlpy.Tools.hypersearch import find_hyperparameters\nbest, trials = find_hyperparameters(\n \"examples/tutorial/infTrackCartPole_rbfs.py\",\n \"./Results/Tutorial/InfTrackCartPole/RBFs_hypersearch\",\n max_evals=10, parallelization=\"joblib\",\n trials_per_point=5)\nprint best\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "rlp", "y_", "._", "Tools_", "._", "hypers", "earch_", "import_", "find", "\\u", "hyperparameters", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "best_", ",_", "trials_", "=_", "find", "\\u", "hyperparameters", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "example", "s", "/", "tutorial", "/", "inf", "Track", "Cart", "Pole", "\\u", "rbf", "s", ".", "py", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"./", "Result", "s", "/", "Tu", "tori", "al", "/", "Inf", "Track", "Cart", "Pole", "/", "RB", "Fs", "\\u", "hypers", "ear", "ch", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "max", "\\u", "evals_", "=_", "10_", ",_", "paralleliz", "ation_", "=_", "\"", "joblib", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tria", "ls", "\\u", "per", "\\u", "point_", "=_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "best_" ]
[ 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 ]
Unused import
dcramer/django-compositepks/django/core/files/uploadedfile.py
[ { "content": "\"\"\"\nClasses representing uploaded files.\n\"\"\"\n\nimport os\ntry:\n from cStringIO import StringIO\nexcept ImportError:\n from StringIO import StringIO\n\nfrom django.conf import settings\nfrom django.core.files.base import File\nfrom django.core.files import temp as tempfile\nfrom django.utils.encoding import smart_str\n\n__all__ = ('UploadedFile', 'TemporaryUploadedFile', 'InMemoryUploadedFile',\n 'SimpleUploadedFile')\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class UploadedFile(File):\n \"\"\"\n A abstract uploaded file (``TemporaryUploadedFile`` and\n ``InMemoryUploadedFile`` are the built-in concrete subclasses).\n\n An ``UploadedFile`` object behaves somewhat like a file object and\n represents some file data that the user submitted with a form.\n \"\"\"\n DEFAULT_CHUNK_SIZE = 64 * 2**10\n\n\n\n\n\n name = property(_get_name, _set_name)\n\n # Abstract methods; subclasses *must* define read() and probably should\n # define open/close.\n\n", "metadata": "root.UploadedFile", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def __init__(self, name=None, content_type=None, size=None, charset=None):\n self.name = name\n self.size = size\n self.content_type = content_type\n self.charset = charset", "metadata": "root.UploadedFile.__init__", "header": "['class', 'UploadedFile', '(', 'File', ')', ':', '___EOS___']", "index": 28 }, { "content": " def __repr__(self):\n return \"<%s: %s (%s)>\" % (self.__class__.__name__, smart_str(self.name), self.content_type)", "metadata": "root.UploadedFile.__repr__", "header": "['class', 'UploadedFile', '(', 'File', ')', ':', '___EOS___']", "index": 34 }, { "content": " def _get_name(self):\n return self._name", "metadata": "root.UploadedFile._get_name", "header": "['class', 'UploadedFile', '(', 'File', ')', ':', '___EOS___']", "index": 37 }, { "content": " def _set_name(self, name):\n # Sanitize the file name so that it can't be dangerous.\n if name is not None:\n # Just use the basename of the file -- anything else is dangerous.\n name = os.path.basename(name)\n\n # File names longer than 255 characters can cause problems on older OSes.\n if len(name) > 255:\n name, ext = os.path.splitext(name)\n name = name[:255 - len(ext)] + ext\n\n self._name = name", "metadata": "root.UploadedFile._set_name", "header": "['class', 'UploadedFile', '(', 'File', ')', ':', '___EOS___']", "index": 40 }, { "content": " def read(self, num_bytes=None):\n raise NotImplementedError()", "metadata": "root.UploadedFile.read", "header": "['class', 'UploadedFile', '(', 'File', ')', ':', '___EOS___']", "index": 57 }, { "content": " def open(self):\n pass", "metadata": "root.UploadedFile.open", "header": "['class', 'UploadedFile', '(', 'File', ')', ':', '___EOS___']", "index": 60 }, { "content": " def close(self):\n pass", "metadata": "root.UploadedFile.close", "header": "['class', 'UploadedFile', '(', 'File', ')', ':', '___EOS___']", "index": 63 }, { "content": "class TemporaryUploadedFile(UploadedFile):\n \"\"\"\n A file uploaded to a temporary location (i.e. stream-to-disk).\n \"\"\"\n\n\n # Most methods on this object get proxied to NamedTemporaryFile.\n # We can't directly subclass because NamedTemporaryFile is actually a\n # factory function", "metadata": "root.TemporaryUploadedFile", "header": "['module', '___EOS___']", "index": 66 }, { "content": " def __init__(self, name, content_type, size, charset):\n super(TemporaryUploadedFile, self).__init__(name, content_type, size, charset)\n if settings.FILE_UPLOAD_TEMP_DIR:\n self._file = tempfile.NamedTemporaryFile(suffix='.upload', dir=settings.FILE_UPLOAD_TEMP_DIR)\n else:\n self._file = tempfile.NamedTemporaryFile(suffix='.upload')", "metadata": "root.TemporaryUploadedFile.__init__", "header": "['class', 'TemporaryUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 70 }, { "content": " def temporary_file_path(self):\n \"\"\"\n Returns the full path of this file.\n \"\"\"\n return self._file.name", "metadata": "root.TemporaryUploadedFile.temporary_file_path", "header": "['class', 'TemporaryUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 77 }, { "content": " def read(self, *args): return self._file.read(*args)", "metadata": "root.TemporaryUploadedFile.read", "header": "['class', 'TemporaryUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 86 }, { "content": " def seek(self, *args): return self._file.seek(*args)", "metadata": "root.TemporaryUploadedFile.seek", "header": "['class', 'TemporaryUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 87 }, { "content": " def write(self, s): return self._file.write(s)", "metadata": "root.TemporaryUploadedFile.write", "header": "['class', 'TemporaryUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 88 }, { "content": " def tell(self, *args): return self._file.tell(*args)", "metadata": "root.TemporaryUploadedFile.tell", "header": "['class', 'TemporaryUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 89 }, { "content": " def __iter__(self): return iter(self._file)", "metadata": "root.TemporaryUploadedFile.__iter__", "header": "['class', 'TemporaryUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 90 }, { "content": " def readlines(self, size=None): return self._file.readlines(size)", "metadata": "root.TemporaryUploadedFile.readlines", "header": "['class', 'TemporaryUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 91 }, { "content": " def xreadlines(self): return self._file.xreadlines()", "metadata": "root.TemporaryUploadedFile.xreadlines", "header": "['class', 'TemporaryUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 92 }, { "content": " def close(self):\n try:\n return self._file.close()\n except OSError, e:\n if e.errno == 2:\n # Means the file was moved or deleted before the tempfile could unlink it.\n # Still sets self._file.close_called and calls self._file.file.close()\n # before the exception\n return\n else:\n raise e", "metadata": "root.TemporaryUploadedFile.close", "header": "['class', 'TemporaryUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 93 }, { "content": "class InMemoryUploadedFile(UploadedFile):\n \"\"\"\n A file uploaded into memory (i.e. stream-to-memory).\n \"\"\"\n\n\n\n\n # proxy methods to StringIO", "metadata": "root.InMemoryUploadedFile", "header": "['module', '___EOS___']", "index": 105 }, { "content": " def __init__(self, file, field_name, name, content_type, size, charset):\n super(InMemoryUploadedFile, self).__init__(name, content_type, size, charset)\n self._file = file\n self.field_name = field_name\n self._file.seek(0)", "metadata": "root.InMemoryUploadedFile.__init__", "header": "['class', 'InMemoryUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 109 }, { "content": " def open(self):\n self._file.seek(0)", "metadata": "root.InMemoryUploadedFile.open", "header": "['class', 'InMemoryUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 115 }, { "content": " def chunks(self, chunk_size=None):\n self._file.seek(0)\n yield self.read()", "metadata": "root.InMemoryUploadedFile.chunks", "header": "['class', 'InMemoryUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 118 }, { "content": " def multiple_chunks(self, chunk_size=None):\n # Since it's in memory, we'll never have multiple chunks.\n return False", "metadata": "root.InMemoryUploadedFile.multiple_chunks", "header": "['class', 'InMemoryUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 122 }, { "content": " def read(self, *args): return self._file.read(*args)", "metadata": "root.InMemoryUploadedFile.read", "header": "['class', 'InMemoryUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 127 }, { "content": " def seek(self, *args): return self._file.seek(*args)", "metadata": "root.InMemoryUploadedFile.seek", "header": "['class', 'InMemoryUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 128 }, { "content": " def tell(self, *args): return self._file.tell(*args)", "metadata": "root.InMemoryUploadedFile.tell", "header": "['class', 'InMemoryUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 129 }, { "content": " def close(self): return self._file.close()", "metadata": "root.InMemoryUploadedFile.close", "header": "['class', 'InMemoryUploadedFile', '(', 'UploadedFile', ')', ':', '___EOS___']", "index": 130 }, { "content": "class SimpleUploadedFile(InMemoryUploadedFile):\n \"\"\"\n A simple representation of a file, which just has content, size, and a name.\n \"\"\"\n\n\n from_dict = classmethod(from_dict)", "metadata": "root.SimpleUploadedFile", "header": "['module', '___EOS___']", "index": 132 }, { "content": " def __init__(self, name, content, content_type='text/plain'):\n self._file = StringIO(content or '')\n self.name = name\n self.field_name = None\n self.size = len(content or '')\n self.content_type = content_type\n self.charset = None\n self._file.seek(0)", "metadata": "root.SimpleUploadedFile.__init__", "header": "['class', 'SimpleUploadedFile', '(', 'InMemoryUploadedFile', ')', ':', '___EOS___']", "index": 136 }, { "content": " def from_dict(cls, file_dict):\n \"\"\"\n Creates a SimpleUploadedFile object from\n a dictionary object with the following keys:\n - filename\n - content-type\n - content\n \"\"\"\n return cls(file_dict['filename'],\n file_dict['content'],\n file_dict.get('content-type', 'text/plain'))", "metadata": "root.SimpleUploadedFile.from_dict", "header": "['class', 'SimpleUploadedFile', '(', 'InMemoryUploadedFile', ')', ':', '___EOS___']", "index": 145 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Class", "es", " ", "represent", "ing", " ", "uploade", "d", " ", "files", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "c", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "files_", "._", "base_", "import_", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "files_", "import_", "temp_", "as_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "encoding_", "import_", "smart", "\\u", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "all\\u\\u_", "=_", "(_", "'", "Upload", "ed", "File", "'_", ",_", "'", "Tempora", "ry", "Upload", "ed", "File", "'_", ",_", "'", "In", "Memo", "ry", "Upload", "ed", "File", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Simple", "Upload", "ed", "File", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Upload", "ed", "File_", "(_", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "abstract", " ", "uploade", "d", " ", "file", " ", "(", "``", "Tempora", "ry", "Upload", "ed", "File", "``", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "``", "In", "Memo", "ry", "Upload", "ed", "File", "``", " ", "are", " ", "the", " ", "bui", "lt", "-", "in", " ", "concre", "te", " ", "subclasses", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "``", "Upload", "ed", "File", "``", " ", "object", " ", "behave", "s", " ", "some", "what", " ", "like", " ", "a", " ", "file", " ", "object", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "represent", "s", " ", "some", " ", "file", " ", "data", " ", "tha", "t", " ", "the", " ", "user", " ", "submitted", " ", "with", " ", "a", " ", "form", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "CHUNK", "\\u", "SIZE_", "=_", "64_", "*_", "2_", "**_", "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\\uDEDENT\\u\\u\\u_", "name_", "=_", "property_", "(_", "\\u", "get", "\\u", "name_", ",_", "\\u", "set\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Abstract", " ", "method", "s", ";", " ", "subclasses", " ", "*", "must", "*", " ", "defin", "e", " ", "read", "()", " ", "and", " ", "probab", "ly", " ", "should_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "defin", "e", " ", "open", "/", "close", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Upload", "ed", "File_", "(_", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "None_", ",_", "content", "\\u", "type_", "=_", "None_", ",_", "size_", "=_", "None_", ",_", "charset_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "size_", "=_", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "content", "\\u", "type_", "=_", "content", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "charset_", "=_", "charset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Upload", "ed", "File_", "(_", "File_", ")_", ":_", "\\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_", "\"<", "%", "s", ":", " ", "%", "s", " ", "(%", "s", ")>", "\"_", "%_", "(_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ",_", "smart", "\\u", "str_", "(_", "self_", "._", "name_", ")_", ",_", "self_", "._", "content", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Upload", "ed", "File_", "(_", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Upload", "ed", "File_", "(_", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set\\u", "name_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sanit", "ize", " ", "the", " ", "file", " ", "name", " ", "so", " ", "tha", "t", " ", "it", " ", "can", "'", "t", " ", "be", " ", "danger", "ous", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ju", "st", " ", "use", " ", "the", " ", "basen", "ame", " ", "of", " ", "the", " ", "file", " ", "--", " ", "anyt", "hing", " ", "else", " ", "is", " ", "danger", "ous", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "File", " ", "names", " ", "long", "er", " ", "than", " ", "255", " ", "character", "s", " ", "can", " ", "caus", "e", " ", "problem", "s", " ", "on", " ", "older", " ", "OS", "es", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "name_", ")_", ">_", "255_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", ",_", "ext_", "=_", "os_", "._", "path_", "._", "splitext_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "name_", "[_", ":_", "255_", "-_", "len_", "(_", "ext_", ")_", "]_", "+_", "ext_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Upload", "ed", "File_", "(_", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "num", "\\u", "bytes_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Upload", "ed", "File_", "(_", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Upload", "ed", "File_", "(_", "File_", ")_", ":_", "\\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 ", " _", "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_", "Tempora", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "file", " ", "uploade", "d", " ", "to", " ", "a", " ", "temporar", "y", " ", "location", " ", "(", "i", ".", "e", ".", " ", "stream", "-", "to", "-", "disk", ").", "\\", "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_", "#", " ", "Mos", "t", " ", "method", "s", " ", "on", " ", "this", " ", "object", " ", "get", " ", "prox", "ied", " ", "to", " ", "Name", "d", "Tempora", "ry", "File", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "can", "'", "t", " ", "direct", "ly", " ", "subclass", " ", "bec", "aus", "e", " ", "Name", "d", "Tempora", "ry", "File", " ", "is", " ", "actual", "ly", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "factor", "y", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Tempora", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "content", "\\u", "type_", ",_", "size_", ",_", "charset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Tempora", "ry", "Upload", "ed", "File_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "name_", ",_", "content", "\\u", "type_", ",_", "size_", ",_", "charset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "settings_", "._", "FILE", "\\u", "UPLOAD", "\\u", "TEMP", "\\u", "DIR_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "file_", "=_", "tempfile_", "._", "Name", "d", "Tempora", "ry", "File_", "(_", "suffix_", "=_", "'.", "upload", "'_", ",_", "dir_", "=_", "settings_", "._", "FILE", "\\u", "UPLOAD", "\\u", "TEMP", "\\u", "DIR_", ")_", "\\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", "file_", "=_", "tempfile_", "._", "Name", "d", "Tempora", "ry", "File_", "(_", "suffix_", "=_", "'.", "upload", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tempora", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\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_", "temporar", "y", "\\u", "file", "\\u", "path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "full", " ", "path", " ", "of", " ", "this", " ", "file", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "file_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tempora", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "return_", "self_", "._", "\\u", "file_", "._", "read_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tempora", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "seek_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "return_", "self_", "._", "\\u", "file_", "._", "seek_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tempora", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "write_", "(_", "self_", ",_", "s_", ")_", ":_", "return_", "self_", "._", "\\u", "file_", "._", "write_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tempora", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "tell_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "return_", "self_", "._", "\\u", "file_", "._", "tell_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tempora", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "return_", "iter_", "(_", "self_", "._", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tempora", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "readlines_", "(_", "self_", ",_", "size_", "=_", "None_", ")_", ":_", "return_", "self_", "._", "\\u", "file_", "._", "readlines_", "(_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tempora", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "xre", "adl", "ines_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "\\u", "file_", "._", "xre", "adl", "ines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tempora", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "close_", "(_", "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 ", " _", "return_", "self_", "._", "\\u", "file_", "._", "close_", "(_", ")_", "\\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 ", " _", "if_", "e_", "._", "errno_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Means", " ", "the", " ", "file", " ", "was", " ", "moved", " ", "or", " ", "delete", "d", " ", "bef", "ore", " ", "the", " ", "tempfile", " ", "coul", "d", " ", "unlink", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Stil", "l", " ", "sets", " ", "self", ".\\u", "file", ".", "close", "\\u", "call", "ed", " ", "and", " ", "calls", " ", "self", ".\\u", "file", ".", "file", ".", "close", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bef", "ore", " ", "the", " ", "exception_", "\\u\\u\\uNL\\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_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "In", "Memo", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "file", " ", "uploade", "d", " ", "int", "o", " ", "memory", " ", "(", "i", ".", "e", ".", " ", "stream", "-", "to", "-", "memory", ").", "\\", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "proxy", " ", "method", "s", " ", "to", " ", "String", "IO_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "In", "Memo", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "file_", ",_", "field", "\\u", "name_", ",_", "name_", ",_", "content", "\\u", "type_", ",_", "size_", ",_", "charset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "In", "Memo", "ry", "Upload", "ed", "File_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "name_", ",_", "content", "\\u", "type_", ",_", "size_", ",_", "charset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "file_", "=_", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "field", "\\u", "name_", "=_", "field", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "file_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "In", "Memo", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "open_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "file_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "In", "Memo", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "chunks_", "(_", "self_", ",_", "chunk", "\\u", "size_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "file_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "self_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "In", "Memo", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "multiple", "\\u", "chunks_", "(_", "self_", ",_", "chunk", "\\u", "size_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sin", "ce", " ", "it", "'", "s", " ", "in", " ", "memory", ",", " ", "we", "'", "ll", " ", "neve", "r", " ", "have", " ", "multiple", " ", "chunks", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "In", "Memo", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "read_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "return_", "self_", "._", "\\u", "file_", "._", "read_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "In", "Memo", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "seek_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "return_", "self_", "._", "\\u", "file_", "._", "seek_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "In", "Memo", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "tell_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "return_", "self_", "._", "\\u", "file_", "._", "tell_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "In", "Memo", "ry", "Upload", "ed", "File_", "(_", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "close_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\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_", "Simple", "Upload", "ed", "File_", "(_", "In", "Memo", "ry", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "simple", " ", "represent", "ation", " ", "of", " ", "a", " ", "file", ",", " ", "whi", "ch", " ", "just", " ", "has", " ", "content", ",", " ", "size", ",", " ", "and", " ", "a", " ", "name", ".", "\\", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from", "\\u", "dict_", "=_", "classmethod_", "(_", "from", "\\u", "dict_", ")_", "[SEP]_", "class_", "Simple", "Upload", "ed", "File_", "(_", "In", "Memo", "ry", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "content_", ",_", "content", "\\u", "type_", "=_", "'", "text", "/", "plain", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "file_", "=_", "String", "IO_", "(_", "content_", "or_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "field", "\\u", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "size_", "=_", "len_", "(_", "content_", "or_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "content", "\\u", "type_", "=_", "content", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "charset_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "file_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simple", "Upload", "ed", "File_", "(_", "In", "Memo", "ry", "Upload", "ed", "File_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "from", "\\u", "dict_", "(_", "cls_", ",_", "file", "\\u", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "es", " ", "a", " ", "Simple", "Upload", "ed", "File", " ", "object", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "dictionar", "y", " ", "object", " ", "with", " ", "the", " ", "follow", "ing", " ", "keys", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "filename", "\\", "10", ";", " ", " ", " ", "-", " ", "content", "-", "type", "\\", "10", ";", " ", " ", " ", "-", " ", "content", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "(_", "file", "\\u", "dict_", "[_", "'", "filename", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file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 2, 2, 2, 2, 2, 2, 2, 2 ]
Unnecessary pass
openstack/swift/swift/proxy/controllers/obj.py
[ { "content": " def _real_iter(self, req, resp_headers):\n if not self.range_specs:\n client_asked_for_range = False\n range_specs = [{\n 'req_client_start': 0,\n 'req_client_end': (None if self.obj_length is None\n else self.obj_length - 1),\n 'resp_client_start': 0,\n 'resp_client_end': (None if self.obj_length is None\n else self.obj_length - 1),\n 'req_segment_start': 0,\n 'req_segment_end': (None if self.obj_length is None\n else self.obj_length - 1),\n 'resp_segment_start': 0,\n 'resp_segment_end': (None if self.obj_length is None\n else self.obj_length - 1),\n 'req_fragment_start': 0,\n 'req_fragment_end': self.fa_length - 1,\n 'resp_fragment_start': 0,\n 'resp_fragment_end': self.fa_length - 1,\n 'satisfiable': self.obj_length > 0,\n }]\n else:\n client_asked_for_range = True\n range_specs = self.range_specs\n\n self._fill_out_range_specs_from_obj_length(range_specs)\n\n multipart = (len([rs for rs in range_specs if rs['satisfiable']]) > 1)\n # Multipart responses are not required to be in the same order as\n # the Range header; the parts may be in any order the server wants.\n # Further, if multiple ranges are requested and only some are\n # satisfiable, then only the satisfiable ones appear in the response\n # at all. Thus, we cannot simply iterate over range_specs in order;\n # we must use the Content-Range header from each part to figure out\n # what we've been given.\n #\n # We do, however, make the assumption that all the object-server\n # responses have their ranges in the same order. Otherwise, a\n # streaming decode would be impossible.\n\n def convert_ranges_iter():\n seen_first_headers = False\n ranges_for_resp = {}\n\n while True:\n # this'll raise StopIteration and exit the loop\n next_range = self._next_range()\n\n headers, frag_iters = next_range\n content_type = headers['Content-Type']\n\n content_range = headers.get('Content-Range')\n if content_range is not None:\n fa_start, fa_end, fa_length = parse_content_range(\n content_range)\n elif self.fa_length <= 0:\n fa_start = None\n fa_end = None\n fa_length = 0\n else:\n fa_start = 0\n fa_end = self.fa_length - 1\n fa_length = self.fa_length\n\n if not seen_first_headers:\n # This is the earliest we can possibly do this. On a\n # 200 or 206-single-byterange response, we can learn\n # the FA's length from the HTTP response headers.\n # However, on a 206-multiple-byteranges response, we\n # don't learn it until the first part of the\n # response body, in the headers of the first MIME\n # part.\n #\n # Similarly, the content type of a\n # 206-multiple-byteranges response is\n # \"multipart/byteranges\", not the object's actual\n # content type.\n self._fill_out_range_specs_from_fa_length(\n fa_length, range_specs)\n\n satisfiable = False\n for range_spec in range_specs:\n satisfiable |= range_spec['satisfiable']\n key = (range_spec['resp_fragment_start'],\n range_spec['resp_fragment_end'])\n ranges_for_resp.setdefault(key, []).append(range_spec)\n\n # The client may have asked for an unsatisfiable set of\n # ranges, but when converted to fragments, the object\n # servers see it as satisfiable. For example, imagine a\n # request for bytes 800-900 of a 750-byte object with a\n # 1024-byte segment size. The object servers will see a\n # request for bytes 0-${fragsize-1}, and that's\n # satisfiable, so they return 206. It's not until we\n # learn the object size that we can check for this\n # condition.\n #\n # Note that some unsatisfiable ranges *will* be caught\n # by the object servers, like bytes 1800-1900 of a\n # 100-byte object with 1024-byte segments. That's not\n # what we're dealing with here, though.\n if client_asked_for_range and not satisfiable:\n req.environ[\n 'swift.non_client_disconnect'] = True\n raise HTTPRequestedRangeNotSatisfiable(\n request=req, headers=resp_headers)\n self.learned_content_type = content_type\n seen_first_headers = True\n\n range_spec = ranges_for_resp[(fa_start, fa_end)].pop(0)\n seg_iter = self._decode_segments_from_fragments(frag_iters)\n if not range_spec['satisfiable']:\n # This'll be small; just a single small segment. Discard\n # it.\n for x in seg_iter:\n pass\n continue\n\n byterange_iter = self._iter_one_range(range_spec, seg_iter)\n\n converted = {\n \"start_byte\": range_spec[\"resp_client_start\"],\n \"end_byte\": range_spec[\"resp_client_end\"],\n \"content_type\": content_type,\n \"part_iter\": byterange_iter}\n\n if self.obj_length is not None:\n converted[\"entity_length\"] = self.obj_length\n yield converted\n\n return document_iters_to_http_response_body(\n convert_ranges_iter(), self.mime_boundary, multipart, self.logger)", "metadata": "root.ECAppIter._real_iter", "header": "['class', 'ECAppIter', '(', 'object', ')', ':', '___EOS___']", "index": 1252 } ]
[]
[]
0
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "EC", "App", "Iter_", "(_", "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", "real", "\\u", "iter_", "(_", "self_", ",_", "req_", ",_", "resp", "\\u", "headers_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "range", "\\u", "specs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client", "\\u", "ask", "ed", "\\u", "for", "\\u", "range_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "range", "\\u", "specs_", "=_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "req", "\\u", "client", "\\u", "start", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "req", "\\u", "client", "\\u", "end", "'_", ":_", "(_", "None_", "if_", "self_", "._", "obj", "\\u", "length_", "is_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "self_", "._", "obj", "\\u", "length_", "-_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resp", "\\u", "client", "\\u", "start", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resp", "\\u", "client", "\\u", "end", "'_", ":_", "(_", "None_", "if_", "self_", "._", "obj", "\\u", "length_", "is_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "self_", "._", "obj", "\\u", "length_", "-_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "req", "\\u", "segment", "\\u", "start", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "req", "\\u", "segment", "\\u", "end", "'_", ":_", "(_", "None_", "if_", "self_", "._", "obj", "\\u", "length_", "is_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "self_", "._", "obj", "\\u", "length_", "-_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resp", "\\u", "segment", "\\u", "start", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resp", "\\u", "segment", "\\u", "end", "'_", ":_", "(_", "None_", "if_", "self_", "._", "obj", "\\u", "length_", "is_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "else_", "self_", "._", "obj", "\\u", "length_", "-_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "req", "\\u", "fragment", "\\u", "start", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "req", "\\u", "fragment", "\\u", "end", "'_", ":_", "self_", "._", "fa", "\\u", "length_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resp", "\\u", "fragment", "\\u", "start", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "resp", "\\u", "fragment", "\\u", "end", "'_", ":_", "self_", "._", "fa", "\\u", "length_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "satisf", "iable", "'_", ":_", "self_", "._", "obj", "\\u", "length_", ">_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "client", "\\u", "ask", "ed", "\\u", "for", "\\u", "range_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "range", "\\u", "specs_", "=_", "self_", "._", "range", "\\u", "specs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "fill", "\\u", "out", "\\u", "range", "\\u", "spec", "s", "\\u", "from", "\\u", "obj", "\\u", "length_", "(_", "range", "\\u", "specs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "multipart_", "=_", "(_", "len_", "(_", "[_", "rs_", "for_", "rs_", "in_", "range", "\\u", "specs_", "if_", "rs_", "[_", "'", "satisf", "iable", "'_", "]_", "]_", ")_", ">_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Multipart", " ", "response", "s", " ", "are", " ", "not", " ", "require", "d", " ", "to", " ", "be", " ", "in", " ", "the", " ", "same", " ", "order", " ", "as_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "Range", " ", "header", ";", " ", "the", " ", "part", "s", " ", "may", " ", "be", " ", "in", " ", "any", " ", "order", " ", "the", " ", "server", " ", "want", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fur", "ther", ",", " ", "if", " ", "multiple", " ", "ranges", " ", "are", " ", "request", "ed", " ", "and", " ", "only", " ", "some", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "satisf", "iable", ",", " ", "then", " ", "only", " ", "the", " ", "satisf", "iable", " ", "ones", " ", "appear", " ", "in", " ", "the", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "at", " ", "all", ".", " ", "Thu", "s", ",", " ", "we", " ", "cann", "ot", " ", "simp", "ly", " ", "iterate", " ", "over", " ", "range", "\\u", "spec", "s", " ", "in", " ", "order", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "must", " ", "use", " ", "the", " ", "Conten", "t", "-", "Range", " ", "header", " ", "from", " ", "each", " ", "part", " ", "to", " ", "figure", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "what", " ", "we", "'", "ve", " ", "bee", "n", " ", "give", "n", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "do", ",", " ", "how", "ever", ",", " ", "make", " ", "the", " ", "assumption", " ", "tha", "t", " ", "all", " ", "the", " ", "object", "-", "server_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "response", "s", " ", "have", " ", "thei", "r", " ", "ranges", " ", "in", " ", "the", " ", "same", " ", "order", ".", " ", "Ot", "her", "wis", "e", ",", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "stream", "ing", " ", "decode", " ", "wou", "ld", " ", "be", " ", "impossible", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "convert", "\\u", "ranges", "\\u", "iter_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "see", "n", "\\u", "first", "\\u", "headers_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ranges", "\\u", "for", "\\u", "resp_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", "'", "ll", " ", "raise", " ", "Sto", "p", "Iterat", "ion", " ", "and", " ", "exit", " ", "the", " ", "loop_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "range_", "=_", "self_", "._", "\\u", "next", "\\u", "range_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", ",_", "frag", "\\u", "iters_", "=_", "next", "\\u", "range_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type_", "=_", "headers_", "[_", "'", "Conten", "t", "-", "Type", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "range_", "=_", "headers_", "._", "get_", "(_", "'", "Conten", "t", "-", "Range", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "content", "\\u", "range_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fa", "\\u", "start_", ",_", "fa", "\\u", "end_", ",_", "fa", "\\u", "length_", "=_", "parse", "\\u", "content", "\\u", "range_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "content", "\\u", "range_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "fa", "\\u", "length_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "fa", "\\u", "start_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fa", "\\u", "end_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fa", "\\u", "length_", "=_", "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 ", " ", "_", "fa", "\\u", "start_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fa", "\\u", "end_", "=_", "self_", "._", "fa", "\\u", "length_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fa", "\\u", "length_", "=_", "self_", "._", "fa", "\\u", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "see", "n", "\\u", "first", "\\u", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "earliest", " ", "we", " ", "can", " ", "possib", "ly", " ", "do", " ", "this", ".", " ", "On", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "200", " ", "or", " ", "206", "-", "single", "-", "byte", "range", " ", "response", ",", " ", "we", " ", "can", " ", "learn_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "FA", "'", "s", " ", "length", " ", "from", " ", "the", " ", "HTTP", " ", "response", " ", "header", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ho", "we", "ver", ",", " ", "on", " ", "a", " ", "206", "-", "multiple", "-", "byte", "ranges", " ", "response", ",", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "learn", " ", "it", " ", "unti", "l", " ", "the", " ", "first", " ", "part", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "response", " ", "body", ",", " ", "in", " ", "the", " ", "header", "s", " ", "of", " ", "the", " ", "first", " ", "MIME", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "part", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simil", "arl", "y", ",", " ", "the", " ", "content", " ", "type", " ", "of", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "206", "-", "multiple", "-", "byte", "ranges", " ", "response", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "multip", "art", "/", "byte", "ranges", "\",", " ", "not", " ", "the", " ", "object", "'", "s", " ", "actual_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "content", " ", "type", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "fill", "\\u", "out", "\\u", "range", "\\u", "spec", "s", "\\u", "from", "\\u", "fa", "\\u", "length_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "fa", "\\u", "length_", ",_", "range", "\\u", "specs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "satisf", "iable", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "range", "\\u", "spec_", "in_", "range", "\\u", "specs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "satisf", "iable", "_", "|=_", "range", "\\u", "spec_", "[_", "'", "satisf", "iable", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "(_", "range", "\\u", "spec_", "[_", "'", "resp", "\\u", "fragment", "\\u", "start", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "range", "\\u", "spec_", "[_", "'", "resp", "\\u", "fragment", "\\u", "end", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ranges", "\\u", "for", "\\u", "resp_", "._", "setdefault_", "(_", "key_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "range", "\\u", "spec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "client", " ", "may", " ", "have", " ", "ask", "ed", " ", "for", " ", "an", " ", "unsa", "tis", "fia", "ble", " ", "set", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ranges", ",", " ", "but", " ", "whe", "n", " ", "convert", "ed", " ", "to", " ", "fragment", "s", ",", " ", "the", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "server", "s", " ", "see", " ", "it", " ", "as", " ", "satisf", "iable", ".", " ", "For", " ", "example", ",", " ", "imagin", "e", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "request", " ", "for", " ", "bytes", " ", "800", "-", "900", " ", "of", " ", "a", " ", "750", "-", "byte", " ", "object", " ", "with", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1024", "-", "byte", " ", "segment", " ", "size", ".", " ", "The", " ", "object", " ", "server", "s", " ", "will", " ", "see", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "request", " ", "for", " ", "bytes", " ", "0", "-", "${", "frags", "ize", "-1", "},", " ", "and", " ", "tha", "t", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "satisf", "iable", ",", " ", "so", " ", "the", "y", " ", "return", " ", "206", ".", " ", "It", "'", "s", " ", "not", " ", "unti", "l", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "learn", " ", "the", " ", "object", " ", "size", " ", "tha", "t", " ", "we", " ", "can", " ", "check", " ", "for", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "condition", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "some", " ", "unsa", "tis", "fia", "ble", " ", "ranges", " ", "*", "will", "*", " ", "be", " ", "cau", "ght_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "the", " ", "object", " ", "server", "s", ",", " ", "like", " ", "bytes", " ", "1800", "-1", "900", " ", "of", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "100", "-", "byte", " ", "object", " ", "with", " ", "1024", "-", "byte", " ", "segments", ".", " ", "Tha", "t", "'", "s", " ", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "what", " ", "we", "'", "re", " ", "deal", "ing", " ", "with", " ", "here", ",", " ", "tho", "ugh", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "client", "\\u", "ask", "ed", "\\u", "for", "\\u", "range_", "and_", "not_", "satisf", "iable", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "req_", "._", "environ_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "swift", ".", "non", "\\u", "client", "\\u", "discon", "nect", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "HTTP", "Requeste", "d", "Range", "Not", "Sat", "isfi", "able_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "req_", ",_", "headers_", "=_", "resp", "\\u", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "learned", "\\u", "content", "\\u", "type_", "=_", "content", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "see", "n", "\\u", "first", "\\u", "headers_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "range", "\\u", "spec_", "=_", "ranges", "\\u", "for", "\\u", "resp_", "[_", "(_", "fa", "\\u", "start_", ",_", "fa", "\\u", "end_", ")_", "]_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seg", "\\u", "iter_", "=_", "self_", "._", "\\u", "decode", "\\u", "segments", "\\u", "from", "\\u", "fragments_", "(_", "frag", "\\u", "iters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "range", "\\u", "spec_", "[_", "'", "satisf", "iable", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", "'", "ll", " ", "be", " ", "small", ";", " ", "just", " ", "a", " ", "single", " ", "small", " ", "segment", ".", " ", "Discard", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "x_", "in_", "seg", "\\u", "iter_", ":_", "\\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_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "byte", "range", "\\u", "iter_", "=_", "self_", "._", "\\u", "iter", "\\u", "one", "\\u", "range_", "(_", "range", "\\u", "spec_", ",_", "seg", "\\u", "iter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "converted_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "start", "\\u", "byte", "\"_", ":_", "range", "\\u", "spec_", "[_", "\"", "resp", "\\u", "client", "\\u", "start", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "end", "\\u", "byte", "\"_", ":_", "range", "\\u", "spec_", "[_", "\"", "resp", "\\u", "client", "\\u", "end", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "content", "\\u", "type", "\"_", ":_", "content", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "part", "\\u", "iter", "\"_", ":_", "byte", "range", "\\u", "iter_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "obj", "\\u", "length_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "converted_", "[_", "\"", "entity", "\\u", "length", "\"_", "]_", "=_", "self_", "._", "obj", "\\u", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "converted_", "\\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_", "document", "\\u", "iters", "\\u", "to", "\\u", "http", "\\u", "response", "\\u", "body_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "convert", "\\u", "ranges", "\\u", "iter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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
karlnapf/kameleon-mcmc/kameleon_mcmc/tests/unit/AddDelSwapProposalUnitTest.py
[ { "content": "\"\"\"\nCopyright (c) 2013-2014 Heiko Strathmann\nAll rights reserved.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are met:\n *\n1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n *\nTHIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\nANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\nWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\nDISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR\nANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\nLOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\nON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\nSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *\nThe views and conclusions contained in the software and documentation are those\nof the authors and should not be interpreted as representing official policies,\neither expressed or implied, of the author.\n\"\"\"\n\nfrom numpy import zeros, ones, asarray\nimport numpy\nfrom numpy.random import rand, randint\nimport unittest\n\nfrom kameleon_mcmc.distribution.Distribution import Sample\nfrom kameleon_mcmc.distribution.proposals.AddDelSwapProposal import AddDelSwapProposal\n\n\n# self.assertAlmostEqual(norm(result - expected), 0)\n\nif __name__ == \"__main__\":\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class AddDelSwapProposalUnitTest(unittest.TestCase):\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# self.assertAlmostEqual(norm(result - expected), 0)\n \n# self.assertAlmostEqual(norm(result - expected), 0)\n\n# self.assertAlmostEqual(norm(result - expected), 0)\n \n# self.assertAlmostEqual(norm(result - expected), 0)\n \n# self.assertAlmostEqual(norm(result - expected), 0)\n ", "metadata": "root.AddDelSwapProposalUnitTest", "header": "['module', '___EOS___']", "index": 38 }, { "content": " def test_contructor_wrong_mu_type_float(self):\n mu = 0\n spread = 1.\n self.assertRaises(TypeError, AddDelSwapProposal, mu, spread)", "metadata": "root.AddDelSwapProposalUnitTest.test_contructor_wrong_mu_type_float", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 39 }, { "content": " def test_contructor_wrong_mu_type_none(self):\n mu = None\n spread = 1.\n self.assertRaises(TypeError, AddDelSwapProposal, mu, spread)", "metadata": "root.AddDelSwapProposalUnitTest.test_contructor_wrong_mu_type_none", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 44 }, { "content": " def test_contructor_wrong_mu_dim_too_large(self):\n mu = zeros((1, 2), dtype=numpy.bool8)\n spread = 1.\n self.assertRaises(ValueError, AddDelSwapProposal, mu, spread)", "metadata": "root.AddDelSwapProposalUnitTest.test_contructor_wrong_mu_dim_too_large", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 49 }, { "content": " def test_contructor_wrong_mu_dimension_0(self):\n mu = zeros(0, dtype=numpy.bool8)\n spread = 1.\n self.assertRaises(ValueError, AddDelSwapProposal, mu, spread)", "metadata": "root.AddDelSwapProposalUnitTest.test_contructor_wrong_mu_dimension_0", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 54 }, { "content": " def test_contructor_wrong_spread_type_int(self):\n mu = zeros(2, dtype=numpy.bool8)\n spread = 1\n self.assertRaises(TypeError, AddDelSwapProposal, mu, spread)", "metadata": "root.AddDelSwapProposalUnitTest.test_contructor_wrong_spread_type_int", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 59 }, { "content": " def test_contructor_wrong_spread_type_none(self):\n mu = zeros(2, dtype=numpy.bool8)\n spread = None\n self.assertRaises(TypeError, AddDelSwapProposal, mu, spread)", "metadata": "root.AddDelSwapProposalUnitTest.test_contructor_wrong_spread_type_none", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 64 }, { "content": " def test_contructor_wrong_spread_range_0(self):\n mu = ones(2, dtype=numpy.bool8)\n spread = 0.\n self.assertRaises(ValueError, AddDelSwapProposal, mu, spread)", "metadata": "root.AddDelSwapProposalUnitTest.test_contructor_wrong_spread_range_0", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 69 }, { "content": " def test_contructor_wrong_spread_range_1(self):\n mu = ones(2, dtype=numpy.bool8)\n spread = 1.\n self.assertRaises(ValueError, AddDelSwapProposal, mu, spread)", "metadata": "root.AddDelSwapProposalUnitTest.test_contructor_wrong_spread_range_1", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 74 }, { "content": " def test_contructor_correct_mu(self):\n mu = ones(2, dtype=numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n self.assertTrue(mu is dist.mu)", "metadata": "root.AddDelSwapProposalUnitTest.test_contructor_correct_mu", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 79 }, { "content": " def test_contructor_correct_spread(self):\n mu = ones(2, dtype=numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n self.assertEqual(spread, dist.spread)", "metadata": "root.AddDelSwapProposalUnitTest.test_contructor_correct_spread", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 85 }, { "content": " def test_sample_wrong_n_sameller_zero(self):\n mu = randint(0, 2, 10).astype(numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n self.assertRaises(ValueError, dist.sample, -1)", "metadata": "root.AddDelSwapProposalUnitTest.test_sample_wrong_n_sameller_zero", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 92 }, { "content": " def test_sample_wrong_n_type_none(self):\n mu = randint(0, 2, 10).astype(numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n self.assertRaises(TypeError, dist.sample, None)", "metadata": "root.AddDelSwapProposalUnitTest.test_sample_wrong_n_type_none", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 98 }, { "content": " def test_sample_wrong_n_type_float(self):\n mu = randint(0, 2, 10).astype(numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n self.assertRaises(TypeError, dist.sample, float(1.))", "metadata": "root.AddDelSwapProposalUnitTest.test_sample_wrong_n_type_float", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 104 }, { "content": " def test_sample_type(self):\n mu = randint(0, 2, 10).astype(numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n s = dist.sample(1)\n self.assertTrue(isinstance(s, Sample))", "metadata": "root.AddDelSwapProposalUnitTest.test_sample_type", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 110 }, { "content": " def test_sample_samples_dtype(self):\n mu = randint(0, 2, 10).astype(numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n s = dist.sample(1)\n self.assertEqual(s.samples.dtype, numpy.bool8)", "metadata": "root.AddDelSwapProposalUnitTest.test_sample_samples_dtype", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 117 }, { "content": " def test_sample_dim(self):\n n = 3\n d = 2\n mu = randint(0, 2, d).astype(numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n s = dist.sample(n)\n self.assertEqual(s.samples.shape, (n, d))", "metadata": "root.AddDelSwapProposalUnitTest.test_sample_dim", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 124 }, { "content": " def test_sample_many_no_checks(self):\n num_runs = 1\n for _ in range(num_runs):\n n = randint(1, 10)\n d = 10\n mu = randint(0, 2, d).astype(numpy.bool8)\n #print 'mu='\n #print mu\n spread = rand()\n dist = AddDelSwapProposal(mu, spread)\n sample = dist.sample(n)", "metadata": "root.AddDelSwapProposalUnitTest.test_sample_many_no_checks", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 133 }, { "content": " def test_log_pdf_wrong_type_none(self):\n d = 2\n mu = randint(0, 2, d).astype(numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n self.assertRaises(TypeError, dist.log_pdf, None)", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_wrong_type_none", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 145 }, { "content": " def test_log_pdf_wrong_type_float(self):\n d = 2\n mu = randint(0, 2, d).astype(numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n self.assertRaises(TypeError, dist.log_pdf, float(1.))", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_wrong_type_float", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 152 }, { "content": " def test_log_pdf_wrong_array_dimension_1(self):\n d = 2\n mu = randint(0, 2, d).astype(numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n self.assertRaises(TypeError, dist.log_pdf, zeros(1))", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_wrong_array_dimension_1", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 159 }, { "content": " def test_log_pdf_wrong_array_dimension_3(self):\n d = 2\n mu = randint(0, 2, d).astype(numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n self.assertRaises(TypeError, dist.log_pdf, zeros(3))", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_wrong_array_dimension_3", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 166 }, { "content": " def test_log_pdf_wrong_dimension(self):\n d = 2\n mu = randint(0, 2, d).astype(numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n self.assertRaises(ValueError, dist.log_pdf, zeros((1, 3)))", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_wrong_dimension", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 173 }, { "content": " def test_log_pdf_type(self):\n mu = asarray([0], dtype=numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n X = asarray([[0]], dtype=numpy.bool8)\n self.assertEqual(type(dist.log_pdf(X)), numpy.ndarray)", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_type", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 180 }, { "content": " def test_log_pdf_returned_array_dimension_1d_X(self):\n n = 1\n mu = asarray([0], dtype=numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n X = asarray([[0]], dtype=numpy.bool8)\n self.assertEqual(dist.log_pdf(X).shape, (n,))", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_returned_array_dimension_1d_X", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 187 }, { "content": " def test_log_pdf_returned_array_dimension_2d_X(self):\n n = 1\n mu = asarray([0, 0], dtype=numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n X = asarray([[0, 1]], dtype=numpy.bool8)\n self.assertEqual(dist.log_pdf(X).shape, (n,))", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_returned_array_dimension_2d_X", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 195 }, { "content": " def test_log_pdf_returned_array_dimension_multiple_X_1d(self):\n n = 2\n mu = asarray([0], dtype=numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n X = asarray([[1], [0]], dtype=numpy.bool8)\n self.assertEqual(dist.log_pdf(X).shape, (n,))", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_returned_array_dimension_multiple_X_1d", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 203 }, { "content": " def test_log_pdf_returned_array_dimension_multiple_X_2d(self):\n n = 2\n mu = asarray([0, 1], dtype=numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n X = asarray([[1, 0], [0, 0]], dtype=numpy.bool8)\n self.assertEqual(dist.log_pdf(X).shape, (n,))", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_returned_array_dimension_multiple_X_2d", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 211 }, { "content": " def test_log_pdf_1n_1d_add(self):\n mu = asarray([0], dtype=numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n X = asarray([[1]], dtype=numpy.bool8)\n result = dist.log_pdf(X)\n expected = zeros(1) + numpy.nan", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_1n_1d_add", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 220 }, { "content": " def test_log_pdf_1n_1d_swap(self):\n mu = asarray([1], dtype=numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n X = asarray([[1]], dtype=numpy.bool8)\n result = dist.log_pdf(X)\n expected = zeros(1) + numpy.nan", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_1n_1d_swap", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 229 }, { "content": " def test_log_pdf_1n_1d_del(self):\n mu = asarray([1], dtype=numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n X = asarray([[0]], dtype=numpy.bool8)\n result = dist.log_pdf(X)\n expected = zeros(1) + numpy.nan", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_1n_1d_del", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 238 }, { "content": " def test_log_pdf_2n_1d_add(self):\n mu = asarray([0], dtype=numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n X = asarray([[1], [0]], dtype=numpy.bool8)\n result = dist.log_pdf(X)\n expected = zeros(2) + numpy.nan", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_2n_1d_add", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 247 }, { "content": " def test_log_pdf_1n_2d(self):\n mu = asarray([0, 1], dtype=numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n X = asarray([[1, 1]], dtype=numpy.bool8)\n result = dist.log_pdf(X)\n expected = zeros(1) + numpy.nan", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_1n_2d", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 256 }, { "content": " def test_log_pdf_2n_2d(self):\n mu = asarray([0, 1], dtype=numpy.bool8)\n spread = .5\n dist = AddDelSwapProposal(mu, spread)\n X = asarray([[1, 1], [0, 1]], dtype=numpy.bool8)\n result = dist.log_pdf(X)\n expected = zeros(2) + numpy.nan", "metadata": "root.AddDelSwapProposalUnitTest.test_log_pdf_2n_2d", "header": "['class', 'AddDelSwapProposalUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 265 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Copy", "right", " ", "(", "c", ")", " ", "2013", "-", "2014", " ", "Hei", "ko", " ", "Strat", "hma", "nn", "\\", "10", ";", "All", " ", "rights", " ", "reserve", "d", ".", "\\", "10", ";", "\\", "10", ";", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out", "\\", "10", ";", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":", "\\", "10", ";", " ", "*", "\\", "10", ";", "1", ".", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",", " ", "this", "\\", "10", ";", " ", " ", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", ".", "\\", "10", ";", "2", ".", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",", "\\", "10", ";", " ", " ", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the", " ", "documentation", "\\", "10", ";", " ", " ", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", ".", "\\", "10", ";", " ", "*", "\\", "10", ";", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "AS", " ", "IS", "\"", " ", "AND", "\\", "10", ";", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", "\\", "10", ";", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "ARE", "\\", "10", ";", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", "\\", "10", ";", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", "\\", "10", ";", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", "\\", "10", ";", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", "\\", "10", ";", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", "\\", "10", ";", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", "\\", "10", ";", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", ".", "\\", "10", ";", " ", "*", "\\", "10", ";", "The", " ", "views", " ", "and", " ", "concl", "usion", "s", " ", "contain", "ed", " ", "in", " ", "the", " ", "software", " ", "and", " ", "documentation", " ", "are", " ", "tho", "se", "\\", "10", ";", "of", " ", "the", " ", "author", "s", " ", "and", " ", "shou", "ld", " ", "not", " ", "be", " ", "interprete", "d", " ", "as", " ", "represent", "ing", " ", "official", " ", "poli", "cies", ",", "\\", "10", ";", "eit", "her", " ", "express", "ed", " ", "or", " ", "impli", "ed", ",", " ", "of", " ", "the", " ", "author", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "numpy_", "import_", "zeros_", ",_", "ones_", ",_", "asarray_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "._", "random_", "import_", "rand_", ",_", "randint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "distribution_", "._", "Distribution_", "import_", "Sample_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kam", "ele", "on", "\\u", "mcmc", "_", "._", "distribution_", "._", "proposals", "_", "._", "Add", "Del", "Swa", "p", "Propos", "al_", "import_", "Add", "Del", "Swa", "p", "Propos", "al_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "assert", "Al", "most", "Equal", "(", "norm", "(", "result", " ", "-", " ", "expected", "),", " ", "0", ")_", "\\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 ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", " ", " ", " ", " ", "self", ".", "assert", "Al", "most", "Equal", "(", "norm", "(", "result", " ", "-", " ", "expected", "),", " ", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "assert", "Al", "most", "Equal", "(", "norm", "(", "result", " ", "-", " ", "expected", "),", " ", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "assert", "Al", "most", "Equal", "(", "norm", "(", "result", " ", "-", " ", "expected", "),", " ", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "assert", "Al", "most", "Equal", "(", "norm", "(", "result", " ", "-", " ", "expected", "),", " ", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "self", ".", "assert", "Al", "most", "Equal", "(", "norm", "(", "result", " ", "-", " ", "expected", "),", " ", "0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "contr", "uct", "or", "\\u", "wrong", "\\u", "mu", "\\u", "type", "\\u", "float_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", "1._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "Add", "Del", "Swa", "p", "Propos", "al_", ",_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "contr", "uct", "or", "\\u", "wrong", "\\u", "mu", "\\u", "type", "\\u", "none_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", "1._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "Add", "Del", "Swa", "p", "Propos", "al_", ",_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "contr", "uct", "or", "\\u", "wrong", "\\u", "mu", "\\u", "dim", "\\u", "too", "\\u", "large_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "zeros_", "(_", "(_", "1_", ",_", "2_", ")_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", "1._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "Add", "Del", "Swa", "p", "Propos", "al_", ",_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "contr", "uct", "or", "\\u", "wrong", "\\u", "mu", "\\u", "dimension", "\\u", "0_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "zeros_", "(_", "0_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", "1._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "Add", "Del", "Swa", "p", "Propos", "al_", ",_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "contr", "uct", "or", "\\u", "wrong", "\\u", "spread", "\\u", "type", "\\u", "int_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "zeros_", "(_", "2_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "Add", "Del", "Swa", "p", "Propos", "al_", ",_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "contr", "uct", "or", "\\u", "wrong", "\\u", "spread", "\\u", "type", "\\u", "none_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "zeros_", "(_", "2_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "Add", "Del", "Swa", "p", "Propos", "al_", ",_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "contr", "uct", "or", "\\u", "wrong", "\\u", "spread", "\\u", "range", "\\u", "0_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "ones_", "(_", "2_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "Add", "Del", "Swa", "p", "Propos", "al_", ",_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "contr", "uct", "or", "\\u", "wrong", "\\u", "spread", "\\u", "range", "\\u", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "ones_", "(_", "2_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", "1._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "Add", "Del", "Swa", "p", "Propos", "al_", ",_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "contr", "uct", "or", "\\u", "correct", "\\u", "mu_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "ones_", "(_", "2_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "mu_", "is_", "dist_", "._", "mu_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "contr", "uct", "or", "\\u", "correct", "\\u", "spread_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "ones_", "(_", "2_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "spread_", ",_", "dist_", "._", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "sample", "\\u", "wrong", "\\u", "n", "\\u", "same", "ller", "\\u", "zero_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "randint_", "(_", "0_", ",_", "2_", ",_", "10_", ")_", "._", "astype_", "(_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "dist_", "._", "sample_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "sample", "\\u", "wrong", "\\u", "n", "\\u", "type", "\\u", "none_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "randint_", "(_", "0_", ",_", "2_", ",_", "10_", ")_", "._", "astype_", "(_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "dist_", "._", "sample_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "sample", "\\u", "wrong", "\\u", "n", "\\u", "type", "\\u", "float_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "randint_", "(_", "0_", ",_", "2_", ",_", "10_", ")_", "._", "astype_", "(_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "dist_", "._", "sample_", ",_", "float_", "(_", "1._", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "sample", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "randint_", "(_", "0_", ",_", "2_", ",_", "10_", ")_", "._", "astype_", "(_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "dist_", "._", "sample_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "s_", ",_", "Sample_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "sample", "\\u", "samples", "\\u", "dtype_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "randint_", "(_", "0_", ",_", "2_", ",_", "10_", ")_", "._", "astype_", "(_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "dist_", "._", "sample_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "s_", "._", "samples_", "._", "dtype_", ",_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "sample", "\\u", "dim_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu_", "=_", "randint_", "(_", "0_", ",_", "2_", ",_", "d_", ")_", "._", "astype_", "(_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "dist_", "._", "sample_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "s_", "._", "samples_", "._", "shape_", ",_", "(_", "n_", ",_", "d_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "sample", "\\u", "many", "\\u", "no", "\\u", "checks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "runs_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u_", "in_", "range_", "(_", "num", "\\u", "runs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "randint_", "(_", "1_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu_", "=_", "randint_", "(_", "0_", ",_", "2_", ",_", "d_", ")_", "._", "astype_", "(_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "mu", "='_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "mu_", "\\u\\u\\uNL\\u\\u\\u_", "spread_", "=_", "rand_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample_", "=_", "dist_", "._", "sample_", "(_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "log", "\\u", "pdf", "\\u", "wrong", "\\u", "type", "\\u", "none_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu_", "=_", "randint_", "(_", "0_", ",_", "2_", ",_", "d_", ")_", "._", "astype_", "(_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "dist_", "._", "log", "\\u", "pdf_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "log", "\\u", "pdf", "\\u", "wrong", "\\u", "type", "\\u", "float_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu_", "=_", "randint_", "(_", "0_", ",_", "2_", ",_", "d_", ")_", "._", "astype_", "(_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "dist_", "._", "log", "\\u", "pdf_", ",_", "float_", "(_", "1._", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "log", "\\u", "pdf", "\\u", "wrong", "\\u", "array", "\\u", "dimension", "\\u", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu_", "=_", "randint_", "(_", "0_", ",_", "2_", ",_", "d_", ")_", "._", "astype_", "(_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "dist_", "._", "log", "\\u", "pdf_", ",_", "zeros_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "log", "\\u", "pdf", "\\u", "wrong", "\\u", "array", "\\u", "dimension", "\\u", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu_", "=_", "randint_", "(_", "0_", ",_", "2_", ",_", "d_", ")_", "._", "astype_", "(_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Type", "Error_", ",_", "dist_", "._", "log", "\\u", "pdf_", ",_", "zeros_", "(_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "log", "\\u", "pdf", "\\u", "wrong", "\\u", "dimension_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu_", "=_", "randint_", "(_", "0_", ",_", "2_", ",_", "d_", ")_", "._", "astype_", "(_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "dist_", "._", "log", "\\u", "pdf_", ",_", "zeros_", "(_", "(_", "1_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "log", "\\u", "pdf", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "asarray_", "(_", "[_", "0_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "asarray_", "(_", "[_", "[_", "0_", "]_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "type_", "(_", "dist_", "._", "log", "\\u", "pdf_", "(_", "X_", ")_", ")_", ",_", "numpy_", "._", "ndarray_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "log", "\\u", "pdf", "\\u", "return", "ed", "\\u", "array", "\\u", "dimension", "\\u", "1d", "\\u", "X_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu_", "=_", "asarray_", "(_", "[_", "0_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "asarray_", "(_", "[_", "[_", "0_", "]_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "dist_", "._", "log", "\\u", "pdf_", "(_", "X_", ")_", "._", "shape_", ",_", "(_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "log", "\\u", "pdf", "\\u", "return", "ed", "\\u", "array", "\\u", "dimension", "\\u", "2d", "\\u", "X_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu_", "=_", "asarray_", "(_", "[_", "0_", ",_", "0_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "asarray_", "(_", "[_", "[_", "0_", ",_", "1_", "]_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "dist_", "._", "log", "\\u", "pdf_", "(_", "X_", ")_", "._", "shape_", ",_", "(_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "log", "\\u", "pdf", "\\u", "return", "ed", "\\u", "array", "\\u", "dimension", "\\u", "multiple", "\\u", "X", "\\u", "1d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu_", "=_", "asarray_", "(_", "[_", "0_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "asarray_", "(_", "[_", "[_", "1_", "]_", ",_", "[_", "0_", "]_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "dist_", "._", "log", "\\u", "pdf_", "(_", "X_", ")_", "._", "shape_", ",_", "(_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "log", "\\u", "pdf", "\\u", "return", "ed", "\\u", "array", "\\u", "dimension", "\\u", "multiple", "\\u", "X", "\\u", "2d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mu_", "=_", "asarray_", "(_", "[_", "0_", ",_", "1_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "asarray_", "(_", "[_", "[_", "1_", ",_", "0_", "]_", ",_", "[_", "0_", ",_", "0_", "]_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "dist_", "._", "log", "\\u", "pdf_", "(_", "X_", ")_", "._", "shape_", ",_", "(_", "n_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "log", "\\u", "pdf", "\\u", "1", "n", "\\u", "1d", "\\u", "add_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "asarray_", "(_", "[_", "0_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "asarray_", "(_", "[_", "[_", "1_", "]_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "dist_", "._", "log", "\\u", "pdf_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "zeros_", "(_", "1_", ")_", "+_", "numpy_", "._", "nan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "log", "\\u", "pdf", "\\u", "1", "n", "\\u", "1d", "\\u", "swap_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "asarray_", "(_", "[_", "1_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "asarray_", "(_", "[_", "[_", "1_", "]_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "dist_", "._", "log", "\\u", "pdf_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "zeros_", "(_", "1_", ")_", "+_", "numpy_", "._", "nan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "log", "\\u", "pdf", "\\u", "1", "n", "\\u", "1d", "\\u", "del_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "asarray_", "(_", "[_", "1_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "asarray_", "(_", "[_", "[_", "0_", "]_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "dist_", "._", "log", "\\u", "pdf_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "zeros_", "(_", "1_", ")_", "+_", "numpy_", "._", "nan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "log", "\\u", "pdf", "\\u", "2n", "\\u", "1d", "\\u", "add_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "asarray_", "(_", "[_", "0_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "asarray_", "(_", "[_", "[_", "1_", "]_", ",_", "[_", "0_", "]_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "dist_", "._", "log", "\\u", "pdf_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "zeros_", "(_", "2_", ")_", "+_", "numpy_", "._", "nan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "log", "\\u", "pdf", "\\u", "1", "n", "\\u", "2d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "asarray_", "(_", "[_", "0_", ",_", "1_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "asarray_", "(_", "[_", "[_", "1_", ",_", "1_", "]_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "dist_", "._", "log", "\\u", "pdf_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "zeros_", "(_", "1_", ")_", "+_", "numpy_", "._", "nan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Add", "Del", "Swa", "p", "Propos", "al", "Unit", "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", "log", "\\u", "pdf", "\\u", "2n", "\\u", "2d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mu_", "=_", "asarray_", "(_", "[_", "0_", ",_", "1_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "spread_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dist_", "=_", "Add", "Del", "Swa", "p", "Propos", "al_", "(_", "mu_", ",_", "spread_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "asarray_", "(_", "[_", "[_", "1_", ",_", "1_", "]_", ",_", "[_", "0_", ",_", "1_", "]_", "]_", ",_", "dtype_", "=_", "numpy_", "._", "bool", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "dist_", "._", "log", "\\u", "pdf_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "zeros_", "(_", "2_", ")_", "+_", "numpy_", "._", "nan_", "\\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, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
miguelgrinberg/oreilly-flask-apis-video/orders/app/models.py
[ { "content": "from datetime import datetime\nfrom dateutil import parser as datetime_parser\nfrom dateutil.tz import tzutc\nfrom werkzeug.security import generate_password_hash, check_password_hash\nfrom itsdangerous import TimedJSONWebSignatureSerializer as Serializer\nfrom flask import url_for, current_app\nfrom . import db\nfrom .exceptions import ValidationError\nfrom .utils import split_url\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class User(db.Model):\n __tablename__ = 'users'\n id = db.Column(db.Integer, primary_key=True)\n username = db.Column(db.String(64), index=True)\n password_hash = db.Column(db.String(128))\n\n\n\n", "metadata": "root.User", "header": "['module', '___EOS___']", "index": 11 }, { "content": " def set_password(self, password):\n self.password_hash = generate_password_hash(password)", "metadata": "root.User.set_password", "header": "['class', 'User', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 17 }, { "content": " def verify_password(self, password):\n return check_password_hash(self.password_hash, password)", "metadata": "root.User.verify_password", "header": "['class', 'User', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 20 }, { "content": " def generate_auth_token(self, expires_in=3600):\n s = Serializer(current_app.config['SECRET_KEY'], expires_in=expires_in)\n return s.dumps({'id': self.id}).decode('utf-8')", "metadata": "root.User.generate_auth_token", "header": "['class', 'User', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 23 }, { "content": " @staticmethod\n def verify_auth_token(token):\n s = Serializer(current_app.config['SECRET_KEY'])\n try:\n data = s.loads(token)\n except:\n return None\n return User.query.get(data['id'])", "metadata": "root.User.verify_auth_token", "header": "['class', 'User', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 27 }, { "content": "class Customer(db.Model):\n __tablename__ = 'customers'\n id = db.Column(db.Integer, primary_key=True)\n name = db.Column(db.String(64), index=True)\n orders = db.relationship('Order', backref='customer', lazy='dynamic')\n\n\n", "metadata": "root.Customer", "header": "['module', '___EOS___']", "index": 37 }, { "content": " def get_url(self):\n return url_for('api.get_customer', id=self.id, _external=True)", "metadata": "root.Customer.get_url", "header": "['class', 'Customer', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 43 }, { "content": " def export_data(self):\n return {\n 'self_url': self.get_url(),\n 'name': self.name,\n 'orders_url': url_for('api.get_customer_orders', id=self.id,\n _external=True)\n }", "metadata": "root.Customer.export_data", "header": "['class', 'Customer', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 46 }, { "content": " def import_data(self, data):\n try:\n self.name = data['name']\n except KeyError as e:\n raise ValidationError('Invalid customer: missing ' + e.args[0])\n return self", "metadata": "root.Customer.import_data", "header": "['class', 'Customer', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 54 }, { "content": "class Product(db.Model):\n __tablename__ = 'products'\n id = db.Column(db.Integer, primary_key=True)\n name = db.Column(db.String(64), index=True)\n items = db.relationship('Item', backref='product', lazy='dynamic')\n\n\n", "metadata": "root.Product", "header": "['module', '___EOS___']", "index": 62 }, { "content": " def get_url(self):\n return url_for('api.get_product', id=self.id, _external=True)", "metadata": "root.Product.get_url", "header": "['class', 'Product', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 68 }, { "content": " def export_data(self):\n return {\n 'self_url': self.get_url(),\n 'name': self.name\n }", "metadata": "root.Product.export_data", "header": "['class', 'Product', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 71 }, { "content": " def import_data(self, data):\n try:\n self.name = data['name']\n except KeyError as e:\n raise ValidationError('Invalid product: missing ' + e.args[0])\n return self", "metadata": "root.Product.import_data", "header": "['class', 'Product', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 77 }, { "content": "class Order(db.Model):\n __tablename__ = 'orders'\n id = db.Column(db.Integer, primary_key=True)\n customer_id = db.Column(db.Integer, db.ForeignKey('customers.id'),\n index=True)\n date = db.Column(db.DateTime, default=datetime.now)\n items = db.relationship('Item', backref='order', lazy='dynamic',\n cascade='all, delete-orphan')\n\n\n", "metadata": "root.Order", "header": "['module', '___EOS___']", "index": 85 }, { "content": " def get_url(self):\n return url_for('api.get_order', id=self.id, _external=True)", "metadata": "root.Order.get_url", "header": "['class', 'Order', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 94 }, { "content": " def export_data(self):\n return {\n 'self_url': self.get_url(),\n 'customer_url': self.customer.get_url(),\n 'date': self.date.isoformat() + 'Z',\n 'items_url': url_for('api.get_order_items', id=self.id,\n _external=True)\n }", "metadata": "root.Order.export_data", "header": "['class', 'Order', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 97 }, { "content": " def import_data(self, data):\n try:\n self.date = datetime_parser.parse(data['date']).astimezone(\n tzutc()).replace(tzinfo=None)\n except KeyError as e:\n raise ValidationError('Invalid order: missing ' + e.args[0])\n return self", "metadata": "root.Order.import_data", "header": "['class', 'Order', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 106 }, { "content": "class Item(db.Model):\n __tablename__ = 'items'\n id = db.Column(db.Integer, primary_key=True)\n order_id = db.Column(db.Integer, db.ForeignKey('orders.id'), index=True)\n product_id = db.Column(db.Integer, db.ForeignKey('products.id'),\n index=True)\n quantity = db.Column(db.Integer)\n\n\n", "metadata": "root.Item", "header": "['module', '___EOS___']", "index": 115 }, { "content": " def get_url(self):\n return url_for('api.get_item', id=self.id, _external=True)", "metadata": "root.Item.get_url", "header": "['class', 'Item', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 123 }, { "content": " def export_data(self):\n return {\n 'self_url': self.get_url(),\n 'order_url': self.order.get_url(),\n 'product_url': self.product.get_url(),\n 'quantity': self.quantity\n }", "metadata": "root.Item.export_data", "header": "['class', 'Item', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 126 }, { "content": " def import_data(self, data):\n try:\n endpoint, args = split_url(data['product_url'])\n self.quantity = int(data['quantity'])\n except KeyError as e:\n raise ValidationError('Invalid order: missing ' + e.args[0])\n if endpoint != 'api.get_product' or not 'id' in args:\n raise ValidationError('Invalid product URL: ' +\n data['product_url'])\n self.product = Product.query.get(args['id'])\n if self.product is None:\n raise ValidationError('Invalid product URL: ' +\n data['product_url'])\n return self", "metadata": "root.Item.import_data", "header": "['class', 'Item', '(', 'db', '.', 'Model', ')', ':', '___EOS___']", "index": 134 } ]
[]
[]
0
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dateutil_", "import_", "parser_", "as_", "datetime", "\\u", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dateutil_", "._", "tz_", "import_", "tz", "utc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "werkzeug_", "._", "security_", "import_", "generat", "e\\u", "password", "\\u", "hash_", ",_", "check", "\\u", "password", "\\u", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "its", "danger", "ous_", "import_", "Time", "d", "JSO", "NW", "eb", "Sign", "ature", "Serializer_", "as_", "Serializer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "import_", "url", "\\u", "for_", ",_", "current", "\\u", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "exceptions_", "import_", "Validat", "ion", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "utils_", "import_", "split", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "User_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "tablename\\u\\u_", "=_", "'", "users", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "db_", "._", "Column_", "(_", "db_", "._", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "username_", "=_", "db_", "._", "Column_", "(_", "db_", "._", "String_", "(_", "64_", ")_", ",_", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password", "\\u", "hash_", "=_", "db_", "._", "Column_", "(_", "db_", "._", "String_", "(_", "128_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "User_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "password_", "(_", "self_", ",_", "password_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "password", "\\u", "hash_", "=_", "generat", "e\\u", "password", "\\u", "hash_", "(_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "verify", "\\u", "password_", "(_", "self_", ",_", "password_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "check", "\\u", "password", "\\u", "hash_", "(_", "self_", "._", "password", "\\u", "hash_", ",_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "generat", "e\\u", "auth", "\\u", "token_", "(_", "self_", ",_", "expir", "es", "\\u", "in_", "=_", "3600_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "Serializer_", "(_", "current", "\\u", "app_", "._", "config_", "[_", "'", "SEC", "RET", "\\u", "KEY", "'_", "]_", ",_", "expir", "es", "\\u", "in_", "=_", "expir", "es", "\\u", "in_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "s_", "._", "dumps_", "(_", "{_", "'", "id", "'_", ":_", "self_", "._", "id_", "}_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User_", "(_", "db_", "._", "Model_", ")_", ":_", "\\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_", "verify", "\\u", "auth", "\\u", "token_", "(_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "Serializer_", "(_", "current", "\\u", "app_", "._", "config_", "[_", "'", "SEC", "RET", "\\u", "KEY", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "s_", "._", "loads_", "(_", "token_", ")_", "\\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\\uDEDENT\\u\\u\\u_", "return_", "User_", "._", "query_", "._", "get_", "(_", "data_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Customer_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "tablename\\u\\u_", "=_", "'", "customer", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "db_", "._", "Column_", "(_", "db_", "._", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "db_", "._", "Column_", "(_", "db_", "._", "String_", "(_", "64_", ")_", ",_", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orders_", "=_", "db_", "._", "relationship_", "(_", "'", "Order", "'_", ",_", "backref_", "=_", "'", "customer", "'_", ",_", "lazy_", "=_", "'", "dynami", "c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Customer_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "url", "\\u", "for_", "(_", "'", "api", ".", "get", "\\u", "customer", "'_", ",_", "id_", "=_", "self_", "._", "id_", ",_", "\\u", "external_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Customer_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "self", "\\u", "url", "'_", ":_", "self_", "._", "get", "\\u", "url_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "self_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "order", "s", "\\u", "url", "'_", ":_", "url", "\\u", "for_", "(_", "'", "api", ".", "get", "\\u", "customer", "\\u", "order", "s", "'_", ",_", "id_", "=_", "self_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "external_", "=_", "True_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Customer_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "import", "\\u", "data_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "data_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "'", "Inva", "lid", " ", "customer", ":", " ", "missi", "ng", " ", "'_", "+_", "e_", "._", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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_", "Product_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "tablename\\u\\u_", "=_", "'", "products", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "db_", "._", "Column_", "(_", "db_", "._", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "db_", "._", "Column_", "(_", "db_", "._", "String_", "(_", "64_", ")_", ",_", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "items_", "=_", "db_", "._", "relationship_", "(_", "'", "Item", "'_", ",_", "backref_", "=_", "'", "product", "'_", ",_", "lazy_", "=_", "'", "dynami", "c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Product_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "url", "\\u", "for_", "(_", "'", "api", ".", "get", "\\u", "product", "'_", ",_", "id_", "=_", "self_", "._", "id_", ",_", "\\u", "external_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Product_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "self", "\\u", "url", "'_", ":_", "self_", "._", "get", "\\u", "url_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "self_", "._", "name_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Product_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "import", "\\u", "data_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "data_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "'", "Inva", "lid", " ", "product", ":", " ", "missi", "ng", " ", "'_", "+_", "e_", "._", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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_", "Order_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "tablename\\u\\u_", "=_", "'", "order", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "db_", "._", "Column_", "(_", "db_", "._", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "customer", "\\u", "id_", "=_", "db_", "._", "Column_", "(_", "db_", "._", "Integer_", ",_", "db_", "._", "Fore", "ign", "Key_", "(_", "'", "customer", "s", ".", "id", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "date_", "=_", "db_", "._", "Column_", "(_", "db_", "._", "Date", "Time_", ",_", "default_", "=_", "datetime_", "._", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "items_", "=_", "db_", "._", "relationship_", "(_", "'", "Item", "'_", ",_", "backref_", "=_", "'", "order", "'_", ",_", "lazy_", "=_", "'", "dynami", "c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cascade_", "=_", "'", "all", ",", " ", "delete", "-", "orphan", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Order_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "url", "\\u", "for_", "(_", "'", "api", ".", "get", "\\u", "order", "'_", ",_", "id_", "=_", "self_", "._", "id_", ",_", "\\u", "external_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Order_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "self", "\\u", "url", "'_", ":_", "self_", "._", "get", "\\u", "url_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "customer", "\\u", "url", "'_", ":_", "self_", "._", "customer_", "._", "get", "\\u", "url_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "'_", ":_", "self_", "._", "date_", "._", "isoformat_", "(_", ")_", "+_", "'", "Z", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "items", "\\u", "url", "'_", ":_", "url", "\\u", "for_", "(_", "'", "api", ".", "get", "\\u", "order", "\\u", "items", "'_", ",_", "id_", "=_", "self_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "external_", "=_", "True_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Order_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "import", "\\u", "data_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "date_", "=_", "datetime", "\\u", "parser_", "._", "parse_", "(_", "data_", "[_", "'", "date", "'_", "]_", ")_", "._", "asti", "mezone", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tz", "utc_", "(_", ")_", ")_", "._", "replace_", "(_", "tzinfo_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "'", "Inva", "lid", " ", "order", ":", " ", "missi", "ng", " ", "'_", "+_", "e_", "._", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\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_", "Item_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "tablename\\u\\u_", "=_", "'", "items", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id_", "=_", "db_", "._", "Column_", "(_", "db_", "._", "Integer_", ",_", "primary", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "\\u", "id_", "=_", "db_", "._", "Column_", "(_", "db_", "._", "Integer_", ",_", "db_", "._", "Fore", "ign", "Key_", "(_", "'", "order", "s", ".", "id", "'_", ")_", ",_", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "product", "\\u", "id_", "=_", "db_", "._", "Column_", "(_", "db_", "._", "Integer_", ",_", "db_", "._", "Fore", "ign", "Key_", "(_", "'", "products", ".", "id", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "index_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "quantity_", "=_", "db_", "._", "Column_", "(_", "db_", "._", "Integer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Item_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "url", "\\u", "for_", "(_", "'", "api", ".", "get", "\\u", "item", "'_", ",_", "id_", "=_", "self_", "._", "id_", ",_", "\\u", "external_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Item_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "self", "\\u", "url", "'_", ":_", "self_", "._", "get", "\\u", "url_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "order", "\\u", "url", "'_", ":_", "self_", "._", "order_", "._", "get", "\\u", "url_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "product", "\\u", "url", "'_", ":_", "self_", "._", "product_", "._", "get", "\\u", "url_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "quanti", "ty", "'_", ":_", "self_", "._", "quantity_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Item_", "(_", "db_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "import", "\\u", "data_", "(_", "self_", ",_", "data_", ")_", ":_", "\\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 ", " _", "endpoint_", ",_", "args_", "=_", "split", "\\u", "url_", "(_", "data_", "[_", "'", "product", "\\u", "url", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "quantity_", "=_", "int_", "(_", "data_", "[_", "'", "quanti", "ty", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "'", "Inva", "lid", " ", "order", ":", " ", "missi", "ng", " ", "'_", "+_", "e_", "._", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "endpoint_", "!=_", "'", "api", ".", "get", "\\u", "product", "'_", "or_", "not_", "'", "id", "'_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "'", "Inva", "lid", " ", "product", " ", "URL", ":", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "product", "\\u", "url", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "product_", "=_", "Product_", "._", "query_", "._", "get_", "(_", "args_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "product_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "'", "Inva", "lid", " ", "product", " ", "URL", ":", " ", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "[_", "'", "product", "\\u", "url", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 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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, 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 ]
Except block handles 'BaseException'
scanner/asimap/asimap/fetch.py
[ { "content": "def _is8bitstring(s):\n if isinstance(s, str):\n try:\n unicode(s, 'us-ascii')\n except UnicodeError:\n return True\n return False", "metadata": "root._is8bitstring", "header": "['module', '___EOS___']", "index": 83 } ]
[]
[]
0
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "is", "8b", "its", "tring_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "s_", ",_", "str_", ")_", ":_", "\\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 ", " _", "unicode_", "(_", "s_", ",_", "'", "us", "-", "ascii", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\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 ]
Module is imported with 'import' and 'import from'
openstack/ironic/ironic/tests/unit/drivers/modules/irmc/test_power.py
[ { "content": "# Copyright 2015 FUJITSU LIMITED\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\n\"\"\"\nTest class for iRMC Power Driver\n\"\"\"\n\nimport mock\nfrom oslo_config import cfg\nfrom oslo_utils import uuidutils\n\nfrom ironic.common import exception\nfrom ironic.common import states\nfrom ironic.conductor import task_manager\nfrom ironic.drivers.modules.irmc import boot as irmc_boot\nfrom ironic.drivers.modules.irmc import common as irmc_common\nfrom ironic.drivers.modules.irmc import power as irmc_power\nfrom ironic.tests.unit.conductor import mgr_utils\nfrom ironic.tests.unit.db import base as db_base\nfrom ironic.tests.unit.db import utils as db_utils\nfrom ironic.tests.unit.objects import utils as obj_utils\n\nINFO_DICT = db_utils.get_test_irmc_info()\nCONF = cfg.CONF\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[]
[]
0
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "201", "5", " ", "FU", "JI", "TS", "U", " ", "LIMIT", "ED_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "WITH", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ations_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Test", " ", "class", " ", "for", " ", "i", "RM", "C", " ", "Power", " ", "Drive", "r", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "config_", "import_", "cfg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "oslo", "\\u", "utils_", "import_", "uuidutils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ironic_", "._", "common_", "import_", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "common_", "import_", "states_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "conductor", "_", "import_", "task", "\\u", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "drivers_", "._", "modules_", "._", "irm", "c_", "import_", "boot_", "as_", "irm", "c\\u", "boot_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "drivers_", "._", "modules_", "._", "irm", "c_", "import_", "common_", "as_", "irm", "c\\u", "common_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "drivers_", "._", "modules_", "._", "irm", "c_", "import_", "power_", "as_", "irm", "c\\u", "power_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "tests_", "._", "unit_", "._", "conductor", "_", "import_", "mgr", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "tests_", "._", "unit_", "._", "db_", "import_", "base_", "as_", "db", "\\u", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "tests_", "._", "unit_", "._", "db_", "import_", "utils_", "as_", "db", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ironic_", "._", "tests_", "._", "unit_", "._", "objects_", "import_", "utils_", "as_", "obj", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "INFO", "\\u", "DICT_", "=_", "db", "\\u", "utils_", "._", "get", "\\u", "test\\u", "irm", "c\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CONF_", "=_", "cfg_", "._", "CONF_", "\\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_" ]
[ 4, 4, 4, 4, 4, 4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