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
Unused import
concurrence/concurrence/test/testio.py
[ { "content": "\nfrom concurrence import unittest, dispatch, TimeoutError, Tasklet\nfrom concurrence.core import FileDescriptorEvent\nfrom concurrence.io import Socket\n\n\n\nif __name__ == '__main__':\n unittest.main(timeout = 10.0)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestIO(unittest.TestCase):", "metadata": "root.TestIO", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def testReadableWritableProperties(self):\n \n socket = Socket.new()\n writable = socket.writable\n self.assertTrue(isinstance(writable, FileDescriptorEvent))\n readable = socket.readable\n self.assertTrue(isinstance(readable, FileDescriptorEvent))\n\n socket.readable = None\n\n #TODO test why is socket.readable event not deallocated immediatly?", "metadata": "root.TestIO.testReadableWritableProperties", "header": "['class', 'TestIO', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 7 } ]
[ { "span": "from concurrence import unittest, dispatch, TimeoutError, Tasklet", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 65 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "conc", "urr", "ence_", "import_", "unittest_", ",_", "dispatch_", ",_", "Time", "out", "Error_", ",_", "Task", "let_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "conc", "urr", "ence_", "._", "core_", "import_", "File", "Descrip", "tor", "Event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "conc", "urr", "ence_", "._", "io_", "import_", "Socket_", "\\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\\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_", "(_", "timeout_", "=_", "10.0_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "IO_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "IO_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test", "Read", "able", "Writ", "able", "Properties_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "socket_", "=_", "Socket_", "._", "new_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "writable_", "=_", "socket_", "._", "writable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "writable_", ",_", "File", "Descrip", "tor", "Event_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "readable_", "=_", "socket_", "._", "readable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "isinstance_", "(_", "readable_", ",_", "File", "Descrip", "tor", "Event_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "socket_", "._", "readable_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "TOD", "O", " ", "test", " ", "wh", "y", " ", "is", " ", "socket", ".", "reada", "ble", " ", "event", " ", "not", " ", "deal", "located", " ", "imm", "edia", "tl", "y", "?", "_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
kenfar/DataGristle/scripts/tests/test_gristle_file_converter.py
[ { "content": "#!/usr/bin/env python\n\"\"\"\n See the file \"LICENSE\" for the full license governing this code. \n Copyright 2011,2012,2013 Ken Farmer\n\"\"\"\n\nimport sys\nimport os\nimport tempfile\nimport random\nimport csv\nimport optparse\nimport pytest\nfrom pprint import pprint as pp\nimport test_tools\n\nmod = test_tools.load_script('gristle_file_converter')\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestOptsAndArgs(object):\n\n\n\n\n", "metadata": "root.TestOptsAndArgs", "header": "['module', '___EOS___']", "index": 21 }, { "content": " def _run_check(self, sysarg, expected_result):\n sys.argv = sysarg\n cmd_parser = None\n opts = None\n files = None\n if expected_result == 'SystemExit':\n with pytest.raises(SystemExit):\n cmd_parser = mod.CommandLineParser()\n opts = cmd_parser.opts\n files = cmd_parser.files\n elif expected_result == 'except':\n with pytest.raises(Exception):\n cmd_parser = mod.CommandLineParser()\n opts = cmd_parser.opts\n files = cmd_parser.files\n elif expected_result == 'pass':\n try:\n cmd_parser = mod.CommandLineParser()\n opts = cmd_parser.opts\n files = cmd_parser.files\n except:\n pytest.fail('cmd had exception - when none was expected')\n\n return cmd_parser, opts, files", "metadata": "root.TestOptsAndArgs._run_check", "header": "['class', 'TestOptsAndArgs', '(', 'object', ')', ':', '___EOS___']", "index": 23 }, { "content": " def test_goaa_happy_path(self):\n parser, opts, files = self._run_check(['../gristle_file_converter.py', 'census.csv', '-d', ',', '-D', '|'], 'pass')\n\n assert opts.output is None\n assert opts.recdelimiter is None\n assert opts.delimiter == ','\n assert opts.out_delimiter == '|'\n assert opts.recdelimiter is None\n assert opts.out_recdelimiter is None\n assert opts.quoting is False\n assert opts.out_quoting is False\n assert opts.quotechar == '\"'\n assert opts.hasheader is False\n assert opts.out_hasheader is False\n assert opts.stripfields is False\n assert opts.verbose is True\n\n self._run_check(['../gristle_file_converter.py', 'census4.csv', '-D', '|'], 'pass')\n self._run_check(['../gristle_file_converter.py', 'census5.csv', '-d',',','-D', '|'], 'pass')\n self._run_check(['../gristle_file_converter.py', 'census6.csv', '-d',',','-D', '|', '--hasheader','--outhasheader'], 'pass')\n self._run_check(['../gristle_file_converter.py', 'census6.csv', '-D', '|', '-r','-R','-q', '-Q','--quotechar','^'], 'pass')\n self._run_check(['../gristle_file_converter.py', 'census6.csv', '-D', '|', '--stripfields'], 'pass')", "metadata": "root.TestOptsAndArgs.test_goaa_happy_path", "header": "['class', 'TestOptsAndArgs', '(', 'object', ')', ':', '___EOS___']", "index": 50 }, { "content": " def test_goaa_check_missing_out_del(self):\n self._run_check(['../gristle_file_converter.py', 'census.csv'], 'SystemExit') # missing out delimiter", "metadata": "root.TestOptsAndArgs.test_goaa_check_missing_out_del", "header": "['class', 'TestOptsAndArgs', '(', 'object', ')', ':', '___EOS___']", "index": 73 }, { "content": " def test_goaa_check_missing_out_del_arg(self):\n self._run_check(['../gristle_file_converter.py', 'census.csv', '-D'], 'SystemExit') # missing arg", "metadata": "root.TestOptsAndArgs.test_goaa_check_missing_out_del_arg", "header": "['class', 'TestOptsAndArgs', '(', 'object', ')', ':', '___EOS___']", "index": 75 }, { "content": " def test_goaa_check_unknown_option(self):\n self._run_check(['../gristle_file_converter.py', 'census.csv', '-X'], 'SystemExit') # unknown value (x)", "metadata": "root.TestOptsAndArgs.test_goaa_check_unknown_option", "header": "['class', 'TestOptsAndArgs', '(', 'object', ')', ':', '___EOS___']", "index": 77 }, { "content": " def test_goaa_check_multi_file_no_options(self):\n self._run_check(['../gristle_file_converter.py', 'census1.csv', 'census2.csv'], 'SystemExit')", "metadata": "root.TestOptsAndArgs.test_goaa_check_multi_file_no_options", "header": "['class', 'TestOptsAndArgs', '(', 'object', ')', ':', '___EOS___']", "index": 79 } ]
[ { "span": "import os", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 9 }, { "span": "import tempfile", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 15 }, { "span": "import random", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 13 }, { "span": "import csv", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 10 }, { "span": "import optparse", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 15 }, { "span": "from pprint import pprint as pp", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 31 } ]
[]
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", ";", " ", " ", " ", "See", " ", "the", " ", "file", " ", "\"", "LICENSE", "\"", " ", "for", " ", "the", " ", "full", " ", "license", " ", "govern", "ing", " ", "this", " ", "code", ".", " ", "\\", "10", ";", " ", " ", " ", "Copy", "right", " ", "2011", ",", "2012", ",", "2013", " ", "Ken", " ", "Far", "mer", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "csv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "optparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pytest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pprint_", "import_", "pprint_", "as_", "pp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "test\\u", "tools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mod_", "=_", "test\\u", "tools_", "._", "load", "\\u", "script_", "(_", "'", "gri", "stl", "e\\u", "file", "\\u", "converter", "'_", ")_", "\\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\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Opt", "s", "And", "Args_", "(_", "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\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Opt", "s", "And", "Args_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "run", "\\u", "check_", "(_", "self_", ",_", "sys", "arg_", ",_", "expected", "\\u", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "argv_", "=_", "sys", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cmd", "\\u", "parser_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "expected", "\\u", "result_", "==_", "'", "System", "Exi", "t", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "pytest_", "._", "raises_", "(_", "System", "Exit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd", "\\u", "parser_", "=_", "mod_", "._", "Command", "Line", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "=_", "cmd", "\\u", "parser_", "._", "opts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "cmd", "\\u", "parser_", "._", "files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "expected", "\\u", "result_", "==_", "'", "except", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "pytest_", "._", "raises_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmd", "\\u", "parser_", "=_", "mod_", "._", "Command", "Line", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "=_", "cmd", "\\u", "parser_", "._", "opts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "cmd", "\\u", "parser_", "._", "files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "expected", "\\u", "result_", "==_", "'", "pass", "'_", ":_", "\\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 ", " _", "cmd", "\\u", "parser_", "=_", "mod_", "._", "Command", "Line", "Parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", "=_", "cmd", "\\u", "parser_", "._", "opts_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "files_", "=_", "cmd", "\\u", "parser_", "._", "files_", "\\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 ", " _", "pytest_", "._", "fail_", "(_", "'", "cmd", " ", "had", " ", "exception", " ", "-", " ", "whe", "n", " ", "none", " ", "was", " ", "expected", "'_", ")_", "\\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_", "cmd", "\\u", "parser_", ",_", "opts_", ",_", "files_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Opt", "s", "And", "Args_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "go", "aa", "\\u", "happy", "\\u", "path_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", ",_", "opts_", ",_", "files_", "=_", "self_", "._", "\\u", "run", "\\u", "check_", "(_", "[_", "'../", "gri", "stl", "e\\u", "file", "\\u", "converter", ".", "py", "'_", ",_", "'", "census", ".", "csv", "'_", ",_", "'-", "d", "'_", ",_", "','_", ",_", "'-", "D", "'_", ",_", "'|'_", "]_", ",_", "'", "pass", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "opts_", "._", "output_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "opts_", "._", "rec", "delimiter_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "opts_", "._", "delimiter_", "==_", "','_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "opts_", "._", "out", "\\u", "delimiter_", "==_", "'|'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "opts_", "._", "rec", "delimiter_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "opts_", "._", "out", "\\u", "rec", "delimiter_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "opts_", "._", "quoting", "_", "is_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "opts_", "._", "out", "\\u", "quoting", "_", "is_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "opts_", "._", "quotechar", "_", "==_", "'\"'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "opts_", "._", "hashe", "ader_", "is_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "opts_", "._", "out", "\\u", "hashe", "ader_", "is_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "opts_", "._", "strip", "fields_", "is_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "opts_", "._", "verbose_", "is_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "check_", "(_", "[_", "'../", "gri", "stl", "e\\u", "file", "\\u", "converter", ".", "py", "'_", ",_", "'", "census", "4", ".", "csv", "'_", ",_", "'-", "D", "'_", ",_", "'|'_", "]_", ",_", "'", "pass", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "check_", "(_", "[_", "'../", "gri", "stl", "e\\u", "file", "\\u", "converter", ".", "py", "'_", ",_", "'", "census", "5", ".", "csv", "'_", ",_", "'-", "d", "'_", ",_", "','_", ",_", "'-", "D", "'_", ",_", "'|'_", "]_", ",_", "'", "pass", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "check_", "(_", "[_", "'../", "gri", "stl", "e\\u", "file", "\\u", "converter", ".", "py", "'_", ",_", "'", "census", "6", ".", "csv", "'_", ",_", "'-", "d", "'_", ",_", "','_", ",_", "'-", "D", "'_", ",_", "'|'_", ",_", "'--", "hashe", "ader", "'_", ",_", "'--", "out", "hashe", "ader", "'_", "]_", ",_", "'", "pass", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "check_", "(_", "[_", "'../", "gri", "stl", "e\\u", "file", "\\u", "converter", ".", "py", "'_", ",_", "'", "census", "6", ".", "csv", "'_", ",_", "'-", "D", "'_", ",_", "'|'_", ",_", "'-", "r", "'_", ",_", "'-", "R", "'_", ",_", "'-", "q", "'_", ",_", "'-", "Q", "'_", ",_", "'--", "quotechar", "'_", ",_", "'", "^", "'_", "]_", ",_", "'", "pass", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "run", "\\u", "check_", "(_", "[_", "'../", "gri", "stl", "e\\u", "file", "\\u", "converter", ".", "py", "'_", ",_", "'", "census", "6", ".", "csv", "'_", ",_", "'-", "D", "'_", ",_", "'|'_", ",_", "'--", "strip", "fields", "'_", "]_", ",_", "'", "pass", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Opt", "s", "And", "Args_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "go", "aa", "\\u", "check", "\\u", "missi", "ng", "\\u", "out", "\\u", "del_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "run", "\\u", "check_", "(_", "[_", "'../", "gri", "stl", "e\\u", "file", "\\u", "converter", ".", "py", "'_", ",_", "'", "census", ".", "csv", "'_", "]_", ",_", "'", "System", "Exi", "t", "'_", ")_", "#", " ", "missi", "ng", " ", "out", " ", "delimiter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Opt", "s", "And", "Args_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "go", "aa", "\\u", "check", "\\u", "missi", "ng", "\\u", "out", "\\u", "del", "\\u", "arg_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "run", "\\u", "check_", "(_", "[_", "'../", "gri", "stl", "e\\u", "file", "\\u", "converter", ".", "py", "'_", ",_", "'", "census", ".", "csv", "'_", ",_", "'-", "D", "'_", "]_", ",_", "'", "System", "Exi", "t", "'_", ")_", "#", " ", "missi", "ng", " ", "arg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Opt", "s", "And", "Args_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "go", "aa", "\\u", "check", "\\u", "unknown", "\\u", "option_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "run", "\\u", "check_", "(_", "[_", "'../", "gri", "stl", "e\\u", "file", "\\u", "converter", ".", "py", "'_", ",_", "'", "census", ".", "csv", "'_", ",_", "'-", "X", "'_", "]_", ",_", "'", "System", "Exi", "t", "'_", ")_", "#", " ", "unknown", " ", "value", " ", "(", "x", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Opt", "s", "And", "Args_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "go", "aa", "\\u", "check", "\\u", "multi", "\\u", "file", "\\u", "no", "\\u", "options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "run", "\\u", "check_", "(_", "[_", "'../", "gri", "stl", "e\\u", "file", "\\u", "converter", ".", "py", "'_", ",_", "'", "census", "1", ".", "csv", "'_", ",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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 ]
Unnecessary pass
jonmorehouse/vimhub/lib/issue_list_test.py
[ { "content": " def test_issue_list(self):\n \n kwargs = {\"state\": \"open\"}\n il = IL(config.test_repo_path, **kwargs)\n pass", "metadata": "root.TestIssueList.test_issue_list", "header": "['class', 'TestIssueList', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 10 } ]
[ { "span": "pass", "start_line": 14, "start_column": 8, "end_line": 14, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "necessar", "y_", "pass_", "[SEP]_", "class_", "Test", "Issue", "List_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "issue", "\\u", "list_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "{_", "\"", "state", "\"_", ":_", "\"", "open", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "il_", "=_", "IL", "_", "(_", "config_", "._", "test\\u", "repo", "\\u", "path_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 2 ]
Use of the return value of a procedure
mikr/xcodeprojer/xcodeprojer.py
[ { "content": "#!/usr/bin/env python\n# -*- coding: utf-8 -*-\n#\n# Copyright (c) 2014 Michael Krause ( http://krause-software.com/ ).\n#\n# You are free to use this code under the MIT license:\n# http://opensource.org/licenses/MIT\n\n# xcoderprojer.py is a script for converting project.pbxproj files\n# that represent Xcode projects into one of three formats,\n# commented Plist, XML and JSON.\n#\n# It can also be used to simply check if a project file is in the\n# correct form via the lint option.\n#\n# Xcode uses global ids (strings of 24 hex digits) as references\n# in project files. These ids are only partially random\n# and they have a structure that can be constructed\n# or taken apart with this script.\n\nfrom __future__ import print_function\n\n__version__ = '0.1'\n\nimport sys\n\nif (((sys.version_info.major == 2) and (sys.version_info.minor < 7))\n or ((sys.version_info.major == 3) and (sys.version_info.minor < 2))):\n sys.stderr.write(\"Error: Python 2.7 or when running on Python 3 at least Python 3.2 is required to run xcodeprojer\\n\")\n sys.exit(1)\n\nimport os\nimport re\nimport argparse\nimport unicodedata\nimport time\nimport random\nimport json\nimport datetime\nimport difflib\nimport tempfile\nimport codecs\nfrom operator import xor\nfrom io import BytesIO\n\nfrom collections import OrderedDict\n\ntry:\n import xml.etree.cElementTree as ETree\nexcept ImportError:\n import xml.etree.ElementTree as ETree\n\n\n__all__ = ['parse', 'unparse', 'report_parse_status', 'projectname_for_path',\n 'print_diff', 'is_global_id', 'find_projectfiles',\n 'UniqueXcodeIDGenerator', 'gidfields']\n\nPBXPROJNAME = 'project.pbxproj'\n\nOK = 0\nERROR = 1\nPARSING_FAILED = 1\n\nLINT_DIFFERENCES = 1\nLINT_FAILED = 2\n\nCONVERT_OUTPUT_FAILED = 2\n\n\nLATEST_OBJECT_VERSION = 46\n\nSTDIN = None\nSTDOUT = '-'\n\nPY2 = sys.version_info[0] == 2\nPY3 = sys.version_info[0] == 3\n\nargs_info = set([])\nargs_debug = set([])\nargs_verbose = set([])\n\n\nif PY2:\n text_type = unicode\n binary_type = str\nelse:\n text_type = str\n binary_type = bytes\n unichr = chr\n\n\n\n\n\n\nINFO_TIME = 'time'\nINFO_BACKTRACKS = 'backtracks'\nINFO_ALL = [INFO_TIME, INFO_BACKTRACKS]\n\nverbose_categories = {\n 1: [INFO_TIME],\n 2: [INFO_BACKTRACKS],\n}\n\nDEBUG_OPTIONS = 'options'\nDEBUG_ALL = [DEBUG_OPTIONS]\n\n\nre_unescape = re.compile(r'\\\\\\\\|\\\\\"|\\\\a|\\\\b|\\\\t|\\\\v|\\\\f|\\\\n|(?:\\\\U[0-9a-f]{4})')\nunescape_dict = {\n '\\\\\\\\': '\\\\',\n '\\\\\"': '\"',\n '\\\\a': '\\a',\n '\\\\b': '\\b',\n '\\\\t': '\\t',\n '\\\\v': '\\v',\n '\\\\f': '\\f',\n '\\\\n': '\\n',\n}\n\nre_escape = re.compile(r'[\\x00-\\x1f\"\\\\]')\nescape_dict = {v: k for k, v in unescape_dict.items()}\n\n\n# In comparison with unquotedstring in r_tokenize Xcode quotes\n# some characters even when they are accepted in unquoted strings.\nr_quoteworthy = re.compile(r'[^a-zA-Z0-9$./_]|___')\nr_gid = re.compile(r'\\A[0-9A-Z]{24}\\Z')\nr_ws = re.compile(r'\\s*')\n\n# Here we have the tokenizing expression that splits any Xcode plist\n# into its tokens. We do not create tokens for whitespace because we\n# don't need them and it would significantly slow the parsers down.\nr_tokenize = re.compile(r\"\"\"\n (?:\n (?P<linecomment>//.*$) # linecomment\n | (?P<comment>/\\*.*?\\*/) # comment\n # unquoted values can contain slashes so we must handle the two comment forms\n # before unquotedstring.\n | (?P<unquotedstring>[$./:_a-zA-Z0-9-]+) # unquotedstring which might be an Xcode global id (24 hex digits)\n | (?P<equals>=) # equals\n | (?P<semicolon>;) # key-value pair terminator\n | (?P<quotedstring>\"(?:\\\\\"|[^\"])*\") # a doule-quoted string\n | (?P<dictionary>\\{) # start of a dictionary\n | (?P<dictionaryend>\\}) # end of a dictionary\n | (?P<comma>,) # array element terminator\n | (?P<array>\\() # start of an array\n | (?P<arrayend>\\)) # end of an array\n )\n \\s* # skip whitespace after each token\n \"\"\", re.MULTILINE | re.VERBOSE)\n\n\nrule_mapping = r_tokenize.groupindex\nrulenumber_to_name = dict((vnr, kname) for (kname, vnr) in rule_mapping.items())\nrule_names = [rulenumber_to_name.get(groupnr, 'dummy') for groupnr in range(r_tokenize.groups + 1)]\n\nRULE_COMMENT = rule_mapping['comment']\nRULE_LINECOMMENT = rule_mapping['linecomment']\nRULE_UNQUOTEDSTRING = rule_mapping['unquotedstring']\nRULE_EQUALS = rule_mapping['equals']\nRULE_SEMICOLON = rule_mapping['semicolon']\nRULE_QUOTEDSTRING = rule_mapping['quotedstring']\nRULE_DICTIONARY = rule_mapping['dictionary']\nRULE_DICTIONARYEND = rule_mapping['dictionaryend']\nRULE_COMMA = rule_mapping['comma']\nRULE_ARRAY = rule_mapping['array']\nRULE_ARRAYEND = rule_mapping['arrayend']\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# ---------------------------------------------------------------\n\n\n\n# noinspection PySetFunctionToLiteral\n\n\n\n\n\n\n# ---------------------------------------------------------------\n\nunparsers = OrderedDict([\n ('xcode', Unparser),\n ('xml', XMLUnparser),\n ('json', JSONUnparser)])\noutput_formats = unparsers.keys()\n\n# ---------------------------------------------------------------\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nreportmessage = outline\n\n\nreportwarning = reporterror\n\n\n\n\n\n\n\n\n\n\n# ----------------------------------------------------------------------\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# ----------------------------------------------------------------------\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n if PY3:\n sys.stdout = codecs.getwriter('utf8')(sys.stdout.buffer)\n sys.stderr = codecs.getwriter('utf8')(sys.stderr.buffer)\n sys.exit(main())\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def main():\n parser = cmdline_parser()\n args = parser.parse_args()\n run_with_args(args, parser)", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 1930 } ]
[ { "span": "main())", "start_line": 1939, "start_column": 13, "end_line": 1939, "end_column": 19 } ]
[ { "span": "def main():", "start_line": 1930, "start_column": 0, "end_line": 1930, "end_column": 11 } ]
1
false
[ "[CLS]_", "Use_", "of_", "the_", "return_", "value_", "of_", "a_", "procedure_", "[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", ")", " ", "2014", " ", "Mich", "ael", " ", "Kra", "use", " ", "(", " ", "http", "://", "kra", "use", "-", "software", ".", "com", "/", " ", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "are", " ", "free", " ", "to", " ", "use", " ", "this", " ", "code", " ", "under", " ", "the", " ", "MIT", " ", "license", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "opens", "ource", ".", "org", "/", "license", "s", "/", "MIT", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "xco", "der", "proje", "r", ".", "py", " ", "is", " ", "a", " ", "script", " ", "for", " ", "convert", "ing", " ", "project", ".", "pb", "xpr", "oj", " ", "files_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "tha", "t", " ", "represent", " ", "Xco", "de", " ", "project", "s", " ", "int", "o", " ", "one", " ", "of", " ", "three", " ", "formats", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "commente", "d", " ", "Plist", ",", " ", "XML", " ", "and", " ", "JSO", "N", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "It", " ", "can", " ", "als", "o", " ", "be", " ", "used", " ", "to", " ", "simp", "ly", " ", "check", " ", "if", " ", "a", " ", "project", " ", "file", " ", "is", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "correct", " ", "form", " ", "via", " ", "the", " ", "lint", " ", "option", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Xco", "de", " ", "use", "s", " ", "global", " ", "ids", " ", "(", "string", "s", " ", "of", " ", "24", " ", "hex", " ", "digit", "s", ")", " ", "as", " ", "references_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "project", " ", "files", ".", " ", "The", "se", " ", "ids", " ", "are", " ", "only", " ", "partial", "ly", " ", "random_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "the", "y", " ", "have", " ", "a", " ", "structure", " ", "tha", "t", " ", "can", " ", "be", " ", "construct", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "or", " ", "take", "n", " ", "apart", " ", "with", " ", "this", " ", "script", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'", "0.", "1", "'_", "\\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_", "if_", "(_", "(_", "(_", "sys_", "._", "version", "\\u", "info_", "._", "major_", "==_", "2_", ")_", "and_", "(_", "sys_", "._", "version", "\\u", "info_", "._", "minor_", "<_", "7_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "(_", "(_", "sys_", "._", "version", "\\u", "info_", "._", "major_", "==_", "3_", ")_", "and_", "(_", "sys_", "._", "version", "\\u", "info_", "._", "minor_", "<_", "2_", ")_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stderr_", "._", "write_", "(_", "\"", "Error", ":", " ", "Pyth", "on", " ", "2.7", " ", "or", " ", "whe", "n", " ", "runn", "ing", " ", "on", " ", "Pyth", "on", " ", "3", " ", "at", " ", "leas", "t", " ", "Pyth", "on", " ", "3.2", " ", "is", " ", "require", "d", " ", "to", " ", "run", " ", "xco", "dep", "roj", "er", "\\\\", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unicodedata_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "difflib", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "codecs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "operator_", "import_", "xor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "io_", "import_", "Byte", "s", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "collections_", "import_", "Order", "ed", "Dict_", "\\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_", "xml_", "._", "etree_", "._", "c", "Element", "Tree_", "as_", "ET", "ree_", "\\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_", "xml_", "._", "etree_", "._", "Element", "Tree_", "as_", "ET", "ree_", "\\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", "all\\u\\u_", "=_", "[_", "'", "parse", "'_", ",_", "'", "unparse", "'_", ",_", "'", "report", "\\u", "parse", "\\u", "status", "'_", ",_", "'", "project", "name", "\\u", "for", "\\u", "path", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "print", "\\u", "diff", "'_", ",_", "'", "is", "\\u", "global", "\\u", "id", "'_", ",_", "'", "find", "\\u", "project", "files", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Unique", "Xco", "de", "ID", "Generat", "or", "'_", ",_", "'", "gid", "fields", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PB", "XP", "RO", "JN", "AME_", "=_", "'", "project", ".", "pb", "xpr", "oj", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "OK_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ERROR_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PAR", "SIN", "G", "\\u", "FAILED_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LIN", "T", "\\u", "DIFF", "ERE", "NCE", "S_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LIN", "T", "\\u", "FAILED_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CONVERT", "\\u", "OUTPU", "T", "\\u", "FAILED_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LATE", "ST", "\\u", "OBJ", "ECT", "\\u", "VERSION_", "=_", "46_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "STD", "IN_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STDOUT_", "=_", "'-'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PY", "2_", "=_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", "==_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PY", "3_", "=_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", "==_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args", "\\u", "info_", "=_", "set_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args", "\\u", "debug_", "=_", "set_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args", "\\u", "verbose_", "=_", "set_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "PY", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text", "\\u", "type_", "=_", "unicode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "binar", "y", "\\u", "type_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "text", "\\u", "type_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "binar", "y", "\\u", "type_", "=_", "bytes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unichr_", "=_", "chr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "INFO", "\\u", "TIME_", "=_", "'", "time", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INFO", "\\u", "BACK", "TRACK", "S_", "=_", "'", "backtrack", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "INFO", "\\u", "ALL_", "=_", "[_", "INFO", "\\u", "TIME_", ",_", "INFO", "\\u", "BACK", "TRACK", "S_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "verbo", "se", "\\u", "categories_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "1_", ":_", "[_", "INFO", "\\u", "TIME_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "2_", ":_", "[_", "INFO", "\\u", "BACK", "TRACK", "S_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEBU", "G", "\\u", "OPTIONS_", "=_", "'", "options", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEBU", "G", "\\u", "ALL_", "=_", "[_", "DEBU", "G", "\\u", "OPTIONS_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "re", "\\u", "unescape_", "=_", "re_", "._", "compile_", "(_", "r", "'\\\\\\\\\\\\\\\\", "|\\\\\\\\", "\"|", "\\\\\\\\", "a", "|\\\\\\\\", "b", "|\\\\\\\\", "t", "|\\\\\\\\", "v", "|\\\\\\\\", "f", "|\\\\\\\\", "n", "|(?", ":\\\\", "\\\\", "U", "[", "0", "-", "9", "a", "-", "f", "]{", "4", "})'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unescape", "\\u", "dict_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\\\\\\\\\\\\\", "'_", ":_", "'\\\\\\\\'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\\\\\", "\"'_", ":_", "'\"'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\\\\\", "a", "'_", ":_", "'\\\\", "a", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\\\\\", "b", "'_", ":_", "'\\\\", "b", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\\\\\", "t", "'_", ":_", "'\\\\", "t", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\\\\\", "v", "'_", ":_", "'\\\\", "v", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\\\\\", "f", "'_", ":_", "'\\\\", "f", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'\\\\\\\\", "n", "'_", ":_", "'\\\\", "n", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "re", "\\u", "escape_", "=_", "re_", "._", "compile_", "(_", "r", "'[", "\\\\", "x0", "0", "-\\\\", "x1", "f", "\"\\\\\\\\", "]'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "escape", "\\u", "dict_", "=_", "{_", "v_", ":_", "k_", "for_", "k_", ",_", "v_", "in_", "unescape", "\\u", "dict_", "._", "items_", "(_", ")_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "compa", "ris", "on", " ", "with", " ", "unqu", "ote", "dstr", "ing", " ", "in", " ", "r", "\\u", "tokenize", " ", "Xco", "de", " ", "quotes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "some", " ", "character", "s", " ", "even", " ", "whe", "n", " ", "the", "y", " ", "are", " ", "accept", "ed", " ", "in", " ", "unqu", "ote", "d", " ", "string", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "r", "\\u", "quote", "worth", "y_", "=_", "re_", "._", "compile_", "(_", "r", "'[", "^", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "$.", "/\\u", "]|", "\\u\\u\\u", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "gid_", "=_", "re_", "._", "compile_", "(_", "r", "'\\\\", "A", "[", "0", "-", "9", "A", "-", "Z", "]{", "24", "}\\\\", "Z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r", "\\u", "ws_", "=_", "re_", "._", "compile_", "(_", "r", "'\\\\", "s", "*'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Her", "e", " ", "we", " ", "have", " ", "the", " ", "tokeni", "zin", "g", " ", "express", "ion", " ", "tha", "t", " ", "split", "s", " ", "any", " ", "Xco", "de", " ", "plist_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "int", "o", " ", "its", " ", "token", "s", ".", " ", "We", " ", "do", " ", "not", " ", "create", " ", "token", "s", " ", "for", " ", "whitespace", " ", "bec", "aus", "e", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "don", "'", "t", " ", "need", " ", "them", " ", "and", " ", "it", " ", "wou", "ld", " ", "significant", "ly", " ", "slow", " ", "the", " ", "parser", "s", " ", "down", "._", "\\u\\u\\uNL\\u\\u\\u_", "r", "\\u", "tokenize_", "=_", "re_", "._", "compile_", "(_", "r", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "(?:", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "(?", "P", "<", "lineco", "mmen", "t", ">/", "/.*", "$)", " ", " ", " ", " ", "#", " ", "lineco", "mmen", "t", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "(?", "P", "<", "comment", ">/", "\\\\*", ".*?\\\\", "*/", ")", " ", " ", " ", " ", "#", " ", "comment", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "unqu", "ote", "d", " ", "values", " ", "can", " ", "contain", " ", "slash", "es", " ", "so", " ", "we", " ", "must", " ", "handle", " ", "the", " ", "two", " ", "comment", " ", "forms", "\\", "10", ";", " ", " ", " ", " ", "#", " ", "bef", "ore", " ", "unqu", "ote", "dstr", "ing", ".", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "(?", "P", "<", "unqu", "ote", "dstr", "ing", ">[", "$.", "/", ":\\u", "a", "-", "z", "A", "-", "Z", "0", "-", "9", "-]+)", " ", " ", "#", " ", "unqu", "ote", "dstr", "ing", " ", "whi", "ch", " ", "mig", "ht", " ", "be", " ", "an", " ", "Xco", "de", " ", "global", " ", "id", " ", "(", "24", " ", "hex", " ", "digit", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "(?", "P", "<", "equals", ">=", ")", " ", " ", " ", " ", " ", "#", " ", "equals", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "(?", "P", "<", "semico", "lon", ">", ";)", " ", " ", " ", " ", " ", " ", "#", " ", "key", "-", "value", " ", "pair", " ", "terminator", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "(?", "P", "<", "quoted", "string", ">\"", "(?:\\\\", "\\\\\"", "|[", "^", "\"]", ")*", "\")", " ", " ", " ", " ", "#", " ", "a", " ", "dou", "le", "-", "quoted", " ", "string", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "(?", "P", "<", "dictionar", "y", ">\\\\", "{", ")", " ", " ", " ", " ", "#", " ", "start", " ", "of", " ", "a", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "(?", "P", "<", "dictionar", "yen", "d", ">\\\\", "})", " ", " ", " ", " ", " ", "#", " ", "end", " ", "of", " ", "a", " ", "dictionar", "y", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "(?", "P", "<", "comma", ">", ",)", " ", " ", " ", " ", " ", " ", "#", " ", "array", " ", "element", " ", "terminator", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "(?", "P", "<", "array", ">\\\\", "()", " ", " ", " ", " ", " ", "#", " ", "start", " ", "of", " ", "an", " ", "array", "\\", "10", ";", " ", " ", " ", " ", "|", " ", "(?", "P", "<", "array", "end", ">\\\\", "))", " ", " ", " ", " ", " ", " ", "#", " ", "end", " ", "of", " ", "an", " ", "array", "\\", "10", ";", " ", " ", " ", " ", ")", "\\", "10", ";", " ", " ", " ", " ", "\\\\", "s", "*", " ", " ", " ", "#", " ", "skip", " ", "whitespace", " ", "after", " ", "each", " ", "token", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ",_", "re_", "._", "MULTILINE_", "|_", "re_", "._", "VERBOSE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rule", "\\u", "mapping_", "=_", "r", "\\u", "tokenize_", "._", "group", "index_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "number", "\\u", "to", "\\u", "name_", "=_", "dict_", "(_", "(_", "vn", "r_", ",_", "kn", "ame_", ")_", "for_", "(_", "kn", "ame_", ",_", "vn", "r_", ")_", "in_", "rule", "\\u", "mapping_", "._", "items_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rule", "\\u", "names_", "=_", "[_", "rule", "number", "\\u", "to", "\\u", "name_", "._", "get_", "(_", "group", "nr_", ",_", "'", "dummy", "'_", ")_", "for_", "group", "nr_", "in_", "range_", "(_", "r", "\\u", "tokenize_", "._", "groups_", "+_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "RULE", "\\u", "COMMENT_", "=_", "rule", "\\u", "mapping_", "[_", "'", "comment", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RULE", "\\u", "LINE", "COMMENT_", "=_", "rule", "\\u", "mapping_", "[_", "'", "lineco", "mmen", "t", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RULE", "\\u", "UN", "QUOTE", "DST", "RING", "_", "=_", "rule", "\\u", "mapping_", "[_", "'", "unqu", "ote", "dstr", "ing", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RULE", "\\u", "EQUAL", "S_", "=_", "rule", "\\u", "mapping_", "[_", "'", "equals", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RULE", "\\u", "SEMI", "COLON", "_", "=_", "rule", "\\u", "mapping_", "[_", "'", "semico", "lon", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RULE", "\\u", "QUOTE", "DST", "RING", "_", "=_", "rule", "\\u", "mapping_", "[_", "'", "quoted", "string", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RULE", "\\u", "DICT", "ION", "ARY", "_", "=_", "rule", "\\u", "mapping_", "[_", "'", "dictionar", "y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RULE", "\\u", "DICT", "ION", "ARY", "END_", "=_", "rule", "\\u", "mapping_", "[_", "'", "dictionar", "yen", "d", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RULE", "\\u", "COMMA", "_", "=_", "rule", "\\u", "mapping_", "[_", "'", "comma", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RULE", "\\u", "ARRAY_", "=_", "rule", "\\u", "mapping_", "[_", "'", "array", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "RULE", "\\u", "ARR", "AY", "END_", "=_", "rule", "\\u", "mapping_", "[_", "'", "array", "end", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_",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\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "noin", "spect", "ion", " ", "Py", "Set", "Function", "To", "Literal_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "unparse", "rs_", "=_", "Order", "ed", "Dict_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "xco", "de", "'_", ",_", "Unp", "arser", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "xml", "'_", ",_", "XML", "Unp", "arser", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "json", "'_", ",_", "JSO", "NU", "npar", "ser_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "formats_", "=_", "unparse", "rs_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "report", "message_", "=_", "outline_", "\\u\\u\\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_", "report", "warning_", "=_", "reporter", "ror_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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 ", " _", "if_", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "stdout_", "=_", "codecs_", "._", "getw", "riter", "_", "(_", "'", "utf", "8", "'_", ")_", "(_", "sys_", "._", "stdout_", "._", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "stderr_", "=_", "codecs_", "._", "getw", "riter", "_", "(_", "'", "utf", "8", "'_", ")_", "(_", "sys_", "._", "stderr_", "._", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sys_", "._", "exit_", "(_", "main_", "(_", ")_", ")_", "\\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_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parser_", "=_", "cmdline\\u", "parser_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "=_", "parser_", "._", "parse", "\\u", "args_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "run", "\\u", "with", "\\u", "args_", "(_", "args_", ",_", "parser_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 2, 2, 4, 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 ]
Unused import
stephenpascoe/esgf-pyclient/pyesgf/logon.py
[ { "content": "\"\"\"\n\nModule :mod:`pyesgf.logon`\n==========================\n\nManage the client's interaction with ESGF's security system. Using this module requires installing the MyProxyClient_ library.\n\n.. _MyProxyClient: http://pypi.python.org/pypi/MyProxyClient\n\nTo obtain ESGF credentials create a :class:`LogonManager` instance and supply it with logon\ndetails::\n\n >>> lm = LogonManager()\n >>> lm.is_logged_on()\n False\n >>> lm.logon(username, password, myproxy_hostname)\n >>> lm.is_logged_on()\n True\n\nLogon parameters that aren't specified will be prompted for at the terminal\nby default. The :class:`LogonManager` object also writes a ``.httprc`` file configuring\nOPeNDAP access through the NetCDF API.\n\nYou can use your OpenID to logon instead. The logon details will be deduced\nfrom the OpenID where possible::\n\n >>> lm.logoff()\n >>> lm.is_logged_on()\n False\n >>> lm.logon_with_openid(openid, password)\n >>> lm.is_logged_on()\n True\n\n\"\"\"\n\nimport os\nimport os.path as op\nimport datetime\nimport shutil\nfrom xml.etree import ElementTree\nimport urllib2\nimport re\nfrom getpass import getpass\n\ntry:\n from myproxy.client import MyProxyClient\n import OpenSSL\n _has_myproxy = True\nexcept ImportError:\n _has_myproxy = False\n\nfrom .exceptions import OpenidResolutionError\n\n#-----------------------------------------------------------------------------\n# Constants\n\nESGF_DIR = op.join(os.environ['HOME'], '.esg')\nESGF_CERTS_DIR = 'certificates'\nESGF_CREDENTIALS = 'credentials.pem'\nDAP_CONFIG = op.join(os.environ['HOME'], '.dodsrc')\nDAP_CONFIG_MARKER = '<<< Managed by esgf-pyclient >>>'\n\nXRI_NS = 'xri://$xrd*($v*2.0)'\nMYPROXY_URN = 'urn:esg:security:myproxy-service'\nESGF_OPENID_REXP = r'https://.*/esgf-idp/openid/(.*)'\nMYPROXY_URI_REXP = r'socket://([^:]*):?(\\d+)?'\n\n#-----------------------------------------------------------------------------\n# classes\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class LogonManager(object):\n \"\"\"\n Manages ESGF crendentials and security configuration files.\n\n Also integrates with NetCDF's secure OPeNDAP configuration.\n \n \"\"\"\n STATE_LOGGED_ON = 0\n STATE_NO_CREDENTIALS = 1\n STATE_EXPIRED_CREDENTIALS = 2\n STATE_INVALID_CREDENTIALS = 3\n\n\n\n\n\n\n\n\n \n\n\n \n\n\n", "metadata": "root.LogonManager", "header": "['module', '___EOS___']", "index": 70 }, { "content": " def __init__(self, esgf_dir=ESGF_DIR, dap_config=DAP_CONFIG):\n \"\"\"\n :param esgf_dir: Root directory of ESGF state. Default ~/.esg\n :param dap_config: Set the location of .httprc. Defaults to ~/.httprc\n\n Note if dap_config is defined your current working directory must be the\n same as the location as the dap_config file when OPeNDAP is initiallised.\n\n \"\"\"\n if not _has_myproxy:\n raise ImportError('pyesgf.logon requires MyProxyClient')\n\n self.esgf_dir = esgf_dir\n self.esgf_credentials = op.join(self.esgf_dir, ESGF_CREDENTIALS)\n self.esgf_certs_dir = op.join(self.esgf_dir, ESGF_CERTS_DIR)\n self.dap_config = dap_config\n\n self._write_dap_config()", "metadata": "root.LogonManager.__init__", "header": "['class', 'LogonManager', '(', 'object', ')', ':', '___EOS___']", "index": 82 }, { "content": " @property\n def state(self):\n if not op.exists(self.esgf_credentials):\n return self.STATE_NO_CREDENTIALS\n else:\n with open(self.esgf_credentials) as fh:\n data = fh.read()\n cert = OpenSSL.crypto.load_certificate(OpenSSL.SSL.FILETYPE_PEM, data)\n\n if cert.has_expired():\n return self.STATE_EXPIRED_CREDENTIALS\n\n #!TODO: check credentials against certificates\n\n return self.STATE_LOGGED_ON", "metadata": "root.LogonManager.state", "header": "['class', 'LogonManager', '(', 'object', ')', ':', '___EOS___']", "index": 101 }, { "content": " def is_logged_on(self):\n return self.state == self.STATE_LOGGED_ON", "metadata": "root.LogonManager.is_logged_on", "header": "['class', 'LogonManager', '(', 'object', ')', ':', '___EOS___']", "index": 118 }, { "content": " def logon_with_openid(self, openid, password=None,\n bootstrap=False, update_trustroots=True,\n interactive=True):\n \"\"\"\n Obtains ESGF credentials by detecting the MyProxy parameters from\n the users OpenID. Some ESGF compatible OpenIDs do not contain enough\n information to obtain credentials. In this case the user is prompted\n for missing information if ``interactive == True``, otherwise an\n exception is raised.\n\n :param openid: OpenID to login with See :meth:`logon` for parameters\n ``interactive``, ``bootstrap`` and ``update_trustroots``.\n \"\"\"\n username, myproxy = self._get_logon_details(openid)\n return self.logon(username, password, myproxy,\n bootstrap=bootstrap,\n update_trustroots=update_trustroots,\n interactive=interactive)", "metadata": "root.LogonManager.logon_with_openid", "header": "['class', 'LogonManager', '(', 'object', ')', ':', '___EOS___']", "index": 122 }, { "content": " def logon(self, username=None, password=None, hostname=None,\n bootstrap=False, update_trustroots=True,\n interactive=True):\n \"\"\"\n Obtain ESGF credentials from the specified MyProxy service.\n\n If ``interactive == True`` then any missing parameters of ``password``,\n ``username`` or ``hostname`` will be prompted for at the terminal.\n \n :param interactive: Whether to ask for input at the terminal for\n any missing information. I.e. username, password or hostname.\n :param bootstrap: Whether to bootstrap the trustroots for this\n MyProxy service.\n :param update_trustroots: Whether to update the trustroots for this\n MyProxy service.\n\n \"\"\"\n if interactive:\n if hostname is None:\n print 'Enter myproxy hostname:',\n hostname = raw_input()\n if username is None:\n print 'Enter myproxy username:',\n username = raw_input()\n if password is None:\n password = getpass('Enter password for %s: ' % username)\n\n if None in (hostname, username, password):\n raise OpenidResolutionError('Full logon details not available')\n\n c = MyProxyClient(hostname=hostname, caCertDir=self.esgf_certs_dir)\n\n creds = c.logon(username, password,\n bootstrap=bootstrap, updateTrustRoots=update_trustroots)\n with open(self.esgf_credentials, 'w') as fh:\n for cred in creds:\n fh.write(cred)", "metadata": "root.LogonManager.logon", "header": "['class', 'LogonManager', '(', 'object', ')', ':', '___EOS___']", "index": 142 }, { "content": " def logoff(self, clear_trustroots=False):\n \"\"\"\n Remove any obtained credentials from the ESGF environment.\n \n :param clear_trustroots: If True also remove trustroots.\n \n \"\"\"\n if op.exists(self.esgf_credentials):\n os.remove(self.esgf_credentials)\n\n if clear_trustroots:\n shutil.rmtree(self.esgf_certs_dir)", "metadata": "root.LogonManager.logoff", "header": "['class', 'LogonManager', '(', 'object', ')', ':', '___EOS___']", "index": 181 }, { "content": " def _get_logon_details(self, openid):\n openid_doc = urllib2.urlopen(openid).read()\n xml = ElementTree.fromstring(openid_doc)\n\n hostname = None\n port = None\n username = None\n\n services = xml.findall('.//{%s}Service' % XRI_NS)\n for service in services:\n try:\n service_type = service.find('{%s}Type' % XRI_NS).text\n except AttributeError:\n continue\n\n # Detect myproxy hostname and port\n if service_type == MYPROXY_URN:\n myproxy_uri = service.find('{%s}URI' % XRI_NS).text\n mo = re.match(MYPROXY_URI_REXP, myproxy_uri)\n if mo:\n hostname, port = mo.groups()\n\n # If the OpenID matches the standard ESGF pattern assume it contains\n # the username, otherwise prompt or raise an exception\n mo = re.match(ESGF_OPENID_REXP, openid)\n if mo:\n username = mo.group(1)\n \n #!TODO maybe support different myproxy port\n if port is not None:\n assert int(port) == 7512\n \n return username, hostname", "metadata": "root.LogonManager._get_logon_details", "header": "['class', 'LogonManager', '(', 'object', ')', ':', '___EOS___']", "index": 194 }, { "content": " def _write_dap_config(self, verbose=False, validate=False):\n preamble, managed, postamble = self._parse_dap_config()\n\n with open(self.dap_config, 'w') as fh:\n fh.write(\"\"\"\\\n{preamble}\n# BEGIN {marker}\nHTTP.VERBOSE={verbose}\nHTTP.COOKIEJAR={esgf_dir}/.dods_cookies\nHTTP.SSL.VALIDATE=0\nHTTP.SSL.CERTIFICATE={esgf_dir}/credentials.pem\nHTTP.SSL.KEY={esgf_dir}/credentials.pem\nHTTP.SSL.CAPATH={esgf_certs_dir}\n# END {marker}\n{postamble}\n\"\"\".format(verbose=1 if verbose else 0, \n validate=1 if validate else 0,\n esgf_certs_dir=self.esgf_certs_dir, \n esgf_dir=self.esgf_dir,\n marker=DAP_CONFIG_MARKER,\n preamble=preamble,\n postamble=postamble,\n ))", "metadata": "root.LogonManager._write_dap_config", "header": "['class', 'LogonManager', '(', 'object', ')', ':', '___EOS___']", "index": 229 }, { "content": " def _parse_dap_config(self, config_str=None):\n \"\"\"\n Read the DAP_CONFIG file and extract the parts not controlled \n by esgf-pyclient.\n\n :return: (preamble, managed, postamble), three strings of \n configuration lines before, within and after the esgf-pyclient \n controlled block.\n\n \"\"\"\n if config_str is None:\n if not op.exists(self.dap_config):\n return ('', '', '')\n config_str = open(self.dap_config).read()\n\n #!NOTE: The flags keyword argument to re.split was introduced in Python2.7\n # Keep with call non-keyword arguments for compatibility with Python2.6\n sections = re.split(r'^# (?:BEGIN|END) {0}$\\n'.format(DAP_CONFIG_MARKER), \n config_str, re.M)\n\n if len(sections) < 2:\n preamble, managed, postamble = sections[0], '', ''\n elif len(sections) == 2:\n preamble, managed, postamble = sections + ['']\n elif len(sections) == 3:\n preamble, managed, postamble = sections\n else:\n # In odd circumstances there might be more than 3 parts of the config \n # so assume the final config is the one to keep\n managed, unmanaged = [], []\n sections.reverse()\n while sections:\n unmanaged.append(sections.pop())\n if sections:\n managed.append(sections.pop())\n\n preamble = '\\n'.join(unmanaged[:-1])\n postamble = unmanaged[-1]\n managed = managed[-1]\n\n\n return preamble.strip(), managed.strip(), postamble.strip()", "metadata": "root.LogonManager._parse_dap_config", "header": "['class', 'LogonManager', '(', 'object', ')', ':', '___EOS___']", "index": 254 } ]
[ { "span": "import datetime", "start_line": 37, "start_column": 0, "end_line": 37, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\\", "10", ";", "Modul", "e", " ", ":", "mod", ":`", "pye", "sg", "f", ".", "logo", "n", "`", "\\", "10", ";", "==============", "============", "\\", "10", ";", "\\", "10", ";", "Manage", " ", "the", " ", "client", "'", "s", " ", "interacti", "on", " ", "with", " ", "ES", "GF", "'", "s", " ", "security", " ", "system", ".", " ", " ", "Us", "ing", " ", "this", " ", "module", " ", "require", "s", " ", "install", "ing", " ", "the", " ", "My", "Pro", "xy", "Client", "\\u", " ", "librar", "y", ".", "\\", "10", ";", "\\", "10", ";", "..", " ", "\\u", "My", "Pro", "xy", "Client", ":", " ", "http", "://", "pypi", ".", "python", ".", "org", "/", "pypi", "/", "My", "Pro", "xy", "Client", "\\", "10", ";", "\\", "10", ";", "To", " ", "obtain", " ", "ES", "GF", " ", "cred", "ential", "s", " ", "create", " ", "a", " ", ":", "class", ":`", "Logo", "n", "Manager", "`", " ", "instance", " ", "and", " ", "supply", " ", "it", " ", "with", " ", "logo", "n", "\\", "10", ";", "deta", "il", "s", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", ">>>", " ", "lm", " ", "=", " ", "Logo", "n", "Manager", "()", "\\", "10", ";", " ", " ", ">>>", " ", "lm", ".", "is", "\\u", "logged", "\\u", "on", "()", "\\", "10", ";", " ", " ", "Fal", "se", "\\", "10", ";", " ", " ", ">>>", " ", "lm", ".", "logo", "n", "(", "user", "name", ",", " ", "password", ",", " ", "mypro", "xy", "\\u", "host", "name", ")", "\\", "10", ";", " ", " ", ">>>", " ", "lm", ".", "is", "\\u", "logged", "\\u", "on", "()", "\\", "10", ";", " ", " ", "Tru", "e", "\\", "10", ";", "\\", "10", ";", "Logo", "n", " ", "parameter", "s", " ", "tha", "t", " ", "are", "n", "'", "t", " ", "specified", " ", "will", " ", "be", " ", "prompt", "ed", " ", "for", " ", "at", " ", "the", " ", "termina", "l", "\\", "10", ";", "by", " ", "default", ".", " ", " ", "The", " ", ":", "class", ":`", "Logo", "n", "Manager", "`", " ", "object", " ", "als", "o", " ", "writes", " ", "a", " ", "``.", "http", "rc", "``", " ", "file", " ", "configur", "ing", "\\", "10", ";", "OP", "e", "ND", "AP", " ", "access", " ", "through", " ", "the", " ", "Net", "CD", "F", " ", "API", ".", "\\", "10", ";", "\\", "10", ";", "You", " ", "can", " ", "use", " ", "your", " ", "Open", "ID", " ", "to", " ", "logo", "n", " ", "inst", "ead", ".", " ", " ", "The", " ", "logo", "n", " ", "deta", "il", "s", " ", "will", " ", "be", " ", "deduc", "ed", "\\", "10", ";", "from", " ", "the", " ", "Open", "ID", " ", "where", " ", "possib", "le", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", ">>>", " ", "lm", ".", "logo", "ff", "()", "\\", "10", ";", " ", " ", ">>>", " ", "lm", ".", "is", "\\u", "logged", "\\u", "on", "()", "\\", "10", ";", " ", " ", "Fal", "se", "\\", "10", ";", " ", " ", ">>>", " ", "lm", ".", "logo", "n", "\\u", "with", "\\u", "openid", "(", "openid", ",", " ", "password", ")", "\\", "10", ";", " ", " ", ">>>", " ", "lm", ".", "is", "\\u", "logged", "\\u", "on", "()", "\\", "10", ";", " ", " ", "Tru", "e", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "as_", "op_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xml_", "._", "etree_", "import_", "Element", "Tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "getpass_", "import_", "getpass_", "\\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_", "mypro", "xy_", "._", "client_", "import_", "My", "Pro", "xy", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Open", "SSL_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "has", "\\u", "mypro", "xy_", "=_", "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 ", " _", "\\u", "has", "\\u", "mypro", "xy_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "._", "exceptions_", "import_", "Open", "id", "Reso", "luti", "on", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Constants_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ES", "GF", "\\u", "DIR_", "=_", "op_", "._", "join_", "(_", "os_", "._", "environ_", "[_", "'", "HOM", "E", "'_", "]_", ",_", "'.", "es", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ES", "GF", "\\u", "CERT", "S", "\\u", "DIR_", "=_", "'", "certificates", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ES", "GF", "\\u", "CREDENTIALS", "_", "=_", "'", "cred", "ential", "s", ".", "pe", "m", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DA", "P", "\\u", "CONFIG_", "=_", "op_", "._", "join_", "(_", "os_", "._", "environ_", "[_", "'", "HOM", "E", "'_", "]_", ",_", "'.", "dod", "src", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DA", "P", "\\u", "CONFIG", "\\u", "MARKER", "_", "=_", "'<<", "<", " ", "Manage", "d", " ", "by", " ", "es", "gf", "-", "pyc", "lien", "t", " ", ">>>", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "XR", "I", "\\u", "NS_", "=_", "'", "xr", "i", "://", "$", "xr", "d", "*(", "$", "v", "*", "2.0", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MY", "PROX", "Y", "\\u", "URN", "_", "=_", "'", "urn", ":", "es", "g", ":", "security", ":", "mypro", "xy", "-", "service", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ES", "GF", "\\u", "OPEN", "ID", "\\u", "RE", "XP", "_", "=_", "r", "'", "https", "://", ".*", "/", "es", "gf", "-", "idp", "/", "openid", "/(.", "*)'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MY", "PROX", "Y", "\\u", "URI", "\\u", "RE", "XP", "_", "=_", "r", "'", "socket", "://", "([", "^", ":]", "*)", ":", "?(", "\\\\", "d", "+)?", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "classes_", "\\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_", "Logo", "n", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Manage", "s", " ", "ES", "GF", " ", "cre", "nden", "tial", "s", " ", "and", " ", "security", " ", "configura", "tion", " ", "files", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Al", "so", " ", "integrate", "s", " ", "with", " ", "Net", "CD", "F", "'", "s", " ", "secure", " ", "OP", "e", "ND", "AP", " ", "configura", "tion", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STATE", "\\u", "LOGGE", "D", "\\u", "ON_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STATE", "\\u", "NO", "\\u", "CREDENTIALS", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STATE", "\\u", "EXPIRE", "D", "\\u", "CREDENTIALS", "_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "STATE", "\\u", "INVALID", "\\u", "CREDENTIALS", "_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "[SEP]_", "class_", "Logo", "n", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "es", "gf", "\\u", "dir_", "=_", "ES", "GF", "\\u", "DIR_", ",_", "dap", "\\u", "config_", "=_", "DA", "P", "\\u", "CONFIG_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "es", "gf", "\\u", "dir", ":", " ", "Roo", "t", " ", "director", "y", " ", "of", " ", "ES", "GF", " ", "state", ".", " ", " ", "Default", " ", "~", "/.", "es", "g", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "dap", "\\u", "config", ":", " ", "Set", " ", "the", " ", "location", " ", "of", " ", ".", "http", "rc", ".", " ", " ", "Default", "s", " ", "to", " ", "~", "/.", "http", "rc", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", " ", "if", " ", "dap", "\\u", "config", " ", "is", " ", "defin", "ed", " ", "your", " ", "current", " ", "working", " ", "director", "y", " ", "must", " ", "be", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "same", " ", "as", " ", "the", " ", "location", " ", "as", " ", "the", " ", "dap", "\\u", "config", " ", "file", " ", "whe", "n", " ", "OP", "e", "ND", "AP", " ", "is", " ", "initial", "lis", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "\\u", "has", "\\u", "mypro", "xy_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Import", "Error_", "(_", "'", "pye", "sg", "f", ".", "logo", "n", " ", "require", "s", " ", "My", "Pro", "xy", "Client", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "es", "gf", "\\u", "dir_", "=_", "es", "gf", "\\u", "dir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "es", "gf", "\\u", "credentials_", "=_", "op_", "._", "join_", "(_", "self_", "._", "es", "gf", "\\u", "dir_", ",_", "ES", "GF", "\\u", "CREDENTIALS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "es", "gf", "\\u", "cert", "s", "\\u", "dir_", "=_", "op_", "._", "join_", "(_", "self_", "._", "es", "gf", "\\u", "dir_", ",_", "ES", "GF", "\\u", "CERT", "S", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dap", "\\u", "config_", "=_", "dap", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "write", "\\u", "dap", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Logo", "n", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "state_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "op_", "._", "exists_", "(_", "self_", "._", "es", "gf", "\\u", "credentials_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "STATE", "\\u", "NO", "\\u", "CREDENTIALS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "self_", "._", "es", "gf", "\\u", "credentials_", ")_", "as_", "fh_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "fh_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cert_", "=_", "Open", "SSL_", "._", "crypto_", "._", "load", "\\u", "certificate_", "(_", "Open", "SSL_", "._", "SSL_", "._", "FILET", "YP", "E", "\\u", "PEM", "_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cert_", "._", "has", "\\u", "expired_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "STATE", "\\u", "EXPIRE", "D", "\\u", "CREDENTIALS", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#!", "TOD", "O", ":", " ", "check", " ", "cred", "ential", "s", " ", "against", " ", "certificates", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "STATE", "\\u", "LOGGE", "D", "\\u", "ON_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Logo", "n", "Manager_", "(_", "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_", "is", "\\u", "logged", "\\u", "on_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "state_", "==_", "self_", "._", "STATE", "\\u", "LOGGE", "D", "\\u", "ON_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Logo", "n", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "logo", "n", "\\u", "with", "\\u", "openid", "_", "(_", "self_", ",_", "openid", "_", ",_", "password_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bootstrap_", "=_", "False_", ",_", "update", "\\u", "trust", "roots_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "interactive_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Obtain", "s", " ", "ES", "GF", " ", "cred", "ential", "s", " ", "by", " ", "detect", "ing", " ", "the", " ", "My", "Pro", "xy", " ", "parameter", "s", " ", "from", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "users", " ", "Open", "ID", ".", " ", " ", "Some", " ", "ES", "GF", " ", "compatible", " ", "Open", "ID", "s", " ", "do", " ", "not", " ", "contain", " ", "eno", "ugh", "\\", "10", ";", " ", " ", " ", " ", "informati", "on", " ", "to", " ", "obtain", " ", "cred", "ential", "s", ".", " ", " ", "In", " ", "this", " ", "case", " ", "the", " ", "user", " ", "is", " ", "prompt", "ed", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "missi", "ng", " ", "informati", "on", " ", "if", " ", "``", "interactive", " ", "==", " ", "Tru", "e", "``", ",", " ", "other", "wis", "e", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "exception", " ", "is", " ", "raise", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "openid", ":", " ", "Open", "ID", " ", "to", " ", "login", " ", "with", " ", "See", " ", ":", "meth", ":`", "logo", "n", "`", " ", "for", " ", "parameter", "s", "\\", "10", ";", " ", " ", " ", " ", "``", "interactive", "``", ",", " ", "``", "boots", "trap", "``", " ", "and", " ", "``", "update", "\\u", "trust", "root", "s", "``.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "username_", ",_", "mypro", "xy_", "=_", "self_", "._", "\\u", "get", "\\u", "logo", "n", "\\u", "details_", "(_", "openid", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "logo", "n_", "(_", "username_", ",_", "password_", ",_", "mypro", "xy_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bootstrap_", "=_", "bootstrap_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "update", "\\u", "trust", "roots_", "=_", "update", "\\u", "trust", "roots_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "interactive_", "=_", "interactive_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Logo", "n", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "logo", "n_", "(_", "self_", ",_", "username_", "=_", "None_", ",_", "password_", "=_", "None_", ",_", "hostname_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bootstrap_", "=_", "False_", ",_", "update", "\\u", "trust", "roots_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "interactive_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Obtain", " ", "ES", "GF", " ", "cred", "ential", "s", " ", "from", " ", "the", " ", "specified", " ", "My", "Pro", "xy", " ", "service", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "``", "interactive", " ", "==", " ", "Tru", "e", "``", " ", "then", " ", "any", " ", "missi", "ng", " ", "parameter", "s", " ", "of", " ", "``", "password", "``", ",", "\\", "10", ";", " ", " ", " ", " ", "``", "user", "name", "``", " ", "or", " ", "``", "host", "name", "``", " ", "will", " ", "be", " ", "prompt", "ed", " ", "for", " ", "at", " ", "the", " ", "termina", "l", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "interactive", ":", " ", "Whe", "ther", " ", "to", " ", "ask", " ", "for", " ", "input", " ", "at", " ", "the", " ", "termina", "l", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "any", " ", "missi", "ng", " ", "informati", "on", ".", " ", " ", "I", ".", "e", ".", " ", "user", "name", ",", " ", "password", " ", "or", " ", "host", "name", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "boots", "trap", ":", " ", "Whe", "ther", " ", "to", " ", "boots", "trap", " ", "the", " ", "trust", "root", "s", " ", "for", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "My", "Pro", "xy", " ", "service", ".", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "update", "\\u", "trust", "root", "s", ":", " ", "Whe", "ther", " ", "to", " ", "update", " ", "the", " ", "trust", "root", "s", " ", "for", " ", "this", "\\", "10", ";", " ", " ", " ", " ", "My", "Pro", "xy", " ", "service", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "interactive_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "hostname_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Enter", " ", "mypro", "xy", " ", "host", "name", ":'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hostname_", "=_", "raw", "\\u", "input_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "username_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'", "Enter", " ", "mypro", "xy", " ", "user", "name", ":'_", ",_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "username_", "=_", "raw", "\\u", "input_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "password_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "password_", "=_", "getpass_", "(_", "'", "Enter", " ", "password", " ", "for", " ", "%", "s", ":", " ", "'_", "%_", "username_", ")_", "\\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_", "None_", "in_", "(_", "hostname_", ",_", "username_", ",_", "password_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Open", "id", "Reso", "luti", "on", "Error_", "(_", "'", "Full", " ", "logo", "n", " ", "deta", "il", "s", " ", "not", " ", "avail", "able", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "c_", "=_", "My", "Pro", "xy", "Client_", "(_", "hostname_", "=_", "hostname_", ",_", "ca", "Cert", "Dir_", "=_", "self_", "._", "es", "gf", "\\u", "cert", "s", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "creds_", "=_", "c_", "._", "logo", "n_", "(_", "username_", ",_", "password_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bootstrap_", "=_", "bootstrap_", ",_", "update", "Trust", "Roo", "ts_", "=_", "update", "\\u", "trust", "roots_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "self_", "._", "es", "gf", "\\u", "credentials_", ",_", "'", "w", "'_", ")_", "as_", "fh_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "cred_", "in_", "creds_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fh_", "._", "write_", "(_", "cred_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Logo", "n", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "logo", "ff_", "(_", "self_", ",_", "clear", "\\u", "trust", "roots_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Remove", " ", "any", " ", "obtain", "ed", " ", "cred", "ential", "s", " ", "from", " ", "the", " ", "ES", "GF", " ", "environ", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "clear", "\\u", "trust", "root", "s", ":", " ", "If", " ", "Tru", "e", " ", "als", "o", " ", "remove", " ", "trust", "root", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "op_", "._", "exists_", "(_", "self_", "._", "es", "gf", "\\u", "credentials_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "remove_", "(_", "self_", "._", "es", "gf", "\\u", "credentials_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "clear", "\\u", "trust", "roots_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "self_", "._", "es", "gf", "\\u", "cert", "s", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Logo", "n", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "logo", "n", "\\u", "details_", "(_", "self_", ",_", "openid", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "openid", "\\u", "doc_", "=_", "urllib2_", "._", "urlopen_", "(_", "openid", "_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xml_", "=_", "Element", "Tree_", "._", "fromstring_", "(_", "openid", "\\u", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hostname_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "username_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "services_", "=_", "xml_", "._", "findall_", "(_", "'./", "/{", "%", "s", "}", "Service", "'_", "%_", "XR", "I", "\\u", "NS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "service_", "in_", "services_", ":_", "\\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 ", " _", "service", "\\u", "type_", "=_", "service_", "._", "find_", "(_", "'{", "%", "s", "}", "Type", "'_", "%_", "XR", "I", "\\u", "NS_", ")_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Detect", " ", "mypro", "xy", " ", "host", "name", " ", "and", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "service", "\\u", "type_", "==_", "MY", "PROX", "Y", "\\u", "URN", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mypro", "xy", "\\u", "uri_", "=_", "service_", "._", "find_", "(_", "'{", "%", "s", "}", "URI", "'_", "%_", "XR", "I", "\\u", "NS_", ")_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mo_", "=_", "re_", "._", "match_", "(_", "MY", "PROX", "Y", "\\u", "URI", "\\u", "RE", "XP", "_", ",_", "mypro", "xy", "\\u", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "hostname_", ",_", "port_", "=_", "mo_", "._", "groups_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "Open", "ID", " ", "matche", "s", " ", "the", " ", "standard", " ", "ES", "GF", " ", "pattern", " ", "assume", " ", "it", " ", "contains_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "user", "name", ",", " ", "other", "wis", "e", " ", "prompt", " ", "or", " ", "raise", " ", "an", " ", "exception_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mo_", "=_", "re_", "._", "match_", "(_", "ES", "GF", "\\u", "OPEN", "ID", "\\u", "RE", "XP", "_", ",_", "openid", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "username_", "=_", "mo_", "._", "group_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#!", "TOD", "O", " ", "may", "be", " ", "support", " ", "different", " ", "mypro", "xy", " ", "port_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "port_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "int_", "(_", "port_", ")_", "==_", "751", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "username_", ",_", "hostname_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Logo", "n", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "write", "\\u", "dap", "\\u", "config_", "(_", "self_", ",_", "verbose_", "=_", "False_", ",_", "validate_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "preamble_", ",_", "managed_", ",_", "posta", "mble", "_", "=_", "self_", "._", "\\u", "parse", "\\u", "dap", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "open_", "(_", "self_", "._", "dap", "\\u", "config_", ",_", "'", "w", "'_", ")_", "as_", "fh_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fh_", "._", "write_", "(_", "\"\"\"", "\\\\", "\\", "10", ";", "{", "preamble", "}", "\\", "10", ";", "#", " ", "BEGIN", " ", "{", "marker", "}", "\\", "10", ";", "HTTP", ".", "VERBOS", "E", "={", "verbo", "se", "}", "\\", "10", ";", "HTTP", ".", "COOKIE", "JA", "R", "={", "es", "gf", "\\u", "dir", "}/", ".", "dod", "s", "\\u", "cookie", "s", "\\", "10", ";", "HTTP", ".", "SS", "L", ".", "VALID", "ATE", "=", "0", "\\", "10", ";", "HTTP", ".", "SS", "L", ".", "CERT", "IFIC", "ATE", "={", "es", "gf", "\\u", "dir", "}/", "cred", "ential", "s", ".", "pe", "m", "\\", "10", ";", "HTTP", ".", "SS", "L", ".", "KEY", "={", "es", "gf", "\\u", "dir", "}/", "cred", "ential", "s", ".", "pe", "m", "\\", "10", ";", "HTTP", ".", "SS", "L", ".", "CAPA", "TH", "={", "es", "gf", "\\u", "cert", "s", "\\u", "dir", "}", "\\", "10", ";", "#", " ", "END", " ", "{", "marker", "}", "\\", "10", ";", "{", "posta", "mble", "}", "\\", "10", ";\"\"\"_", "._", "format_", "(_", "verbose_", "=_", "1_", "if_", "verbose_", "else_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "validate_", "=_", "1_", "if_", "validate_", "else_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "es", "gf", "\\u", "cert", "s", "\\u", "dir_", "=_", "self_", "._", "es", "gf", "\\u", "cert", "s", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "es", "gf", "\\u", "dir_", "=_", "self_", "._", "es", "gf", "\\u", "dir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "marker_", "=_", "DA", "P", "\\u", "CONFIG", "\\u", "MARKER", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "preamble_", "=_", "preamble_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "posta", "mble", "_", "=_", "posta", "mble", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Logo", "n", "Manager_", "(_", "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", "parse", "\\u", "dap", "\\u", "config_", "(_", "self_", ",_", "config", "\\u", "str_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Read", " ", "the", " ", "DA", "P", "\\u", "CONFIG", " ", "file", " ", "and", " ", "extract", " ", "the", " ", "part", "s", " ", "not", " ", "controlle", "d", " ", "\\", "10", ";", " ", " ", " ", " ", "by", " ", "es", "gf", "-", "pyc", "lien", "t", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "return", ":", " ", "(", "preamble", ",", " ", "manage", "d", ",", " ", "posta", "mble", "),", " ", "three", " ", "string", "s", " ", "of", " ", "\\", "10", ";", " ", " ", " ", " ", "configura", "tion", " ", "lines", " ", "bef", "ore", ",", " ", "within", " ", "and", " ", "after", " ", "the", " ", "es", "gf", "-", "pyc", "lien", "t", " ", "\\", "10", ";", " ", " ", " ", " ", "controlle", "d", " ", "block", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "config", "\\u", "str_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "op_", "._", "exists_", "(_", "self_", "._", "dap", "\\u", "config_", ")_", ":_", "\\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_", "config", "\\u", "str_", "=_", "open_", "(_", "self_", "._", "dap", "\\u", "config_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#!", "NOTE", ":", " ", "The", " ", "flags", " ", "keyw", "ord", " ", "argu", "ment", " ", "to", " ", "re", ".", "split", " ", "was", " ", "introduce", "d", " ", "in", " ", "Pyth", "on2", ".7_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Keep", " ", "with", " ", "call", " ", "non", "-", "keyw", "ord", " ", "argu", "ment", "s", " ", "for", " ", "compatibility", " ", "with", " ", "Pyth", "on2", ".6_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "sections_", "=_", "re_", "._", "split_", "(_", "r", "'", "^", "#", " ", "(?:", "BEGIN", "|", "END", ")", " ", "{", "0", "}$", "\\\\", "n", "'_", "._", "format_", "(_", "DA", "P", "\\u", "CONFIG", "\\u", "MARKER", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config", "\\u", "str_", ",_", "re_", "._", "M_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "sections_", ")_", "<_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "preamble_", ",_", "managed_", ",_", "posta", "mble", "_", "=_", "sections_", "[_", "0_", "]_", ",_", "''_", ",_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "sections_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "preamble_", ",_", "managed_", ",_", "posta", "mble", "_", "=_", "sections_", "+_", "[_", "''_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "sections_", ")_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "preamble_", ",_", "managed_", ",_", "posta", "mble", "_", "=_", "sections_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "In", " ", "odd", " ", "circum", "stance", "s", " ", "there", " ", "mig", "ht", " ", "be", " ", "more", " ", "than", " ", "3", " ", "part", "s", " ", "of", " ", "the", " ", "config", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", " ", "assume", " ", "the", " ", "final", " ", "config", " ", "is", " ", "the", " ", "one", " ", "to", " ", "keep_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "managed_", ",_", "unma", "nage", "d_", "=_", "[_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sections_", "._", "reverse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "sections_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unma", "nage", "d_", "._", "append_", "(_", "sections_", "._", "pop_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "sections_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "managed_", "._", "append_", "(_", "sections_", "._", "pop_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "preamble_", "=_", "'\\\\", "n", "'_", "._", "join_", "(_", "unma", "nage", "d_", "[_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "posta", "mble", "_", "=_", "unma", "nage", "d_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "managed_", "=_", "managed_", "[_", "-_", "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_", "return_", "preamble_", "._", "strip_", "(_", ")_", ",_", "managed_", "._", "strip_", "(_", ")_", ",_", "posta", "mble", "_", "._", "strip_", "(_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 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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 'BaseException'
callowayproject/django-kamasutra/positions/templatetags/position_tags.py
[ { "content": " def render(self, context):\n \n obj = resolve_variable(self.obj, context, none_on_fail=True)\n content_type_id = resolve_variable(self.content_type_id, context)\n object_id = resolve_variable(self.object_id, context)\n \n if not obj:\n try:\n ctype = ContentType.objects.get(pk=str(content_type_id))\n obj = ctype.get_object_for_this_type(pk=str(object_id))\n except:\n pass\n\n context[self.varname] = Position.objects.get_applicable(obj, self.return_all)\n \n return \"\" ", "metadata": "root.ApplicablePositionsNode.render", "header": "['class', 'ApplicablePositionsNode', '(', 'Node', ')', ':', '___EOS___']", "index": 58 }, { "content": " def render(self, context):\n \n obj = resolve_variable(self.obj, context, none_on_fail=True)\n content_type_id = resolve_variable(self.content_type_id, context)\n object_id = resolve_variable(self.object_id, context)\n \n if not obj:\n try:\n ctype = ContentType.objects.get(pk=str(content_type_id))\n obj = ctype.get_object_for_this_type(pk=str(object_id))\n except:\n pass\n \n context[self.varname] = Position.objects.positions_for_object(obj)\n \n return \"\" ", "metadata": "root.ContentPositionsNode.render", "header": "['class', 'ContentPositionsNode', '(', 'Node', ')', ':', '___EOS___']", "index": 81 }, { "content": " def render(self, context):\n \n obj = resolve_variable(self.obj, context, none_on_fail=True)\n content_type_id = resolve_variable(self.content_type_id, context)\n object_id = resolve_variable(self.object_id, context)\n \n if not obj:\n try:\n ctype = ContentType.objects.get(pk=str(content_type_id))\n obj = ctype.get_object_for_this_type(pk=str(object_id))\n except:\n pass\n \n if obj:\n context[self.varname] = Position.objects.can_be_positioned(obj)\n else:\n context[self.varname] = False\n \n return \"\"", "metadata": "root.CanBePositionedNode.render", "header": "['class', 'CanBePositionedNode', '(', 'Node', ')', ':', '___EOS___']", "index": 156 } ]
[ { "span": "except:", "start_line": 68, "start_column": 12, "end_line": 68, "end_column": 19 }, { "span": "except:", "start_line": 91, "start_column": 12, "end_line": 91, "end_column": 19 }, { "span": "except:", "start_line": 166, "start_column": 12, "end_line": 166, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Applica", "ble", "Position", "s", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "obj_", ",_", "context_", ",_", "none", "\\u", "on", "\\u", "fail_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type", "\\u", "id_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "content", "\\u", "type", "\\u", "id_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "id_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "object\\u", "id_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "obj_", ":_", "\\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 ", " _", "ctype_", "=_", "Conten", "t", "Type_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "str_", "(_", "content", "\\u", "type", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "ctype_", "._", "get", "\\u", "object\\u", "for", "\\u", "this", "\\u", "type_", "(_", "pk_", "=_", "str_", "(_", "object\\u", "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 ", " _", "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_", "context_", "[_", "self_", "._", "varname_", "]_", "=_", "Position_", "._", "objects_", "._", "get", "\\u", "applica", "ble_", "(_", "obj_", ",_", "self_", "._", "return", "\\u", "all_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conten", "t", "Position", "s", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "obj_", ",_", "context_", ",_", "none", "\\u", "on", "\\u", "fail_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type", "\\u", "id_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "content", "\\u", "type", "\\u", "id_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "id_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "object\\u", "id_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "obj_", ":_", "\\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 ", " _", "ctype_", "=_", "Conten", "t", "Type_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "str_", "(_", "content", "\\u", "type", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "ctype_", "._", "get", "\\u", "object\\u", "for", "\\u", "this", "\\u", "type_", "(_", "pk_", "=_", "str_", "(_", "object\\u", "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 ", " _", "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_", "context_", "[_", "self_", "._", "varname_", "]_", "=_", "Position_", "._", "objects_", "._", "position", "s", "\\u", "for", "\\u", "object_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Can", "Be", "Position", "ed", "Node_", "(_", "Node_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "render_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "obj_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "obj_", ",_", "context_", ",_", "none", "\\u", "on", "\\u", "fail_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "content", "\\u", "type", "\\u", "id_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "content", "\\u", "type", "\\u", "id_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "object\\u", "id_", "=_", "resolve", "\\u", "variable_", "(_", "self_", "._", "object\\u", "id_", ",_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "obj_", ":_", "\\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 ", " _", "ctype_", "=_", "Conten", "t", "Type_", "._", "objects_", "._", "get_", "(_", "pk_", "=_", "str_", "(_", "content", "\\u", "type", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj_", "=_", "ctype_", "._", "get", "\\u", "object\\u", "for", "\\u", "this", "\\u", "type_", "(_", "pk_", "=_", "str_", "(_", "object\\u", "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 ", " _", "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_", "obj_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "self_", "._", "varname_", "]_", "=_", "Position_", "._", "objects_", "._", "can", "\\u", "be", "\\u", "position", "ed_", "(_", "obj_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "context_", "[_", "self_", "._", "varname_", "]_", "=_", "False_", "\\u\\u\\uNEWLIN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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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
infrae/pyoai/src/oaipmh/tests/fakeserver.py
[ { "content": "from oaipmh import common, error\nfrom datetime import datetime\nimport random\n\n\n\n\n\n \n\n \n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class FakeServerCommon(object):\n", "metadata": "root.FakeServerCommon", "header": "['module', '___EOS___']", "index": 4 }, { "content": " def identify(self):\n return common.Identify(\n repositoryName='Fake',\n baseURL='http://www.infrae.com/oai/',\n protocolVersion=\"2.0\",\n adminEmails=['[email protected]'],\n earliestDatestamp=datetime(2004, 1, 1),\n deletedRecord='transient',\n granularity='YYYY-MM-DDThh:mm:ssZ',\n compression=['identity'])", "metadata": "root.FakeServerCommon.identify", "header": "['class', 'FakeServerCommon', '(', 'object', ')', ':', '___EOS___']", "index": 5 }, { "content": " def getRecord(self, metadataPrefix, identifier):\n try:\n return self._data[int(identifier)]\n except IndexError:\n raise error.IdDoesNotExistError, \"Id does not exist: %s\" % identifier", "metadata": "root.FakeServerCommon.getRecord", "header": "['class', 'FakeServerCommon', '(', 'object', ')', ':', '___EOS___']", "index": 16 }, { "content": "class FakeServerBase(FakeServerCommon):\n \n", "metadata": "root.FakeServerBase", "header": "['module', '___EOS___']", "index": 22 }, { "content": " def listIdentifiers(self, metadataPrefix=None, from_=None, until=None,\n set=None):\n result = []\n for header, metadata, about in self._data:\n if datestampInRange(header, from_, until):\n result.append(header)\n return result", "metadata": "root.FakeServerBase.listIdentifiers", "header": "['class', 'FakeServerBase', '(', 'FakeServerCommon', ')', ':', '___EOS___']", "index": 24 }, { "content": " def listRecords(self, metadataPrefix=None, from_=None, until=None,\n set=None):\n result = []\n for header, metadata, about in self._data:\n if datestampInRange(header, from_, until):\n result.append((header, metadata, about))\n return result", "metadata": "root.FakeServerBase.listRecords", "header": "['class', 'FakeServerBase', '(', 'FakeServerCommon', ')', ':', '___EOS___']", "index": 32 }, { "content": "class BatchingFakeServerBase(FakeServerCommon):\n \n", "metadata": "root.BatchingFakeServerBase", "header": "['module', '___EOS___']", "index": 40 }, { "content": " def listIdentifiers(self, metadataPrefix=None, from_=None, until=None,\n set=None, cursor=0, batch_size=10):\n result = []\n for header, metadata, about in self._data:\n if datestampInRange(header, from_, until):\n result.append(header)\n return result[cursor:cursor + batch_size]", "metadata": "root.BatchingFakeServerBase.listIdentifiers", "header": "['class', 'BatchingFakeServerBase', '(', 'FakeServerCommon', ')', ':', '___EOS___']", "index": 42 }, { "content": " def listRecords(self, metadataPrefix=None, from_=None, until=None,\n set=None, cursor=0, batch_size=10):\n result = []\n for header, metadata, about in self._data:\n if datestampInRange(header, from_, until):\n result.append((header, metadata, about))\n return result[cursor:cursor + batch_size]", "metadata": "root.BatchingFakeServerBase.listRecords", "header": "['class', 'BatchingFakeServerBase', '(', 'FakeServerCommon', ')', ':', '___EOS___']", "index": 50 }, { "content": "def datestampInRange(header, from_, until):\n if from_ is not None and header.datestamp() < from_:\n return False\n if until is not None and header.datestamp() > until:\n return False\n return True", "metadata": "root.datestampInRange", "header": "['module', '___EOS___']", "index": 58 }, { "content": "def createFakeData():\n data = []\n for i in range(100):\n # create some datestamp spread\n year = 2004\n month = i % 12 + 1\n day = i % 28 + 1\n hour = i % 24\n minute = i % 60\n second = i % 60\n fake_element = None\n datestamp = datetime(year, month, day, hour, minute, second)\n data.append((common.Header(fake_element, str(i), datestamp, '', False),\n common.Metadata(fake_element, {'title': ['Title %s' % i]}),\n None))\n return data", "metadata": "root.createFakeData", "header": "['module', '___EOS___']", "index": 65 }, { "content": "class FakeServer(FakeServerBase):", "metadata": "root.FakeServer", "header": "['module', '___EOS___']", "index": 82 }, { "content": " def __init__(self):\n self._data = createFakeData()", "metadata": "root.FakeServer.__init__", "header": "['class', 'FakeServer', '(', 'FakeServerBase', ')', ':', '___EOS___']", "index": 83 }, { "content": "class BatchingFakeServer(BatchingFakeServerBase):", "metadata": "root.BatchingFakeServer", "header": "['module', '___EOS___']", "index": 86 }, { "content": " def __init__(self):\n self._data = createFakeData()", "metadata": "root.BatchingFakeServer.__init__", "header": "['class', 'BatchingFakeServer', '(', 'BatchingFakeServerBase', ')', ':', '___EOS___']", "index": 87 }, { "content": "class FakeServerWithDeletions(FakeServerBase):\n\n ", "metadata": "root.FakeServerWithDeletions", "header": "['module', '___EOS___']", "index": 90 }, { "content": " def __init__(self):\n data = []\n\n for i in range(0, 12):\n # create some records in a year\n year = 2005\n month = i + 1\n day = 1\n datestamp = datetime(year, month, day, 12, 30, 0)\n fake_element = None\n data.append((common.Header(fake_element, str(i), datestamp, '', False),\n common.Metadata(fake_element, {'title': ['Title %s' % i]}),\n None))\n self._data = data", "metadata": "root.FakeServerWithDeletions.__init__", "header": "['class', 'FakeServerWithDeletions', '(', 'FakeServerBase', ')', ':', '___EOS___']", "index": 92 }, { "content": " def deletionEvent(self):\n # delete half the records we store\n data = []\n # create deletion remains for these records\n for i in range(0, 6):\n year = 2006\n month = i + 1\n day = 1\n datestamp = datetime(year, month, day, 12, 35, 0)\n fake_element = None\n data.append((common.Header(fake_element, str(i), datestamp, '', True),\n None,\n None))\n # replace first half with deleted records\n self._data = data + self._data[6:]", "metadata": "root.FakeServerWithDeletions.deletionEvent", "header": "['class', 'FakeServerWithDeletions', '(', 'FakeServerBase', ')', ':', '___EOS___']", "index": 107 } ]
[ { "span": "import random", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "oai", "pm", "h_", "import_", "common_", ",_", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Fake", "Server", "Common_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Fake", "Server", "Common_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "identify", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "common_", "._", "Identif", "y_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "repos", "itor", "y", "Name_", "=_", "'", "Fake", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "base", "URL_", "=_", "'", "http", "://", "www", ".", "infra", "e", ".", "com", "/", "oai", "/'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "protoc", "ol", "Version_", "=_", "\"", "2.0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "admin", "Ema", "ils_", "=_", "[_", "'", "fa", "ass", "en", "@", "infra", "e", ".", "com", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "earliest", "Dates", "tamp", "_", "=_", "datetime_", "(_", "2004", "_", ",_", "1_", ",_", "1_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "delete", "d", "Record_", "=_", "'", "transient", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "granularity", "_", "=_", "'", "YYY", "Y", "-", "MM", "-", "DD", "Th", "h", ":", "mm", ":", "ss", "Z", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "compression_", "=_", "[_", "'", "identi", "ty", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fake", "Server", "Common_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "Record_", "(_", "self_", ",_", "metadata", "Prefix_", ",_", "identifier_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "data_", "[_", "int_", "(_", "identifier_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Index", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "error_", "._", "Id", "Do", "es", "Not", "Exist", "Error_", ",_", "\"", "Id", " ", "doe", "s", " ", "not", " ", "exist", ":", " ", "%", "s", "\"_", "%_", "identifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Fake", "Server", "Base_", "(_", "Fake", "Server", "Common_", ")_", ":_", "\\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_", "Fake", "Server", "Base_", "(_", "Fake", "Server", "Common_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "list", "Identifiers_", "(_", "self_", ",_", "metadata", "Prefix_", "=_", "None_", ",_", "from\\u_", "=_", "None_", ",_", "until_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "set_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "header_", ",_", "metadata_", ",_", "about_", "in_", "self_", "._", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dates", "tamp", "In", "Range_", "(_", "header_", ",_", "from\\u_", ",_", "until_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "header_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fake", "Server", "Base_", "(_", "Fake", "Server", "Common_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "list", "Records_", "(_", "self_", ",_", "metadata", "Prefix_", "=_", "None_", ",_", "from\\u_", "=_", "None_", ",_", "until_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "set_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "header_", ",_", "metadata_", ",_", "about_", "in_", "self_", "._", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dates", "tamp", "In", "Range_", "(_", "header_", ",_", "from\\u_", ",_", "until_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "(_", "header_", ",_", "metadata_", ",_", "about_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Bat", "chin", "g", "Fake", "Server", "Base_", "(_", "Fake", "Server", "Common_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Bat", "chin", "g", "Fake", "Server", "Base_", "(_", "Fake", "Server", "Common_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "list", "Identifiers_", "(_", "self_", ",_", "metadata", "Prefix_", "=_", "None_", ",_", "from\\u_", "=_", "None_", ",_", "until_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "set_", "=_", "None_", ",_", "cursor_", "=_", "0_", ",_", "batch", "\\u", "size_", "=_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "header_", ",_", "metadata_", ",_", "about_", "in_", "self_", "._", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dates", "tamp", "In", "Range_", "(_", "header_", ",_", "from\\u_", ",_", "until_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "header_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "[_", "cursor_", ":_", "cursor_", "+_", "batch", "\\u", "size_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bat", "chin", "g", "Fake", "Server", "Base_", "(_", "Fake", "Server", "Common_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "list", "Records_", "(_", "self_", ",_", "metadata", "Prefix_", "=_", "None_", ",_", "from\\u_", "=_", "None_", ",_", "until_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "set_", "=_", "None_", ",_", "cursor_", "=_", "0_", ",_", "batch", "\\u", "size_", "=_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "header_", ",_", "metadata_", ",_", "about_", "in_", "self_", "._", "\\u", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "dates", "tamp", "In", "Range_", "(_", "header_", ",_", "from\\u_", ",_", "until_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "append_", "(_", "(_", "header_", ",_", "metadata_", ",_", "about_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "[_", "cursor_", ":_", "cursor_", "+_", "batch", "\\u", "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_", "def_", "dates", "tamp", "In", "Range_", "(_", "header_", ",_", "from\\u_", ",_", "until_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "from\\u_", "is_", "not_", "None_", "and_", "header_", "._", "dates", "tamp", "_", "(_", ")_", "<_", "from\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "until_", "is_", "not_", "None_", "and_", "header_", "._", "dates", "tamp", "_", "(_", ")_", ">_", "until_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "create", "Fake", "Data_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "100_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "some", " ", "dates", "tamp", " ", "spread_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "year_", "=_", "2004", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "month_", "=_", "i_", "%_", "12_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "day_", "=_", "i_", "%_", "28_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hour_", "=_", "i_", "%_", "24_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "minute_", "=_", "i_", "%_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "second_", "=_", "i_", "%_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "element_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dates", "tamp", "_", "=_", "datetime_", "(_", "year_", ",_", "month_", ",_", "day_", ",_", "hour_", ",_", "minute_", ",_", "second_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "._", "append_", "(_", "(_", "common_", "._", "Header_", "(_", "fake", "\\u", "element_", ",_", "str_", "(_", "i_", ")_", ",_", "dates", "tamp", "_", ",_", "''_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "common_", "._", "Metadata_", "(_", "fake", "\\u", "element_", ",_", "{_", "'", "title", "'_", ":_", "[_", "'", "Tit", "le", " ", "%", "s", "'_", "%_", "i_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Fake", "Server_", "(_", "Fake", "Server", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fake", "Server_", "(_", "Fake", "Server", "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_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "data_", "=_", "create", "Fake", "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_", "Bat", "chin", "g", "Fake", "Server_", "(_", "Bat", "chin", "g", "Fake", "Server", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bat", "chin", "g", "Fake", "Server_", "(_", "Bat", "chin", "g", "Fake", "Server", "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_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "data_", "=_", "create", "Fake", "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_", "Fake", "Server", "With", "Deletion", "s_", "(_", "Fake", "Server", "Base_", ")_", ":_", "\\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_", "Fake", "Server", "With", "Deletion", "s_", "(_", "Fake", "Server", "Base_", ")_", ":_", "\\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 ", " _", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "12_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "some", " ", "record", "s", " ", "in", " ", "a", " ", "year_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "year_", "=_", "2005", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "month_", "=_", "i_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "day_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dates", "tamp", "_", "=_", "datetime_", "(_", "year_", ",_", "month_", ",_", "day_", ",_", "12_", ",_", "30_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "element_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "._", "append_", "(_", "(_", "common_", "._", "Header_", "(_", "fake", "\\u", "element_", ",_", "str_", "(_", "i_", ")_", ",_", "dates", "tamp", "_", ",_", "''_", ",_", "False_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "common_", "._", "Metadata_", "(_", "fake", "\\u", "element_", ",_", "{_", "'", "title", "'_", ":_", "[_", "'", "Tit", "le", " ", "%", "s", "'_", "%_", "i_", "]_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "data_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fake", "Server", "With", "Deletion", "s_", "(_", "Fake", "Server", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "deletion", "Event_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "delete", " ", "half", " ", "the", " ", "record", "s", " ", "we", " ", "store_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "deletion", " ", "remains", " ", "for", " ", "these", " ", "records_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "0_", ",_", "6_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "year_", "=_", "2006", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "month_", "=_", "i_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "day_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dates", "tamp", "_", "=_", "datetime_", "(_", "year_", ",_", "month_", ",_", "day_", ",_", "12_", ",_", "35_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fake", "\\u", "element_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "._", "append_", "(_", "(_", "common_", "._", "Header_", "(_", "fake", "\\u", "element_", ",_", "str_", "(_", "i_", ")_", ",_", "dates", "tamp", "_", ",_", "''_", ",_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "replace", " ", "first", " ", "half", " ", "with", " ", "delete", "d", " ", "records_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "data_", "=_", "data_", "+_", "self_", "._", "\\u", "data_", "[_", "6_", ":_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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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 ]
NotImplemented is not an Exception
flaviogrossi/sockjs-cyclone/sockjs/cyclone/session.py
[ { "content": " def send_message(self, msg, stats=True):\n \"\"\" Send or queue outgoing message\n\n @param msg: Message to send\n\n @param stats: If set to True, will update statistics after operation\n completes\n \"\"\"\n raise NotImplemented()", "metadata": "root.BaseSession.send_message", "header": "['class', 'BaseSession', '(', 'object', ')', ':', '___EOS___']", "index": 133 }, { "content": " def send_jsonified(self, msg, stats=True):\n \"\"\" Send or queue outgoing message which was json-encoded before. Used\n by the C{broadcast} method.\n\n @param msg: JSON-encoded message to send\n @param stats: If set to True, will update statistics after operation\n completes\n \"\"\"\n raise NotImplemented()", "metadata": "root.BaseSession.send_jsonified", "header": "['class', 'BaseSession', '(', 'object', ')', ':', '___EOS___']", "index": 143 } ]
[ { "span": "NotImplemented(", "start_line": 141, "start_column": 14, "end_line": 141, "end_column": 28 }, { "span": "NotImplemented(", "start_line": 151, "start_column": 14, "end_line": 151, "end_column": 28 } ]
[]
1
true
[ "[CLS]_", "Not", "Implemented_", "is_", "not_", "an_", "Exception_", "[SEP]_", "class_", "Base", "Session_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "message_", "(_", "self_", ",_", "msg_", ",_", "stats_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Sen", "d", " ", "or", " ", "queue", " ", "outgoing", " ", "message", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "msg", ":", " ", "Messag", "e", " ", "to", " ", "send", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "stats", ":", " ", "If", " ", "set", " ", "to", " ", "Tru", "e", ",", " ", "will", " ", "update", " ", "statistic", "s", " ", "after", " ", "operati", "on", "\\", "10", ";", " ", " ", " ", " ", "complete", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Implemented_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Session_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "send", "\\u", "json", "ified", "_", "(_", "self_", ",_", "msg_", ",_", "stats_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Sen", "d", " ", "or", " ", "queue", " ", "outgoing", " ", "message", " ", "whi", "ch", " ", "was", " ", "json", "-", "encode", "d", " ", "bef", "ore", ".", " ", "Us", "ed", "\\", "10", ";", " ", " ", " ", " ", "by", " ", "the", " ", "C", "{", "broadcast", "}", " ", "method", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "msg", ":", " ", "JSO", "N", "-", "encode", "d", " ", "message", " ", "to", " ", "send", "\\", "10", ";", " ", " ", " ", " ", "@", "param", " ", "stats", ":", " ", "If", " ", "set", " ", "to", " ", "Tru", "e", ",", " ", "will", " ", "update", " ", "statistic", "s", " ", "after", " ", "operati", "on", "\\", "10", ";", " ", " ", " ", " ", "complete", "s", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Not", "Implemented_", "(_", ")_", "\\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, 0, 1, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
jonmorehouse/vimhub/lib/issue.py
[ { "content": "import utils\nimport config\nimport re\nimport git\nimport copy\nimport comment_list\nimport webbrowser\nimport github\n\ntry:\n import vim\nexcept ImportError as e:\n vim = False\n\ni_hash = {} # hash individual issues\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Issue:\n\n defaults = {\n \"title\": \"\",\n \"assignee\": \"\",\n \"milestone\": \"\",\n \"state\": \"open\",\n \"labels\": [],\n \"body\": \"\",\n }\n\n\n\n\n\n\n\n \n\n \n\n \n\n\n\n\n", "metadata": "root.Issue", "header": "['module', '___EOS___']", "index": 16 }, { "content": " def __init__(self, **kwargs):\n \n # set defaults for class\n if not Issue.defaults.get(\"assignee\"):\n Issue.defaults[\"assignee\"] = utils.github.user()[\"login\"]\n self.repo = kwargs.get(\"repo\")\n self.number = kwargs.get(\"number\")\n self.issue_uri = \"repos/%s/issues/%s\" % (self.repo, self.number) \n self.comments = comment_list.CommentList(self.number, self.repo) \n self._get_data()", "metadata": "root.Issue.__init__", "header": "['class', 'Issue', ':', '___EOS___']", "index": 27 }, { "content": " @classmethod\n def open(cls, *args):\n\n i = cls._issue_from_args(*args)\n if not i or not i.repo:\n print \"Not a valid repository or issue. Please try again or consult help pages\"\n return\n i.post_hook()", "metadata": "root.Issue.open", "header": "['class', 'Issue', ':', '___EOS___']", "index": 38 }, { "content": " @classmethod\n def browse(cls, *args):\n \n i = cls._issue_from_args(*args)\n if hasattr(i, \"url\"):\n webbrowser.open(i.url)\n i.map_buffer()", "metadata": "root.Issue.browse", "header": "['class', 'Issue', ':', '___EOS___']", "index": 47 }, { "content": " @classmethod\n def save(cls):\n \n i = cls._issue_from_buffer()\n if not i:\n print \"Error has occurred. Issue was not found. Please report an issue on github\"\n return\n\n # parse the uri from this issue\n i.position = vim.current.window.cursor\n i.parse() # parse the buffer\n i.update() # push to the server\n i.post_hook()", "metadata": "root.Issue.save", "header": "['class', 'Issue', ':', '___EOS___']", "index": 55 }, { "content": " @classmethod\n def toggle_state(cls):\n\n i = cls._issue_from_buffer()\n i.position = vim.current.window.cursor\n i.parse() # parse current buffer to correct location\n i.change_state()\n i.update()\n i.post_hook()", "metadata": "root.Issue.toggle_state", "header": "['class', 'Issue', ':', '___EOS___']", "index": 69 }, { "content": " @classmethod\n def _issue_from_args(cls, *args, **kwargs):\n \n kwargs = utils.args_to_kwargs(args, kwargs)\n\n if not kwargs.get(\"args\") or len(kwargs.get(\"args\")) == 0:\n kwargs[\"number\"] = \"new\"\n else:\n kwargs[\"number\"] = kwargs.get(\"args\")[0]\n del kwargs[\"args\"]\n \n key = \"%s/%s\" % (kwargs.get(\"repo\"), kwargs.get(\"number\"))\n if not i_hash.has_key(key):\n i_hash[key] = cls(**kwargs)\n return i_hash.get(key)", "metadata": "root.Issue._issue_from_args", "header": "['class', 'Issue', ':', '___EOS___']", "index": 79 }, { "content": " @classmethod\n def _issue_from_buffer(cls):\n\n # bname corresponds to to the issue hash key \n bname = vim.current.buffer.name\n\n # check to make sure the correct pieces are here\n mg = re.match(r\"(?P<user>.*)/(?P<repo>.*)/(?P<issue>.*)\", bname)\n if not mg:\n return None\n return i_hash.get(bname)", "metadata": "root.Issue._issue_from_buffer", "header": "['class', 'Issue', ':', '___EOS___']", "index": 95 }, { "content": " def change_state(self):\n\n if self.data[\"state\"] == \"open\":\n self.data[\"state\"] = \"closed\"\n else:\n self.data[\"state\"] = \"open\"", "metadata": "root.Issue.change_state", "header": "['class', 'Issue', ':', '___EOS___']", "index": 108 }, { "content": " def parse(self):\n # reset body\n self.data[\"body\"] = []\n\n # this is messy - convert to a matchgroup in the future\n for index, line in enumerate(vim.current.buffer[1:]):\n mg = re.match(r\"# (?P<label>[^:]+): (?P<value>.*)\", line)\n # handle normal attribute\n if mg:\n value = mg.group(\"value\")\n label = mg.group(\"label\").lower()\n if label in self.defaults.keys():\n if type(self.defaults[label]) == list:\n self.data[label] = value.split(\",\")\n else:\n self.data[label] = value\n # handle error\n elif re.search(r\"^## Comments Issue #%s\" % self.number, line):\n # pass the comments to the other section\n self.comments.parse(vim.current.buffer[index+1:-1])\n break\n else: \n self.data[\"body\"].append(line)\n\n self.data[\"body\"] = utils.trim_lines(self.data[\"body\"])", "metadata": "root.Issue.parse", "header": "['class', 'Issue', ':', '___EOS___']", "index": 115 }, { "content": " def post_hook(self):\n\n self.draw()\n self.map_buffer()\n if hasattr(self, \"position\"):\n vim.command(str(self.position[0]))\n #vim.command(\"|%s\" % str(self.position[1]))", "metadata": "root.Issue.post_hook", "header": "['class', 'Issue', ':', '___EOS___']", "index": 141 }, { "content": " def map_buffer(self):\n # autocommand to call on post save ...\n vim.command(\"map <buffer> s :python issue.Issue.save()<cr>\") # uses current buffer name\n # toggle the state of the current issue\n vim.command(\"map <buffer> cc :python issue.Issue.toggle_state()<cr>\") # uses current buffer name\n # hit enter to browse the current url\n vim.command(\"map <buffer> <cr> :normal! 0<cr>:python issue.Issue.browse(\\\"%s\\\", \\\"%s\\\")<cr>\" % (self.repo, self.number)) # doesn't use current buffer name", "metadata": "root.Issue.map_buffer", "header": "['class', 'Issue', ':', '___EOS___']", "index": 149 }, { "content": " def draw(self):\n \n self.buffer_name = \"%s/%s\" % (self.repo, self.number)\n b = utils.get_buffer(self.buffer_name) \n vim.command(\"1,$d\")\n vim.command(\"set filetype=markdown\")\n\n # print out issue\n b.append(\"## %s # %s\" % (self.repo, self.number))\n b.append(\"\")\n\n # iterate through all keys that aren't body\n keys = self.data.keys()\n keys.remove(\"body\")\n for key in keys:\n value = self.data[key]\n if type(value) == list:\n value = \",\".join(value)\n b.append(\"# %s: %s\" % (key.capitalize(), value))\n\n # print out body if applicable\n if self.data.has_key(\"body\") and self.data[\"body\"]:\n for line in self.data[\"body\"].splitlines():\n b.append(line)\n \n # now we need to print the comments\n self.comments.draw(b)\n # remove leading line\n vim.command(\"1delete _\")", "metadata": "root.Issue.draw", "header": "['class', 'Issue', ':', '___EOS___']", "index": 157 }, { "content": " def update(self):\n\n if self.number == \"new\":\n self._create_issue()\n else: \n self._save_issue() ", "metadata": "root.Issue.update", "header": "['class', 'Issue', ':', '___EOS___']", "index": 187 }, { "content": " def _get_data(self):\n\n self.data = copy.deepcopy(self.defaults)\n\n # get issue from github api if not new\n if not self.number == \"new\":\n data, status = github.request(github.url(self.issue_uri))\n if not status:\n utils.log(data)\n return\n\n # issue was successfully requested\n for key in self.defaults.keys() + [\"assignee\", \"user\"]:\n # github will return None\n if key in (\"assignee\", \"user\") and data.get(key):\n self.data[key] = data[key][\"login\"]\n elif key == \"labels\":\n self.data[key] = [str(label[\"name\"]) for label in data[key]]\n elif key == \"milestone\" and data.get(\"milestone\"):\n self.data[key] = data[key][\"title\"]\n elif data.get(key):\n self.data[key] = data[key]\n\n # grab the browse url \n self.url = data[\"html_url\"]", "metadata": "root.Issue._get_data", "header": "['class', 'Issue', ':', '___EOS___']", "index": 194 }, { "content": " def _create_issue(self):\n # create issue on the server\n uri = \"repos/%s/issues\" % self.repo\n url = github.url(uri)\n data = utils.clean_data(copy.deepcopy(self.data), [\"state\"])\n if not data or len(data.keys()) == 0:\n utils.log(\"New issues require title/body\")\n return\n data, status = github.request(url, \"post\", data)\n if not status:\n utils.log(data)\n return \n\n # update attributes as needed for object\n self.number = str(data[\"number\"])\n self.data[\"user\"] = data[\"user\"][\"login\"]\n self.url = data[\"html_url\"]\n self.issue_uri = \"repos/%s/issues/%s\" % (self.repo, self.number)\n self.comments.number = self.number\n\n # clean up hash\n del i_hash[\"%s/%s\" % (self.repo, \"new\")]\n i_hash[\"%s/%s\" % (self.repo, self.number)] = self\n\n # delete the old buffer that we don't need any more\n vim.command(\"silent new\")\n vim.command(\"bdelete %s\" % self.buffer_name)", "metadata": "root.Issue._create_issue", "header": "['class', 'Issue', ':', '___EOS___']", "index": 220 }, { "content": " def _save_issue(self):\n\n # get ready for the patch operation\n url = github.url(self.issue_uri)\n data = utils.clean_data(copy.deepcopy(self.data), [\"number\", \"user\", \"labels\"])\n data, status = github.request(url, \"patch\", data)", "metadata": "root.Issue._save_issue", "header": "['class', 'Issue', ':', '___EOS___']", "index": 248 } ]
[ { "span": "import config", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 13 }, { "span": "import git", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "git_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "comment", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "webbrowser_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "github_", "\\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_", "vim_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vim_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i", "\\u", "hash_", "=_", "{_", "}_", "#", " ", "hash", " ", "individual", " ", "issues_", "\\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_", "Issue_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "defaults_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "title", "\"_", ":_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "assignee", "\"_", ":_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "milestone", "\"_", ":_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "state", "\"_", ":_", "\"", "open", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "labels", "\"_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "body", "\"_", ":_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Issue_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set", " ", "default", "s", " ", "for", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "Issue_", "._", "defaults_", "._", "get_", "(_", "\"", "assignee", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Issue_", "._", "defaults_", "[_", "\"", "assignee", "\"_", "]_", "=_", "utils_", "._", "github_", "._", "user_", "(_", ")_", "[_", "\"", "login", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "repo_", "=_", "kwargs_", "._", "get_", "(_", "\"", "repo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "number_", "=_", "kwargs_", "._", "get_", "(_", "\"", "number", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "issue", "\\u", "uri_", "=_", "\"", "repos", "/", "%", "s", "/", "issue", "s", "/", "%", "s", "\"_", "%_", "(_", "self_", "._", "repo_", ",_", "self_", "._", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "comments_", "=_", "comment", "\\u", "list_", "._", "Comme", "nt", "List_", "(_", "self_", "._", "number_", ",_", "self_", "._", "repo_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "get", "\\u", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issue_", ":_", "\\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_", "open_", "(_", "cls_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "cls_", "._", "\\u", "issue", "\\u", "from", "\\u", "args_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "i_", "or_", "not_", "i_", "._", "repo_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Not", " ", "a", " ", "valid", " ", "repos", "itor", "y", " ", "or", " ", "issue", ".", " ", "Ple", "ase", " ", "try", " ", "again", " ", "or", " ", "consul", "t", " ", "help", " ", "page", "s", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "._", "post", "\\u", "hook_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issue_", ":_", "\\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_", "browse_", "(_", "cls_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "cls_", "._", "\\u", "issue", "\\u", "from", "\\u", "args_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "i_", ",_", "\"", "url", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "webbrowser_", "._", "open_", "(_", "i_", "._", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "._", "map", "\\u", "buffer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issue_", ":_", "\\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_", "save_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "cls_", "._", "\\u", "issue", "\\u", "from", "\\u", "buffer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "i_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "Error", " ", "has", " ", "occur", "red", ".", " ", "Issue", " ", "was", " ", "not", " ", "found", ".", " ", "Ple", "ase", " ", "report", " ", "an", " ", "issue", " ", "on", " ", "git", "hub", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "parse", " ", "the", " ", "uri", " ", "from", " ", "this", " ", "issue_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "i_", "._", "position_", "=_", "vim_", "._", "current_", "._", "window_", "._", "cursor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "._", "parse_", "(_", ")_", "#", " ", "parse", " ", "the", " ", "buffer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "._", "update_", "(_", ")_", "#", " ", "push", " ", "to", " ", "the", " ", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "._", "post", "\\u", "hook_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issue_", ":_", "\\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_", "toggle", "\\u", "state_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "=_", "cls_", "._", "\\u", "issue", "\\u", "from", "\\u", "buffer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "._", "position_", "=_", "vim_", "._", "current_", "._", "window_", "._", "cursor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "._", "parse_", "(_", ")_", "#", " ", "parse", " ", "current", " ", "buffer", " ", "to", " ", "correct", " ", "location_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "._", "change", "\\u", "state_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "._", "update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "._", "post", "\\u", "hook_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issue_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "issue", "\\u", "from", "\\u", "args_", "(_", "cls_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "utils_", "._", "args", "\\u", "to", "\\u", "kwargs_", "(_", "args_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "kwargs_", "._", "get_", "(_", "\"", "args", "\"_", ")_", "or_", "len_", "(_", "kwargs_", "._", "get_", "(_", "\"", "args", "\"_", ")_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "\"", "number", "\"_", "]_", "=_", "\"", "new", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "\"", "number", "\"_", "]_", "=_", "kwargs_", "._", "get_", "(_", "\"", "args", "\"_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "kwargs_", "[_", "\"", "args", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "kwargs_", "._", "get_", "(_", "\"", "repo", "\"_", ")_", ",_", "kwargs_", "._", "get_", "(_", "\"", "number", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "i", "\\u", "hash_", "._", "has", "\\u", "key_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "hash_", "[_", "key_", "]_", "=_", "cls_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "i", "\\u", "hash_", "._", "get_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issue_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "issue", "\\u", "from", "\\u", "buffer_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bn", "ame", " ", "correspond", "s", " ", "to", " ", "to", " ", "the", " ", "issue", " ", "hash", " ", "key", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bname_", "=_", "vim_", "._", "current_", "._", "buffer_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "to", " ", "make", " ", "sure", " ", "the", " ", "correct", " ", "piece", "s", " ", "are", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "mg_", "=_", "re_", "._", "match_", "(_", "r", "\"(?", "P", "<", "user", ">.*)", "/(", "?", "P", "<", "repo", ">.*)", "/(", "?", "P", "<", "issue", ">.*)", "\"_", ",_", "bname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "mg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "i", "\\u", "hash_", "._", "get_", "(_", "bname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issue_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "change", "\\u", "state_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "data_", "[_", "\"", "state", "\"_", "]_", "==_", "\"", "open", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data_", "[_", "\"", "state", "\"_", "]_", "=_", "\"", "close", "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 ", " _", "self_", "._", "data_", "[_", "\"", "state", "\"_", "]_", "=_", "\"", "open", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issue_", ":_", "\\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_", "parse_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "reset", " ", "body_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data_", "[_", "\"", "body", "\"_", "]_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "is", " ", "mess", "y", " ", "-", " ", "convert", " ", "to", " ", "a", " ", "match", "group", " ", "in", " ", "the", " ", "future_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "index_", ",_", "line_", "in_", "enumerate_", "(_", "vim_", "._", "current_", "._", "buffer_", "[_", "1_", ":_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mg_", "=_", "re_", "._", "match_", "(_", "r", "\"#", " ", "(?", "P", "<", "label", ">[", "^", ":]", "+)", ":", " ", "(?", "P", "<", "value", ">.*)", "\"_", ",_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "handle", " ", "normal", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "mg_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "mg_", "._", "group_", "(_", "\"", "value", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label_", "=_", "mg_", "._", "group_", "(_", "\"", "label", "\"_", ")_", "._", "lower_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "label_", "in_", "self_", "._", "defaults_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "type_", "(_", "self_", "._", "defaults_", "[_", "label_", "]_", ")_", "==_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "data_", "[_", "label_", "]_", "=_", "value_", "._", "split_", "(_", "\",\"_", ")_", "\\u\\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_", "._", "data_", "[_", "label_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "handle", " ", "error_", "\\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_", "re_", "._", "search_", "(_", "r", "\"", "^", "##", " ", "Comme", "nts", " ", "Issue", " ", "#", "%", "s", "\"_", "%_", "self_", "._", "number_", ",_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "pass", " ", "the", " ", "comment", "s", " ", "to", " ", "the", " ", "other", " ", "section_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "comments_", "._", "parse_", "(_", "vim_", "._", "current_", "._", "buffer_", "[_", "index_", "+_", "1_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data_", "[_", "\"", "body", "\"_", "]_", "._", "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_", "self_", "._", "data_", "[_", "\"", "body", "\"_", "]_", "=_", "utils_", "._", "trim", "\\u", "lines_", "(_", "self_", "._", "data_", "[_", "\"", "body", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issue_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post", "\\u", "hook_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "draw_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "map", "\\u", "buffer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hasattr_", "(_", "self_", ",_", "\"", "position", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vim_", "._", "command_", "(_", "str_", "(_", "self_", "._", "position_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "vim", ".", "command", "(\"", "|", "%", "s", "\"", " ", "%", " ", "str", "(", "self", ".", "position", "[", "1", "]))", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Issue_", ":_", "\\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_", "map", "\\u", "buffer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "autoc", "ommand", " ", "to", " ", "call", " ", "on", " ", "post", " ", "save", " ", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vim_", "._", "command_", "(_", "\"", "map", " ", "<", "buffer", ">", " ", "s", " ", ":", "python", " ", "issue", ".", "Issue", ".", "save", "()", "<", "cr", ">\"_", ")_", "#", " ", "use", "s", " ", "current", " ", "buffer", " ", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "toggle", " ", "the", " ", "state", " ", "of", " ", "the", " ", "current", " ", "issue_", "\\u\\u\\uNL\\u\\u\\u_", "vim_", "._", "command_", "(_", "\"", "map", " ", "<", "buffer", ">", " ", "cc", " ", ":", "python", " ", "issue", ".", "Issue", ".", "toggle", "\\u", "state", "()", "<", "cr", ">\"_", ")_", "#", " ", "use", "s", " ", "current", " ", "buffer", " ", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "hit", " ", "enter", " ", "to", " ", "browse", " ", "the", " ", "current", " ", "url_", "\\u\\u\\uNL\\u\\u\\u_", "vim_", "._", "command_", "(_", "\"", "map", " ", "<", "buffer", ">", " ", "<", "cr", ">", " ", ":", "normal", "!", " ", "0", "<", "cr", ">:", "python", " ", "issue", ".", "Issue", ".", "browse", "(\\\\\"", "%", "s", "\\\\\",", " ", "\\\\\"", "%", "s", "\\\\\")", "<", "cr", ">\"_", "%_", "(_", "self_", "._", "repo_", ",_", "self_", "._", "number_", ")_", ")_", "#", " ", "doe", "sn", "'", "t", " ", "use", " ", "current", " ", "buffer", " ", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issue_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "draw_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "buffer", "\\u", "name_", "=_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "self_", "._", "repo_", ",_", "self_", "._", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "utils_", "._", "get", "\\u", "buffer_", "(_", "self_", "._", "buffer", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vim_", "._", "command_", "(_", "\"", "1", ",", "$", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vim_", "._", "command_", "(_", "\"", "set", " ", "filet", "ype", "=", "mark", "down", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "out", " ", "issue_", "\\u\\u\\uNL\\u\\u\\u_", "b_", "._", "append_", "(_", "\"##", " ", "%", "s", " ", "#", " ", "%", "s", "\"_", "%_", "(_", "self_", "._", "repo_", ",_", "self_", "._", "number_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "append_", "(_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "iterate", " ", "through", " ", "all", " ", "keys", " ", "tha", "t", " ", "are", "n", "'", "t", " ", "body_", "\\u\\u\\uNL\\u\\u\\u_", "keys_", "=_", "self_", "._", "data_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keys_", "._", "remove_", "(_", "\"", "body", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "data_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "value_", ")_", "==_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "\",\"_", "._", "join_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "b_", "._", "append_", "(_", "\"#", " ", "%", "s", ":", " ", "%", "s", "\"_", "%_", "(_", "key_", "._", "capitalize_", "(_", ")_", ",_", "value_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "out", " ", "body", " ", "if", " ", "applica", "ble_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "data_", "._", "has", "\\u", "key_", "(_", "\"", "body", "\"_", ")_", "and_", "self_", "._", "data_", "[_", "\"", "body", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "line_", "in_", "self_", "._", "data_", "[_", "\"", "body", "\"_", "]_", "._", "splitlines_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b_", "._", "append_", "(_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "we", " ", "need", " ", "to", " ", "print", " ", "the", " ", "comments_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "comments_", "._", "draw_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "remove", " ", "lead", "ing", " ", "line_", "\\u\\u\\uNL\\u\\u\\u_", "vim_", "._", "command_", "(_", "\"", "1d", "ele", "te", " ", "\\u\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issue_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "number_", "==_", "\"", "new", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "create", "\\u", "issue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "save", "\\u", "issue_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issue_", ":_", "\\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", "data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "data_", "=_", "copy_", "._", "deepcopy_", "(_", "self_", "._", "defaults_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "issue", " ", "from", " ", "git", "hub", " ", "api", " ", "if", " ", "not", " ", "new_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "number_", "==_", "\"", "new", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", ",_", "status_", "=_", "github_", "._", "request_", "(_", "github_", "._", "url_", "(_", "self_", "._", "issue", "\\u", "uri_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "status_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utils_", "._", "log_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "issue", " ", "was", " ", "success", "full", "y", " ", "requested_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "key_", "in_", "self_", "._", "defaults_", "._", "keys_", "(_", ")_", "+_", "[_", "\"", "assignee", "\"_", ",_", "\"", "user", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "git", "hub", " ", "will", " ", "return", " ", "None_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "in_", "(_", "\"", "assignee", "\"_", ",_", "\"", "user", "\"_", ")_", "and_", "data_", "._", "get_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "data_", "[_", "key_", "]_", "=_", "data_", "[_", "key_", "]_", "[_", "\"", "login", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "\"", "labels", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "data_", "[_", "key_", "]_", "=_", "[_", "str_", "(_", "label_", "[_", "\"", "name", "\"_", "]_", ")_", "for_", "label_", "in_", "data_", "[_", "key_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "==_", "\"", "milestone", "\"_", "and_", "data_", "._", "get_", "(_", "\"", "milestone", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "data_", "[_", "key_", "]_", "=_", "data_", "[_", "key_", "]_", "[_", "\"", "title", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "data_", "._", "get_", "(_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "data_", "[_", "key_", "]_", "=_", "data_", "[_", "key_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "gra", "b", " ", "the", " ", "browse", " ", "url", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "url_", "=_", "data_", "[_", "\"", "html", "\\u", "url", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issue_", ":_", "\\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", "create", "\\u", "issue_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "create", " ", "issue", " ", "on", " ", "the", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uri_", "=_", "\"", "repos", "/", "%", "s", "/", "issue", "s", "\"_", "%_", "self_", "._", "repo_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "url_", "=_", "github_", "._", "url_", "(_", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "utils_", "._", "clean", "\\u", "data_", "(_", "copy_", "._", "deepcopy_", "(_", "self_", "._", "data_", ")_", ",_", "[_", "\"", "state", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "data_", "or_", "len_", "(_", "data_", "._", "keys_", "(_", ")_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utils_", "._", "log_", "(_", "\"", "New", " ", "issue", "s", " ", "require", " ", "title", "/", "body", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "data_", ",_", "status_", "=_", "github_", "._", "request_", "(_", "url_", ",_", "\"", "post", "\"_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "status_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utils_", "._", "log_", "(_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "update", " ", "attribute", "s", " ", "as", " ", "need", "ed", " ", "for", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "number_", "=_", "str_", "(_", "data_", "[_", "\"", "number", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "[_", "\"", "user", "\"_", "]_", "=_", "data_", "[_", "\"", "user", "\"_", "]_", "[_", "\"", "login", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "url_", "=_", "data_", "[_", "\"", "html", "\\u", "url", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "issue", "\\u", "uri_", "=_", "\"", "repos", "/", "%", "s", "/", "issue", "s", "/", "%", "s", "\"_", "%_", "(_", "self_", "._", "repo_", ",_", "self_", "._", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "comments_", "._", "number_", "=_", "self_", "._", "number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "clean", " ", "up", " ", "hash_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "i", "\\u", "hash_", "[_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "self_", "._", "repo_", ",_", "\"", "new", "\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "hash_", "[_", "\"%", "s", "/", "%", "s", "\"_", "%_", "(_", "self_", "._", "repo_", ",_", "self_", "._", "number_", ")_", "]_", "=_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "delete", " ", "the", " ", "old", " ", "buffer", " ", "tha", "t", " ", "we", " ", "don", "'", "t", " ", "need", " ", "any", " ", "more_", "\\u\\u\\uNL\\u\\u\\u_", "vim_", "._", "command_", "(_", "\"", "sile", "nt", " ", "new", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vim_", "._", "command_", "(_", "\"", "bde", "lete", " ", "%", "s", "\"_", "%_", "self_", "._", "buffer", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Issue_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "save", "\\u", "issue_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "get", " ", "read", "y", " ", "for", " ", "the", " ", "patch", " ", "operation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "github_", "._", "url_", "(_", "self_", "._", "issue", "\\u", "uri_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "utils_", "._", "clean", "\\u", "data_", "(_", "copy_", "._", "deepcopy_", "(_", "self_", "._", "data_", ")_", ",_", "[_", "\"", "number", "\"_", ",_", "\"", "user", "\"_", ",_", "\"", "labels", "\"_", "]_", ")_", "\\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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
nextml/NEXT/next/utils/utils.py
[ { "content": "def str2datetime(str_time):\n \"\"\"\n Converts a datetime object into the string format used in the system.\n For consistency, one should never use their own method of converting to string, always use this method. \n \n Usage: ::\\n\n date = utils.datetimeNow()\n date_str = utils.datetime2str(date)\n utils.str2datetime(date_str)\n \"\"\"\n try:\n return datetime.strptime(str_time,'%Y-%m-%d %H:%M:%S.%f')\n except:\n return datetime.strptime(str_time,'%Y-%m-%d %H:%M:%S')", "metadata": "root.str2datetime", "header": "['module', '___EOS___']", "index": 305 } ]
[ { "span": "except:", "start_line": 317, "start_column": 2, "end_line": 317, "end_column": 9 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "str2", "datetime_", "(_", "str", "\\u", "time_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", "Convert", "s", " ", "a", " ", "datetime", " ", "object", " ", "int", "o", " ", "the", " ", "string", " ", "format", " ", "used", " ", "in", " ", "the", " ", "system", ".", "\\", "10", ";", " ", " ", "For", " ", "consiste", "nc", "y", ",", " ", "one", " ", "shou", "ld", " ", "neve", "r", " ", "use", " ", "thei", "r", " ", "own", " ", "method", " ", "of", " ", "convert", "ing", " ", "to", " ", "string", ",", " ", "alw", "ay", "s", " ", "use", " ", "this", " ", "method", ".", " ", "\\", "10", ";", " ", " ", "\\", "10", ";", " ", " ", "Us", "age", ":", " ", "::", "\\\\", "n", "\\", "10", ";", " ", " ", " ", " ", "date", " ", "=", " ", "util", "s", ".", "datetime", "No", "w", "()", "\\", "10", ";", " ", " ", " ", " ", "date", "\\u", "str", " ", "=", " ", "util", "s", ".", "datetime", "2s", "tr", "(", "date", ")", "\\", "10", ";", " ", " ", " ", " ", "util", "s", ".", "str2", "datetime", "(", "date", "\\u", "str", ")", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "datetime_", "._", "strptime_", "(_", "str", "\\u", "time_", ",_", "'%", "Y", "-%", "m", "-%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", ".", "%", "f", "'_", ")_", "\\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_", "datetime_", "._", "strptime_", "(_", "str", "\\u", "time_", ",_", "'%", "Y", "-%", "m", "-%", "d", " ", "%", "H", ":", "%", "M", ":", "%", "S", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
statsmodels/statsmodels/statsmodels/stats/tests/test_power.py
[ { "content": " @dec.skipif(not have_matplotlib)\n def test_power_plot(self):\n if self.cls == smp.FTestPower:\n raise nose.SkipTest('skip FTestPower plot_power')\n fig = plt.figure()\n ax = fig.add_subplot(2,1,1)\n fig = self.cls().plot_power(dep_var='nobs',\n nobs= np.arange(2, 100),\n effect_size=np.array([0.1, 0.2, 0.3, 0.5, 1]),\n #alternative='larger',\n ax=ax, title='Power of t-Test',\n **self.kwds_extra)\n ax = fig.add_subplot(2,1,2)\n fig = self.cls().plot_power(dep_var='es',\n nobs=np.array([10, 20, 30, 50, 70, 100]),\n effect_size=np.linspace(0.01, 2, 51),\n #alternative='larger',\n ax=ax, title='',\n **self.kwds_extra)\n plt.close('all')", "metadata": "root.CheckPowerMixin.test_power_plot", "header": "['class', 'CheckPowerMixin', '(', 'object', ')', ':', '___EOS___']", "index": 92 }, { "content": "def test_normal_power_explicit():\n # a few initial test cases for NormalIndPower\n sigma = 1\n d = 0.3\n nobs = 80\n alpha = 0.05\n res1 = smp.normal_power(d, nobs/2., 0.05)\n res2 = smp.NormalIndPower().power(d, nobs, 0.05)\n res3 = smp.NormalIndPower().solve_power(effect_size=0.3, nobs1=80, alpha=0.05, power=None)\n res_R = 0.475100870572638\n assert_almost_equal(res1, res_R, decimal=13)\n assert_almost_equal(res2, res_R, decimal=13)\n assert_almost_equal(res3, res_R, decimal=13)\n\n\n norm_pow = smp.normal_power(-0.01, nobs/2., 0.05)\n norm_pow_R = 0.05045832927039234\n #value from R: >pwr.2p.test(h=0.01,n=80,sig.level=0.05,alternative=\"two.sided\")\n assert_almost_equal(norm_pow, norm_pow_R, decimal=11)\n\n norm_pow = smp.NormalIndPower().power(0.01, nobs, 0.05,\n alternative=\"larger\")\n norm_pow_R = 0.056869534873146124\n #value from R: >pwr.2p.test(h=0.01,n=80,sig.level=0.05,alternative=\"greater\")\n assert_almost_equal(norm_pow, norm_pow_R, decimal=11)\n\n # Note: negative effect size is same as switching one-sided alternative\n # TODO: should I switch to larger/smaller instead of \"one-sided\" options\n norm_pow = smp.NormalIndPower().power(-0.01, nobs, 0.05,\n alternative=\"larger\")\n norm_pow_R = 0.0438089705093578\n #value from R: >pwr.2p.test(h=0.01,n=80,sig.level=0.05,alternative=\"less\")\n assert_almost_equal(norm_pow, norm_pow_R, decimal=11)", "metadata": "root.test_normal_power_explicit", "header": "['module', '___EOS___']", "index": 387 }, { "content": "def test_power_solver_warn():\n # messing up the solver to trigger warning\n # I wrote this with scipy 0.9,\n # convergence behavior of scipy 0.11 is different,\n # fails at a different case, but is successful where it failed before\n\n pow_ = 0.69219411243824214 # from previous function\n nip = smp.NormalIndPower()\n # using nobs, has one backup (fsolve)\n nip.start_bqexp['nobs1'] = {'upp': 50, 'low': -20}\n val = nip.solve_power(0.1, nobs1=None, alpha=0.01, power=pow_, ratio=1,\n alternative='larger')\n import scipy\n if scipy.__version__ < '0.10':\n assert_almost_equal(val, 1600, decimal=4)\n assert_equal(nip.cache_fit_res[0], 1)\n assert_equal(len(nip.cache_fit_res), 3)\n\n # case that has convergence failure, and should warn\n nip.start_ttp['nobs1'] = np.nan\n\n from statsmodels.tools.sm_exceptions import ConvergenceWarning\n assert_warns(ConvergenceWarning, nip.solve_power, 0.1, nobs1=None,\n alpha=0.01, power=pow_, ratio=1, alternative='larger')\n # this converges with scipy 0.11 ???\n # nip.solve_power(0.1, nobs1=None, alpha=0.01, power=pow_, ratio=1, alternative='larger')\n\n with warnings.catch_warnings(): # python >= 2.6\n warnings.simplefilter(\"ignore\")\n val = nip.solve_power(0.1, nobs1=None, alpha=0.01, power=pow_, ratio=1,\n alternative='larger')\n assert_equal(nip.cache_fit_res[0], 0)\n assert_equal(len(nip.cache_fit_res), 3)", "metadata": "root.test_power_solver_warn", "header": "['module', '___EOS___']", "index": 717 } ]
[ { "span": "fig ", "start_line": 105, "start_column": 8, "end_line": 105, "end_column": 11 }, { "span": "sigma ", "start_line": 389, "start_column": 4, "end_line": 389, "end_column": 9 }, { "span": "alpha ", "start_line": 392, "start_column": 4, "end_line": 392, "end_column": 9 }, { "span": "val ", "start_line": 746, "start_column": 12, "end_line": 746, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Check", "Power", "Mixin_", "(_", "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_", "@_", "dec_", "._", "skipif_", "(_", "not_", "have", "\\u", "matplotlib_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "power", "\\u", "plot_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "cls_", "==_", "smp", "_", "._", "FT", "est", "Power_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "nose_", "._", "Ski", "p", "Test_", "(_", "'", "skip", " ", "FT", "est", "Power", " ", "plot", "\\u", "power", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "fig_", "=_", "plt_", "._", "figure_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "2_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "self_", "._", "cls_", "(_", ")_", "._", "plot", "\\u", "power_", "(_", "dep", "\\u", "var_", "=_", "'", "nob", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nob", "s_", "=_", "np_", "._", "arange_", "(_", "2_", ",_", "100_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "effect", "\\u", "size_", "=_", "np_", "._", "array_", "(_", "[_", "0.1_", ",_", "0.2_", ",_", "0.3_", ",_", "0.5_", ",_", "1_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "alternative", "='", "large", "r", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "=_", "ax_", ",_", "title_", "=_", "'", "Power", " ", "of", " ", "t", "-", "Test", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "self_", "._", "kwd", "s", "\\u", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "2_", ",_", "1_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fig_", "=_", "self_", "._", "cls_", "(_", ")_", "._", "plot", "\\u", "power_", "(_", "dep", "\\u", "var_", "=_", "'", "es", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "nob", "s_", "=_", "np_", "._", "array_", "(_", "[_", "10_", ",_", "20_", ",_", "30_", ",_", "50_", ",_", "70_", ",_", "100_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "effect", "\\u", "size_", "=_", "np_", "._", "linspace_", "(_", "0.01_", ",_", "2_", ",_", "51_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", "alternative", "='", "large", "r", "',", "_", "\\u\\u\\uNL\\u\\u\\u_", "ax_", "=_", "ax_", ",_", "title_", "=_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "self_", "._", "kwd", "s", "\\u", "extra_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "close_", "(_", "'", "all", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "normal", "\\u", "power", "\\u", "explicit", "_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "a", " ", "few", " ", "initial", " ", "test", " ", "case", "s", " ", "for", " ", "Normal", "Ind", "Power_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sigma_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "0.3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nob", "s_", "=_", "80_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alpha_", "=_", "0.05_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res1_", "=_", "smp", "_", "._", "normal", "\\u", "power_", "(_", "d_", ",_", "nob", "s_", "/_", "2._", ",_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res2_", "=_", "smp", "_", "._", "Normal", "Ind", "Power_", "(_", ")_", "._", "power_", "(_", "d_", ",_", "nob", "s_", ",_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "3_", "=_", "smp", "_", "._", "Normal", "Ind", "Power_", "(_", ")_", "._", "solve", "\\u", "power_", "(_", "effect", "\\u", "size_", "=_", "0.3_", ",_", "nob", "s1_", "=_", "80_", ",_", "alpha_", "=_", "0.05_", ",_", "power_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "R_", "=_", "0.47", "510", "087", "057", "263", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "res1_", ",_", "res", "\\u", "R_", ",_", "decimal_", "=_", "13_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "res2_", ",_", "res", "\\u", "R_", ",_", "decimal_", "=_", "13_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "res", "3_", ",_", "res", "\\u", "R_", ",_", "decimal_", "=_", "13_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "norm", "\\u", "pow_", "=_", "smp", "_", "._", "normal", "\\u", "power_", "(_", "-_", "0.01_", ",_", "nob", "s_", "/_", "2._", ",_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "norm", "\\u", "pow", "\\u", "R_", "=_", "0.05", "045", "832", "927", "039", "234_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "value", " ", "from", " ", "R", ":", " ", ">", "pwr", ".2", "p", ".", "test", "(", "h", "=", "0.01", ",", "n", "=", "80", ",", "sig", ".", "level", "=", "0.05", ",", "alternative", "=\"", "two", ".", "side", "d", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "norm", "\\u", "pow_", ",_", "norm", "\\u", "pow", "\\u", "R_", ",_", "decimal_", "=_", "11_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "norm", "\\u", "pow_", "=_", "smp", "_", "._", "Normal", "Ind", "Power_", "(_", ")_", "._", "power_", "(_", "0.01_", ",_", "nob", "s_", ",_", "0.05_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alternative", "_", "=_", "\"", "large", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "norm", "\\u", "pow", "\\u", "R_", "=_", "0.05", "686", "953", "487", "314", "612", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "value", " ", "from", " ", "R", ":", " ", ">", "pwr", ".2", "p", ".", "test", "(", "h", "=", "0.01", ",", "n", "=", "80", ",", "sig", ".", "level", "=", "0.05", ",", "alternative", "=\"", "great", "er", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "norm", "\\u", "pow_", ",_", "norm", "\\u", "pow", "\\u", "R_", ",_", "decimal_", "=_", "11_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "negati", "ve", " ", "effect", " ", "size", " ", "is", " ", "same", " ", "as", " ", "switching", " ", "one", "-", "side", "d", " ", "alternative", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "shou", "ld", " ", "I", " ", "switch", " ", "to", " ", "large", "r", "/", "small", "er", " ", "inst", "ead", " ", "of", " ", "\"", "one", "-", "side", "d", "\"", " ", "options_", "\\u\\u\\uNL\\u\\u\\u_", "norm", "\\u", "pow_", "=_", "smp", "_", "._", "Normal", "Ind", "Power_", "(_", ")_", "._", "power_", "(_", "-_", "0.01_", ",_", "nob", "s_", ",_", "0.05_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alternative", "_", "=_", "\"", "large", "r", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "norm", "\\u", "pow", "\\u", "R_", "=_", "0.04", "380", "897", "050", "935", "78_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "value", " ", "from", " ", "R", ":", " ", ">", "pwr", ".2", "p", ".", "test", "(", "h", "=", "0.01", ",", "n", "=", "80", ",", "sig", ".", "level", "=", "0.05", ",", "alternative", "=\"", "less", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "norm", "\\u", "pow_", ",_", "norm", "\\u", "pow", "\\u", "R_", ",_", "decimal_", "=_", "11_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "power", "\\u", "solve", "r", "\\u", "warn_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "mess", "ing", " ", "up", " ", "the", " ", "solve", "r", " ", "to", " ", "trigger", " ", "warning_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "I", " ", "wrote", " ", "this", " ", "with", " ", "sci", "py", " ", "0.", "9", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convergence", " ", "behavior", " ", "of", " ", "sci", "py", " ", "0.11", " ", "is", " ", "different", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fail", "s", " ", "at", " ", "a", " ", "different", " ", "case", ",", " ", "but", " ", "is", " ", "success", "ful", " ", "where", " ", "it", " ", "fail", "ed", " ", "before_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pow", "\\u_", "=_", "0.69", "219", "4112", "438", "242", "14_", "#", " ", "from", " ", "previ", "ous", " ", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nip", "_", "=_", "smp", "_", "._", "Normal", "Ind", "Power_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "usi", "ng", " ", "nob", "s", ",", " ", "has", " ", "one", " ", "backup", " ", "(", "fs", "olve", ")_", "\\u\\u\\uNL\\u\\u\\u_", "nip", "_", "._", "start", "\\u", "bq", "exp_", "[_", "'", "nob", "s1", "'_", "]_", "=_", "{_", "'", "upp", "'_", ":_", "50_", ",_", "'", "low", "'_", ":_", "-_", "20_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "nip", "_", "._", "solve", "\\u", "power_", "(_", "0.1_", ",_", "nob", "s1_", "=_", "None_", ",_", "alpha_", "=_", "0.01_", ",_", "power_", "=_", "pow", "\\u_", ",_", "ratio_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alternative", "_", "=_", "'", "large", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "scipy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "scipy_", "._", "\\u\\u", "version\\u\\u_", "<_", "'", "0.10", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "val_", ",_", "1600", "_", ",_", "decimal_", "=_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "nip", "_", "._", "cache", "\\u", "fit", "\\u", "res_", "[_", "0_", "]_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "len_", "(_", "nip", "_", "._", "cache", "\\u", "fit", "\\u", "res_", ")_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "case", " ", "tha", "t", " ", "has", " ", "convergence", " ", "fail", "ure", ",", " ", "and", " ", "shou", "ld", " ", "warn_", "\\u\\u\\uNL\\u\\u\\u_", "nip", "_", "._", "start", "\\u", "ttp", "_", "[_", "'", "nob", "s1", "'_", "]_", "=_", "np_", "._", "nan_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "stats", "models_", "._", "tools_", "._", "sm", "\\u", "exceptions_", "import_", "Converge", "nce", "Warning_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "warns", "_", "(_", "Converge", "nce", "Warning_", ",_", "nip", "_", "._", "solve", "\\u", "power_", ",_", "0.1_", ",_", "nob", "s1_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alpha_", "=_", "0.01_", ",_", "power_", "=_", "pow", "\\u_", ",_", "ratio_", "=_", "1_", ",_", "alternative", "_", "=_", "'", "large", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "this", " ", "converg", "es", " ", "with", " ", "sci", "py", " ", "0.11", " ", " ", "???", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "nip", ".", "solve", "\\u", "power", "(", "0.", "1", ",", " ", "nob", "s1", "=", "Non", "e", ",", " ", "alpha", "=", "0.01", ",", " ", "power", "=", "pow", "\\u", ",", " ", "ratio", "=", "1", ",", " ", "alternative", "='", "large", "r", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "warnings_", "._", "catch", "\\u", "warnings_", "(_", ")_", ":_", "#", " ", "python", " ", ">=", " ", "2.6", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "warnings_", "._", "simplefilter_", "(_", "\"", "ignore", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "val_", "=_", "nip", "_", "._", "solve", "\\u", "power_", "(_", "0.1_", ",_", "nob", "s1_", "=_", "None_", ",_", "alpha_", "=_", "0.01_", ",_", "power_", "=_", "pow", "\\u_", ",_", "ratio_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "alternative", "_", "=_", "'", "large", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "nip", "_", "._", "cache", "\\u", "fit", "\\u", "res_", "[_", "0_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "len_", "(_", "nip", "_", "._", "cache", "\\u", "fit", "\\u", "res_", ")_", ",_", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 ]
Unused import
flask-admin/flask-admin/examples/auth-mongoengine/app.py
[ { "content": "from flask import Flask, url_for, redirect, render_template, request\nfrom flask_mongoengine import MongoEngine\n\nfrom wtforms import form, fields, validators\n\nimport flask_admin as admin\nimport flask_login as login\nfrom flask_admin.contrib.mongoengine import ModelView\nfrom flask_admin import helpers\n\n# Create application\napp = Flask(__name__)\n\n# Create dummy secrey key so we can use sessions\napp.config['SECRET_KEY'] = '123456790'\n\n# MongoDB settings\napp.config['MONGODB_SETTINGS'] = {'DB': 'test'}\ndb = MongoEngine()\ndb.init_app(app)\n\n\n# Create user model. For simplicity, it will store passwords in plain text.\n# Obviously that's not right thing to do in real world application.\n\n\n# Define login and registration forms (for flask-login)\n\n\n\n\n# Initialize flask-login\n\n\n# Create customized model view class\n\n\n# Create customized index view class\n\n\n# Flask views\n\n\n\n\n\n\n\nif __name__ == '__main__':\n # Initialize flask-login\n init_login()\n\n # Create admin\n admin = admin.Admin(app, 'Example: Auth-Mongo', index_view=MyAdminIndexView())\n\n # Add view\n admin.add_view(MyModelView(User))\n\n # Start app\n app.run(debug=True)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class User(db.Document):\n login = db.StringField(max_length=80, unique=True)\n email = db.StringField(max_length=120)\n password = db.StringField(max_length=64)\n\n # Flask-Login integration\n\n\n\n\n # Required for administrative interface", "metadata": "root.User", "header": "['module', '___EOS___']", "index": 24 }, { "content": " def is_authenticated(self):\n return True", "metadata": "root.User.is_authenticated", "header": "['class', 'User', '(', 'db', '.', 'Document', ')', ':', '___EOS___']", "index": 30 }, { "content": " def is_active(self):\n return True", "metadata": "root.User.is_active", "header": "['class', 'User', '(', 'db', '.', 'Document', ')', ':', '___EOS___']", "index": 33 }, { "content": " def is_anonymous(self):\n return False", "metadata": "root.User.is_anonymous", "header": "['class', 'User', '(', 'db', '.', 'Document', ')', ':', '___EOS___']", "index": 36 }, { "content": " def get_id(self):\n return str(self.id)", "metadata": "root.User.get_id", "header": "['class', 'User', '(', 'db', '.', 'Document', ')', ':', '___EOS___']", "index": 39 }, { "content": " def __unicode__(self):\n return self.login", "metadata": "root.User.__unicode__", "header": "['class', 'User', '(', 'db', '.', 'Document', ')', ':', '___EOS___']", "index": 43 }, { "content": "class LoginForm(form.Form):\n login = fields.TextField(validators=[validators.required()])\n password = fields.PasswordField(validators=[validators.required()])\n\n", "metadata": "root.LoginForm", "header": "['module', '___EOS___']", "index": 48 }, { "content": " def validate_login(self, field):\n user = self.get_user()\n\n if user is None:\n raise validators.ValidationError('Invalid user')\n\n if user.password != self.password.data:\n raise validators.ValidationError('Invalid password')", "metadata": "root.LoginForm.validate_login", "header": "['class', 'LoginForm', '(', 'form', '.', 'Form', ')', ':', '___EOS___']", "index": 52 }, { "content": " def get_user(self):\n return User.objects(login=self.login.data).first()", "metadata": "root.LoginForm.get_user", "header": "['class', 'LoginForm', '(', 'form', '.', 'Form', ')', ':', '___EOS___']", "index": 61 }, { "content": "class RegistrationForm(form.Form):\n login = fields.TextField(validators=[validators.required()])\n email = fields.TextField()\n password = fields.PasswordField(validators=[validators.required()])\n", "metadata": "root.RegistrationForm", "header": "['module', '___EOS___']", "index": 65 }, { "content": " def validate_login(self, field):\n if User.objects(login=self.login.data):\n raise validators.ValidationError('Duplicate username')", "metadata": "root.RegistrationForm.validate_login", "header": "['class', 'RegistrationForm', '(', 'form', '.', 'Form', ')', ':', '___EOS___']", "index": 70 }, { "content": "def init_login():\n login_manager = login.LoginManager()\n login_manager.setup_app(app)\n\n # Create user loader function\n @login_manager.user_loader\n def load_user(user_id):\n return User.objects(id=user_id).first()", "metadata": "root.init_login", "header": "['module', '___EOS___']", "index": 76 }, { "content": "class MyModelView(ModelView):", "metadata": "root.MyModelView", "header": "['module', '___EOS___']", "index": 87 }, { "content": " def is_accessible(self):\n return login.current_user.is_authenticated", "metadata": "root.MyModelView.is_accessible", "header": "['class', 'MyModelView', '(', 'ModelView', ')', ':', '___EOS___']", "index": 88 }, { "content": "class MyAdminIndexView(admin.AdminIndexView):", "metadata": "root.MyAdminIndexView", "header": "['module', '___EOS___']", "index": 93 }, { "content": " def is_accessible(self):\n return login.current_user.is_authenticated", "metadata": "root.MyAdminIndexView.is_accessible", "header": "['class', 'MyAdminIndexView', '(', 'admin', '.', 'AdminIndexView', ')', ':', '___EOS___']", "index": 94 }, { "content": "@app.route('/')\ndef index():\n return render_template('index.html', user=login.current_user)", "metadata": "root.index", "header": "['module', '___EOS___']", "index": 99 }, { "content": "@app.route('/login/', methods=('GET', 'POST'))\ndef login_view():\n form = LoginForm(request.form)\n if request.method == 'POST' and form.validate():\n user = form.get_user()\n login.login_user(user)\n return redirect(url_for('index'))\n\n return render_template('form.html', form=form)", "metadata": "root.login_view", "header": "['module', '___EOS___']", "index": 104 }, { "content": "@app.route('/register/', methods=('GET', 'POST'))\ndef register_view():\n form = RegistrationForm(request.form)\n if request.method == 'POST' and form.validate():\n user = User()\n\n form.populate_obj(user)\n user.save()\n\n login.login_user(user)\n return redirect(url_for('index'))\n\n return render_template('form.html', form=form)", "metadata": "root.register_view", "header": "['module', '___EOS___']", "index": 115 }, { "content": "@app.route('/logout/')\ndef logout_view():\n login.logout_user()\n return redirect(url_for('index'))", "metadata": "root.logout_view", "header": "['module', '___EOS___']", "index": 130 } ]
[ { "span": "from flask_admin import helpers", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 31 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "flask_", "import_", "Flask_", ",_", "url", "\\u", "for_", ",_", "redirect_", ",_", "render", "\\u", "template_", ",_", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "sk", "\\u", "mongoengine_", "import_", "Mon", "go", "Engine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "wtforms_", "import_", "form_", ",_", "fields_", ",_", "validators_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "fla", "sk", "\\u", "admin_", "as_", "admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "fla", "sk", "\\u", "login_", "as_", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "sk", "\\u", "admin_", "._", "contrib_", "._", "mongoengine_", "import_", "Model", "View_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fla", "sk", "\\u", "admin_", "import_", "helpers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "application_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "=_", "Flask_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "dummy", " ", "sec", "rey", " ", "key", " ", "so", " ", "we", " ", "can", " ", "use", " ", "sessions_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "._", "config_", "[_", "'", "SEC", "RET", "\\u", "KEY", "'_", "]_", "=_", "'", "1234567", "90", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Mon", "go", "DB", " ", "settings_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "._", "config_", "[_", "'", "MONGO", "DB", "\\u", "SETTING", "S", "'_", "]_", "=_", "{_", "'", "DB", "'_", ":_", "'", "test", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "=_", "Mon", "go", "Engine_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db_", "._", "init", "\\u", "app_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "user", " ", "model", ".", " ", "For", " ", "simpli", "city", ",", " ", "it", " ", "will", " ", "store", " ", "passwords", " ", "in", " ", "plain", " ", "text", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ob", "vio", "usl", "y", " ", "tha", "t", "'", "s", " ", "not", " ", "right", " ", "thing", " ", "to", " ", "do", " ", "in", " ", "real", " ", "world", " ", "applica", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Define", " ", "login", " ", "and", " ", "registration", " ", "forms", " ", "(", "for", " ", "fla", "sk", "-", "login", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Initializ", "e", " ", "fla", "sk", "-", "login_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "customize", "d", " ", "model", " ", "view", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "customize", "d", " ", "index", " ", "view", " ", "class_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fla", "sk", " ", "views_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Initializ", "e", " ", "fla", "sk", "-", "login_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "init", "\\u", "login_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "admin_", "\\u\\u\\uNL\\u\\u\\u_", "admin_", "=_", "admin_", "._", "Admin_", "(_", "app_", ",_", "'", "Exam", "ple", ":", " ", "Auth", "-", "Mon", "go", "'_", ",_", "index", "\\u", "view_", "=_", "My", "Admi", "n", "Index", "View_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "view_", "\\u\\u\\uNL\\u\\u\\u_", "admin_", "._", "add", "\\u", "view_", "(_", "My", "Model", "View_", "(_", "User_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Start", " ", "app_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "._", "run_", "(_", "debug_", "=_", "True_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "User_", "(_", "db_", "._", "Document_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "login_", "=_", "db_", "._", "String", "Field_", "(_", "max", "\\u", "length_", "=_", "80_", ",_", "unique_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "=_", "db_", "._", "String", "Field_", "(_", "max", "\\u", "length_", "=_", "120_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "db_", "._", "String", "Field_", "(_", "max", "\\u", "length_", "=_", "64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fla", "sk", "-", "Logi", "n", " ", "integration_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Requ", "ired", " ", "for", " ", "administrati", "ve", " ", "interface_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "User_", "(_", "db_", "._", "Document_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "is", "\\u", "authenticated_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User_", "(_", "db_", "._", "Document_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "active_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User_", "(_", "db_", "._", "Document_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "anonymous_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User_", "(_", "db_", "._", "Document_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "self_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "User_", "(_", "db_", "._", "Document_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "unicode\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "login_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Logi", "n", "Form_", "(_", "form_", "._", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "login_", "=_", "fields_", "._", "Text", "Field_", "(_", "validators_", "=_", "[_", "validators_", "._", "required_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "fields_", "._", "Passw", "ord", "Field_", "(_", "validators_", "=_", "[_", "validators_", "._", "required_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Logi", "n", "Form_", "(_", "form_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validat", "e\\u", "login_", "(_", "self_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "self_", "._", "get", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "user_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "validators_", "._", "Validat", "ion", "Error_", "(_", "'", "Inva", "lid", " ", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "user_", "._", "password_", "!=_", "self_", "._", "password_", "._", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "validators_", "._", "Validat", "ion", "Error_", "(_", "'", "Inva", "lid", " ", "password", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Logi", "n", "Form_", "(_", "form_", "._", "Form_", ")_", ":_", "\\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", "user_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "User_", "._", "objects_", "(_", "login_", "=_", "self_", "._", "login_", "._", "data_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Registration", "Form_", "(_", "form_", "._", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "login_", "=_", "fields_", "._", "Text", "Field_", "(_", "validators_", "=_", "[_", "validators_", "._", "required_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "email_", "=_", "fields_", "._", "Text", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "fields_", "._", "Passw", "ord", "Field_", "(_", "validators_", "=_", "[_", "validators_", "._", "required_", "(_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Registration", "Form_", "(_", "form_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "validat", "e\\u", "login_", "(_", "self_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "User_", "._", "objects_", "(_", "login_", "=_", "self_", "._", "login_", "._", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "validators_", "._", "Validat", "ion", "Error_", "(_", "'", "Duplicate", " ", "user", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "login_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "login", "\\u", "manager_", "=_", "login_", "._", "Logi", "n", "Manager_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "login", "\\u", "manager_", "._", "setup", "\\u", "app_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "user", " ", "load", "er", " ", "function_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "login", "\\u", "manager_", "._", "user", "\\u", "loader_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "load", "\\u", "user_", "(_", "user", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "User_", "._", "objects_", "(_", "id_", "=_", "user", "\\u", "id_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "My", "Model", "View_", "(_", "Model", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "Model", "View_", "(_", "Model", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "is", "\\u", "accessible", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "login_", "._", "current", "\\u", "user_", "._", "is", "\\u", "authenticated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "My", "Admi", "n", "Index", "View_", "(_", "admin_", "._", "Admi", "n", "Index", "View_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "Admi", "n", "Index", "View_", "(_", "admin_", "._", "Admi", "n", "Index", "View_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "is", "\\u", "accessible", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "login_", "._", "current", "\\u", "user_", "._", "is", "\\u", "authenticated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "index_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "'", "index", ".", "html", "'_", ",_", "user_", "=_", "login_", "._", "current", "\\u", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "login", "/'_", ",_", "methods_", "=_", "(_", "'", "GET", "'_", ",_", "'", "POST", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "login", "\\u", "view_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Logi", "n", "Form_", "(_", "request_", "._", "form_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", "and_", "form_", "._", "validate_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "form_", "._", "get", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "login_", "._", "login", "\\u", "user_", "(_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "redirect_", "(_", "url", "\\u", "for_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "'", "form", ".", "html", "'_", ",_", "form_", "=_", "form_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "register", "/'_", ",_", "methods_", "=_", "(_", "'", "GET", "'_", ",_", "'", "POST", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register", "\\u", "view_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "form_", "=_", "Registration", "Form_", "(_", "request_", "._", "form_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "request_", "._", "method_", "==_", "'", "POST", "'_", "and_", "form_", "._", "validate_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "User_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "form_", "._", "populate", "\\u", "obj_", "(_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "login_", "._", "login", "\\u", "user_", "(_", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "redirect_", "(_", "url", "\\u", "for_", "(_", "'", "index", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "render", "\\u", "template_", "(_", "'", "form", ".", "html", "'_", ",_", "form_", "=_", "form_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/", "logo", "ut", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "logo", "ut", "\\u", "view_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "login_", "._", "logo", "ut", "\\u", "user_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "redirect_", "(_", "url", "\\u", "for_", "(_", "'", "index", "'_", ")_", ")_", "\\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, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
ODM2/ODMToolsPython/odmtools/gui/mnuRibbon.py
[ { "content": " def _init_ctrls(self, prnt):\n RB.RibbonBar.__init__(self, name='ribbon', parent=prnt, id=wxID_PANEL1)\n #self.SetArtProvider(RB.RibbonMSWArtProvider())\n self.SetArtProvider(RB.RibbonAUIArtProvider())\n self.SetFont(wx.Font(9, wx.SWISS, wx.NORMAL, wx.NORMAL, False, u'Tahoma'))\n\n fileMenu = RB.RibbonPage(self, wxID_FileMenu, \"File\")\n\n #----PlotMenu-------------\n home = RB.RibbonPage(self, wx.ID_ANY, \"Plot\")\n\n\n #------Plot Type ---------------------------------------------------------------------------\n\n plot_panel = RB.RibbonPanel(home, wx.ID_ANY, \"Plots\", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize,\n RB.RIBBON_PANEL_NO_AUTO_MINIMISE)\n self.plots_bar = RB.RibbonButtonBar(plot_panel, wx.ID_ANY)\n self.plots_bar.AddSimpleButton(wxID_RIBBONPLOTTIMESERIES, \"Time Series\", tsa_icon.GetBitmap(), \"\")\n self.plots_bar.AddSimpleButton(wxID_RIBBONPLOTPROB, \"Exceedance Frequency\", probability.GetBitmap(), \"\")\n self.plots_bar.AddSimpleButton(wxID_RIBBONPLOTHIST, \"Histogram\", histogram.GetBitmap(), \"\")\n self.plots_bar.AddSimpleButton(wxID_RIBBONPLOTBOX, \"Box/Whisker\", box_whisker.GetBitmap(), \"\")\n self.plots_bar.AddSimpleButton(wxID_RIBBONPLOTSUMMARY, \"Summary\", summary.GetBitmap(), \"\")\n\n\n #-- PLOT OPTIONS-----------------------------------------------------------------------------\n PlotOptions_panel = RB.RibbonPanel(home, wx.ID_ANY, \"Plot Options\", wx.NullBitmap, wx.DefaultPosition,\n wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE)\n self.PlotsOptions_bar = RB.RibbonButtonBar(PlotOptions_panel, wx.ID_ANY)\n\n self.PlotsOptions_bar.AddDropdownButton(wxID_RIBBONPLOTTSTYPE, \"Plot Type\", plot_type.GetBitmap(), \"\")\n\n self.PlotsOptions_bar.AddSimpleButton(wxID_RIBBONPLOTTSLEGEND, \"Show Legend\", legend.GetBitmap(),\n help_string=\"show legend on plot\", kind=0x4)\n\n self.PlotsOptions_bar.AddSimpleButton(wxID_RIBBONPLOTBLANKBTN, \"#Hist Bins\", blank.GetBitmap(), \"\")\n\n self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTBLANKBTN, False)\n\n self.spnBins = wx.SpinCtrl(id=wxID_FRAME1SPINCTRL1, initial=50, max=100, min=1, name='spnBins',\n parent=self.PlotsOptions_bar, pos=wx.Point(85, 7), #without color button\n size=wx.Size(44, 25), style=wx.SP_ARROW_KEYS)\n self.spnBins.Enabled = False\n\n self.PlotsOptions_bar.AddDropdownButton(wxID_RIBBONPLOTBOXTYPE, \"Box Whisker Type\",\n box_whisker_type.GetBitmap(), \"\")\n\n self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTTSTYPE, False)\n self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTTSLEGEND, False)\n self.PlotsOptions_bar.EnableButton(wxID_RIBBONPLOTBOXTYPE, False)\n\n dateTime_panel = RB.RibbonPanel(home, wx.ID_ANY, \"Date Time\", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize,\n RB.RIBBON_PANEL_NO_AUTO_MINIMISE)\n\n self.dateTime_buttonbar = RB.RibbonButtonBar(dateTime_panel)\n\n self.dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTBLANKBTN, \"\", blank.GetBitmap(), \"\")\n self.dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTBLANKBTN, \"\", blank.GetBitmap(), \"\")\n self.dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTBLANKBTN, \"\", blank.GetBitmap(), \"\")\n self.dateTime_buttonbar.EnableButton(wxID_RIBBONPLOTBLANKBTN, False)\n\n self.dpStartDate = wx.DatePickerCtrl(id=wxID_STARTDPDATE, name=u'dpStartDate', parent=self.dateTime_buttonbar,\n pos=wx.Point(5, 8), size=wx.Size(120, 24), style=wx.DP_DROPDOWN)\n #self.dpStartDate.SetValue(wx.DateTimeFromDMY(16, 1, 2008, 0, 0, 0))\n #self.dpStartDate.SetLabel(repr(wx.DateTimeFromDMY(16, 1, 2008, 0, 0, 0)))\n self.dpStartDate.SetToolTipString(u'Start Date')\n\n self.dpEndDate = wx.DatePickerCtrl(id=wxID_ENDDPDATE, name=u'dpEndDate', parent=self.dateTime_buttonbar,\n pos=wx.Point(5, 40), size=wx.Size(120, 24), style=wx.DP_DROPDOWN)\n #self.dpEndDate.SetValue(wx.DateTimeFromDMY(01, 04, 2008, 0, 0, 0))\n #self.dpEndDate.SetLabel(repr(wx.DateTimeFromDMY(1, 04, 2008, 0, 0, 0)))\n self.dpEndDate.SetToolTipString(u'End Date')\n\n self.dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTDATEAPPLY, \"Apply\", date_setting.GetBitmap(), \"\")\n\n self.dateTime_buttonbar.AddSimpleButton(wxID_RIBBONPLOTDATEFULL, \"Full Date Range\", full_date_range.GetBitmap(),\n \"\")\n\n self.dateTime_buttonbar.EnableButton(wxID_RIBBONPLOTDATEFULL, False)\n self.dateTime_buttonbar.EnableButton(wxID_RIBBONPLOTDATEAPPLY, False)\n self.dpEndDate.Enabled = False\n self.dpStartDate.Enabled = False\n\n #-------------------------------------------------------------------------------\n editPage = RB.RibbonPage(self, wx.ID_ANY, \"Edit\")\n\n main_panel = RB.RibbonPanel(editPage, wx.ID_ANY, \"Main\", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize,\n RB.RIBBON_PANEL_NO_AUTO_MINIMISE)\n self.main_bar = RB.RibbonButtonBar(main_panel)\n self.editbutton = self.main_bar.AddSimpleButton(wxID_RIBBONEDITSERIES, \"Edit Series\", bitmap=edit.GetBitmap(),\n help_string=\"\",\n kind=0x4) #kind sets the button to be a True or False\n\n self.main_bar.AddSimpleButton(wxID_RIBBONEDITRESTORE, \"Restore Series\", restore.GetBitmap(), \"\")\n self.main_bar.AddSimpleButton(wxID_RIBBONEDITSAVE, \"Save\", save_data.GetBitmap(), \"\")\n\n self.main_bar.EnableButton(wxID_RIBBONEDITRESTORE, False)\n self.main_bar.EnableButton(wxID_RIBBONEDITSAVE, False)\n\n #------------------------------------------------------------------------------\n edit_panel = RB.RibbonPanel(editPage, wx.ID_ANY, \"Edit Functions\", wx.NullBitmap, wx.DefaultPosition,\n wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE)\n self.edit_bar = RB.RibbonButtonBar(edit_panel)\n self.edit_bar.AddSimpleButton(wxID_RIBBONEDITFILTER, \"Filter Points\", filter_list.GetBitmap(), \"\")\n self.edit_bar.AddSimpleButton(wxID_RIBBONEDITRESETFILTER, \"Reset Selection\", Undo.GetBitmap(), \"\")\n self.edit_bar.AddSimpleButton(wxID_RIBBONEDITCHGVALUE, \"Change Value\", edit_view.GetBitmap(), \"\")\n self.edit_bar.AddSimpleButton(wxID_RIBBONEDITINTEROPOLATE, \"Interpolate\", interpolate.GetBitmap(), \"\")\n self.edit_bar.AddSimpleButton(wxID_RIBBONEDITLINFILTER, \"Linear Drift\", lin_drift.GetBitmap(), \"\")\n self.edit_bar.AddSimpleButton(wxID_RIBBONEDITFLAG, \"Flag\", flag.GetBitmap(), \"\")\n self.edit_bar.AddSimpleButton(wxID_RIBBONEDITADDPOINT, \"Add Point\", add.GetBitmap(), \"\")\n self.edit_bar.AddSimpleButton(wxID_RIBBONEDITDELPOINT, \"Delete Point\", delete.GetBitmap(), \"\")\n #self.edit_bar.AddSimpleButton(wxID_RIBBONEDITRECORD, \"Record\", bitmap=record.GetBitmap(), help_string=\"\",kind=0x4)\n\n self.edit_bar.EnableButton(wxID_RIBBONEDITFILTER, False)\n self.edit_bar.EnableButton(wxID_RIBBONEDITCHGVALUE, False)\n self.edit_bar.EnableButton(wxID_RIBBONEDITINTEROPOLATE, False)\n self.edit_bar.EnableButton(wxID_RIBBONEDITLINFILTER, False)\n self.edit_bar.EnableButton(wxID_RIBBONEDITFLAG, False)\n self.edit_bar.EnableButton(wxID_RIBBONEDITADDPOINT, False)\n self.edit_bar.EnableButton(wxID_RIBBONEDITDELPOINT, False)\n #self.edit_bar.EnableButton(wxID_RIBBONEDITRECORD, False)\n\n self.record_panel = RB.RibbonPanel(editPage, wx.ID_ANY, \"Recording Options\", wx.NullBitmap, wx.DefaultPosition,\n wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE)\n\n self.record_bar = RB.RibbonButtonBar(self.record_panel)\n self.record_bar.AddSimpleButton(wxID_RIBBONRECORDNEW, \"New Script\", newscript.GetBitmap(), \"\")\n self.record_bar.AddSimpleButton(wxID_RIBBONRECORDOPEN, \"Open Script\", openscript.GetBitmap(), \"\")\n self.record_bar.AddSimpleButton(wxID_RIBBONRECORDSAVE, \"Save Script\", savescript.GetBitmap(), \"\")\n #self.record_panel.Hide()\n\n self.record_bar.EnableButton(wxID_RIBBONRECORDNEW, False)\n self.record_bar.EnableButton(wxID_RIBBONRECORDOPEN, False)\n self.record_bar.EnableButton(wxID_RIBBONRECORDSAVE, False)\n\n\n #-------------------------------------------------------------------------------\n\n viewPage = RB.RibbonPage(self, wx.ID_ANY, \"View\")\n\n view_panel = RB.RibbonPanel(viewPage, wx.ID_ANY, \"Tools\", wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize,\n RB.RIBBON_PANEL_NO_AUTO_MINIMISE)\n view_bar = RB.RibbonButtonBar(view_panel)\n view_bar.AddSimpleButton(wxID_RIBBONVIEWPLOT, \"Plot\", line_chart.GetBitmap(), \"\")\n view_bar.AddSimpleButton(wxID_RIBBONVIEWTABLE, \"Table\", table.GetBitmap(), \"\")\n view_bar.AddSimpleButton(wxID_RIBBONVIEWSERIES, \"Series Selector\", bitmap_editor.GetBitmap(), \"\")\n view_bar.AddSimpleButton(wxID_RIBBONVIEWCONSOLE, \"Python Console\", window_command_line.GetBitmap(), \"\")\n view_bar.AddSimpleButton(wxID_RIBBONVIEWSCRIPT, \"PythonScript\", script.GetBitmap(), \"\")\n\n self.scriptPanel = RB.RibbonPanel(viewPage, wx.ID_ANY, \"Script Options\", wx.NullBitmap, wx.DefaultPosition,\n wx.DefaultSize, RB.RIBBON_PANEL_NO_AUTO_MINIMISE)\n\n self.scriptBar = RB.RibbonButtonBar(self.scriptPanel)\n self.scriptBar.AddSimpleButton(wxID_RIBBONRECORDNEW, \"New Script\", newscript.GetBitmap(), \"\")\n self.scriptBar.AddSimpleButton(wxID_RIBBONRECORDOPEN, \"Open Script\", openscript.GetBitmap(), \"\")\n self.scriptBar.AddSimpleButton(wxID_RIBBONRECORDSAVE, \"Save Script\", savescript.GetBitmap(), \"\")\n self.scriptPanel.Hide()\n\n self.CurrPage = 1\n self.SetActivePageByIndex(self.CurrPage)\n\n self.bindEvents()\n self.initPubSub()", "metadata": "root.mnuRibbon._init_ctrls", "header": "['class', 'mnuRibbon', '(', 'RB', '.', 'RibbonBar', ')', ':', '___EOS___']", "index": 47 }, { "content": " def onLineDrift(self, event):\n dataframe = self.parent.getRecordService().get_filtered_points()\n try:\n self.isEmptySelection(dataframe)\n except EmptySelection:\n val = wx.MessageBox(\"You have no points selected, \"\n \"Please select points before applying a Linear Drift Correction\",\n 'Linear Drift Correction', wx.OK | wx.ICON_WARNING)\n return\n\n lin_drift = frmLinearDrift(self.parent, self.parent.getRecordService())\n lin_drift.CenterOnParent()\n lin_drift.ShowModal()\n lin_drift.Destroy()\n event.Skip()", "metadata": "root.mnuRibbon.onLineDrift", "header": "['class', 'mnuRibbon', '(', 'RB', '.', 'RibbonBar', ')', ':', '___EOS___']", "index": 345 }, { "content": " def onEditInterpolate(self, event):\n\n\n dataframe = self.parent.getRecordService().get_filtered_points()\n try:\n self.isEmptySelection(dataframe)\n except EmptySelection:\n val = wx.MessageBox(\"You have no points selected, Please select points before interpolating.\",\n 'Interpolation', wx.OK | wx.ICON_EXCLAMATION, parent=self.parent)\n return\n\n val = wx.MessageBox(\"You have chosen to interpolate the %s selected points.\\nDo you want to continue?\" % len(dataframe),\n 'Interpolation', wx.YES_NO | wx.ICON_QUESTION | wx.CENTRE, parent=self.parent)\n if val == 2: #wx.ID_YES:\n self.parent.getRecordService().interpolate()\n\n event.Skip()", "metadata": "root.mnuRibbon.onEditInterpolate", "header": "['class', 'mnuRibbon', '(', 'RB', '.', 'RibbonBar', ')', ':', '___EOS___']", "index": 418 } ]
[ { "span": "fileMenu ", "start_line": 53, "start_column": 8, "end_line": 53, "end_column": 16 }, { "span": "val ", "start_line": 350, "start_column": 12, "end_line": 350, "end_column": 15 }, { "span": "val ", "start_line": 425, "start_column": 12, "end_line": 425, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "mnu", "Rib", "bon", "_", "(_", "RB_", "._", "Rib", "bon", "Bar_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "init", "\\u", "ctrl", "s_", "(_", "self_", ",_", "prn", "t_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "RB_", "._", "Rib", "bon", "Bar_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "name_", "=_", "'", "rib", "bon", "'_", ",_", "parent_", "=_", "prn", "t_", ",_", "id_", "=_", "wx", "ID", "\\u", "PANEL", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "Set", "Art", "Provider", "(", "RB", ".", "Rib", "bon", "MS", "WA", "rt", "Provider", "())", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Set", "Art", "Provider_", "(_", "RB_", "._", "Rib", "bon", "AU", "IA", "rt", "Provider_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Set", "Font_", "(_", "wx_", "._", "Font_", "(_", "9_", ",_", "wx_", "._", "SWI", "SS_", ",_", "wx_", "._", "NORMAL_", ",_", "wx_", "._", "NORMAL_", ",_", "False_", ",_", "u", "'", "Ta", "hom", "a", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "file", "Menu_", "=_", "RB_", "._", "Rib", "bon", "Page_", "(_", "self_", ",_", "wx", "ID", "\\u", "File", "Menu_", ",_", "\"", "File", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "---", "Plot", "Menu", "-------------", "_", "\\u\\u\\uNL\\u\\u\\u_", "home_", "=_", "RB_", "._", "Rib", "bon", "Page_", "(_", "self_", ",_", "wx_", "._", "ID", "\\u", "ANY_", ",_", "\"", "Plot", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "-----", "Plot", " ", "Type", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plot", "\\u", "panel_", "=_", "RB_", "._", "Rib", "bon", "Panel_", "(_", "home_", ",_", "wx_", "._", "ID", "\\u", "ANY_", ",_", "\"", "Plot", "s", "\"_", ",_", "wx_", "._", "Null", "Bitmap_", ",_", "wx_", "._", "Default", "Position_", ",_", "wx_", "._", "Default", "Size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "RB_", "._", "RIB", "BON", "\\u", "PANEL", "\\u", "NO", "\\u", "AUTO", "\\u", "MINIM", "ISE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "plots", "\\u", "bar_", "=_", "RB_", "._", "Rib", "bon", "Butt", "on", "Bar_", "(_", "plot", "\\u", "panel_", ",_", "wx_", "._", "ID", "\\u", "ANY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "plots", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "TIMES", "ERI", "ES_", ",_", "\"", "Time", " ", "Serie", "s", "\"_", ",_", "tsa", "\\u", "icon_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "plots", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "PROB", "_", ",_", "\"", "Exce", "eda", "nce", " ", "Freq", "uenc", "y", "\"_", ",_", "probability_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "plots", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "HIS", "T_", ",_", "\"", "Histogram", "\"_", ",_", "histogram_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "plots", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "BOX_", ",_", "\"", "Box", "/", "Whi", "ske", "r", "\"_", ",_", "box", "\\u", "whis", "ker_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "plots", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "SUMMARY", "_", ",_", "\"", "Summ", "ary", "\"_", ",_", "summary_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "-", " ", "PLOT", " ", "OPTION", "S", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "Plot", "Optio", "ns", "\\u", "panel_", "=_", "RB_", "._", "Rib", "bon", "Panel_", "(_", "home_", ",_", "wx_", "._", "ID", "\\u", "ANY_", ",_", "\"", "Plot", " ", "Optio", "ns", "\"_", ",_", "wx_", "._", "Null", "Bitmap_", ",_", "wx_", "._", "Default", "Position_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wx_", "._", "Default", "Size_", ",_", "RB_", "._", "RIB", "BON", "\\u", "PANEL", "\\u", "NO", "\\u", "AUTO", "\\u", "MINIM", "ISE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Plot", "s", "Optio", "ns", "\\u", "bar_", "=_", "RB_", "._", "Rib", "bon", "Butt", "on", "Bar_", "(_", "Plot", "Optio", "ns", "\\u", "panel_", ",_", "wx_", "._", "ID", "\\u", "ANY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Plot", "s", "Optio", "ns", "\\u", "bar_", "._", "Add", "Drop", "down", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "TST", "YPE_", ",_", "\"", "Plot", " ", "Type", "\"_", ",_", "plot", "\\u", "type_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Plot", "s", "Optio", "ns", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "TS", "LE", "GEN", "D_", ",_", "\"", "Show", " ", "Legend", "\"_", ",_", "legend_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "string_", "=_", "\"", "show", " ", "legend", " ", "on", " ", "plot", "\"_", ",_", "kind_", "=_", "0x4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Plot", "s", "Optio", "ns", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "BLANK", "BTN", "_", ",_", "\"#", "Hist", " ", "Bin", "s", "\"_", ",_", "blank_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Plot", "s", "Optio", "ns", "\\u", "bar_", "._", "Enable", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "BLANK", "BTN", "_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "spn", "Bins_", "=_", "wx_", "._", "Spin", "Ctrl_", "(_", "id_", "=_", "wx", "ID", "\\u", "FRAME", "1", "SPIN", "CTR", "L1_", ",_", "initial_", "=_", "50_", ",_", "max_", "=_", "100_", ",_", "min_", "=_", "1_", ",_", "name_", "=_", "'", "spn", "Bin", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "self_", "._", "Plot", "s", "Optio", "ns", "\\u", "bar_", ",_", "pos_", "=_", "wx_", "._", "Point_", "(_", "85_", ",_", "7_", ")_", ",_", "#", "with", "out", " ", "color", " ", "button_", "\\u\\u\\uNL\\u\\u\\u_", "size_", "=_", "wx_", "._", "Size_", "(_", "44_", ",_", "25_", ")_", ",_", "style_", "=_", "wx_", "._", "SP", "\\u", "ARROW", "\\u", "KEYS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "spn", "Bins_", "._", "Enabled_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Plot", "s", "Optio", "ns", "\\u", "bar_", "._", "Add", "Drop", "down", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "BO", "XT", "YPE_", ",_", "\"", "Box", " ", "Whi", "ske", "r", " ", "Type", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "box", "\\u", "whis", "ker", "\\u", "type_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Plot", "s", "Optio", "ns", "\\u", "bar_", "._", "Enable", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "TST", "YPE_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Plot", "s", "Optio", "ns", "\\u", "bar_", "._", "Enable", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "TS", "LE", "GEN", "D_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Plot", "s", "Optio", "ns", "\\u", "bar_", "._", "Enable", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "BO", "XT", "YPE_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "date", "Time", "\\u", "panel_", "=_", "RB_", "._", "Rib", "bon", "Panel_", "(_", "home_", ",_", "wx_", "._", "ID", "\\u", "ANY_", ",_", "\"", "Date", " ", "Time", "\"_", ",_", "wx_", "._", "Null", "Bitmap_", ",_", "wx_", "._", "Default", "Position_", ",_", "wx_", "._", "Default", "Size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "RB_", "._", "RIB", "BON", "\\u", "PANEL", "\\u", "NO", "\\u", "AUTO", "\\u", "MINIM", "ISE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "date", "Time", "\\u", "button", "bar_", "=_", "RB_", "._", "Rib", "bon", "Butt", "on", "Bar_", "(_", "date", "Time", "\\u", "panel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "date", "Time", "\\u", "button", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "BLANK", "BTN", "_", ",_", "\"\"_", ",_", "blank_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "date", "Time", "\\u", "button", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "BLANK", "BTN", "_", ",_", "\"\"_", ",_", "blank_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "date", "Time", "\\u", "button", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "BLANK", "BTN", "_", ",_", "\"\"_", ",_", "blank_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "date", "Time", "\\u", "button", "bar_", "._", "Enable", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "BLANK", "BTN", "_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dp", "Start", "Date_", "=_", "wx_", "._", "Date", "Picke", "r", "Ctrl_", "(_", "id_", "=_", "wx", "ID", "\\u", "START", "DP", "DATE_", ",_", "name_", "=_", "u", "'", "dp", "Start", "Date", "'_", ",_", "parent_", "=_", "self_", "._", "date", "Time", "\\u", "button", "bar_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pos_", "=_", "wx_", "._", "Point_", "(_", "5_", ",_", "8_", ")_", ",_", "size_", "=_", "wx_", "._", "Size_", "(_", "120_", ",_", "24_", ")_", ",_", "style_", "=_", "wx_", "._", "DP", "\\u", "DROP", "DOWN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "dp", "Start", "Date", ".", "Set", "Value", "(", "wx", ".", "Date", "Time", "Fro", "m", "DM", "Y", "(", "16", ",", " ", "1", ",", " ", "2008", ",", " ", "0", ",", " ", "0", ",", " ", "0", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "dp", "Start", "Date", ".", "Set", "Label", "(", "repr", "(", "wx", ".", "Date", "Time", "Fro", "m", "DM", "Y", "(", "16", ",", " ", "1", ",", " ", "2008", ",", " ", "0", ",", " ", "0", ",", " ", "0", ")))", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dp", "Start", "Date_", "._", "Set", "Tool", "Tip", "String_", "(_", "u", "'", "Start", " ", "Date", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dp", "End", "Date_", "=_", "wx_", "._", "Date", "Picke", "r", "Ctrl_", "(_", "id_", "=_", "wx", "ID", "\\u", "END", "DP", "DATE_", ",_", "name_", "=_", "u", "'", "dp", "End", "Date", "'_", ",_", "parent_", "=_", "self_", "._", "date", "Time", "\\u", "button", "bar_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pos_", "=_", "wx_", "._", "Point_", "(_", "5_", ",_", "40_", ")_", ",_", "size_", "=_", "wx_", "._", "Size_", "(_", "120_", ",_", "24_", ")_", ",_", "style_", "=_", "wx_", "._", "DP", "\\u", "DROP", "DOWN_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "dp", "End", "Date", ".", "Set", "Value", "(", "wx", ".", "Date", "Time", "Fro", "m", "DM", "Y", "(", "01", ",", " ", "04", ",", " ", "2008", ",", " ", "0", ",", " ", "0", ",", " ", "0", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "dp", "End", "Date", ".", "Set", "Label", "(", "repr", "(", "wx", ".", "Date", "Time", "Fro", "m", "DM", "Y", "(", "1", ",", " ", "04", ",", " ", "2008", ",", " ", "0", ",", " ", "0", ",", " ", "0", ")))", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "dp", "End", "Date_", "._", "Set", "Tool", "Tip", "String_", "(_", "u", "'", "End", " ", "Date", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "date", "Time", "\\u", "button", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "DAT", "EAP", "PL", "Y_", ",_", "\"", "Apply", "\"_", ",_", "date", "\\u", "setting_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "date", "Time", "\\u", "button", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "DAT", "EF", "ULL_", ",_", "\"", "Full", " ", "Date", " ", "Range", "\"_", ",_", "full", "\\u", "date", "\\u", "range_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "date", "Time", "\\u", "button", "bar_", "._", "Enable", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "DAT", "EF", "ULL_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "date", "Time", "\\u", "button", "bar_", "._", "Enable", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "PLOT", "DAT", "EAP", "PL", "Y_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dp", "End", "Date_", "._", "Enabled_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dp", "Start", "Date_", "._", "Enabled_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "edit", "Page_", "=_", "RB_", "._", "Rib", "bon", "Page_", "(_", "self_", ",_", "wx_", "._", "ID", "\\u", "ANY_", ",_", "\"", "Edit", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "main", "\\u", "panel_", "=_", "RB_", "._", "Rib", "bon", "Panel_", "(_", "edit", "Page_", ",_", "wx_", "._", "ID", "\\u", "ANY_", ",_", "\"", "Main", "\"_", ",_", "wx_", "._", "Null", "Bitmap_", ",_", "wx_", "._", "Default", "Position_", ",_", "wx_", "._", "Default", "Size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "RB_", "._", "RIB", "BON", "\\u", "PANEL", "\\u", "NO", "\\u", "AUTO", "\\u", "MINIM", "ISE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "main", "\\u", "bar_", "=_", "RB_", "._", "Rib", "bon", "Butt", "on", "Bar_", "(_", "main", "\\u", "panel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "button_", "=_", "self_", "._", "main", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "SER", "IES_", ",_", "\"", "Edit", " ", "Serie", "s", "\"_", ",_", "bitmap_", "=_", "edit_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "string_", "=_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "kind_", "=_", "0x4_", ")_", "#", "kind", " ", "sets", " ", "the", " ", "button", " ", "to", " ", "be", " ", "a", " ", "Tru", "e", " ", "or", " ", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "main", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "REST", "ORE", "_", ",_", "\"", "Restor", "e", " ", "Serie", "s", "\"_", ",_", "restore_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "main", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "SAVE", "_", ",_", "\"", "Save", "\"_", ",_", "save", "\\u", "data_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "main", "\\u", "bar_", "._", "Enable", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "REST", "ORE", "_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "main", "\\u", "bar_", "._", "Enable", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "SAVE", "_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "edit", "\\u", "panel_", "=_", "RB_", "._", "Rib", "bon", "Panel_", "(_", "edit", "Page_", ",_", "wx_", "._", "ID", "\\u", "ANY_", ",_", "\"", "Edit", " ", "Function", "s", "\"_", ",_", "wx_", "._", "Null", "Bitmap_", ",_", "wx_", "._", "Default", "Position_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wx_", "._", "Default", "Size_", ",_", "RB_", "._", "RIB", "BON", "\\u", "PANEL", "\\u", "NO", "\\u", "AUTO", "\\u", "MINIM", "ISE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "bar_", "=_", "RB_", "._", "Rib", "bon", "Butt", "on", "Bar_", "(_", "edit", "\\u", "panel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "FILTER_", ",_", "\"", "Filter", " ", "Point", "s", "\"_", ",_", "filter", "\\u", "list_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "RESE", "TF", "IL", "TER_", ",_", "\"", "Reset", " ", "Selecti", "on", "\"_", ",_", "Und", "o_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "CH", "GV", "AL", "UE", "_", ",_", "\"", "Change", " ", "Value", "\"_", ",_", "edit", "\\u", "view_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "INTER", "OP", "OL", "ATE_", ",_", "\"", "Interpolate", "\"_", ",_", "interpolate_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "LIN", "FILTER_", ",_", "\"", "Linea", "r", " ", "Dri", "ft", "\"_", ",_", "lin", "\\u", "drift", "_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "FLAG_", ",_", "\"", "Fla", "g", "\"_", ",_", "flag_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "ADD", "POINT_", ",_", "\"", "Add", " ", "Point", "\"_", ",_", "add_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "DEL", "POINT_", ",_", "\"", "Delete", " ", "Point", "\"_", ",_", "delete_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "edit", "\\u", "bar", ".", "Add", "Simple", "Butt", "on", "(", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "RECORD", ",", " ", "\"", "Record", "\",", " ", "bitmap", "=", "record", ".", "Get", "Bit", "map", "()", ",", " ", "help", "\\u", "string", "=\"\"", ",", "kind", "=", "0x4", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "edit", "\\u", "bar_", "._", "Enable", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "FILTER_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "bar_", "._", "Enable", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "CH", "GV", "AL", "UE", "_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "bar_", "._", "Enable", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "INTER", "OP", "OL", "ATE_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "bar_", "._", "Enable", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "LIN", "FILTER_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "bar_", "._", "Enable", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "FLAG_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "bar_", "._", "Enable", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "ADD", "POINT_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "edit", "\\u", "bar_", "._", "Enable", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "DEL", "POINT_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "edit", "\\u", "bar", ".", "Enable", "Butt", "on", "(", "wx", "ID", "\\u", "RIB", "BON", "EDIT", "RECORD", ",", " ", "Fal", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "record", "\\u", "panel_", "=_", "RB_", "._", "Rib", "bon", "Panel_", "(_", "edit", "Page_", ",_", "wx_", "._", "ID", "\\u", "ANY_", ",_", "\"", "Record", "ing", " ", "Optio", "ns", "\"_", ",_", "wx_", "._", "Null", "Bitmap_", ",_", "wx_", "._", "Default", "Position_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wx_", "._", "Default", "Size_", ",_", "RB_", "._", "RIB", "BON", "\\u", "PANEL", "\\u", "NO", "\\u", "AUTO", "\\u", "MINIM", "ISE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "record", "\\u", "bar_", "=_", "RB_", "._", "Rib", "bon", "Butt", "on", "Bar_", "(_", "self_", "._", "record", "\\u", "panel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "record", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "RECORD", "NEW_", ",_", "\"", "New", " ", "Script", "\"_", ",_", "news", "cript_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "record", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "RECORD", "OPEN_", ",_", "\"", "Open", " ", "Script", "\"_", ",_", "opens", "cript_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "record", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "RECORD", "SAVE", "_", ",_", "\"", "Save", " ", "Script", "\"_", ",_", "save", "script_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "record", "\\u", "panel", ".", "Hi", "de", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "record", "\\u", "bar_", "._", "Enable", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "RECORD", "NEW_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "record", "\\u", "bar_", "._", "Enable", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "RECORD", "OPEN_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "record", "\\u", "bar_", "._", "Enable", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "RECORD", "SAVE", "_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "--------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "Page_", "=_", "RB_", "._", "Rib", "bon", "Page_", "(_", "self_", ",_", "wx_", "._", "ID", "\\u", "ANY_", ",_", "\"", "View", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "view", "\\u", "panel_", "=_", "RB_", "._", "Rib", "bon", "Panel_", "(_", "view", "Page_", ",_", "wx_", "._", "ID", "\\u", "ANY_", ",_", "\"", "Tool", "s", "\"_", ",_", "wx_", "._", "Null", "Bitmap_", ",_", "wx_", "._", "Default", "Position_", ",_", "wx_", "._", "Default", "Size_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "RB_", "._", "RIB", "BON", "\\u", "PANEL", "\\u", "NO", "\\u", "AUTO", "\\u", "MINIM", "ISE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "\\u", "bar_", "=_", "RB_", "._", "Rib", "bon", "Butt", "on", "Bar_", "(_", "view", "\\u", "panel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "VIEW", "PLOT", "_", ",_", "\"", "Plot", "\"_", ",_", "line", "\\u", "chart_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "VIEW", "TABLE_", ",_", "\"", "Table", "\"_", ",_", "table_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "VIEW", "SER", "IES_", ",_", "\"", "Serie", "s", " ", "Select", "or", "\"_", ",_", "bitmap", "\\u", "editor_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "VIEW", "CONSOLE", "_", ",_", "\"", "Pyth", "on", " ", "Cons", "ole", "\"_", ",_", "window", "\\u", "command", "\\u", "line_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "view", "\\u", "bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "VIEW", "SCRIPT_", ",_", "\"", "Pyth", "on", "Script", "\"_", ",_", "script_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "script", "Panel_", "=_", "RB_", "._", "Rib", "bon", "Panel_", "(_", "view", "Page_", ",_", "wx_", "._", "ID", "\\u", "ANY_", ",_", "\"", "Script", " ", "Optio", "ns", "\"_", ",_", "wx_", "._", "Null", "Bitmap_", ",_", "wx_", "._", "Default", "Position_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "wx_", "._", "Default", "Size_", ",_", "RB_", "._", "RIB", "BON", "\\u", "PANEL", "\\u", "NO", "\\u", "AUTO", "\\u", "MINIM", "ISE", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "script", "Bar_", "=_", "RB_", "._", "Rib", "bon", "Butt", "on", "Bar_", "(_", "self_", "._", "script", "Panel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "script", "Bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "RECORD", "NEW_", ",_", "\"", "New", " ", "Script", "\"_", ",_", "news", "cript_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "script", "Bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "RECORD", "OPEN_", ",_", "\"", "Open", " ", "Script", "\"_", ",_", "opens", "cript_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "script", "Bar_", "._", "Add", "Simple", "Button_", "(_", "wx", "ID", "\\u", "RIB", "BON", "RECORD", "SAVE", "_", ",_", "\"", "Save", " ", "Script", "\"_", ",_", "save", "script_", "._", "Get", "Bitmap_", "(_", ")_", ",_", "\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "script", "Panel_", "._", "Hide_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "Curr", "Page_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Set", "Activ", "e", "Page", "By", "Index_", "(_", "self_", "._", "Curr", "Page_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "bind", "Events_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "init", "Pub", "Sub_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "mnu", "Rib", "bon", "_", "(_", "RB_", "._", "Rib", "bon", "Bar_", ")_", ":_", "\\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_", "on", "Line", "Dri", "ft_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataframe_", "=_", "self_", "._", "parent_", "._", "get", "Record", "Service_", "(_", ")_", "._", "get", "\\u", "filter", "ed", "\\u", "points_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "is", "Emp", "ty", "Selection_", "(_", "dataframe_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Emp", "ty", "Selection_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "wx_", "._", "Messag", "e", "Box_", "(_", "\"", "You", " ", "have", " ", "no", " ", "points", " ", "selecte", "d", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ple", "ase", " ", "select", " ", "points", " ", "bef", "ore", " ", "appl", "ying", " ", "a", " ", "Linea", "r", " ", "Dri", "ft", " ", "Correct", "ion", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Linea", "r", " ", "Dri", "ft", " ", "Correct", "ion", "'_", ",_", "wx_", "._", "OK_", "|_", "wx_", "._", "ICON", "\\u", "WARNING_", ")_", "\\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_", "lin", "\\u", "drift", "_", "=_", "frm", "Linea", "r", "Dri", "ft_", "(_", "self_", "._", "parent_", ",_", "self_", "._", "parent_", "._", "get", "Record", "Service_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lin", "\\u", "drift", "_", "._", "Center", "On", "Parent_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lin", "\\u", "drift", "_", "._", "Show", "Modal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lin", "\\u", "drift", "_", "._", "Destroy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event_", "._", "Skip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "mnu", "Rib", "bon", "_", "(_", "RB_", "._", "Rib", "bon", "Bar_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Edit", "Interpolate", "_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dataframe_", "=_", "self_", "._", "parent_", "._", "get", "Record", "Service_", "(_", ")_", "._", "get", "\\u", "filter", "ed", "\\u", "points_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "is", "Emp", "ty", "Selection_", "(_", "dataframe_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Emp", "ty", "Selection_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "val_", "=_", "wx_", "._", "Messag", "e", "Box_", "(_", "\"", "You", " ", "have", " ", "no", " ", "points", " ", "selecte", "d", ",", " ", "Ple", "ase", " ", "select", " ", "points", " ", "bef", "ore", " ", "interpolati", "ng", ".\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Interpolation", "'_", ",_", "wx_", "._", "OK_", "|_", "wx_", "._", "ICON", "\\u", "EXC", "LAM", "ATION_", ",_", "parent_", "=_", "self_", "._", "parent_", ")_", "\\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_", "val_", "=_", "wx_", "._", "Messag", "e", "Box_", "(_", "\"", "You", " ", "have", " ", "chosen", " ", "to", " ", "interpolat", "e", " ", "the", " ", "%", "s", " ", "selecte", "d", " ", "points", ".\\\\", "n", "Do", " ", "you", " ", "want", " ", "to", " ", "continue", "?\"_", "%_", "len_", "(_", "dataframe_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Interpolation", "'_", ",_", "wx_", "._", "YE", "S", "\\u", "NO_", "|_", "wx_", "._", "ICON", "\\u", "QUESTION", "_", "|_", "wx_", "._", "CENTR", "E_", ",_", "parent_", "=_", "self_", "._", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "val_", "==_", "2_", ":_", "#", "wx", ".", "ID", "\\u", "YE", "S", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "parent_", "._", "get", "Record", "Service_", "(_", ")_", "._", "interpolate_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "event_", "._", "Skip_", "(_", ")_", "\\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, 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,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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 ]
Comparison using is when operands support `__eq__`
babble/babble/include/jython/Lib/test/test_bool.py
[ { "content": " def test_math(self):\n self.assertEqual(+False, 0)\n self.assertIsNot(+False, False)\n self.assertEqual(-False, 0)\n self.assertIsNot(-False, False)\n self.assertEqual(abs(False), 0)\n self.assertIsNot(abs(False), False)\n self.assertEqual(+True, 1)\n self.assertIsNot(+True, True)\n self.assertEqual(-True, -1)\n self.assertEqual(abs(True), 1)\n self.assertIsNot(abs(True), True)\n self.assertEqual(~False, -1)\n self.assertEqual(~True, -2)\n\n self.assertEqual(False+2, 2)\n self.assertEqual(True+2, 3)\n self.assertEqual(2+False, 2)\n self.assertEqual(2+True, 3)\n\n self.assertEqual(False+False, 0)\n self.assertIsNot(False+False, False)\n self.assertEqual(False+True, 1)\n self.assertIsNot(False+True, True)\n self.assertEqual(True+False, 1)\n self.assertIsNot(True+False, True)\n self.assertEqual(True+True, 2)\n\n self.assertEqual(True-True, 0)\n self.assertIsNot(True-True, False)\n self.assertEqual(False-False, 0)\n self.assertIsNot(False-False, False)\n self.assertEqual(True-False, 1)\n self.assertIsNot(True-False, True)\n self.assertEqual(False-True, -1)\n\n self.assertEqual(True*1, 1)\n self.assertEqual(False*1, 0)\n self.assertIsNot(False*1, False)\n\n self.assertEqual(True/1, 1)\n self.assertIsNot(True/1, True)\n self.assertEqual(False/1, 0)\n self.assertIsNot(False/1, False)\n\n for b in False, True:\n for i in 0, 1, 2:\n self.assertEqual(b**i, int(b)**i)\n self.assertIsNot(b**i, bool(int(b)**i))\n\n for a in False, True:\n for b in False, True:\n self.assertIs(a&b, bool(int(a)&int(b)))\n self.assertIs(a|b, bool(int(a)|int(b)))\n self.assertIs(a^b, bool(int(a)^int(b)))\n self.assertEqual(a&int(b), int(a)&int(b))\n self.assertIsNot(a&int(b), bool(int(a)&int(b)))\n self.assertEqual(a|int(b), int(a)|int(b))\n self.assertIsNot(a|int(b), bool(int(a)|int(b)))\n self.assertEqual(a^int(b), int(a)^int(b))\n self.assertIsNot(a^int(b), bool(int(a)^int(b)))\n self.assertEqual(int(a)&b, int(a)&int(b))\n self.assertIsNot(int(a)&b, bool(int(a)&int(b)))\n self.assertEqual(int(a)|b, int(a)|int(b))\n self.assertIsNot(int(a)|b, bool(int(a)|int(b)))\n self.assertEqual(int(a)^b, int(a)^int(b))\n self.assertIsNot(int(a)^b, bool(int(a)^int(b)))\n\n self.assertIs(1==1, True)\n self.assertIs(1==0, False)\n self.assertIs(0<1, True)\n self.assertIs(1<0, False)\n self.assertIs(0<=0, True)\n self.assertIs(1<=0, False)\n self.assertIs(1>0, True)\n self.assertIs(1>1, False)\n self.assertIs(1>=1, True)\n self.assertIs(0>=1, False)\n self.assertIs(0!=1, True)\n self.assertIs(0!=0, False)\n\n x = [1]\n self.assertIs(x is x, True)\n self.assertIs(x is not x, False)\n\n self.assertIs(1 in x, True)\n self.assertIs(0 in x, False)\n self.assertIs(1 not in x, False)\n self.assertIs(0 not in x, True)\n\n x = {1: 2}\n self.assertIs(x is x, True)\n self.assertIs(x is not x, False)\n\n self.assertIs(1 in x, True)\n self.assertIs(0 in x, False)\n self.assertIs(1 not in x, False)\n self.assertIs(0 not in x, True)\n\n self.assertIs(not True, False)\n self.assertIs(not False, True)", "metadata": "root.BoolTest.test_math", "header": "['class', 'BoolTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 53 } ]
[ { "span": "x is x,", "start_line": 135, "start_column": 22, "end_line": 135, "end_column": 28 }, { "span": "x is not x,", "start_line": 136, "start_column": 22, "end_line": 136, "end_column": 32 }, { "span": "x is x,", "start_line": 144, "start_column": 22, "end_line": 144, "end_column": 28 }, { "span": "x is not x,", "start_line": 145, "start_column": 22, "end_line": 145, "end_column": 32 } ]
[]
1
false
[ "[CLS]_", "Compari", "son_", "using_", "is_", "when_", "operands_", "support_", " _", "`_", "\\u\\u", "eq\\u\\u_", "`_", "[SEP]_", "class_", "Boo", "l", "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", "math_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "+_", "False_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "+_", "False_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "-_", "False_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "-_", "False_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "abs_", "(_", "False_", ")_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "abs_", "(_", "False_", ")_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "+_", "True_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "+_", "True_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "-_", "True_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "abs_", "(_", "True_", ")_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "abs_", "(_", "True_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "~_", "False_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "~_", "True_", ",_", "-_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "False_", "+_", "2_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "True_", "+_", "2_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", "+_", "False_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "2_", "+_", "True_", ",_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "False_", "+_", "False_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "False_", "+_", "False_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "False_", "+_", "True_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "False_", "+_", "True_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "True_", "+_", "False_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "True_", "+_", "False_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "True_", "+_", "True_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "True_", "-_", "True_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "True_", "-_", "True_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "False_", "-_", "False_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "False_", "-_", "False_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "True_", "-_", "False_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "True_", "-_", "False_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "False_", "-_", "True_", ",_", "-_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "True_", "*_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "False_", "*_", "1_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "False_", "*_", "1_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "True_", "/_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "True_", "/_", "1_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "False_", "/_", "1_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "False_", "/_", "1_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "b_", "in_", "False_", ",_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", "in_", "0_", ",_", "1_", ",_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "b_", "**_", "i_", ",_", "int_", "(_", "b_", ")_", "**_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "b_", "**_", "i_", ",_", "bool_", "(_", "int_", "(_", "b_", ")_", "**_", "i_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "a_", "in_", "False_", ",_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "b_", "in_", "False_", ",_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Is_", "(_", "a_", "&_", "b_", ",_", "bool_", "(_", "int_", "(_", "a_", ")_", "&_", "int_", "(_", "b_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "a_", "|_", "b_", ",_", "bool_", "(_", "int_", "(_", "a_", ")_", "|_", "int_", "(_", "b_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "a_", "^_", "b_", ",_", "bool_", "(_", "int_", "(_", "a_", ")_", "^_", "int_", "(_", "b_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", "&_", "int_", "(_", "b_", ")_", ",_", "int_", "(_", "a_", ")_", "&_", "int_", "(_", "b_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "a_", "&_", "int_", "(_", "b_", ")_", ",_", "bool_", "(_", "int_", "(_", "a_", ")_", "&_", "int_", "(_", "b_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", "|_", "int_", "(_", "b_", ")_", ",_", "int_", "(_", "a_", ")_", "|_", "int_", "(_", "b_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "a_", "|_", "int_", "(_", "b_", ")_", ",_", "bool_", "(_", "int_", "(_", "a_", ")_", "|_", "int_", "(_", "b_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "a_", "^_", "int_", "(_", "b_", ")_", ",_", "int_", "(_", "a_", ")_", "^_", "int_", "(_", "b_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "a_", "^_", "int_", "(_", "b_", ")_", ",_", "bool_", "(_", "int_", "(_", "a_", ")_", "^_", "int_", "(_", "b_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "int_", "(_", "a_", ")_", "&_", "b_", ",_", "int_", "(_", "a_", ")_", "&_", "int_", "(_", "b_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "int_", "(_", "a_", ")_", "&_", "b_", ",_", "bool_", "(_", "int_", "(_", "a_", ")_", "&_", "int_", "(_", "b_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "int_", "(_", "a_", ")_", "|_", "b_", ",_", "int_", "(_", "a_", ")_", "|_", "int_", "(_", "b_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "int_", "(_", "a_", ")_", "|_", "b_", ",_", "bool_", "(_", "int_", "(_", "a_", ")_", "|_", "int_", "(_", "b_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "int_", "(_", "a_", ")_", "^_", "b_", ",_", "int_", "(_", "a_", ")_", "^_", "int_", "(_", "b_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Not_", "(_", "int_", "(_", "a_", ")_", "^_", "b_", ",_", "bool_", "(_", "int_", "(_", "a_", ")_", "^_", "int_", "(_", "b_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "1_", "==_", "1_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "1_", "==_", "0_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "0_", "<_", "1_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "1_", "<_", "0_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "0_", "<=_", "0_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "1_", "<=_", "0_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "1_", ">_", "0_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "1_", ">_", "1_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "1_", ">=_", "1_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "0_", ">=_", "1_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "0_", "!=_", "1_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "0_", "!=_", "0_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "x_", "is_", "x_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "x_", "is_", "not_", "x_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "1_", "in_", "x_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "0_", "in_", "x_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "1_", "not_", "in_", "x_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "0_", "not_", "in_", "x_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", "=_", "{_", "1_", ":_", "2_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "x_", "is_", "x_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "x_", "is_", "not_", "x_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "1_", "in_", "x_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "0_", "in_", "x_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "1_", "not_", "in_", "x_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "0_", "not_", "in_", "x_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "not_", "True_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is_", "(_", "not_", "False_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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, 0, 1, 1, 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 ]
Unused import
nii-cloud/dodai-compute/nova/tests/api/openstack/test_limits.py
[ { "content": "# Copyright 2011 OpenStack LLC.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\n\"\"\"\nTests dealing with HTTP rate-limiting.\n\"\"\"\n\nimport httplib\nimport json\nimport StringIO\nimport stubout\nimport time\nimport unittest\nimport webob\nfrom xml.dom import minidom\n\nimport nova.context\nfrom nova.api.openstack import limits\nfrom nova.api.openstack import views\nfrom nova import test\n\n\nTEST_LIMITS = [\n limits.Limit(\"GET\", \"/delayed\", \"^/delayed\", 1, limits.PER_MINUTE),\n limits.Limit(\"POST\", \"*\", \".*\", 7, limits.PER_MINUTE),\n limits.Limit(\"POST\", \"/servers\", \"^/servers\", 3, limits.PER_MINUTE),\n limits.Limit(\"PUT\", \"*\", \"\", 10, limits.PER_MINUTE),\n limits.Limit(\"PUT\", \"/servers\", \"^/servers\", 5, limits.PER_MINUTE),\n]\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BaseLimitTestSuite(unittest.TestCase):\n \"\"\"Base test suite which provides relevant stubs and time abstraction.\"\"\"\n\n\n", "metadata": "root.BaseLimitTestSuite", "header": "['module', '___EOS___']", "index": 43 }, { "content": " def setUp(self):\n \"\"\"Run before each test.\"\"\"\n self.time = 0.0\n self.stubs = stubout.StubOutForTesting()\n self.stubs.Set(limits.Limit, \"_get_time\", self._get_time)\n self.absolute_limits = {}\n\n def stub_get_project_quotas(context, project_id):\n return self.absolute_limits\n\n self.stubs.Set(nova.quota, \"get_project_quotas\",\n stub_get_project_quotas)", "metadata": "root.BaseLimitTestSuite.setUp", "header": "['class', 'BaseLimitTestSuite', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 46 }, { "content": " def tearDown(self):\n \"\"\"Run after each test.\"\"\"\n self.stubs.UnsetAll()", "metadata": "root.BaseLimitTestSuite.tearDown", "header": "['class', 'BaseLimitTestSuite', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 59 }, { "content": " def _get_time(self):\n \"\"\"Return the \"time\" according to this test suite.\"\"\"\n return self.time", "metadata": "root.BaseLimitTestSuite._get_time", "header": "['class', 'BaseLimitTestSuite', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 63 }, { "content": "class LimitsControllerV10Test(BaseLimitTestSuite):\n \"\"\"\n Tests for `limits.LimitsControllerV10` class.\n \"\"\"\n\n\n\n\n\n\n\n", "metadata": "root.LimitsControllerV10Test", "header": "['module', '___EOS___']", "index": 68 }, { "content": " def setUp(self):\n \"\"\"Run before each test.\"\"\"\n BaseLimitTestSuite.setUp(self)\n self.controller = limits.create_resource('1.0')", "metadata": "root.LimitsControllerV10Test.setUp", "header": "['class', 'LimitsControllerV10Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 73 }, { "content": " def _get_index_request(self, accept_header=\"application/json\"):\n \"\"\"Helper to set routing arguments.\"\"\"\n request = webob.Request.blank(\"/\")\n request.accept = accept_header\n request.environ[\"wsgiorg.routing_args\"] = (None, {\n \"action\": \"index\",\n \"controller\": \"\",\n })\n context = nova.context.RequestContext('testuser', 'testproject')\n request.environ[\"nova.context\"] = context\n return request", "metadata": "root.LimitsControllerV10Test._get_index_request", "header": "['class', 'LimitsControllerV10Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 78 }, { "content": " def _populate_limits(self, request):\n \"\"\"Put limit info into a request.\"\"\"\n _limits = [\n limits.Limit(\"GET\", \"*\", \".*\", 10, 60).display(),\n limits.Limit(\"POST\", \"*\", \".*\", 5, 60 * 60).display(),\n ]\n request.environ[\"nova.limits\"] = _limits\n return request", "metadata": "root.LimitsControllerV10Test._populate_limits", "header": "['class', 'LimitsControllerV10Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 90 }, { "content": " def _setup_absolute_limits(self):\n self.absolute_limits = {\n 'instances': 5,\n 'cores': 8,\n 'ram': 2 ** 13,\n 'volumes': 21,\n 'gigabytes': 34,\n 'metadata_items': 55,\n 'injected_files': 89,\n 'injected_file_content_bytes': 144,\n }", "metadata": "root.LimitsControllerV10Test._setup_absolute_limits", "header": "['class', 'LimitsControllerV10Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 99 }, { "content": " def test_empty_index_json(self):\n \"\"\"Test getting empty limit details in JSON.\"\"\"\n request = self._get_index_request()\n response = request.get_response(self.controller)\n expected = {\n \"limits\": {\n \"rate\": [],\n \"absolute\": {},\n },\n }\n body = json.loads(response.body)\n self.assertEqual(expected, body)", "metadata": "root.LimitsControllerV10Test.test_empty_index_json", "header": "['class', 'LimitsControllerV10Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 111 }, { "content": " def test_index_json(self):\n \"\"\"Test getting limit details in JSON.\"\"\"\n request = self._get_index_request()\n request = self._populate_limits(request)\n self._setup_absolute_limits()\n response = request.get_response(self.controller)\n expected = {\n \"limits\": {\n \"rate\": [{\n \"regex\": \".*\",\n \"resetTime\": 0,\n \"URI\": \"*\",\n \"value\": 10,\n \"verb\": \"GET\",\n \"remaining\": 10,\n \"unit\": \"MINUTE\",\n },\n {\n \"regex\": \".*\",\n \"resetTime\": 0,\n \"URI\": \"*\",\n \"value\": 5,\n \"verb\": \"POST\",\n \"remaining\": 5,\n \"unit\": \"HOUR\",\n }],\n \"absolute\": {\n \"maxTotalInstances\": 5,\n \"maxTotalCores\": 8,\n \"maxTotalRAMSize\": 2 ** 13,\n \"maxServerMeta\": 55,\n \"maxImageMeta\": 55,\n \"maxPersonality\": 89,\n \"maxPersonalitySize\": 144,\n },\n },\n }\n body = json.loads(response.body)\n self.assertEqual(expected, body)", "metadata": "root.LimitsControllerV10Test.test_index_json", "header": "['class', 'LimitsControllerV10Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 124 }, { "content": " def test_empty_index_xml(self):\n \"\"\"Test getting limit details in XML.\"\"\"\n request = self._get_index_request(\"application/xml\")\n response = request.get_response(self.controller)\n\n expected = minidom.parseString(\"\"\"\n <limits\n xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\">\n <rate/>\n <absolute/>\n </limits>\n \"\"\".replace(\" \", \"\"))\n\n body = minidom.parseString(response.body.replace(\" \", \"\"))\n\n self.assertEqual(expected.toxml(), body.toxml())", "metadata": "root.LimitsControllerV10Test.test_empty_index_xml", "header": "['class', 'LimitsControllerV10Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 164 }, { "content": " def test_index_xml(self):\n \"\"\"Test getting limit details in XML.\"\"\"\n request = self._get_index_request(\"application/xml\")\n request = self._populate_limits(request)\n response = request.get_response(self.controller)\n\n expected = minidom.parseString(\"\"\"\n <limits\n xmlns=\"http://docs.rackspacecloud.com/servers/api/v1.0\">\n <rate>\n <limit URI=\"*\" regex=\".*\" remaining=\"10\" resetTime=\"0\"\n unit=\"MINUTE\" value=\"10\" verb=\"GET\"/>\n <limit URI=\"*\" regex=\".*\" remaining=\"5\" resetTime=\"0\"\n unit=\"HOUR\" value=\"5\" verb=\"POST\"/>\n </rate>\n <absolute/>\n </limits>\n \"\"\".replace(\" \", \"\"))\n body = minidom.parseString(response.body.replace(\" \", \"\"))\n\n self.assertEqual(expected.toxml(), body.toxml())", "metadata": "root.LimitsControllerV10Test.test_index_xml", "header": "['class', 'LimitsControllerV10Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 181 }, { "content": "class LimitsControllerV11Test(BaseLimitTestSuite):\n \"\"\"\n Tests for `limits.LimitsControllerV11` class.\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.LimitsControllerV11Test", "header": "['module', '___EOS___']", "index": 204 }, { "content": " def setUp(self):\n \"\"\"Run before each test.\"\"\"\n BaseLimitTestSuite.setUp(self)\n self.controller = limits.create_resource('1.1')\n self.maxDiff = None", "metadata": "root.LimitsControllerV11Test.setUp", "header": "['class', 'LimitsControllerV11Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 209 }, { "content": " def _get_index_request(self, accept_header=\"application/json\"):\n \"\"\"Helper to set routing arguments.\"\"\"\n request = webob.Request.blank(\"/\")\n request.accept = accept_header\n request.environ[\"wsgiorg.routing_args\"] = (None, {\n \"action\": \"index\",\n \"controller\": \"\",\n })\n context = nova.context.RequestContext('testuser', 'testproject')\n request.environ[\"nova.context\"] = context\n return request", "metadata": "root.LimitsControllerV11Test._get_index_request", "header": "['class', 'LimitsControllerV11Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 215 }, { "content": " def _populate_limits(self, request):\n \"\"\"Put limit info into a request.\"\"\"\n _limits = [\n limits.Limit(\"GET\", \"*\", \".*\", 10, 60).display(),\n limits.Limit(\"POST\", \"*\", \".*\", 5, 60 * 60).display(),\n limits.Limit(\"GET\", \"changes-since*\", \"changes-since\",\n 5, 60).display(),\n ]\n request.environ[\"nova.limits\"] = _limits\n return request", "metadata": "root.LimitsControllerV11Test._populate_limits", "header": "['class', 'LimitsControllerV11Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 227 }, { "content": " def test_empty_index_json(self):\n \"\"\"Test getting empty limit details in JSON.\"\"\"\n request = self._get_index_request()\n response = request.get_response(self.controller)\n expected = {\n \"limits\": {\n \"rate\": [],\n \"absolute\": {},\n },\n }\n body = json.loads(response.body)\n self.assertEqual(expected, body)", "metadata": "root.LimitsControllerV11Test.test_empty_index_json", "header": "['class', 'LimitsControllerV11Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 238 }, { "content": " def test_index_json(self):\n \"\"\"Test getting limit details in JSON.\"\"\"\n request = self._get_index_request()\n request = self._populate_limits(request)\n self.absolute_limits = {\n 'ram': 512,\n 'instances': 5,\n 'cores': 21,\n }\n response = request.get_response(self.controller)\n expected = {\n \"limits\": {\n \"rate\": [\n {\n \"regex\": \".*\",\n \"uri\": \"*\",\n \"limit\": [\n {\n \"verb\": \"GET\",\n \"next-available\": \"1970-01-01T00:00:00Z\",\n \"unit\": \"MINUTE\",\n \"value\": 10,\n \"remaining\": 10,\n },\n {\n \"verb\": \"POST\",\n \"next-available\": \"1970-01-01T00:00:00Z\",\n \"unit\": \"HOUR\",\n \"value\": 5,\n \"remaining\": 5,\n },\n ],\n },\n {\n \"regex\": \"changes-since\",\n \"uri\": \"changes-since*\",\n \"limit\": [\n {\n \"verb\": \"GET\",\n \"next-available\": \"1970-01-01T00:00:00Z\",\n \"unit\": \"MINUTE\",\n \"value\": 5,\n \"remaining\": 5,\n },\n ],\n },\n\n ],\n \"absolute\": {\n \"maxTotalRAMSize\": 512,\n \"maxTotalInstances\": 5,\n \"maxTotalCores\": 21,\n },\n },\n }\n body = json.loads(response.body)\n self.assertEqual(expected, body)", "metadata": "root.LimitsControllerV11Test.test_index_json", "header": "['class', 'LimitsControllerV11Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 251 }, { "content": " def _populate_limits_diff_regex(self, request):\n \"\"\"Put limit info into a request.\"\"\"\n _limits = [\n limits.Limit(\"GET\", \"*\", \".*\", 10, 60).display(),\n limits.Limit(\"GET\", \"*\", \"*.*\", 10, 60).display(),\n ]\n request.environ[\"nova.limits\"] = _limits\n return request", "metadata": "root.LimitsControllerV11Test._populate_limits_diff_regex", "header": "['class', 'LimitsControllerV11Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 309 }, { "content": " def test_index_diff_regex(self):\n \"\"\"Test getting limit details in JSON.\"\"\"\n request = self._get_index_request()\n request = self._populate_limits_diff_regex(request)\n response = request.get_response(self.controller)\n expected = {\n \"limits\": {\n \"rate\": [\n {\n \"regex\": \".*\",\n \"uri\": \"*\",\n \"limit\": [\n {\n \"verb\": \"GET\",\n \"next-available\": \"1970-01-01T00:00:00Z\",\n \"unit\": \"MINUTE\",\n \"value\": 10,\n \"remaining\": 10,\n },\n ],\n },\n {\n \"regex\": \"*.*\",\n \"uri\": \"*\",\n \"limit\": [\n {\n \"verb\": \"GET\",\n \"next-available\": \"1970-01-01T00:00:00Z\",\n \"unit\": \"MINUTE\",\n \"value\": 10,\n \"remaining\": 10,\n },\n ],\n },\n\n ],\n \"absolute\": {},\n },\n }\n body = json.loads(response.body)\n self.assertEqual(expected, body)", "metadata": "root.LimitsControllerV11Test.test_index_diff_regex", "header": "['class', 'LimitsControllerV11Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 318 }, { "content": " def _test_index_absolute_limits_json(self, expected):\n request = self._get_index_request()\n response = request.get_response(self.controller)\n body = json.loads(response.body)\n self.assertEqual(expected, body['limits']['absolute'])", "metadata": "root.LimitsControllerV11Test._test_index_absolute_limits_json", "header": "['class', 'LimitsControllerV11Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 360 }, { "content": " def test_index_ignores_extra_absolute_limits_json(self):\n self.absolute_limits = {'unknown_limit': 9001}\n self._test_index_absolute_limits_json({})", "metadata": "root.LimitsControllerV11Test.test_index_ignores_extra_absolute_limits_json", "header": "['class', 'LimitsControllerV11Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 366 }, { "content": " def test_index_absolute_ram_json(self):\n self.absolute_limits = {'ram': 1024}\n self._test_index_absolute_limits_json({'maxTotalRAMSize': 1024})", "metadata": "root.LimitsControllerV11Test.test_index_absolute_ram_json", "header": "['class', 'LimitsControllerV11Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 370 }, { "content": " def test_index_absolute_cores_json(self):\n self.absolute_limits = {'cores': 17}\n self._test_index_absolute_limits_json({'maxTotalCores': 17})", "metadata": "root.LimitsControllerV11Test.test_index_absolute_cores_json", "header": "['class', 'LimitsControllerV11Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 374 }, { "content": " def test_index_absolute_instances_json(self):\n self.absolute_limits = {'instances': 19}\n self._test_index_absolute_limits_json({'maxTotalInstances': 19})", "metadata": "root.LimitsControllerV11Test.test_index_absolute_instances_json", "header": "['class', 'LimitsControllerV11Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 378 }, { "content": " def test_index_absolute_metadata_json(self):\n # NOTE: both server metadata and image metadata are overloaded\n # into metadata_items\n self.absolute_limits = {'metadata_items': 23}\n expected = {\n 'maxServerMeta': 23,\n 'maxImageMeta': 23,\n }\n self._test_index_absolute_limits_json(expected)", "metadata": "root.LimitsControllerV11Test.test_index_absolute_metadata_json", "header": "['class', 'LimitsControllerV11Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 382 }, { "content": " def test_index_absolute_injected_files(self):\n self.absolute_limits = {\n 'injected_files': 17,\n 'injected_file_content_bytes': 86753,\n }\n expected = {\n 'maxPersonality': 17,\n 'maxPersonalitySize': 86753,\n }\n self._test_index_absolute_limits_json(expected)", "metadata": "root.LimitsControllerV11Test.test_index_absolute_injected_files", "header": "['class', 'LimitsControllerV11Test', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 392 }, { "content": "class TestLimiter(limits.Limiter):\n pass", "metadata": "root.TestLimiter", "header": "['module', '___EOS___']", "index": 404 }, { "content": "class LimitMiddlewareTest(BaseLimitTestSuite):\n \"\"\"\n Tests for the `limits.RateLimitingMiddleware` class.\n \"\"\"\n\n\n\n\n\n", "metadata": "root.LimitMiddlewareTest", "header": "['module', '___EOS___']", "index": 408 }, { "content": " @webob.dec.wsgify\n def _empty_app(self, request):\n \"\"\"Do-nothing WSGI app.\"\"\"\n pass", "metadata": "root.LimitMiddlewareTest._empty_app", "header": "['class', 'LimitMiddlewareTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 413 }, { "content": " def setUp(self):\n \"\"\"Prepare middleware for use through fake WSGI app.\"\"\"\n BaseLimitTestSuite.setUp(self)\n _limits = '(GET, *, .*, 1, MINUTE)'\n self.app = limits.RateLimitingMiddleware(self._empty_app, _limits,\n \"%s.TestLimiter\" %\n self.__class__.__module__)", "metadata": "root.LimitMiddlewareTest.setUp", "header": "['class', 'LimitMiddlewareTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 418 }, { "content": " def test_limit_class(self):\n \"\"\"Test that middleware selected correct limiter class.\"\"\"\n assert isinstance(self.app._limiter, TestLimiter)", "metadata": "root.LimitMiddlewareTest.test_limit_class", "header": "['class', 'LimitMiddlewareTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 426 }, { "content": " def test_good_request(self):\n \"\"\"Test successful GET request through middleware.\"\"\"\n request = webob.Request.blank(\"/\")\n response = request.get_response(self.app)\n self.assertEqual(200, response.status_int)", "metadata": "root.LimitMiddlewareTest.test_good_request", "header": "['class', 'LimitMiddlewareTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 430 }, { "content": " def test_limited_request_json(self):\n \"\"\"Test a rate-limited (403) GET request through middleware.\"\"\"\n request = webob.Request.blank(\"/\")\n response = request.get_response(self.app)\n self.assertEqual(200, response.status_int)\n\n request = webob.Request.blank(\"/\")\n response = request.get_response(self.app)\n self.assertEqual(response.status_int, 403)\n\n body = json.loads(response.body)\n expected = \"Only 1 GET request(s) can be made to * every minute.\"\n value = body[\"overLimitFault\"][\"details\"].strip()\n self.assertEqual(value, expected)", "metadata": "root.LimitMiddlewareTest.test_limited_request_json", "header": "['class', 'LimitMiddlewareTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 436 }, { "content": " def test_limited_request_xml(self):\n \"\"\"Test a rate-limited (403) response as XML\"\"\"\n request = webob.Request.blank(\"/\")\n response = request.get_response(self.app)\n self.assertEqual(200, response.status_int)\n\n request = webob.Request.blank(\"/\")\n request.accept = \"application/xml\"\n response = request.get_response(self.app)\n self.assertEqual(response.status_int, 403)\n\n root = minidom.parseString(response.body).childNodes[0]\n expected = \"Only 1 GET request(s) can be made to * every minute.\"\n\n details = root.getElementsByTagName(\"details\")\n self.assertEqual(details.length, 1)\n\n value = details.item(0).firstChild.data.strip()\n self.assertEqual(value, expected)", "metadata": "root.LimitMiddlewareTest.test_limited_request_xml", "header": "['class', 'LimitMiddlewareTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 451 }, { "content": "class LimitTest(BaseLimitTestSuite):\n \"\"\"\n Tests for the `limits.Limit` class.\n \"\"\"\n\n", "metadata": "root.LimitTest", "header": "['module', '___EOS___']", "index": 472 }, { "content": " def test_GET_no_delay(self):\n \"\"\"Test a limit handles 1 GET per second.\"\"\"\n limit = limits.Limit(\"GET\", \"*\", \".*\", 1, 1)\n delay = limit(\"GET\", \"/anything\")\n self.assertEqual(None, delay)\n self.assertEqual(0, limit.next_request)\n self.assertEqual(0, limit.last_request)", "metadata": "root.LimitTest.test_GET_no_delay", "header": "['class', 'LimitTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 477 }, { "content": " def test_GET_delay(self):\n \"\"\"Test two calls to 1 GET per second limit.\"\"\"\n limit = limits.Limit(\"GET\", \"*\", \".*\", 1, 1)\n delay = limit(\"GET\", \"/anything\")\n self.assertEqual(None, delay)\n\n delay = limit(\"GET\", \"/anything\")\n self.assertEqual(1, delay)\n self.assertEqual(1, limit.next_request)\n self.assertEqual(0, limit.last_request)\n\n self.time += 4\n\n delay = limit(\"GET\", \"/anything\")\n self.assertEqual(None, delay)\n self.assertEqual(4, limit.next_request)\n self.assertEqual(4, limit.last_request)", "metadata": "root.LimitTest.test_GET_delay", "header": "['class', 'LimitTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 485 }, { "content": "class ParseLimitsTest(BaseLimitTestSuite):\n \"\"\"\n Tests for the default limits parser in the in-memory\n `limits.Limiter` class.\n \"\"\"\n\n\n\n\n\n", "metadata": "root.ParseLimitsTest", "header": "['module', '___EOS___']", "index": 504 }, { "content": " def test_invalid(self):\n \"\"\"Test that parse_limits() handles invalid input correctly.\"\"\"\n self.assertRaises(ValueError, limits.Limiter.parse_limits,\n ';;;;;')", "metadata": "root.ParseLimitsTest.test_invalid", "header": "['class', 'ParseLimitsTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 510 }, { "content": " def test_bad_rule(self):\n \"\"\"Test that parse_limits() handles bad rules correctly.\"\"\"\n self.assertRaises(ValueError, limits.Limiter.parse_limits,\n 'GET, *, .*, 20, minute')", "metadata": "root.ParseLimitsTest.test_bad_rule", "header": "['class', 'ParseLimitsTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 515 }, { "content": " def test_missing_arg(self):\n \"\"\"Test that parse_limits() handles missing args correctly.\"\"\"\n self.assertRaises(ValueError, limits.Limiter.parse_limits,\n '(GET, *, .*, 20)')", "metadata": "root.ParseLimitsTest.test_missing_arg", "header": "['class', 'ParseLimitsTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 520 }, { "content": " def test_bad_value(self):\n \"\"\"Test that parse_limits() handles bad values correctly.\"\"\"\n self.assertRaises(ValueError, limits.Limiter.parse_limits,\n '(GET, *, .*, foo, minute)')", "metadata": "root.ParseLimitsTest.test_bad_value", "header": "['class', 'ParseLimitsTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 525 }, { "content": " def test_bad_unit(self):\n \"\"\"Test that parse_limits() handles bad units correctly.\"\"\"\n self.assertRaises(ValueError, limits.Limiter.parse_limits,\n '(GET, *, .*, 20, lightyears)')", "metadata": "root.ParseLimitsTest.test_bad_unit", "header": "['class', 'ParseLimitsTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 530 }, { "content": " def test_multiple_rules(self):\n \"\"\"Test that parse_limits() handles multiple rules correctly.\"\"\"\n try:\n l = limits.Limiter.parse_limits('(get, *, .*, 20, minute);'\n '(PUT, /foo*, /foo.*, 10, hour);'\n '(POST, /bar*, /bar.*, 5, second);'\n '(Say, /derp*, /derp.*, 1, day)')\n except ValueError, e:\n assert False, str(e)\n\n # Make sure the number of returned limits are correct\n self.assertEqual(len(l), 4)\n\n # Check all the verbs...\n expected = ['GET', 'PUT', 'POST', 'SAY']\n self.assertEqual([t.verb for t in l], expected)\n\n # ...the URIs...\n expected = ['*', '/foo*', '/bar*', '/derp*']\n self.assertEqual([t.uri for t in l], expected)\n\n # ...the regexes...\n expected = ['.*', '/foo.*', '/bar.*', '/derp.*']\n self.assertEqual([t.regex for t in l], expected)\n\n # ...the values...\n expected = [20, 10, 5, 1]\n self.assertEqual([t.value for t in l], expected)\n\n # ...and the units...\n expected = [limits.PER_MINUTE, limits.PER_HOUR,\n limits.PER_SECOND, limits.PER_DAY]\n self.assertEqual([t.unit for t in l], expected)", "metadata": "root.ParseLimitsTest.test_multiple_rules", "header": "['class', 'ParseLimitsTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 535 }, { "content": "class LimiterTest(BaseLimitTestSuite):\n \"\"\"\n Tests for the in-memory `limits.Limiter` class.\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.LimiterTest", "header": "['module', '___EOS___']", "index": 570 }, { "content": " def setUp(self):\n \"\"\"Run before each test.\"\"\"\n BaseLimitTestSuite.setUp(self)\n userlimits = {'user:user3': ''}\n self.limiter = limits.Limiter(TEST_LIMITS, **userlimits)", "metadata": "root.LimiterTest.setUp", "header": "['class', 'LimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 575 }, { "content": " def _check(self, num, verb, url, username=None):\n \"\"\"Check and yield results from checks.\"\"\"\n for x in xrange(num):\n yield self.limiter.check_for_delay(verb, url, username)[0]", "metadata": "root.LimiterTest._check", "header": "['class', 'LimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 581 }, { "content": " def _check_sum(self, num, verb, url, username=None):\n \"\"\"Check and sum results from checks.\"\"\"\n results = self._check(num, verb, url, username)\n return sum(item for item in results if item)", "metadata": "root.LimiterTest._check_sum", "header": "['class', 'LimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 586 }, { "content": " def test_no_delay_GET(self):\n \"\"\"\n Simple test to ensure no delay on a single call for a limit verb we\n didn\"t set.\n \"\"\"\n delay = self.limiter.check_for_delay(\"GET\", \"/anything\")\n self.assertEqual(delay, (None, None))", "metadata": "root.LimiterTest.test_no_delay_GET", "header": "['class', 'LimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 591 }, { "content": " def test_no_delay_PUT(self):\n \"\"\"\n Simple test to ensure no delay on a single call for a known limit.\n \"\"\"\n delay = self.limiter.check_for_delay(\"PUT\", \"/anything\")\n self.assertEqual(delay, (None, None))", "metadata": "root.LimiterTest.test_no_delay_PUT", "header": "['class', 'LimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 599 }, { "content": " def test_delay_PUT(self):\n \"\"\"\n Ensure the 11th PUT will result in a delay of 6.0 seconds until\n the next request will be granced.\n \"\"\"\n expected = [None] * 10 + [6.0]\n results = list(self._check(11, \"PUT\", \"/anything\"))\n\n self.assertEqual(expected, results)", "metadata": "root.LimiterTest.test_delay_PUT", "header": "['class', 'LimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 606 }, { "content": " def test_delay_POST(self):\n \"\"\"\n Ensure the 8th POST will result in a delay of 6.0 seconds until\n the next request will be granced.\n \"\"\"\n expected = [None] * 7\n results = list(self._check(7, \"POST\", \"/anything\"))\n self.assertEqual(expected, results)\n\n expected = 60.0 / 7.0\n results = self._check_sum(1, \"POST\", \"/anything\")\n self.failUnlessAlmostEqual(expected, results, 8)", "metadata": "root.LimiterTest.test_delay_POST", "header": "['class', 'LimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 616 }, { "content": " def test_delay_GET(self):\n \"\"\"\n Ensure the 11th GET will result in NO delay.\n \"\"\"\n expected = [None] * 11\n results = list(self._check(11, \"GET\", \"/anything\"))\n\n self.assertEqual(expected, results)", "metadata": "root.LimiterTest.test_delay_GET", "header": "['class', 'LimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 629 }, { "content": " def test_delay_PUT_servers(self):\n \"\"\"\n Ensure PUT on /servers limits at 5 requests, and PUT elsewhere is still\n OK after 5 requests...but then after 11 total requests, PUT limiting\n kicks in.\n \"\"\"\n # First 6 requests on PUT /servers\n expected = [None] * 5 + [12.0]\n results = list(self._check(6, \"PUT\", \"/servers\"))\n self.assertEqual(expected, results)\n\n # Next 5 request on PUT /anything\n expected = [None] * 4 + [6.0]\n results = list(self._check(5, \"PUT\", \"/anything\"))\n self.assertEqual(expected, results)", "metadata": "root.LimiterTest.test_delay_PUT_servers", "header": "['class', 'LimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 638 }, { "content": " def test_delay_PUT_wait(self):\n \"\"\"\n Ensure after hitting the limit and then waiting for the correct\n amount of time, the limit will be lifted.\n \"\"\"\n expected = [None] * 10 + [6.0]\n results = list(self._check(11, \"PUT\", \"/anything\"))\n self.assertEqual(expected, results)\n\n # Advance time\n self.time += 6.0\n\n expected = [None, 6.0]\n results = list(self._check(2, \"PUT\", \"/anything\"))\n self.assertEqual(expected, results)", "metadata": "root.LimiterTest.test_delay_PUT_wait", "header": "['class', 'LimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 654 }, { "content": " def test_multiple_delays(self):\n \"\"\"\n Ensure multiple requests still get a delay.\n \"\"\"\n expected = [None] * 10 + [6.0] * 10\n results = list(self._check(20, \"PUT\", \"/anything\"))\n self.assertEqual(expected, results)\n\n self.time += 1.0\n\n expected = [5.0] * 10\n results = list(self._check(10, \"PUT\", \"/anything\"))\n self.assertEqual(expected, results)", "metadata": "root.LimiterTest.test_multiple_delays", "header": "['class', 'LimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 670 }, { "content": " def test_user_limit(self):\n \"\"\"\n Test user-specific limits.\n \"\"\"\n self.assertEqual(self.limiter.levels['user3'], [])", "metadata": "root.LimiterTest.test_user_limit", "header": "['class', 'LimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 684 }, { "content": " def test_multiple_users(self):\n \"\"\"\n Tests involving multiple users.\n \"\"\"\n # User1\n expected = [None] * 10 + [6.0] * 10\n results = list(self._check(20, \"PUT\", \"/anything\", \"user1\"))\n self.assertEqual(expected, results)\n\n # User2\n expected = [None] * 10 + [6.0] * 5\n results = list(self._check(15, \"PUT\", \"/anything\", \"user2\"))\n self.assertEqual(expected, results)\n\n # User3\n expected = [None] * 20\n results = list(self._check(20, \"PUT\", \"/anything\", \"user3\"))\n self.assertEqual(expected, results)\n\n self.time += 1.0\n\n # User1 again\n expected = [5.0] * 10\n results = list(self._check(10, \"PUT\", \"/anything\", \"user1\"))\n self.assertEqual(expected, results)\n\n self.time += 1.0\n\n # User1 again\n expected = [4.0] * 5\n results = list(self._check(5, \"PUT\", \"/anything\", \"user2\"))\n self.assertEqual(expected, results)", "metadata": "root.LimiterTest.test_multiple_users", "header": "['class', 'LimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 690 }, { "content": "class WsgiLimiterTest(BaseLimitTestSuite):\n \"\"\"\n Tests for `limits.WsgiLimiter` class.\n \"\"\"\n\n\n\n\n\n\n\n", "metadata": "root.WsgiLimiterTest", "header": "['module', '___EOS___']", "index": 724 }, { "content": " def setUp(self):\n \"\"\"Run before each test.\"\"\"\n BaseLimitTestSuite.setUp(self)\n self.app = limits.WsgiLimiter(TEST_LIMITS)", "metadata": "root.WsgiLimiterTest.setUp", "header": "['class', 'WsgiLimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 729 }, { "content": " def _request_data(self, verb, path):\n \"\"\"Get data decribing a limit request verb/path.\"\"\"\n return json.dumps({\"verb\": verb, \"path\": path})", "metadata": "root.WsgiLimiterTest._request_data", "header": "['class', 'WsgiLimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 734 }, { "content": " def _request(self, verb, url, username=None):\n \"\"\"Make sure that POSTing to the given url causes the given username\n to perform the given action. Make the internal rate limiter return\n delay and make sure that the WSGI app returns the correct response.\n \"\"\"\n if username:\n request = webob.Request.blank(\"/%s\" % username)\n else:\n request = webob.Request.blank(\"/\")\n\n request.method = \"POST\"\n request.body = self._request_data(verb, url)\n response = request.get_response(self.app)\n\n if \"X-Wait-Seconds\" in response.headers:\n self.assertEqual(response.status_int, 403)\n return response.headers[\"X-Wait-Seconds\"]\n\n self.assertEqual(response.status_int, 204)", "metadata": "root.WsgiLimiterTest._request", "header": "['class', 'WsgiLimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 738 }, { "content": " def test_invalid_methods(self):\n \"\"\"Only POSTs should work.\"\"\"\n requests = []\n for method in [\"GET\", \"PUT\", \"DELETE\", \"HEAD\", \"OPTIONS\"]:\n request = webob.Request.blank(\"/\", method=method)\n response = request.get_response(self.app)\n self.assertEqual(response.status_int, 405)", "metadata": "root.WsgiLimiterTest.test_invalid_methods", "header": "['class', 'WsgiLimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 758 }, { "content": " def test_good_url(self):\n delay = self._request(\"GET\", \"/something\")\n self.assertEqual(delay, None)", "metadata": "root.WsgiLimiterTest.test_good_url", "header": "['class', 'WsgiLimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 766 }, { "content": " def test_escaping(self):\n delay = self._request(\"GET\", \"/something/jump%20up\")\n self.assertEqual(delay, None)", "metadata": "root.WsgiLimiterTest.test_escaping", "header": "['class', 'WsgiLimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 770 }, { "content": " def test_response_to_delays(self):\n delay = self._request(\"GET\", \"/delayed\")\n self.assertEqual(delay, None)\n\n delay = self._request(\"GET\", \"/delayed\")\n self.assertEqual(delay, '60.00')", "metadata": "root.WsgiLimiterTest.test_response_to_delays", "header": "['class', 'WsgiLimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 774 }, { "content": " def test_response_to_delays_usernames(self):\n delay = self._request(\"GET\", \"/delayed\", \"user1\")\n self.assertEqual(delay, None)\n\n delay = self._request(\"GET\", \"/delayed\", \"user2\")\n self.assertEqual(delay, None)\n\n delay = self._request(\"GET\", \"/delayed\", \"user1\")\n self.assertEqual(delay, '60.00')\n\n delay = self._request(\"GET\", \"/delayed\", \"user2\")\n self.assertEqual(delay, '60.00')", "metadata": "root.WsgiLimiterTest.test_response_to_delays_usernames", "header": "['class', 'WsgiLimiterTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 781 }, { "content": "class FakeHttplibSocket(object):\n \"\"\"\n Fake `httplib.HTTPResponse` replacement.\n \"\"\"\n\n", "metadata": "root.FakeHttplibSocket", "header": "['module', '___EOS___']", "index": 795 }, { "content": " def __init__(self, response_string):\n \"\"\"Initialize new `FakeHttplibSocket`.\"\"\"\n self._buffer = StringIO.StringIO(response_string)", "metadata": "root.FakeHttplibSocket.__init__", "header": "['class', 'FakeHttplibSocket', '(', 'object', ')', ':', '___EOS___']", "index": 800 }, { "content": " def makefile(self, _mode, _other):\n \"\"\"Returns the socket's internal buffer.\"\"\"\n return self._buffer", "metadata": "root.FakeHttplibSocket.makefile", "header": "['class', 'FakeHttplibSocket', '(', 'object', ')', ':', '___EOS___']", "index": 804 }, { "content": "class FakeHttplibConnection(object):\n \"\"\"\n Fake `httplib.HTTPConnection`.\n \"\"\"\n\n\n", "metadata": "root.FakeHttplibConnection", "header": "['module', '___EOS___']", "index": 809 }, { "content": " def __init__(self, app, host):\n \"\"\"\n Initialize `FakeHttplibConnection`.\n \"\"\"\n self.app = app\n self.host = host", "metadata": "root.FakeHttplibConnection.__init__", "header": "['class', 'FakeHttplibConnection', '(', 'object', ')', ':', '___EOS___']", "index": 814 }, { "content": " def request(self, method, path, body=\"\", headers=None):\n \"\"\"\n Requests made via this connection actually get translated and routed\n into our WSGI app, we then wait for the response and turn it back into\n an `httplib.HTTPResponse`.\n \"\"\"\n if not headers:\n headers = {}\n\n req = webob.Request.blank(path)\n req.method = method\n req.headers = headers\n req.host = self.host\n req.body = body\n\n resp = str(req.get_response(self.app))\n resp = \"HTTP/1.0 %s\" % resp\n sock = FakeHttplibSocket(resp)\n self.http_response = httplib.HTTPResponse(sock)\n self.http_response.begin()", "metadata": "root.FakeHttplibConnection.request", "header": "['class', 'FakeHttplibConnection', '(', 'object', ')', ':', '___EOS___']", "index": 821 }, { "content": " def getresponse(self):\n \"\"\"Return our generated response from the request.\"\"\"\n return self.http_response", "metadata": "root.FakeHttplibConnection.getresponse", "header": "['class', 'FakeHttplibConnection', '(', 'object', ')', ':', '___EOS___']", "index": 842 }, { "content": "def wire_HTTPConnection_to_WSGI(host, app):\n \"\"\"Monkeypatches HTTPConnection so that if you try to connect to host, you\n are instead routed straight to the given WSGI app.\n\n After calling this method, when any code calls\n\n httplib.HTTPConnection(host)\n\n the connection object will be a fake. Its requests will be sent directly\n to the given WSGI app rather than through a socket.\n\n Code connecting to hosts other than host will not be affected.\n\n This method may be called multiple times to map different hosts to\n different apps.\n \"\"\"\n class HTTPConnectionDecorator(object):\n \"\"\"Wraps the real HTTPConnection class so that when you instantiate\n the class you might instead get a fake instance.\"\"\"\n\n def __init__(self, wrapped):\n self.wrapped = wrapped\n\n def __call__(self, connection_host, *args, **kwargs):\n if connection_host == host:\n return FakeHttplibConnection(app, host)\n else:\n return self.wrapped(connection_host, *args, **kwargs)\n\n httplib.HTTPConnection = HTTPConnectionDecorator(httplib.HTTPConnection)", "metadata": "root.wire_HTTPConnection_to_WSGI", "header": "['module', '___EOS___']", "index": 847 }, { "content": "class WsgiLimiterProxyTest(BaseLimitTestSuite):\n \"\"\"\n Tests for the `limits.WsgiLimiterProxy` class.\n \"\"\"\n\n\n", "metadata": "root.WsgiLimiterProxyTest", "header": "['module', '___EOS___']", "index": 879 }, { "content": " def setUp(self):\n \"\"\"\n Do some nifty HTTP/WSGI magic which allows for WSGI to be called\n directly by something like the `httplib` library.\n \"\"\"\n BaseLimitTestSuite.setUp(self)\n self.app = limits.WsgiLimiter(TEST_LIMITS)\n wire_HTTPConnection_to_WSGI(\"169.254.0.1:80\", self.app)\n self.proxy = limits.WsgiLimiterProxy(\"169.254.0.1:80\")", "metadata": "root.WsgiLimiterProxyTest.setUp", "header": "['class', 'WsgiLimiterProxyTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 884 }, { "content": " def test_200(self):\n \"\"\"Successful request test.\"\"\"\n delay = self.proxy.check_for_delay(\"GET\", \"/anything\")\n self.assertEqual(delay, (None, None))", "metadata": "root.WsgiLimiterProxyTest.test_200", "header": "['class', 'WsgiLimiterProxyTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 894 }, { "content": " def test_403(self):\n \"\"\"Forbidden request test.\"\"\"\n delay = self.proxy.check_for_delay(\"GET\", \"/delayed\")\n self.assertEqual(delay, (None, None))\n\n delay, error = self.proxy.check_for_delay(\"GET\", \"/delayed\")\n error = error.strip()\n\n expected = (\"60.00\", \"403 Forbidden\\n\\nOnly 1 GET request(s) can be \"\\\n \"made to /delayed every minute.\")\n\n self.assertEqual((delay, error), expected)", "metadata": "root.WsgiLimiterProxyTest.test_403", "header": "['class', 'WsgiLimiterProxyTest', '(', 'BaseLimitTestSuite', ')', ':', '___EOS___']", "index": 899 }, { "content": "class LimitsViewBuilderV11Test(test.TestCase):\n\n\n\n", "metadata": "root.LimitsViewBuilderV11Test", "header": "['module', '___EOS___']", "index": 913 }, { "content": " def setUp(self):\n self.view_builder = views.limits.ViewBuilderV11()\n self.rate_limits = [{\"URI\": \"*\",\n \"regex\": \".*\",\n \"value\": 10,\n \"verb\": \"POST\",\n \"remaining\": 2,\n \"unit\": \"MINUTE\",\n \"resetTime\": 1311272226},\n {\"URI\": \"*/servers\",\n \"regex\": \"^/servers\",\n \"value\": 50,\n \"verb\": \"POST\",\n \"remaining\": 10,\n \"unit\": \"DAY\",\n \"resetTime\": 1311272226}]\n self.absolute_limits = {\"metadata_items\": 1,\n \"injected_files\": 5,\n \"injected_file_content_bytes\": 5}", "metadata": "root.LimitsViewBuilderV11Test.setUp", "header": "['class', 'LimitsViewBuilderV11Test', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 915 }, { "content": " def tearDown(self):\n pass", "metadata": "root.LimitsViewBuilderV11Test.tearDown", "header": "['class', 'LimitsViewBuilderV11Test', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 935 }, { "content": " def test_build_limits(self):\n expected_limits = {\"limits\": {\n \"rate\": [{\n \"uri\": \"*\",\n \"regex\": \".*\",\n \"limit\": [{\"value\": 10,\n \"verb\": \"POST\",\n \"remaining\": 2,\n \"unit\": \"MINUTE\",\n \"next-available\": \"2011-07-21T18:17:06Z\"}]},\n {\"uri\": \"*/servers\",\n \"regex\": \"^/servers\",\n \"limit\": [{\"value\": 50,\n \"verb\": \"POST\",\n \"remaining\": 10,\n \"unit\": \"DAY\",\n \"next-available\": \"2011-07-21T18:17:06Z\"}]}],\n \"absolute\": {\"maxServerMeta\": 1,\n \"maxImageMeta\": 1,\n \"maxPersonality\": 5,\n \"maxPersonalitySize\": 5}}}\n\n output = self.view_builder.build(self.rate_limits,\n self.absolute_limits)\n self.assertDictMatch(output, expected_limits)", "metadata": "root.LimitsViewBuilderV11Test.test_build_limits", "header": "['class', 'LimitsViewBuilderV11Test', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 938 }, { "content": " def test_build_limits_empty_limits(self):\n expected_limits = {\"limits\": {\"rate\": [],\n \"absolute\": {}}}\n\n abs_limits = {}\n rate_limits = []\n output = self.view_builder.build(rate_limits, abs_limits)\n self.assertDictMatch(output, expected_limits)", "metadata": "root.LimitsViewBuilderV11Test.test_build_limits_empty_limits", "header": "['class', 'LimitsViewBuilderV11Test', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 964 }, { "content": "class LimitsXMLSerializationTest(test.TestCase):\n\n\n\n", "metadata": "root.LimitsXMLSerializationTest", "header": "['module', '___EOS___']", "index": 974 }, { "content": " def setUp(self):\n self.maxDiff = None", "metadata": "root.LimitsXMLSerializationTest.setUp", "header": "['class', 'LimitsXMLSerializationTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 976 }, { "content": " def tearDown(self):\n pass", "metadata": "root.LimitsXMLSerializationTest.tearDown", "header": "['class', 'LimitsXMLSerializationTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 979 }, { "content": " def test_index(self):\n serializer = limits.LimitsXMLSerializer()\n fixture = {\"limits\": {\n \"rate\": [{\n \"uri\": \"*\",\n \"regex\": \".*\",\n \"limit\": [{\n \"value\": 10,\n \"verb\": \"POST\",\n \"remaining\": 2,\n \"unit\": \"MINUTE\",\n \"next-available\": \"2011-12-15T22:42:45Z\"}]},\n {\"uri\": \"*/servers\",\n \"regex\": \"^/servers\",\n \"limit\": [{\n \"value\": 50,\n \"verb\": \"POST\",\n \"remaining\": 10,\n \"unit\": \"DAY\",\n \"next-available\": \"2011-12-15T22:42:45Z\"}]}],\n \"absolute\": {\"maxServerMeta\": 1,\n \"maxImageMeta\": 1,\n \"maxPersonality\": 5,\n \"maxPersonalitySize\": 10240}}}\n\n output = serializer.serialize(fixture, 'index')\n actual = minidom.parseString(output.replace(\" \", \"\"))\n\n expected = minidom.parseString(\"\"\"\n <limits xmlns=\"http://docs.openstack.org/compute/api/v1.1\">\n <rates>\n <rate uri=\"*\" regex=\".*\">\n <limit value=\"10\" verb=\"POST\" remaining=\"2\"\n unit=\"MINUTE\"\n next-available=\"2011-12-15T22:42:45Z\"/>\n </rate>\n <rate uri=\"*/servers\" regex=\"^/servers\">\n <limit value=\"50\" verb=\"POST\" remaining=\"10\"\n unit=\"DAY\"\n next-available=\"2011-12-15T22:42:45Z\"/>\n </rate>\n </rates>\n <absolute>\n <limit name=\"maxServerMeta\" value=\"1\"/>\n <limit name=\"maxPersonality\" value=\"5\"/>\n <limit name=\"maxImageMeta\" value=\"1\"/>\n <limit name=\"maxPersonalitySize\" value=\"10240\"/>\n </absolute>\n </limits>\n \"\"\".replace(\" \", \"\"))\n\n self.assertEqual(expected.toxml(), actual.toxml())", "metadata": "root.LimitsXMLSerializationTest.test_index", "header": "['class', 'LimitsXMLSerializationTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 982 }, { "content": " def test_index_no_limits(self):\n serializer = limits.LimitsXMLSerializer()\n\n fixture = {\"limits\": {\n \"rate\": [],\n \"absolute\": {}}}\n\n output = serializer.serialize(fixture, 'index')\n actual = minidom.parseString(output.replace(\" \", \"\"))\n\n expected = minidom.parseString(\"\"\"\n <limits xmlns=\"http://docs.openstack.org/compute/api/v1.1\">\n <rates />\n <absolute />\n </limits>\n \"\"\".replace(\" \", \"\"))\n\n self.assertEqual(expected.toxml(), actual.toxml())", "metadata": "root.LimitsXMLSerializationTest.test_index_no_limits", "header": "['class', 'LimitsXMLSerializationTest', '(', 'test', '.', 'TestCase', ')', ':', '___EOS___']", "index": 1035 } ]
[ { "span": "import time", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2011", " ", "Open", "Stack", " ", "LLC", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "WITH", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ations_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Test", "s", " ", "deal", "ing", " ", "with", " ", "HTTP", " ", "rate", "-", "limit", "ing", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "httplib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "stub", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "webob_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "xml_", "._", "dom_", "import_", "minidom_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "nova_", "._", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "api_", "._", "openstack_", "import_", "limits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "api_", "._", "openstack_", "import_", "views_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TEST", "\\u", "LIMIT", "S_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "limits_", "._", "Limit_", "(_", "\"", "GET", "\"_", ",_", "\"/", "delayed", "\"_", ",_", "\"", "^", "/", "delayed", "\"_", ",_", "1_", ",_", "limits_", "._", "PER", "\\u", "MINUTE", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limits_", "._", "Limit_", "(_", "\"", "POST", "\"_", ",_", "\"*\"_", ",_", "\".*", "\"_", ",_", "7_", ",_", "limits_", "._", "PER", "\\u", "MINUTE", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limits_", "._", "Limit_", "(_", "\"", "POST", "\"_", ",_", "\"/", "server", "s", "\"_", ",_", "\"", "^", "/", "server", "s", "\"_", ",_", "3_", ",_", "limits_", "._", "PER", "\\u", "MINUTE", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limits_", "._", "Limit_", "(_", "\"", "PU", "T", "\"_", ",_", "\"*\"_", ",_", "\"\"_", ",_", "10_", ",_", "limits_", "._", "PER", "\\u", "MINUTE", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limits_", "._", "Limit_", "(_", "\"", "PU", "T", "\"_", ",_", "\"/", "server", "s", "\"_", ",_", "\"", "^", "/", "server", "s", "\"_", ",_", "5_", ",_", "limits_", "._", "PER", "\\u", "MINUTE", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "Limit", "Test", "Suite_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", " ", "test", " ", "suit", "e", " ", "whi", "ch", " ", "provide", "s", " ", "rele", "van", "t", " ", "stub", "s", " ", "and", " ", "time", " ", "abstract", "ion", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Limit", "Test", "Suite_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", " ", "bef", "ore", " ", "each", " ", "test", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "time_", "=_", "0.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stubs_", "=_", "stub", "out_", "._", "Stu", "b", "Out", "For", "Test", "ing_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stubs_", "._", "Set_", "(_", "limits_", "._", "Limit_", ",_", "\"\\u", "get", "\\u", "time", "\"_", ",_", "self_", "._", "\\u", "get", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "abs", "olute", "\\u", "limits_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "stub", "\\u", "get", "\\u", "project", "\\u", "quotas_", "(_", "context_", ",_", "project", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "abs", "olute", "\\u", "limits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "stubs_", "._", "Set_", "(_", "nova_", "._", "quota_", ",_", "\"", "get", "\\u", "project", "\\u", "quotas", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "stub", "\\u", "get", "\\u", "project", "\\u", "quotas_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Limit", "Test", "Suite_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", " ", "after", " ", "each", " ", "test", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "stubs_", "._", "Unse", "t", "All_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "Limit", "Test", "Suite_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "time_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "\"", "time", "\"", " ", "according", " ", "to", " ", "this", " ", "test", " ", "suit", "e", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Limit", "s", "Controlle", "r", "V1", "0", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "for", " ", "`", "limit", "s", ".", "Limit", "s", "Controlle", "r", "V1", "0", "`", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "0", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", " ", "bef", "ore", " ", "each", " ", "test", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Base", "Limit", "Test", "Suite_", "._", "set", "Up_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "controller_", "=_", "limits_", "._", "create", "\\u", "resource_", "(_", "'", "1.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "0", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "index", "\\u", "request_", "(_", "self_", ",_", "accept", "\\u", "header_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Help", "er", " ", "to", " ", "set", " ", "routin", "g", " ", "argu", "ment", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "accept_", "=_", "accept", "\\u", "header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "environ_", "[_", "\"", "wsgi", "org", ".", "routin", "g", "\\u", "args", "\"_", "]_", "=_", "(_", "None_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "action", "\"_", ":_", "\"", "index", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "controlle", "r", "\"_", ":_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "nova_", "._", "context_", "._", "Request", "Context_", "(_", "'", "testu", "ser", "'_", ",_", "'", "testpro", "ject", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "environ_", "[_", "\"", "nova", ".", "context", "\"_", "]_", "=_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "0", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "populate", "\\u", "limits_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Put", " ", "limit", " ", "info", " ", "int", "o", " ", "a", " ", "request", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "limits_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "limits_", "._", "Limit_", "(_", "\"", "GET", "\"_", ",_", "\"*\"_", ",_", "\".*", "\"_", ",_", "10_", ",_", "60_", ")_", "._", "display_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limits_", "._", "Limit_", "(_", "\"", "POST", "\"_", ",_", "\"*\"_", ",_", "\".*", "\"_", ",_", "5_", ",_", "60_", "*_", "60_", ")_", "._", "display_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "environ_", "[_", "\"", "nova", ".", "limit", "s", "\"_", "]_", "=_", "\\u", "limits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "0", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "setup", "\\u", "abs", "olute", "\\u", "limits_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "abs", "olute", "\\u", "limits_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "s", "'_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cores", "'_", ":_", "8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ram", "'_", ":_", "2_", "**_", "13_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "volume", "s", "'_", ":_", "21_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "giga", "bytes", "'_", ":_", "34_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "metadata", "\\u", "items", "'_", ":_", "55_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "injected", "\\u", "files", "'_", ":_", "89_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "injected", "\\u", "file", "\\u", "content", "\\u", "bytes", "'_", ":_", "144_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "0", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "empty", "\\u", "index", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "getti", "ng", " ", "empty", " ", "limit", " ", "deta", "il", "s", " ", "in", " ", "JSO", "N", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "\\u", "get", "\\u", "index", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "self_", "._", "controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "s", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rate", "\"_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "abs", "olute", "\"_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "0", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "index", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "getti", "ng", " ", "limit", " ", "deta", "il", "s", " ", "in", " ", "JSO", "N", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "\\u", "get", "\\u", "index", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "\\u", "populate", "\\u", "limits_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "setup", "\\u", "abs", "olute", "\\u", "limits_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "self_", "._", "controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "s", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rate", "\"_", ":_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "regex", "\"_", ":_", "\".*", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "reset", "Time", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "URI", "\"_", ":_", "\"*\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "value", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "verb", "\"_", ":_", "\"", "GET", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rema", "inin", "g", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "unit", "\"_", ":_", "\"", "MINUTE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "regex", "\"_", ":_", "\".*", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "reset", "Time", "\"_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "URI", "\"_", ":_", "\"*\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "value", "\"_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "verb", "\"_", ":_", "\"", "POST", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rema", "inin", "g", "\"_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "unit", "\"_", ":_", "\"", "HOUR", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "abs", "olute", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Total", "Insta", "nce", "s", "\"_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Total", "Core", "s", "\"_", ":_", "8_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Total", "RAM", "Size", "\"_", ":_", "2_", "**_", "13_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Server", "Meta", "\"_", ":_", "55_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Image", "Meta", "\"_", ":_", "55_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Persona", "lit", "y", "\"_", ":_", "89_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Persona", "lit", "y", "Size", "\"_", ":_", "144_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "0", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "empty", "\\u", "index", "\\u", "xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "getti", "ng", " ", "limit", " ", "deta", "il", "s", " ", "in", " ", "XML", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "\\u", "get", "\\u", "index", "\\u", "request_", "(_", "\"", "applica", "tion", "/", "xml", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "self_", "._", "controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "minidom_", "._", "parse", "String_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "<", "limit", "s", "\\", "10", ";", " ", " ", " ", " ", "xml", "ns", "=\"", "http", "://", "docs", ".", "racks", "pace", "cloud", ".", "com", "/", "server", "s", "/", "api", "/", "v1", ".0", "\">", "\\", "10", ";", " ", " ", " ", " ", "<", "rate", "/>", "\\", "10", ";", " ", " ", " ", " ", "<", "abs", "olute", "/>", "\\", "10", ";", " ", " ", " ", " ", "</", "limit", "s", ">", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "._", "replace_", "(_", "\"", " ", " ", "\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "minidom_", "._", "parse", "String_", "(_", "response_", "._", "body_", "._", "replace_", "(_", "\"", " ", " ", "\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", "._", "tox", "ml_", "(_", ")_", ",_", "body_", "._", "tox", "ml_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "0", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "index", "\\u", "xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "getti", "ng", " ", "limit", " ", "deta", "il", "s", " ", "in", " ", "XML", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "\\u", "get", "\\u", "index", "\\u", "request_", "(_", "\"", "applica", "tion", "/", "xml", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "\\u", "populate", "\\u", "limits_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "self_", "._", "controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "minidom_", "._", "parse", "String_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "<", "limit", "s", "\\", "10", ";", " ", " ", " ", " ", "xml", "ns", "=\"", "http", "://", "docs", ".", "racks", "pace", "cloud", ".", "com", "/", "server", "s", "/", "api", "/", "v1", ".0", "\">", "\\", "10", ";", " ", " ", " ", " ", "<", "rate", ">", "\\", "10", ";", " ", " ", "<", "limit", " ", "URI", "=\"", "*\"", " ", "regex", "=\".", "*\"", " ", "rema", "inin", "g", "=\"", "10", "\"", " ", "reset", "Time", "=\"", "0", "\"", "\\", "10", ";", " ", " ", "unit", "=\"", "MINUTE", "\"", " ", "value", "=\"", "10", "\"", " ", "verb", "=\"", "GET", "\"/>", "\\", "10", ";", " ", " ", "<", "limit", " ", "URI", "=\"", "*\"", " ", "regex", "=\".", "*\"", " ", "rema", "inin", "g", "=\"", "5", "\"", " ", "reset", "Time", "=\"", "0", "\"", "\\", "10", ";", " ", " ", "unit", "=\"", "HOUR", "\"", " ", "value", "=\"", "5", "\"", " ", "verb", "=\"", "POST", "\"/>", "\\", "10", ";", " ", " ", " ", " ", "</", "rate", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "abs", "olute", "/>", "\\", "10", ";", " ", " ", " ", " ", "</", "limit", "s", ">", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "._", "replace_", "(_", "\"", " ", " ", "\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "minidom_", "._", "parse", "String_", "(_", "response_", "._", "body_", "._", "replace_", "(_", "\"", " ", " ", "\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", "._", "tox", "ml_", "(_", ")_", ",_", "body_", "._", "tox", "ml_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Limit", "s", "Controlle", "r", "V1", "1", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "for", " ", "`", "limit", "s", ".", "Limit", "s", "Controlle", "r", "V1", "1", "`", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "1", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", " ", "bef", "ore", " ", "each", " ", "test", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Base", "Limit", "Test", "Suite_", "._", "set", "Up_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "controller_", "=_", "limits_", "._", "create", "\\u", "resource_", "(_", "'", "1.1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "max", "Diff_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "1", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "index", "\\u", "request_", "(_", "self_", ",_", "accept", "\\u", "header_", "=_", "\"", "applica", "tion", "/", "json", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Help", "er", " ", "to", " ", "set", " ", "routin", "g", " ", "argu", "ment", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "accept_", "=_", "accept", "\\u", "header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "environ_", "[_", "\"", "wsgi", "org", ".", "routin", "g", "\\u", "args", "\"_", "]_", "=_", "(_", "None_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "action", "\"_", ":_", "\"", "index", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "controlle", "r", "\"_", ":_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "nova_", "._", "context_", "._", "Request", "Context_", "(_", "'", "testu", "ser", "'_", ",_", "'", "testpro", "ject", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "environ_", "[_", "\"", "nova", ".", "context", "\"_", "]_", "=_", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "1", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "populate", "\\u", "limits_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Put", " ", "limit", " ", "info", " ", "int", "o", " ", "a", " ", "request", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "limits_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "limits_", "._", "Limit_", "(_", "\"", "GET", "\"_", ",_", "\"*\"_", ",_", "\".*", "\"_", ",_", "10_", ",_", "60_", ")_", "._", "display_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limits_", "._", "Limit_", "(_", "\"", "POST", "\"_", ",_", "\"*\"_", ",_", "\".*", "\"_", ",_", "5_", ",_", "60_", "*_", "60_", ")_", "._", "display_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limits_", "._", "Limit_", "(_", "\"", "GET", "\"_", ",_", "\"", "change", "s", "-", "sinc", "e", "*\"_", ",_", "\"", "change", "s", "-", "sinc", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "5_", ",_", "60_", ")_", "._", "display_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "environ_", "[_", "\"", "nova", ".", "limit", "s", "\"_", "]_", "=_", "\\u", "limits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "1", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "empty", "\\u", "index", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "getti", "ng", " ", "empty", " ", "limit", " ", "deta", "il", "s", " ", "in", " ", "JSO", "N", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "\\u", "get", "\\u", "index", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "self_", "._", "controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "s", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rate", "\"_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "abs", "olute", "\"_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "1", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "index", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "getti", "ng", " ", "limit", " ", "deta", "il", "s", " ", "in", " ", "JSO", "N", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "\\u", "get", "\\u", "index", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "\\u", "populate", "\\u", "limits_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "abs", "olute", "\\u", "limits_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ram", "'_", ":_", "512_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "s", "'_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "cores", "'_", ":_", "21_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "self_", "._", "controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "s", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rate", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "regex", "\"_", ":_", "\".*", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "uri", "\"_", ":_", "\"*\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "verb", "\"_", ":_", "\"", "GET", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "next", "-", "avail", "able", "\"_", ":_", "\"", "197", "0", "-0", "1", "-0", "1", "T", "00", ":", "00", ":", "00", "Z", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "unit", "\"_", ":_", "\"", "MINUTE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "value", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rema", "inin", "g", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "verb", "\"_", ":_", "\"", "POST", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "next", "-", "avail", "able", "\"_", ":_", "\"", "197", "0", "-0", "1", "-0", "1", "T", "00", ":", "00", ":", "00", "Z", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "unit", "\"_", ":_", "\"", "HOUR", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "value", "\"_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rema", "inin", "g", "\"_", ":_", "5_", ",_", "\\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_", "\"", "regex", "\"_", ":_", "\"", "change", "s", "-", "sinc", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "uri", "\"_", ":_", "\"", "change", "s", "-", "sinc", "e", "*\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "verb", "\"_", ":_", "\"", "GET", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "next", "-", "avail", "able", "\"_", ":_", "\"", "197", "0", "-0", "1", "-0", "1", "T", "00", ":", "00", ":", "00", "Z", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "unit", "\"_", ":_", "\"", "MINUTE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "value", "\"_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rema", "inin", "g", "\"_", ":_", "5_", ",_", "\\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\\uNL\\u\\u\\u_", "\"", "abs", "olute", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Total", "RAM", "Size", "\"_", ":_", "512_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Total", "Insta", "nce", "s", "\"_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Total", "Core", "s", "\"_", ":_", "21_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "1", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "populate", "\\u", "limit", "s", "\\u", "diff", "\\u", "regex_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Put", " ", "limit", " ", "info", " ", "int", "o", " ", "a", " ", "request", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "limits_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "limits_", "._", "Limit_", "(_", "\"", "GET", "\"_", ",_", "\"*\"_", ",_", "\".*", "\"_", ",_", "10_", ",_", "60_", ")_", "._", "display_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limits_", "._", "Limit_", "(_", "\"", "GET", "\"_", ",_", "\"*\"_", ",_", "\"*", ".*\"_", ",_", "10_", ",_", "60_", ")_", "._", "display_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "environ_", "[_", "\"", "nova", ".", "limit", "s", "\"_", "]_", "=_", "\\u", "limits_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "1", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "index", "\\u", "diff", "\\u", "regex_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "getti", "ng", " ", "limit", " ", "deta", "il", "s", " ", "in", " ", "JSO", "N", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "\\u", "get", "\\u", "index", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "self_", "._", "\\u", "populate", "\\u", "limit", "s", "\\u", "diff", "\\u", "regex_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "self_", "._", "controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "s", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rate", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "regex", "\"_", ":_", "\".*", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "uri", "\"_", ":_", "\"*\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "verb", "\"_", ":_", "\"", "GET", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "next", "-", "avail", "able", "\"_", ":_", "\"", "197", "0", "-0", "1", "-0", "1", "T", "00", ":", "00", ":", "00", "Z", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "unit", "\"_", ":_", "\"", "MINUTE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "value", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rema", "inin", "g", "\"_", ":_", "10_", ",_", "\\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_", "\"", "regex", "\"_", ":_", "\"*", ".*\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "uri", "\"_", ":_", "\"*\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "verb", "\"_", ":_", "\"", "GET", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "next", "-", "avail", "able", "\"_", ":_", "\"", "197", "0", "-0", "1", "-0", "1", "T", "00", ":", "00", ":", "00", "Z", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "unit", "\"_", ":_", "\"", "MINUTE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "value", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rema", "inin", "g", "\"_", ":_", "10_", ",_", "\\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\\uNL\\u\\u\\u_", "\"", "abs", "olute", "\"_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "1", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "test\\u", "index", "\\u", "abs", "olute", "\\u", "limit", "s", "\\u", "json_", "(_", "self_", ",_", "expected_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "self_", "._", "\\u", "get", "\\u", "index", "\\u", "request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "self_", "._", "controller_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "body_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "body_", "[_", "'", "limit", "s", "'_", "]_", "[_", "'", "abs", "olute", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "1", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "index", "\\u", "ignores", "\\u", "extra", "\\u", "abs", "olute", "\\u", "limit", "s", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "abs", "olute", "\\u", "limits_", "=_", "{_", "'", "unknown", "\\u", "limit", "'_", ":_", "900", "1_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "test\\u", "index", "\\u", "abs", "olute", "\\u", "limit", "s", "\\u", "json_", "(_", "{_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "1", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "index", "\\u", "abs", "olute", "\\u", "ram", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "abs", "olute", "\\u", "limits_", "=_", "{_", "'", "ram", "'_", ":_", "1024_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "test\\u", "index", "\\u", "abs", "olute", "\\u", "limit", "s", "\\u", "json_", "(_", "{_", "'", "max", "Total", "RAM", "Size", "'_", ":_", "1024_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "1", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "index", "\\u", "abs", "olute", "\\u", "cores", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "abs", "olute", "\\u", "limits_", "=_", "{_", "'", "cores", "'_", ":_", "17_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "test\\u", "index", "\\u", "abs", "olute", "\\u", "limit", "s", "\\u", "json_", "(_", "{_", "'", "max", "Total", "Core", "s", "'_", ":_", "17_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "1", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "index", "\\u", "abs", "olute", "\\u", "instance", "s", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "abs", "olute", "\\u", "limits_", "=_", "{_", "'", "instance", "s", "'_", ":_", "19_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "test\\u", "index", "\\u", "abs", "olute", "\\u", "limit", "s", "\\u", "json_", "(_", "{_", "'", "max", "Total", "Insta", "nce", "s", "'_", ":_", "19_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "1", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "index", "\\u", "abs", "olute", "\\u", "metadata", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "bot", "h", " ", "server", " ", "metadata", " ", "and", " ", "image", " ", "metadata", " ", "are", " ", "overload", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "int", "o", " ", "metadata", "\\u", "items_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "abs", "olute", "\\u", "limits_", "=_", "{_", "'", "metadata", "\\u", "items", "'_", ":_", "23_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "Server", "Meta", "'_", ":_", "23_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "Image", "Meta", "'_", ":_", "23_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "test\\u", "index", "\\u", "abs", "olute", "\\u", "limit", "s", "\\u", "json_", "(_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "Controlle", "r", "V1", "1", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "index", "\\u", "abs", "olute", "\\u", "injected", "\\u", "files_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "abs", "olute", "\\u", "limits_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "injected", "\\u", "files", "'_", ":_", "17_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "injected", "\\u", "file", "\\u", "content", "\\u", "bytes", "'_", ":_", "867", "53_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "Persona", "lit", "y", "'_", ":_", "17_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "max", "Persona", "lit", "y", "Size", "'_", ":_", "867", "53_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "test\\u", "index", "\\u", "abs", "olute", "\\u", "limit", "s", "\\u", "json_", "(_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Limit", "er_", "(_", "limits_", "._", "Limit", "er_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Limit", "Mid", "dle", "ware", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "for", " ", "the", " ", "`", "limit", "s", ".", "Rat", "e", "Limit", "ing", "Mid", "dle", "ware", "`", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Limit", "Mid", "dle", "ware", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "webob_", "._", "dec_", "._", "wsgi", "fy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "empty", "\\u", "app_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Do", "-", "not", "hing", " ", "WS", "GI", " ", "app", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "Mid", "dle", "ware", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Prepare", " ", "middle", "ware", " ", "for", " ", "use", " ", "through", " ", "fake", " ", "WS", "GI", " ", "app", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Base", "Limit", "Test", "Suite_", "._", "set", "Up_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "limits_", "=_", "'(", "GET", ",", " ", "*", ",", " ", ".*", ",", " ", "1", ",", " ", "MINUTE", ")'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "=_", "limits_", "._", "Rat", "e", "Limit", "ing", "Middleware_", "(_", "self_", "._", "\\u", "empty", "\\u", "app_", ",_", "\\u", "limits_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", ".", "Test", "Limit", "er", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "module\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "Mid", "dle", "ware", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "limit", "\\u", "class_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "tha", "t", " ", "middle", "ware", " ", "selecte", "d", " ", "correct", " ", "limiter", " ", "class", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "self_", "._", "app_", "._", "\\u", "limiter", "_", ",_", "Test", "Limit", "er_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "Mid", "dle", "ware", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "good", "\\u", "request_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "success", "ful", " ", "GET", " ", "request", " ", "through", " ", "middle", "ware", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "self_", "._", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "200_", ",_", "response_", "._", "status", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "Mid", "dle", "ware", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "limited", "\\u", "request", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "a", " ", "rate", "-", "limited", " ", "(", "403", ")", " ", "GET", " ", "request", " ", "through", " ", "middle", "ware", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "self_", "._", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "200_", ",_", "response_", "._", "status", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "self_", "._", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "\"", "On", "ly", " ", "1", " ", "GET", " ", "request", "(", "s", ")", " ", "can", " ", "be", " ", "made", " ", "to", " ", "*", " ", "every", " ", "minute", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "body_", "[_", "\"", "over", "Limit", "Fau", "lt", "\"_", "]_", "[_", "\"", "deta", "il", "s", "\"_", "]_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "value_", ",_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "Mid", "dle", "ware", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "limited", "\\u", "request", "\\u", "xml_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "a", " ", "rate", "-", "limited", " ", "(", "403", ")", " ", "response", " ", "as", " ", "XML", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "self_", "._", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "200_", ",_", "response_", "._", "status", "\\u", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "accept_", "=_", "\"", "applica", "tion", "/", "xml", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "self_", "._", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "root_", "=_", "minidom_", "._", "parse", "String_", "(_", "response_", "._", "body_", ")_", "._", "child", "Nodes_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "\"", "On", "ly", " ", "1", " ", "GET", " ", "request", "(", "s", ")", " ", "can", " ", "be", " ", "made", " ", "to", " ", "*", " ", "every", " ", "minute", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "details_", "=_", "root_", "._", "get", "Element", "s", "By", "Ta", "g", "Name_", "(_", "\"", "deta", "il", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "details_", "._", "length_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "details_", "._", "item_", "(_", "0_", ")_", "._", "first", "Child_", "._", "data_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "value_", ",_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Limit", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "for", " ", "the", " ", "`", "limit", "s", ".", "Limit", "`", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Limit", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "GET", "\\u", "no", "\\u", "delay_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "a", " ", "limit", " ", "handle", "s", " ", "1", " ", "GET", " ", "per", " ", "second", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit_", "=_", "limits_", "._", "Limit_", "(_", "\"", "GET", "\"_", ",_", "\"*\"_", ",_", "\".*", "\"_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delay_", "=_", "limit_", "(_", "\"", "GET", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "None_", ",_", "delay_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "limit_", "._", "next", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "limit_", "._", "last", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "GET", "\\u", "delay_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "two", " ", "calls", " ", "to", " ", "1", " ", "GET", " ", "per", " ", "second", " ", "limit", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit_", "=_", "limits_", "._", "Limit_", "(_", "\"", "GET", "\"_", ",_", "\"*\"_", ",_", "\".*", "\"_", ",_", "1_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delay_", "=_", "limit_", "(_", "\"", "GET", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "None_", ",_", "delay_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "delay_", "=_", "limit_", "(_", "\"", "GET", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "delay_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "1_", ",_", "limit_", "._", "next", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "limit_", "._", "last", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "time_", "+=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "delay_", "=_", "limit_", "(_", "\"", "GET", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "None_", ",_", "delay_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "4_", ",_", "limit_", "._", "next", "\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "4_", ",_", "limit_", "._", "last", "\\u", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Pars", "e", "Limit", "s", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "for", " ", "the", " ", "default", " ", "limit", "s", " ", "parser", " ", "in", " ", "the", " ", "in", "-", "memory", "\\", "10", ";", " ", " ", " ", " ", "`", "limit", "s", ".", "Limit", "er", "`", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Pars", "e", "Limit", "s", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "invalid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "tha", "t", " ", "parse", "\\u", "limit", "s", "()", " ", "handle", "s", " ", "invalid", " ", "input", " ", "correct", "ly", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "limits_", "._", "Limit", "er_", "._", "parse", "\\u", "limits_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "';", ";;;", ";'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pars", "e", "Limit", "s", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bad", "\\u", "rule_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "tha", "t", " ", "parse", "\\u", "limit", "s", "()", " ", "handle", "s", " ", "bad", " ", "rule", "s", " ", "correct", "ly", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "limits_", "._", "Limit", "er_", "._", "parse", "\\u", "limits_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "GET", ",", " ", "*", ",", " ", ".*", ",", " ", "20", ",", " ", "minute", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pars", "e", "Limit", "s", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "missi", "ng", "\\u", "arg_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "tha", "t", " ", "parse", "\\u", "limit", "s", "()", " ", "handle", "s", " ", "missi", "ng", " ", "args", " ", "correct", "ly", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "limits_", "._", "Limit", "er_", "._", "parse", "\\u", "limits_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "GET", ",", " ", "*", ",", " ", ".*", ",", " ", "20", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pars", "e", "Limit", "s", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bad", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "tha", "t", " ", "parse", "\\u", "limit", "s", "()", " ", "handle", "s", " ", "bad", " ", "values", " ", "correct", "ly", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "limits_", "._", "Limit", "er_", "._", "parse", "\\u", "limits_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "GET", ",", " ", "*", ",", " ", ".*", ",", " ", "foo", ",", " ", "minute", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pars", "e", "Limit", "s", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "bad", "\\u", "unit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "tha", "t", " ", "parse", "\\u", "limit", "s", "()", " ", "handle", "s", " ", "bad", " ", "unit", "s", " ", "correct", "ly", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "limits_", "._", "Limit", "er_", "._", "parse", "\\u", "limits_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "GET", ",", " ", "*", ",", " ", ".*", ",", " ", "20", ",", " ", "light", "year", "s", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Pars", "e", "Limit", "s", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "multiple", "\\u", "rules_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "tha", "t", " ", "parse", "\\u", "limit", "s", "()", " ", "handle", "s", " ", "multiple", " ", "rule", "s", " ", "correct", "ly", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "l_", "=_", "limits_", "._", "Limit", "er_", "._", "parse", "\\u", "limits_", "(_", "'(", "get", ",", " ", "*", ",", " ", ".*", ",", " ", "20", ",", " ", "minute", ");'_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "PU", "T", ",", " ", "/", "foo", "*", ",", " ", "/", "foo", ".*", ",", " ", "10", ",", " ", "hour", ");'_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "POST", ",", " ", "/", "bar", "*", ",", " ", "/", "bar", ".*", ",", " ", "5", ",", " ", "second", ");'_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "Say", ",", " ", "/", "der", "p", "*", ",", " ", "/", "der", "p", ".*", ",", " ", "1", ",", " ", "day", ")'_", ")_", "\\u\\u\\uNEWLINE\\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 ", " _", "assert_", "False_", ",_", "str_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "the", " ", "number", " ", "of", " ", "return", "ed", " ", "limit", "s", " ", "are", " ", "correct_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "l_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "all", " ", "the", " ", "verbs", "..._", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "[_", "'", "GET", "'_", ",_", "'", "PU", "T", "'_", ",_", "'", "POST", "'_", ",_", "'", "SA", "Y", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "t_", "._", "verb_", "for_", "t_", "in_", "l_", "]_", ",_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "...", "the", " ", "URI", "s", "..._", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "[_", "'*'_", ",_", "'/", "foo", "*'_", ",_", "'/", "bar", "*'_", ",_", "'/", "der", "p", "*'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "t_", "._", "uri_", "for_", "t_", "in_", "l_", "]_", ",_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "...", "the", " ", "regex", "es", "..._", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "[_", "'.*'_", ",_", "'/", "foo", ".*'_", ",_", "'/", "bar", ".*'_", ",_", "'/", "der", "p", ".*'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "t_", "._", "regex_", "for_", "t_", "in_", "l_", "]_", ",_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "...", "the", " ", "values", "..._", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "[_", "20_", ",_", "10_", ",_", "5_", ",_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "t_", "._", "value_", "for_", "t_", "in_", "l_", "]_", ",_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "...", "and", " ", "the", " ", "unit", "s", "..._", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "[_", "limits_", "._", "PER", "\\u", "MINUTE", "_", ",_", "limits_", "._", "PER", "\\u", "HOUR", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limits_", "._", "PER", "\\u", "SECOND", "_", ",_", "limits_", "._", "PER", "\\u", "DAY_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "t_", "._", "unit_", "for_", "t_", "in_", "l_", "]_", ",_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "for", " ", "the", " ", "in", "-", "memory", " ", "`", "limit", "s", ".", "Limit", "er", "`", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", " ", "bef", "ore", " ", "each", " ", "test", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Base", "Limit", "Test", "Suite_", "._", "set", "Up_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "userl", "imit", "s_", "=_", "{_", "'", "user", ":", "user3", "'_", ":_", "''_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "limiter", "_", "=_", "limits_", "._", "Limit", "er_", "(_", "TEST", "\\u", "LIMIT", "S_", ",_", "**_", "userl", "imit", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check_", "(_", "self_", ",_", "num_", ",_", "verb_", ",_", "url_", ",_", "username_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "and", " ", "yield", " ", "results", " ", "from", " ", "checks", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "x_", "in_", "xrange_", "(_", "num_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "self_", "._", "limiter", "_", "._", "check", "\\u", "for", "\\u", "delay_", "(_", "verb_", ",_", "url_", ",_", "username_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "check", "\\u", "sum_", "(_", "self_", ",_", "num_", ",_", "verb_", ",_", "url_", ",_", "username_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", " ", "and", " ", "sum", " ", "results", " ", "from", " ", "checks", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "self_", "._", "\\u", "check_", "(_", "num_", ",_", "verb_", ",_", "url_", ",_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "sum_", "(_", "item_", "for_", "item_", "in_", "results_", "if_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "no", "\\u", "dela", "y", "\\u", "GET_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Simple", " ", "test", " ", "to", " ", "ensure", " ", "no", " ", "dela", "y", " ", "on", " ", "a", " ", "single", " ", "call", " ", "for", " ", "a", " ", "limit", " ", "verb", " ", "we", "\\", "10", ";", " ", " ", " ", " ", "did", "n", "\"", "t", " ", "set", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delay_", "=_", "self_", "._", "limiter", "_", "._", "check", "\\u", "for", "\\u", "delay_", "(_", "\"", "GET", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "delay_", ",_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "no", "\\u", "dela", "y", "\\u", "PUT_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Simple", " ", "test", " ", "to", " ", "ensure", " ", "no", " ", "dela", "y", " ", "on", " ", "a", " ", "single", " ", "call", " ", "for", " ", "a", " ", "know", "n", " ", "limit", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delay_", "=_", "self_", "._", "limiter", "_", "._", "check", "\\u", "for", "\\u", "delay_", "(_", "\"", "PU", "T", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "delay_", ",_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "dela", "y", "\\u", "PUT_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "the", " ", "11", "th", " ", "PU", "T", " ", "will", " ", "result", " ", "in", " ", "a", " ", "dela", "y", " ", "of", " ", "6.0", " ", "second", "s", " ", "unti", "l", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "next", " ", "request", " ", "will", " ", "be", " ", "gran", "ced", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "[_", "None_", "]_", "*_", "10_", "+_", "[_", "6.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "list_", "(_", "self_", "._", "\\u", "check_", "(_", "11_", ",_", "\"", "PU", "T", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "dela", "y", "\\u", "POST_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "the", " ", "8", "th", " ", "POST", " ", "will", " ", "result", " ", "in", " ", "a", " ", "dela", "y", " ", "of", " ", "6.0", " ", "second", "s", " ", "unti", "l", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "next", " ", "request", " ", "will", " ", "be", " ", "gran", "ced", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "[_", "None_", "]_", "*_", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "list_", "(_", "self_", "._", "\\u", "check_", "(_", "7_", ",_", "\"", "POST", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "60.0_", "/_", "7.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "self_", "._", "\\u", "check", "\\u", "sum_", "(_", "1_", ",_", "\"", "POST", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail", "Un", "less", "Al", "most", "Equal_", "(_", "expected_", ",_", "results_", ",_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "dela", "y", "\\u", "GET_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "the", " ", "11", "th", " ", "GET", " ", "will", " ", "result", " ", "in", " ", "NO", " ", "dela", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "[_", "None_", "]_", "*_", "11_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "list_", "(_", "self_", "._", "\\u", "check_", "(_", "11_", ",_", "\"", "GET", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "dela", "y", "\\u", "PU", "T", "\\u", "servers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "PU", "T", " ", "on", " ", "/", "server", "s", " ", "limit", "s", " ", "at", " ", "5", " ", "request", "s", ",", " ", "and", " ", "PU", "T", " ", "else", "where", " ", "is", " ", "still", "\\", "10", ";", " ", " ", " ", " ", "OK", " ", "after", " ", "5", " ", "request", "s", "...", "but", " ", "then", " ", "after", " ", "11", " ", "total", " ", "request", "s", ",", " ", "PU", "T", " ", "limit", "ing", "\\", "10", ";", " ", " ", " ", " ", "kick", "s", " ", "in", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "6", " ", "request", "s", " ", "on", " ", "PU", "T", " ", "/", "servers_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "[_", "None_", "]_", "*_", "5_", "+_", "[_", "12.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "list_", "(_", "self_", "._", "\\u", "check_", "(_", "6_", ",_", "\"", "PU", "T", "\"_", ",_", "\"/", "server", "s", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ne", "xt", " ", "5", " ", "request", " ", "on", " ", "PU", "T", " ", "/", "anyt", "hing_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "[_", "None_", "]_", "*_", "4_", "+_", "[_", "6.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "list_", "(_", "self_", "._", "\\u", "check_", "(_", "5_", ",_", "\"", "PU", "T", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "dela", "y", "\\u", "PU", "T", "\\u", "wait_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "after", " ", "hit", "ting", " ", "the", " ", "limit", " ", "and", " ", "then", " ", "wait", "ing", " ", "for", " ", "the", " ", "correct", "\\", "10", ";", " ", " ", " ", " ", "amo", "unt", " ", "of", " ", "time", ",", " ", "the", " ", "limit", " ", "will", " ", "be", " ", "lift", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "[_", "None_", "]_", "*_", "10_", "+_", "[_", "6.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "list_", "(_", "self_", "._", "\\u", "check_", "(_", "11_", ",_", "\"", "PU", "T", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Advance", " ", "time_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "time_", "+=_", "6.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "[_", "None_", ",_", "6.0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "list_", "(_", "self_", "._", "\\u", "check_", "(_", "2_", ",_", "\"", "PU", "T", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "multiple", "\\u", "delays", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Ensur", "e", " ", "multiple", " ", "request", "s", " ", "still", " ", "get", " ", "a", " ", "dela", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "[_", "None_", "]_", "*_", "10_", "+_", "[_", "6.0_", "]_", "*_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "list_", "(_", "self_", "._", "\\u", "check_", "(_", "20_", ",_", "\"", "PU", "T", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "time_", "+=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "[_", "5.0_", "]_", "*_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "list_", "(_", "self_", "._", "\\u", "check_", "(_", "10_", ",_", "\"", "PU", "T", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "user", "\\u", "limit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", " ", "user", "-", "specific", " ", "limit", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "limiter", "_", "._", "levels_", "[_", "'", "user3", "'_", "]_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "multiple", "\\u", "users_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "involv", "ing", " ", "multiple", " ", "users", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "User", "1_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "[_", "None_", "]_", "*_", "10_", "+_", "[_", "6.0_", "]_", "*_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "list_", "(_", "self_", "._", "\\u", "check_", "(_", "20_", ",_", "\"", "PU", "T", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ",_", "\"", "user", "1", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "User", "2_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "[_", "None_", "]_", "*_", "10_", "+_", "[_", "6.0_", "]_", "*_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "list_", "(_", "self_", "._", "\\u", "check_", "(_", "15_", ",_", "\"", "PU", "T", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ",_", "\"", "user", "2", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "User", "3_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "[_", "None_", "]_", "*_", "20_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "list_", "(_", "self_", "._", "\\u", "check_", "(_", "20_", ",_", "\"", "PU", "T", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ",_", "\"", "user3", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "time_", "+=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "User", "1", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "[_", "5.0_", "]_", "*_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "list_", "(_", "self_", "._", "\\u", "check_", "(_", "10_", ",_", "\"", "PU", "T", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ",_", "\"", "user", "1", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "results_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "time_", "+=_", "1.0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "User", "1", " ", "again", "_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "[_", "4.0_", "]_", "*_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "list_", "(_", "self_", "._", "\\u", "check_", "(_", "5_", ",_", "\"", "PU", "T", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ",_", "\"", "user", "2", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", ",_", "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_", "Ws", "gi", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "for", " ", "`", "limit", "s", ".", "Ws", "gi", "Limit", "er", "`", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ws", "gi", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Run", " ", "bef", "ore", " ", "each", " ", "test", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Base", "Limit", "Test", "Suite_", "._", "set", "Up_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "=_", "limits_", "._", "Ws", "gi", "Limit", "er_", "(_", "TEST", "\\u", "LIMIT", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ws", "gi", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "request", "\\u", "data_", "(_", "self_", ",_", "verb_", ",_", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "data", " ", "dec", "rib", "ing", " ", "a", " ", "limit", " ", "request", " ", "verb", "/", "path", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json_", "._", "dumps_", "(_", "{_", "\"", "verb", "\"_", ":_", "verb_", ",_", "\"", "path", "\"_", ":_", "path_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ws", "gi", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "request_", "(_", "self_", ",_", "verb_", ",_", "url_", ",_", "username_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Make", " ", "sure", " ", "tha", "t", " ", "POST", "ing", " ", "to", " ", "the", " ", "give", "n", " ", "url", " ", "caus", "es", " ", "the", " ", "give", "n", " ", "user", "name", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "perform", " ", "the", " ", "give", "n", " ", "action", ".", " ", " ", "Make", " ", "the", " ", "internal", " ", "rate", " ", "limiter", " ", "return", "\\", "10", ";", " ", " ", " ", " ", "dela", "y", " ", "and", " ", "make", " ", "sure", " ", "tha", "t", " ", "the", " ", "WS", "GI", " ", "app", " ", "return", "s", " ", "the", " ", "correct", " ", "response", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "username_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/%", "s", "\"_", "%_", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "._", "method_", "=_", "\"", "POST", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request_", "._", "body_", "=_", "self_", "._", "\\u", "request", "\\u", "data_", "(_", "verb_", ",_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "self_", "._", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "\"", "X", "-", "Wait", "-", "Second", "s", "\"_", "in_", "response_", "._", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "response_", "._", "headers_", "[_", "\"", "X", "-", "Wait", "-", "Second", "s", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "204_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ws", "gi", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "invalid", "\\u", "methods_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "On", "ly", " ", "POST", "s", " ", "shou", "ld", " ", "work", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "requests_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "method_", "in_", "[_", "\"", "GET", "\"_", ",_", "\"", "PU", "T", "\"_", ",_", "\"", "DELET", "E", "\"_", ",_", "\"", "HEAD", "\"_", ",_", "\"", "OPTION", "S", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "\"/\"_", ",_", "method_", "=_", "method_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "request_", "._", "get", "\\u", "response_", "(_", "self_", "._", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "response_", "._", "status", "\\u", "int_", ",_", "405_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ws", "gi", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "good", "\\u", "url_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delay_", "=_", "self_", "._", "\\u", "request_", "(_", "\"", "GET", "\"_", ",_", "\"/", "somet", "hing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "delay_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ws", "gi", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "esca", "ping_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delay_", "=_", "self_", "._", "\\u", "request_", "(_", "\"", "GET", "\"_", ",_", "\"/", "somet", "hing", "/", "jump", "%", "20", "up", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "delay_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ws", "gi", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "response", "\\u", "to", "\\u", "delays", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delay_", "=_", "self_", "._", "\\u", "request_", "(_", "\"", "GET", "\"_", ",_", "\"/", "delayed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "delay_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "delay_", "=_", "self_", "._", "\\u", "request_", "(_", "\"", "GET", "\"_", ",_", "\"/", "delayed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "delay_", ",_", "'", "60", ".00", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ws", "gi", "Limit", "er", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "response", "\\u", "to", "\\u", "delays", "\\u", "usernames", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "delay_", "=_", "self_", "._", "\\u", "request_", "(_", "\"", "GET", "\"_", ",_", "\"/", "delayed", "\"_", ",_", "\"", "user", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "delay_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "delay_", "=_", "self_", "._", "\\u", "request_", "(_", "\"", "GET", "\"_", ",_", "\"/", "delayed", "\"_", ",_", "\"", "user", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "delay_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "delay_", "=_", "self_", "._", "\\u", "request_", "(_", "\"", "GET", "\"_", ",_", "\"/", "delayed", "\"_", ",_", "\"", "user", "1", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "delay_", ",_", "'", "60", ".00", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "delay_", "=_", "self_", "._", "\\u", "request_", "(_", "\"", "GET", "\"_", ",_", "\"/", "delayed", "\"_", ",_", "\"", "user", "2", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "delay_", ",_", "'", "60", ".00", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Fake", "Http", "lib", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Fake", " ", "`", "http", "lib", ".", "HTTP", "Respons", "e", "`", " ", "replace", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Fake", "Http", "lib", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "response", "\\u", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "e", " ", "new", " ", "`", "Fake", "Http", "lib", "Sock", "et", "`.\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "buffer_", "=_", "String", "IO_", "._", "String", "IO_", "(_", "response", "\\u", "string_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fake", "Http", "lib", "Socket_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "makefile_", "(_", "self_", ",_", "\\u", "mode_", ",_", "\\u", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", "s", " ", "the", " ", "socket", "'", "s", " ", "internal", " ", "buffer", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "buffer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Fake", "Http", "lib", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Fake", " ", "`", "http", "lib", ".", "HTTP", "Connect", "ion", "`.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Fake", "Http", "lib", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "app_", ",_", "host_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Initializ", "e", " ", "`", "Fake", "Http", "lib", "Connect", "ion", "`.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "=_", "app_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "host_", "=_", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fake", "Http", "lib", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "request_", "(_", "self_", ",_", "method_", ",_", "path_", ",_", "body_", "=_", "\"\"_", ",_", "headers_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Request", "s", " ", "made", " ", "via", " ", "this", " ", "connecti", "on", " ", "actual", "ly", " ", "get", " ", "translat", "ed", " ", "and", " ", "route", "d", "\\", "10", ";", " ", " ", " ", " ", "int", "o", " ", "our", " ", "WS", "GI", " ", "app", ",", " ", "we", " ", "then", " ", "wait", " ", "for", " ", "the", " ", "response", " ", "and", " ", "turn", " ", "it", " ", "back", " ", "int", "o", "\\", "10", ";", " ", " ", " ", " ", "an", " ", "`", "http", "lib", ".", "HTTP", "Respons", "e", "`.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "req_", "=_", "webob_", "._", "Request_", "._", "blank_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "method_", "=_", "method_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "headers_", "=_", "headers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "host_", "=_", "self_", "._", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "._", "body_", "=_", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "str_", "(_", "req_", "._", "get", "\\u", "response_", "(_", "self_", "._", "app_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "\"", "HTTP", "/", "1.0", " ", "%", "s", "\"_", "%_", "resp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sock_", "=_", "Fake", "Http", "lib", "Socket_", "(_", "resp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "http", "\\u", "response_", "=_", "httplib_", "._", "HTTP", "Response_", "(_", "sock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "http", "\\u", "response_", "._", "begin_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Fake", "Http", "lib", "Connection_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getresponse_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "our", " ", "generat", "ed", " ", "response", " ", "from", " ", "the", " ", "request", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "http", "\\u", "response_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "wire", "\\u", "HTTP", "Connect", "ion", "\\u", "to", "\\u", "WS", "GI", "_", "(_", "host_", ",_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Mon", "keypa", "tche", "s", " ", "HTTP", "Connect", "ion", " ", "so", " ", "tha", "t", " ", "if", " ", "you", " ", "try", " ", "to", " ", "connect", " ", "to", " ", "host", ",", " ", "you", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "inst", "ead", " ", "route", "d", " ", "straight", " ", "to", " ", "the", " ", "give", "n", " ", "WS", "GI", " ", "app", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Af", "ter", " ", "calling", " ", "this", " ", "method", ",", " ", "whe", "n", " ", "any", " ", "code", " ", "calls", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "http", "lib", ".", "HTTP", "Connect", "ion", "(", "host", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "connecti", "on", " ", "object", " ", "will", " ", "be", " ", "a", " ", "fake", ".", " ", " ", "It", "s", " ", "request", "s", " ", "will", " ", "be", " ", "sent", " ", "direct", "ly", "\\", "10", ";", " ", " ", " ", " ", "to", " ", "the", " ", "give", "n", " ", "WS", "GI", " ", "app", " ", "rat", "her", " ", "than", " ", "through", " ", "a", " ", "socket", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Code", " ", "connecti", "ng", " ", "to", " ", "host", "s", " ", "other", " ", "than", " ", "host", " ", "will", " ", "not", " ", "be", " ", "affect", "ed", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "may", " ", "be", " ", "call", "ed", " ", "multiple", " ", "times", " ", "to", " ", "map", " ", "different", " ", "host", "s", " ", "to", "\\", "10", ";", " ", " ", " ", " ", "different", " ", "apps", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "HTTP", "Connect", "ion", "Decorator_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Wra", "ps", " ", "the", " ", "real", " ", "HTTP", "Connect", "ion", " ", "class", " ", "so", " ", "tha", "t", " ", "whe", "n", " ", "you", " ", "instantiate", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "class", " ", "you", " ", "mig", "ht", " ", "inst", "ead", " ", "get", " ", "a", " ", "fake", " ", "instance", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "wrapped_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "wrapped_", "=_", "wrapped_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "connecti", "on", "\\u", "host_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "connecti", "on", "\\u", "host_", "==_", "host_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Fake", "Http", "lib", "Connection_", "(_", "app_", ",_", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "wrapped_", "(_", "connecti", "on", "\\u", "host_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\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_", "httplib_", "._", "HTTP", "Connection_", "=_", "HTTP", "Connect", "ion", "Decorator_", "(_", "httplib_", "._", "HTTP", "Connection_", ")_", "\\u\\u\\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_", "Ws", "gi", "Limit", "er", "Pro", "xy", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Test", "s", " ", "for", " ", "the", " ", "`", "limit", "s", ".", "Ws", "gi", "Limit", "er", "Pro", "xy", "`", " ", "class", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ws", "gi", "Limit", "er", "Pro", "xy", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Do", " ", "some", " ", "nif", "ty", " ", "HTTP", "/", "WS", "GI", " ", "magic", " ", "whi", "ch", " ", "allow", "s", " ", "for", " ", "WS", "GI", " ", "to", " ", "be", " ", "call", "ed", "\\", "10", ";", " ", " ", " ", " ", "direct", "ly", " ", "by", " ", "somet", "hing", " ", "like", " ", "the", " ", "`", "http", "lib", "`", " ", "librar", "y", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Base", "Limit", "Test", "Suite_", "._", "set", "Up_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "app_", "=_", "limits_", "._", "Ws", "gi", "Limit", "er_", "(_", "TEST", "\\u", "LIMIT", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wire", "\\u", "HTTP", "Connect", "ion", "\\u", "to", "\\u", "WS", "GI", "_", "(_", "\"", "169", ".2", "54.", "0.", "1", ":", "80", "\"_", ",_", "self_", "._", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "proxy_", "=_", "limits_", "._", "Ws", "gi", "Limit", "er", "Proxy_", "(_", "\"", "169", ".2", "54.", "0.", "1", ":", "80", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ws", "gi", "Limit", "er", "Pro", "xy", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "200_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Success", "ful", " ", "request", " ", "test", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delay_", "=_", "self_", "._", "proxy_", "._", "check", "\\u", "for", "\\u", "delay_", "(_", "\"", "GET", "\"_", ",_", "\"/", "anyt", "hing", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "delay_", ",_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Ws", "gi", "Limit", "er", "Pro", "xy", "Test_", "(_", "Base", "Limit", "Test", "Suite_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "403_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "For", "bid", "den", " ", "request", " ", "test", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delay_", "=_", "self_", "._", "proxy_", "._", "check", "\\u", "for", "\\u", "delay_", "(_", "\"", "GET", "\"_", ",_", "\"/", "delayed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "delay_", ",_", "(_", "None_", ",_", "None_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "delay_", ",_", "error_", "=_", "self_", "._", "proxy_", "._", "check", "\\u", "for", "\\u", "delay_", "(_", "\"", "GET", "\"_", ",_", "\"/", "delayed", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error_", "=_", "error_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "(_", "\"", "60", ".00", "\"_", ",_", "\"", "403", " ", "For", "bid", "den", "\\\\", "n", "\\\\", "n", "On", "ly", " ", "1", " ", "GET", " ", "request", "(", "s", ")", " ", "can", " ", "be", " ", "\"_", "\"", "made", " ", "to", " ", "/", "delayed", " ", "every", " ", "minute", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "(_", "delay_", ",_", "error_", ")_", ",_", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Limit", "s", "View", "Build", "er", "V1", "1", "Test_", "(_", "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_", "[SEP]_", "class_", "Limit", "s", "View", "Build", "er", "V1", "1", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "view", "\\u", "builder_", "=_", "views_", "._", "limits_", "._", "View", "Build", "er", "V1", "1_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rate", "\\u", "limits_", "=_", "[_", "{_", "\"", "URI", "\"_", ":_", "\"*\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "regex", "\"_", ":_", "\".*", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "value", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "verb", "\"_", ":_", "\"", "POST", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rema", "inin", "g", "\"_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "unit", "\"_", ":_", "\"", "MINUTE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "reset", "Time", "\"_", ":_", "131", "127", "222", "6_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "URI", "\"_", ":_", "\"*", "/", "server", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "regex", "\"_", ":_", "\"", "^", "/", "server", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "value", "\"_", ":_", "50_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "verb", "\"_", ":_", "\"", "POST", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rema", "inin", "g", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "unit", "\"_", ":_", "\"", "DAY", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "reset", "Time", "\"_", ":_", "131", "127", "222", "6_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "abs", "olute", "\\u", "limits_", "=_", "{_", "\"", "metadata", "\\u", "items", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "injected", "\\u", "files", "\"_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "injected", "\\u", "file", "\\u", "content", "\\u", "bytes", "\"_", ":_", "5_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "View", "Build", "er", "V1", "1", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "View", "Build", "er", "V1", "1", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "build", "\\u", "limits_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected", "\\u", "limits_", "=_", "{_", "\"", "limit", "s", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rate", "\"_", ":_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "uri", "\"_", ":_", "\"*\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "regex", "\"_", ":_", "\".*", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "[_", "{_", "\"", "value", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "verb", "\"_", ":_", "\"", "POST", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rema", "inin", "g", "\"_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "unit", "\"_", ":_", "\"", "MINUTE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "next", "-", "avail", "able", "\"_", ":_", "\"", "2011", "-0", "7", "-", "21", "T1", "8", ":", "1", "7", ":", "0", "6", "Z", "\"_", "}_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "uri", "\"_", ":_", "\"*", "/", "server", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "regex", "\"_", ":_", "\"", "^", "/", "server", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "[_", "{_", "\"", "value", "\"_", ":_", "50_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "verb", "\"_", ":_", "\"", "POST", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rema", "inin", "g", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "unit", "\"_", ":_", "\"", "DAY", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "next", "-", "avail", "able", "\"_", ":_", "\"", "2011", "-0", "7", "-", "21", "T1", "8", ":", "1", "7", ":", "0", "6", "Z", "\"_", "}_", "]_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "abs", "olute", "\"_", ":_", "{_", "\"", "max", "Server", "Meta", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Image", "Meta", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Persona", "lit", "y", "\"_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Persona", "lit", "y", "Size", "\"_", ":_", "5_", "}_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "=_", "self_", "._", "view", "\\u", "builder_", "._", "build_", "(_", "self_", "._", "rate", "\\u", "limits_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "abs", "olute", "\\u", "limits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Dict", "Match_", "(_", "output_", ",_", "expected", "\\u", "limits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "View", "Build", "er", "V1", "1", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "build", "\\u", "limit", "s", "\\u", "empty", "\\u", "limits_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "expected", "\\u", "limits_", "=_", "{_", "\"", "limit", "s", "\"_", ":_", "{_", "\"", "rate", "\"_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "abs", "olute", "\"_", ":_", "{_", "}_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "abs", "\\u", "limits_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rate", "\\u", "limits_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "self_", "._", "view", "\\u", "builder_", "._", "build_", "(_", "rate", "\\u", "limits_", ",_", "abs", "\\u", "limits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Dict", "Match_", "(_", "output_", ",_", "expected", "\\u", "limits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Limit", "s", "XML", "Serializa", "tion", "Test_", "(_", "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_", "[SEP]_", "class_", "Limit", "s", "XML", "Serializa", "tion", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "max", "Diff_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "XML", "Serializa", "tion", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "XML", "Serializa", "tion", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "index_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "serializer_", "=_", "limits_", "._", "Limit", "s", "XML", "Serializer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fixture_", "=_", "{_", "\"", "limit", "s", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rate", "\"_", ":_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "uri", "\"_", ":_", "\"*\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "regex", "\"_", ":_", "\".*", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "value", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "verb", "\"_", ":_", "\"", "POST", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rema", "inin", "g", "\"_", ":_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "unit", "\"_", ":_", "\"", "MINUTE", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "next", "-", "avail", "able", "\"_", ":_", "\"", "2011", "-1", "2", "-1", "5", "T2", "2", ":", "4", "2", ":", "4", "5", "Z", "\"_", "}_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "uri", "\"_", ":_", "\"*", "/", "server", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "regex", "\"_", ":_", "\"", "^", "/", "server", "s", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "limit", "\"_", ":_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "value", "\"_", ":_", "50_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "verb", "\"_", ":_", "\"", "POST", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rema", "inin", "g", "\"_", ":_", "10_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "unit", "\"_", ":_", "\"", "DAY", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "next", "-", "avail", "able", "\"_", ":_", "\"", "2011", "-1", "2", "-1", "5", "T2", "2", ":", "4", "2", ":", "4", "5", "Z", "\"_", "}_", "]_", "}_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "abs", "olute", "\"_", ":_", "{_", "\"", "max", "Server", "Meta", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Image", "Meta", "\"_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Persona", "lit", "y", "\"_", ":_", "5_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "max", "Persona", "lit", "y", "Size", "\"_", ":_", "1024", "0_", "}_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "=_", "serializer_", "._", "serialize_", "(_", "fixture_", ",_", "'", "index", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "=_", "minidom_", "._", "parse", "String_", "(_", "output_", "._", "replace_", "(_", "\"", " ", " ", "\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "minidom_", "._", "parse", "String_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "<", "limit", "s", " ", "xml", "ns", "=\"", "http", "://", "docs", ".", "openst", "ack", ".", "org", "/", "compute", "/", "api", "/", "v1", ".1", "\">", "\\", "10", ";", " ", " ", " ", " ", "<", "rate", "s", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "rate", " ", "uri", "=\"", "*\"", " ", "regex", "=\".", "*\"", ">", "\\", "10", ";", " ", " ", "<", "limit", " ", "value", "=\"", "10", "\"", " ", "verb", "=\"", "POST", "\"", " ", "rema", "inin", "g", "=\"", "2", "\"", "\\", "10", ";", " ", " ", "unit", "=\"", "MINUTE", "\"", "\\", "10", ";", " ", " ", "next", "-", "avail", "able", "=\"", "2011", "-1", "2", "-1", "5", "T2", "2", ":", "4", "2", ":", "4", "5", "Z", "\"/>", "\\", "10", ";", " ", " ", " ", " ", "</", "rate", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "rate", " ", "uri", "=\"", "*/", "server", "s", "\"", " ", "regex", "=\"", "^", "/", "server", "s", "\">", "\\", "10", ";", " ", " ", "<", "limit", " ", "value", "=\"", "50", "\"", " ", "verb", "=\"", "POST", "\"", " ", "rema", "inin", "g", "=\"", "10", "\"", "\\", "10", ";", " ", " ", "unit", "=\"", "DAY", "\"", "\\", "10", ";", " ", " ", "next", "-", "avail", "able", "=\"", "2011", "-1", "2", "-1", "5", "T2", "2", ":", "4", "2", ":", "4", "5", "Z", "\"/>", "\\", "10", ";", " ", " ", " ", " ", "</", "rate", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "rate", "s", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "abs", "olute", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "limit", " ", "name", "=\"", "max", "Server", "Meta", "\"", " ", "value", "=\"", "1", "\"/>", "\\", "10", ";", " ", " ", " ", " ", "<", "limit", " ", "name", "=\"", "max", "Persona", "lit", "y", "\"", " ", "value", "=\"", "5", "\"/>", "\\", "10", ";", " ", " ", " ", " ", "<", "limit", " ", "name", "=\"", "max", "Image", "Meta", "\"", " ", "value", "=\"", "1", "\"/>", "\\", "10", ";", " ", " ", " ", " ", "<", "limit", " ", "name", "=\"", "max", "Persona", "lit", "y", "Size", "\"", " ", "value", "=\"", "1024", "0", "\"/>", "\\", "10", ";", " ", " ", " ", " ", "</", "abs", "olute", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "limit", "s", ">", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "._", "replace_", "(_", "\"", " ", " ", "\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", "._", "tox", "ml_", "(_", ")_", ",_", "actual_", "._", "tox", "ml_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Limit", "s", "XML", "Serializa", "tion", "Test_", "(_", "test_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "index", "\\u", "no", "\\u", "limits_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "serializer_", "=_", "limits_", "._", "Limit", "s", "XML", "Serializer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fixture_", "=_", "{_", "\"", "limit", "s", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "rate", "\"_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "abs", "olute", "\"_", ":_", "{_", "}_", "}_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "output_", "=_", "serializer_", "._", "serialize_", "(_", "fixture_", ",_", "'", "index", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actual_", "=_", "minidom_", "._", "parse", "String_", "(_", "output_", "._", "replace_", "(_", "\"", " ", " ", "\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "=_", "minidom_", "._", "parse", "String_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "<", "limit", "s", " ", "xml", "ns", "=\"", "http", "://", "docs", ".", "openst", "ack", ".", "org", "/", "compute", "/", "api", "/", "v1", ".1", "\">", "\\", "10", ";", " ", " ", " ", " ", "<", "rate", "s", " ", "/>", "\\", "10", ";", " ", " ", " ", " ", "<", "abs", "olute", " ", "/>", "\\", "10", ";", " ", " ", " ", " ", "</", "limit", "s", ">", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "._", "replace_", "(_", "\"", " ", " ", "\"_", ",_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "expected_", "._", "tox", "ml_", "(_", ")_", ",_", "actual_", "._", "tox", "ml_", "(_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
sahana/eden/modules/templates/MAVC/layouts.py
[ { "content": "# -*- coding: utf-8 -*-\n\nfrom gluon import *\nfrom gluon.storage import Storage\nfrom s3 import *\nfrom s3theme import NAV, SECTION\n\n# =============================================================================\n\n# =============================================================================\n\n# -----------------------------------------------------------------------------\n# Shortcut\n#\nMF = S3FooterMenuLayout\n\n# =============================================================================\n\n# -----------------------------------------------------------------------------\n# Shortcut\n#\nML = S3LanguageMenuLayout\n\n# END =========================================================================\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class S3MainMenuLayout(S3NavigationItem):\n \"\"\" Custom Main Menu Layout \"\"\"\n\n\n # ---------------------------------------------------------------------", "metadata": "root.S3MainMenuLayout", "header": "['module', '___EOS___']", "index": 8 }, { "content": " @staticmethod\n def layout(item):\n \"\"\" Custom Layout Method \"\"\"\n\n # Manage flags: hide any disabled/unauthorized items\n if not item.authorized:\n item.enabled = False\n item.visible = False\n elif item.enabled is None or item.enabled:\n item.enabled = True\n item.visible = True\n\n if item.enabled and item.visible:\n\n items = item.render_components()\n if item.parent is not None:\n\n classes = []\n\n if item.parent.parent is None:\n # Item at the top-level?\n toplevel = True\n if item.opts.left:\n classes.append(\"menu-left\")\n #if item.opts.right:\n # classes.append(\"menu-right\")\n else:\n toplevel = False\n\n if item.components:\n classes.append(\"has-dropdown not-click\")\n if item.selected:\n classes.append(\"active\")\n if item.opts.icon:\n classes.append(\"label-icon\")\n title = item.label\n item.label = ICON(item.opts.icon)\n else:\n title = None\n _class = \" \".join(classes)\n\n # Menu item with Dropdown\n if item.get_first(enabled=True):\n _href = item.url()\n return LI(A(item.label,\n _href = _href,\n _id = item.attr._id,\n _title = title,\n ),\n UL(items,\n _class=\"dropdown\"\n ),\n _class=_class,\n )\n else:\n # Menu item without Drop-Down\n if toplevel:\n item_url = item.url()\n if item_url == URL(c=\"default\", f=\"index\"):\n classes.append(\"menu-home\")\n if item.selected:\n classes.append(\"active\")\n _class = \" \".join(classes)\n return LI(A(item.label,\n _href=item_url,\n _id=item.attr._id,\n ),\n _class=_class,\n )\n else:\n # Submenu item\n if isinstance(item.label, dict):\n if \"name\" in item.label:\n label = item.label[\"name\"]\n else:\n return None\n else:\n label = item.label\n link = A(label, _href=item.url(), _id=item.attr._id)\n return LI(link)\n else:\n # Main menu\n\n right = []\n left = []\n for item in items:\n if \"menu-left\" in item[\"_class\"]:\n item.remove_class(\"menu-left\")\n left.append(item)\n else:\n right.append(item)\n #right.reverse()\n if current.response.s3.rtl:\n right, left = left, right\n return NAV(UL(LI(A(\" \",\n _href=URL(c=\"default\", f=\"index\"),\n ),\n _class=\"name\"\n ),\n LI(A(SPAN(current.T(\"Menu\"))),\n _class=\"toggle-topbar menu-icon\",\n ),\n _class=\"title-area\",\n ),\n SECTION(UL(left, _class=\"left\"),\n UL(right, _class=\"right\"),\n _class=\"top-bar-section\",\n ),\n _class = \"top-bar\",\n data = {\"topbar\": \" \"},\n )\n else:\n return None", "metadata": "root.S3MainMenuLayout.layout", "header": "['class', 'S3MainMenuLayout', '(', 'S3NavigationItem', ')', ':', '___EOS___']", "index": 11 }, { "content": " @staticmethod\n def checkbox_item(item):\n \"\"\" Render special active items \"\"\"\n\n name = item.label\n link = item.url()\n _id = name[\"id\"]\n if \"name\" in name:\n _name = name[\"name\"]\n else:\n _name = \"\"\n if \"value\" in name:\n _value = name[\"value\"]\n else:\n _value = False\n if \"request_type\" in name:\n _request_type = name[\"request_type\"]\n else:\n _request_type = \"ajax\"\n if link:\n if _request_type == \"ajax\":\n _onchange='''var val=$('#%s:checked').length;$.getS3('%s'+'?val='+val,null,false,null,false,false)''' % \\\n (_id, link)\n else:\n # Just load the page. Use this if the changed menu\n # item should alter the contents of the page, and\n # it's simpler just to load it.\n _onchange=\"location.href='%s'\" % link\n else:\n _onchange=None\n return LI(A(INPUT(_type=\"checkbox\",\n _id=_id,\n _onchange=_onchange,\n value=_value,\n ),\n \"%s\" % _name,\n _nowrap=\"nowrap\",\n ),\n _class=\"menu-toggle\",\n )", "metadata": "root.S3MainMenuLayout.checkbox_item", "header": "['class', 'S3MainMenuLayout', '(', 'S3NavigationItem', ')', ':', '___EOS___']", "index": 126 }, { "content": "class S3FooterMenuLayout(S3NavigationItem):\n \"\"\" MAVC Footer Menu Layout \"\"\"\n", "metadata": "root.S3FooterMenuLayout", "header": "['module', '___EOS___']", "index": 168 }, { "content": " @staticmethod\n def layout(item):\n \"\"\" Custom Layout Method \"\"\"\n\n if not item.authorized:\n item.enabled = item.visible = False\n elif item.enabled is None or item.enabled:\n item.enabled = item.visible = True\n\n if item.enabled and item.visible:\n\n if item.parent is not None:\n\n return LI(A(item.label,\n _href = item.url(),\n _id = item.attr._id,\n _class = \"footer-menu-item\",\n ))\n\n else:\n # The menu itself\n items = item.render_components()\n\n # Homepage link\n logo = \"/%s/static/themes/MAVC/img/footer-logo.png\" % \\\n current.request.application\n\n return TAG[\"\"](UL(items,\n _class = \"footer-menu\",\n ),\n A(IMG(_src=logo),\n _href = URL(\"default\", \"index\"),\n _class = \"footer-home\",\n ),\n )\n else:\n return None", "metadata": "root.S3FooterMenuLayout.layout", "header": "['class', 'S3FooterMenuLayout', '(', 'S3NavigationItem', ')', ':', '___EOS___']", "index": 171 }, { "content": "class S3LanguageMenuLayout(S3NavigationItem):\n \"\"\" Custom Language Menu (Dropdown) \"\"\"\n\n\n # -------------------------------------------------------------------------", "metadata": "root.S3LanguageMenuLayout", "header": "['module', '___EOS___']", "index": 215 }, { "content": " @staticmethod\n def layout(item):\n \"\"\"\n Language menu layout\n\n options for each entry:\n - lang_code: the language code\n - lang_name: the language name\n \"\"\"\n\n if item.enabled:\n if item.components:\n # The language menu itself\n T = current.T\n items = item.render_components()\n select = SELECT(items,\n _name = \"_language\",\n _title = T(\"Language Selection\"),\n _onchange = '''S3.reloadWithQueryStringVars({'_language':$(this).val()})''',\n value = T.accepted_language,\n )\n form = FORM(select,\n _class = \"language-selector\",\n _name = \"_language\",\n _action = \"\",\n _method = \"get\",\n )\n return form\n else:\n # A language entry\n return OPTION(item.opts.lang_name,\n _value=item.opts.lang_code,\n )\n else:\n return None", "metadata": "root.S3LanguageMenuLayout.layout", "header": "['class', 'S3LanguageMenuLayout', '(', 'S3NavigationItem', ')', ':', '___EOS___']", "index": 218 }, { "content": " def check_enabled(self):\n \"\"\" Check whether the language menu is enabled \"\"\"\n\n if current.deployment_settings.get_L10n_display_toolbar():\n return True\n else:\n return False", "metadata": "root.S3LanguageMenuLayout.check_enabled", "header": "['class', 'S3LanguageMenuLayout', '(', 'S3NavigationItem', ')', ':', '___EOS___']", "index": 255 } ]
[ { "span": "from gluon.storage import Storage", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 33 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "gluon_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gluon_", "._", "storage_", "import_", "Storage_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "s3_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "s3", "theme_", "import_", "NAV", "_", ",_", "SECTION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "=======", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "=======", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Shortcut_", "\\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_", "MF", "_", "=_", "S", "3", "Footer", "Menu", "Layout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "==============", "==============", "==============", "==============", "==============", "=======", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--------------", "--------------", "--------------", "--------------", "--------------", "-------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Shortcut_", "\\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_", "ML_", "=_", "S", "3", "Lang", "ua", "ge", "Menu", "Layout_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "END", " ", "==============", "==============", "==============", "==============", "==============", "===", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "S", "3", "Main", "Menu", "Layout_", "(_", "S", "3", "Navigat", "ion", "Item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Custom", " ", "Main", " ", "Menu", " ", "Lay", "out", " ", "\"\"\"_", "\\u\\u\\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_", "S", "3", "Main", "Menu", "Layout_", "(_", "S", "3", "Navigat", "ion", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "layout_", "(_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Custom", " ", "Lay", "out", " ", "Meth", "od", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Manage", " ", "flags", ":", " ", "hide", " ", "any", " ", "disable", "d", "/", "unauthorized", " ", "items_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "item_", "._", "authorized_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "._", "enabled_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item_", "._", "visible_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "item_", "._", "enabled_", "is_", "None_", "or_", "item_", "._", "enabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "._", "enabled_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item_", "._", "visible_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "item_", "._", "enabled_", "and_", "item_", "._", "visible_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "items_", "=_", "item_", "._", "render", "\\u", "components_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "item_", "._", "parent_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "classes_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "item_", "._", "parent_", "._", "parent_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Item", " ", "at", " ", "the", " ", "top", "-", "level", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "toplevel_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "item_", "._", "opts_", "._", "left_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "classes_", "._", "append_", "(_", "\"", "menu", "-", "left", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "if", " ", "item", ".", "opts", ".", "right", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "classe", "s", ".", "append", "(\"", "menu", "-", "right", "\")", "_", "\\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 ", " ", "_", "toplevel_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "item_", "._", "components_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "classes_", "._", "append_", "(_", "\"", "has", "-", "dropdown", " ", "not", "-", "click", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "item_", "._", "selected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "classes_", "._", "append_", "(_", "\"", "active", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "item_", "._", "opts_", "._", "icon_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "classes_", "._", "append_", "(_", "\"", "label", "-", "icon", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "title_", "=_", "item_", "._", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "item_", "._", "label_", "=_", "ICON_", "(_", "item_", "._", "opts_", "._", "icon_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "title_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "class_", "=_", "\"", " ", "\"_", "._", "join_", "(_", "classes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Menu", " ", "item", " ", "with", " ", "Drop", "down_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "item_", "._", "get", "\\u", "first_", "(_", "enabled_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "\\u", "href_", "=_", "item_", "._", "url_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "LI_", "(_", "A_", "(_", "item_", "._", "label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "href_", "=_", "\\u", "href_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "id_", "=_", "item_", "._", "attr_", "._", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "title_", "=_", "title_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "UL", "_", "(_", "items_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "dropdown", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\\u", "class_", ",_", "\\u\\u\\uNL\\u\\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_", "#", " ", "Menu", " ", "item", " ", "with", "out", " ", "Drop", "-", "Down_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "toplevel_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "item", "\\u", "url_", "=_", "item_", "._", "url_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "item", "\\u", "url_", "==_", "URL_", "(_", "c_", "=_", "\"", "default", "\"_", ",_", "f_", "=_", "\"", "index", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "classes_", "._", "append_", "(_", "\"", "menu", "-", "home", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "item_", "._", "selected_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "classes_", "._", "append_", "(_", "\"", "active", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "class_", "=_", "\"", " ", "\"_", "._", "join_", "(_", "classes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "LI_", "(_", "A_", "(_", "item_", "._", "label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "href_", "=_", "item", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "id_", "=_", "item_", "._", "attr_", "._", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\\u", "class_", ",_", "\\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_", "#", " ", "Subm", "enu", " ", "item_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "isinstance_", "(_", "item_", "._", "label_", ",_", "dict_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "if_", "\"", "name", "\"_", "in_", "item_", "._", "label_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "label_", "=_", "item_", "._", "label_", "[_", "\"", "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 ", " ", " _", "return_", "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 ", " ", " _", "label_", "=_", "item_", "._", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "link_", "=_", "A_", "(_", "label_", ",_", "\\u", "href_", "=_", "item_", "._", "url_", "(_", ")_", ",_", "\\u", "id_", "=_", "item_", "._", "attr_", "._", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "LI_", "(_", "link_", ")_", "\\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_", "#", " ", "Main", " ", "menu_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "right_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "left_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "\"", "menu", "-", "left", "\"_", "in_", "item_", "[_", "\"\\u", "class", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "item_", "._", "remove", "\\u", "class_", "(_", "\"", "menu", "-", "left", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "left_", "._", "append_", "(_", "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 ", " ", " _", "right_", "._", "append_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "right", ".", "reverse", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "current_", "._", "response_", "._", "s3_", "._", "rtl", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "right_", ",_", "left_", "=_", "left_", ",_", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "NAV", "_", "(_", "UL", "_", "(_", "LI_", "(_", "A_", "(_", "\"", " ", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "href_", "=_", "URL_", "(_", "c_", "=_", "\"", "default", "\"_", ",_", "f_", "=_", "\"", "index", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "name", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "LI_", "(_", "A_", "(_", "SPAN", "_", "(_", "current_", "._", "T_", "(_", "\"", "Menu", "\"_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "toggle", "-", "top", "bar", " ", "menu", "-", "icon", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "title", "-", "area", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "SECTION_", "(_", "UL", "_", "(_", "left_", ",_", "\\u", "class_", "=_", "\"", "left", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "UL", "_", "(_", "right_", ",_", "\\u", "class_", "=_", "\"", "right", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "top", "-", "bar", "-", "section", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "top", "-", "bar", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "{_", "\"", "top", "bar", "\"_", ":_", "\"", " ", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\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 ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "Main", "Menu", "Layout_", "(_", "S", "3", "Navigat", "ion", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "checkb", "ox", "\\u", "item_", "(_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Render", " ", "special", " ", "active", " ", "items", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "item_", "._", "label_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link_", "=_", "item_", "._", "url_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "id_", "=_", "name_", "[_", "\"", "id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\"", "name", "\"_", "in_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "name_", "=_", "name_", "[_", "\"", "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 ", " _", "\\u", "name_", "=_", "\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "value", "\"_", "in_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "value_", "=_", "name_", "[_", "\"", "value", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "value_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "request", "\\u", "type", "\"_", "in_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "request", "\\u", "type_", "=_", "name_", "[_", "\"", "request", "\\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 ", " _", "\\u", "request", "\\u", "type_", "=_", "\"", "aja", "x", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "link_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "\\u", "request", "\\u", "type_", "==_", "\"", "aja", "x", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "onchange", "_", "=_", "'''", "var", " ", "val", "=$", "('", "#", "%", "s", ":", "checke", "d", "')", ".", "length", ";", "$.", "get", "S", "3", "('", "%", "s", "'+", "'?", "val", "='", "+", "val", ",", "null", ",", "fal", "se", ",", "null", ",", "fal", "se", ",", "fal", "se", ")'''_", "%_", "(_", "\\u", "id_", ",_", "link_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ju", "st", " ", "load", " ", "the", " ", "page", ".", " ", "Us", "e", " ", "this", " ", "if", " ", "the", " ", "change", "d", " ", "menu_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "item", " ", "shou", "ld", " ", "alter", " ", "the", " ", "content", "s", " ", "of", " ", "the", " ", "page", ",", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", "'", "s", " ", "simple", "r", " ", "just", " ", "to", " ", "load", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "onchange", "_", "=_", "\"", "location", ".", "href", "='", "%", "s", "'\"_", "%_", "link_", "\\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 ", " _", "\\u", "onchange", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "LI_", "(_", "A_", "(_", "INPUT_", "(_", "\\u", "type_", "=_", "\"", "checkb", "ox", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "id_", "=_", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "onchange", "_", "=_", "\\u", "onchange", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "\\u", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "s", "\"_", "%_", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "now", "rap", "_", "=_", "\"", "now", "rap", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "menu", "-", "toggle", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "S", "3", "Footer", "Menu", "Layout_", "(_", "S", "3", "Navigat", "ion", "Item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "MAV", "C", " ", "Footer", " ", "Menu", " ", "Lay", "out", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "Footer", "Menu", "Layout_", "(_", "S", "3", "Navigat", "ion", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "layout_", "(_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Custom", " ", "Lay", "out", " ", "Meth", "od", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "item_", "._", "authorized_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "._", "enabled_", "=_", "item_", "._", "visible_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "item_", "._", "enabled_", "is_", "None_", "or_", "item_", "._", "enabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "._", "enabled_", "=_", "item_", "._", "visible_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "item_", "._", "enabled_", "and_", "item_", "._", "visible_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "item_", "._", "parent_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "LI_", "(_", "A_", "(_", "item_", "._", "label_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "href_", "=_", "item_", "._", "url_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "id_", "=_", "item_", "._", "attr_", "._", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "footer", "-", "menu", "-", "item", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\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_", "#", " ", "The", " ", "menu", " ", "its", "elf_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "items_", "=_", "item_", "._", "render", "\\u", "components_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Home", "page", " ", "link_", "\\u\\u\\uNL\\u\\u\\u_", "logo_", "=_", "\"/%", "s", "/", "static", "/", "themes", "/", "MAV", "C", "/", "img", "/", "footer", "-", "logo", ".", "png", "\"_", "%_", "current_", "._", "request_", "._", "application_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "TAG_", "[_", "\"\"_", "]_", "(_", "UL", "_", "(_", "items_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "footer", "-", "menu", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "A_", "(_", "IMG", "_", "(_", "\\u", "src_", "=_", "logo_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "href_", "=_", "URL_", "(_", "\"", "default", "\"_", ",_", "\"", "index", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "footer", "-", "home", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\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 ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "S", "3", "Lang", "ua", "ge", "Menu", "Layout_", "(_", "S", "3", "Navigat", "ion", "Item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Custom", " ", "Lang", "ua", "ge", " ", "Menu", " ", "(", "Drop", "down", ")", " ", "\"\"\"_", "\\u\\u\\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_", "S", "3", "Lang", "ua", "ge", "Menu", "Layout_", "(_", "S", "3", "Navigat", "ion", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "layout_", "(_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Lang", "ua", "ge", " ", "menu", " ", "layout", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "options", " ", "for", " ", "each", " ", "entry", ":", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "lang", "\\u", "code", ":", " ", "the", " ", "language", " ", "code", "\\", "10", ";", " ", " ", " ", " ", "-", " ", "lang", "\\u", "name", ":", " ", "the", " ", "language", " ", "name", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "item_", "._", "enabled_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "item_", "._", "components_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "language", " ", "menu", " ", "its", "elf_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "T_", "=_", "current_", "._", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "items_", "=_", "item_", "._", "render", "\\u", "components_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "select_", "=_", "SELECT", "_", "(_", "items_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "name_", "=_", "\"\\u", "language", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "title_", "=_", "T_", "(_", "\"", "Lang", "ua", "ge", " ", "Selecti", "on", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "onchange", "_", "=_", "'''", "S", "3", ".", "relo", "ad", "With", "Query", "String", "Var", "s", "({", "'\\u", "language", "':", "$(", "this", ").", "val", "()}", ")'''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "value_", "=_", "T_", "._", "accept", "ed", "\\u", "language_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "form_", "=_", "FORM", "_", "(_", "select_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "class_", "=_", "\"", "language", "-", "select", "or", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "name_", "=_", "\"\\u", "language", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "action_", "=_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "method_", "=_", "\"", "get", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "A", " ", "language", " ", "entry_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "OPTION", "_", "(_", "item_", "._", "opts_", "._", "lang", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "value_", "=_", "item_", "._", "opts_", "._", "lang", "\\u", "code_", ",_", "\\u\\u\\uNL\\u\\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 ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "S", "3", "Lang", "ua", "ge", "Menu", "Layout_", "(_", "S", "3", "Navigat", "ion", "Item_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "\\u", "enabled_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Check", " ", "whe", "ther", " ", "the", " ", "language", " ", "menu", " ", "is", " ", "enable", "d", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "current_", "._", "deploy", "ment", "\\u", "settings_", "._", "get", "\\u", "L1", "0", "n", "\\u", "display", "\\u", "toolbar_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\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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 ]
Module is imported with 'import' and 'import from'
apiad/sublime-browser-integration/selenium/webdriver/safari/service.py
[ { "content": "#!/usr/bin/python\n#\n# Copyright 2011 Webdriver_name committers\n# Copyright 2011 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\nimport subprocess\nfrom subprocess import PIPE\nimport time\nfrom selenium.common.exceptions import WebDriverException\nfrom selenium.webdriver.common import utils\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import subprocess", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[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", " ", "2011", " ", "Web", "driver", "\\u", "name", " ", "committer", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2011", " ", "Goo", "gle", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "subprocess_", "import_", "PIPE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "selenium_", "._", "common_", "._", "exceptions_", "import_", "Web", "Drive", "r", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "selenium_", "._", "webdriver_", "._", "common_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Module is imported with 'import' and 'import from'
istresearch/scrapy-cluster/kafka-monitor/tests/tests_offline.py
[ { "content": "'''\nOffline tests\n'''\n\nimport unittest\nfrom unittest import TestCase\nfrom mock import MagicMock\n\nimport sys\nfrom os import path\nsys.path.append(path.dirname(path.dirname(path.abspath(__file__))))\n\nfrom kafka_monitor import KafkaMonitor\nfrom plugins.scraper_handler import ScraperHandler\nfrom plugins.base_handler import BaseHandler\nfrom plugins.action_handler import ActionHandler\nfrom plugins.stats_handler import StatsHandler\nimport copy\n\nfrom kafka.common import OffsetOutOfRangeError\nfrom jsonschema import Draft4Validator\nimport tldextract\n\n\n\n\n\n\n\nif __name__ == '__main__':\n unittest.main()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import unittest", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "Off", "line", " ", "tests", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "unittest_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mock_", "import_", "Mag", "ic", "Mock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "os_", "import_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "path_", "._", "dirname_", "(_", "path_", "._", "dirname_", "(_", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kaf", "ka", "\\u", "monitor_", "import_", "Ka", "fk", "a", "Monitor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "plugins_", "._", "scraper", "\\u", "handler_", "import_", "Scrape", "r", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "plugins_", "._", "base", "\\u", "handler_", "import_", "Base", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "plugins_", "._", "action", "\\u", "handler_", "import_", "Action", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "plugins_", "._", "stats", "\\u", "handler_", "import_", "Stat", "s", "Handler_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "kaf", "ka_", "._", "common_", "import_", "Off", "set", "Out", "Of", "Range", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "jsonschema", "_", "import_", "Dra", "ft", "4", "Validator_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tld", "extract_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
ganeti/ganeti/test/py/ganeti.ovf_unittest.py
[ { "content": "#!/usr/bin/python\n#\n\n# Copyright (C) 2011, 2012 Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# 1. Redistributions of source code must retain the above copyright notice,\n# this list of conditions and the following disclaimer.\n#\n# 2. Redistributions in binary form must reproduce the above copyright\n# notice, this list of conditions and the following disclaimer in the\n# documentation and/or other materials provided with the distribution.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS\n# IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED\n# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR\n# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\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\"\"\"Script for testing ganeti.ovf.\n\n\"\"\"\n\nimport optparse\nimport os\nimport os.path\nimport re\nimport shutil\nimport sys\nimport tempfile\nimport unittest\n\ntry:\n import xml.etree.ElementTree as ET\nexcept ImportError:\n import elementtree.ElementTree as ET\n\nfrom ganeti import constants\nfrom ganeti import errors\nfrom ganeti import ovf\nfrom ganeti import utils\nfrom ganeti import pathutils\n\nimport testutils\n\nOUTPUT_DIR = \"newdir\"\n\nGANETI_DISKS = {\n \"disk_count\": \"1\",\n \"disk0_dump\": \"new_disk.raw\",\n \"disk0_size\": \"0\",\n \"disk0_ivname\": \"disk/0\",\n}\nGANETI_NETWORKS = {\n \"nic_count\": \"1\",\n \"nic0_mode\": \"bridged\",\n \"nic0_ip\": \"none\",\n \"nic0_mac\": \"aa:00:00:d8:2c:1e\",\n \"nic0_link\": \"xen-br0\",\n \"nic0_network\": \"auto\",\n}\nGANETI_HYPERVISOR = {\n \"hypervisor_name\": \"xen-pvm\",\n \"root-path\": \"/dev/sda\",\n \"kernel_args\": \"ro\",\n}\nGANETI_OS = {\"os_name\": \"lenny-image\"}\nGANETI_BACKEND = {\n \"vcpus\": \"1\",\n \"memory\" : \"2048\",\n \"auto_balance\": \"False\",\n}\nGANETI_NAME = \"ganeti-test-xen\"\nGANETI_TEMPLATE = \"plain\"\nGANETI_TAGS = None\nGANETI_VERSION = \"0\"\n\nVIRTUALBOX_DISKS = {\n \"disk_count\": \"2\",\n \"disk0_ivname\": \"disk/0\",\n \"disk0_dump\": \"new_disk.raw\",\n \"disk0_size\": \"0\",\n \"disk1_ivname\": \"disk/1\",\n \"disk1_dump\": \"second_disk.raw\",\n \"disk1_size\": \"0\",\n}\nVIRTUALBOX_NETWORKS = {\n \"nic_count\": \"1\",\n \"nic0_mode\": \"bridged\",\n \"nic0_ip\": \"none\",\n \"nic0_link\": \"auto\",\n \"nic0_mac\": \"auto\",\n \"nic0_network\": \"auto\",\n}\nVIRTUALBOX_HYPERVISOR = {\"hypervisor_name\": \"auto\"}\nVIRTUALBOX_OS = {\"os_name\": None}\nVIRTUALBOX_BACKEND = {\n \"vcpus\": \"1\",\n \"memory\" : \"2048\",\n \"auto_balance\": \"auto\",\n}\nVIRTUALBOX_NAME = None\nVIRTUALBOX_TEMPLATE = None\nVIRTUALBOX_TAGS = None\nVIRTUALBOX_VERSION = None\n\nEMPTY_DISKS = {}\nEMPTY_NETWORKS = {}\nEMPTY_HYPERVISOR = {\"hypervisor_name\": \"auto\"}\nEMPTY_OS = {}\nEMPTY_BACKEND = {\n \"vcpus\": \"auto\",\n \"memory\" : \"auto\",\n \"auto_balance\": \"auto\",\n}\nEMPTY_NAME = None\nEMPTY_TEMPLATE = None\nEMPTY_TAGS = None\nEMPTY_VERSION = None\n\nCMDARGS_DISKS = {\n \"disk_count\": \"1\",\n \"disk0_ivname\": \"disk/0\",\n \"disk0_dump\": \"disk0.raw\",\n \"disk0_size\": \"8\",\n}\nCMDARGS_NETWORKS = {\n \"nic0_link\": \"auto\",\n \"nic0_mode\": \"bridged\",\n \"nic0_ip\": \"none\",\n \"nic0_mac\": \"auto\",\n \"nic_count\": \"1\",\n \"nic0_network\": \"auto\",\n}\nCMDARGS_HYPERVISOR = {\n \"hypervisor_name\": \"xen-pvm\"\n}\nCMDARGS_OS = {\"os_name\": \"lenny-image\"}\nCMDARGS_BACKEND = {\n \"auto_balance\": False,\n \"vcpus\": \"1\",\n \"memory\": \"256\",\n}\nCMDARGS_NAME = \"test-instance\"\nCMDARGS_TEMPLATE = \"plain\"\nCMDARGS_TAGS = \"test-tag-1,test-tag-2\"\n\nARGS_EMPTY = {\n \"output_dir\": None,\n \"nics\": [],\n \"disks\": [],\n \"name\": \"test-instance\",\n \"ova_package\": False,\n \"ext_usage\": False,\n \"disk_format\": \"cow\",\n \"compression\": False,\n}\nARGS_EXPORT_DIR = dict(ARGS_EMPTY, **{\n \"output_dir\": OUTPUT_DIR,\n \"name\": None,\n \"hypervisor\": None,\n \"os\": None,\n \"beparams\": {},\n \"no_nics\": False,\n \"disk_template\": None,\n \"tags\": None,\n})\nARGS_VBOX = dict(ARGS_EXPORT_DIR, **{\n \"output_dir\": OUTPUT_DIR,\n \"name\": \"test-instance\",\n \"os\": \"lenny-image\",\n \"hypervisor\": (\"xen-pvm\", {}),\n \"osparams\":{},\n \"osparams_private\":{},\n \"disks\": [],\n})\nARGS_COMPLETE = dict(ARGS_VBOX, **{\n \"beparams\": {\"vcpus\":\"1\", \"memory\":\"256\", \"auto_balance\": False},\n \"disks\": [(0,{\"size\":\"5mb\"})],\n \"nics\": [(\"0\",{\"mode\":\"bridged\"})],\n \"disk_template\": \"plain\",\n \"tags\": \"test-tag-1,test-tag-2\",\n})\nARGS_BROKEN = dict(ARGS_EXPORT_DIR , **{\n \"no_nics\": True,\n \"disk_template\": \"diskless\",\n \"name\": \"test-instance\",\n \"os\": \"lenny-image\",\n \"osparams\": {},\n \"osparams_private\":{},\n})\n\nEXP_ARGS_COMPRESSED = dict(ARGS_EXPORT_DIR, **{\n \"compression\": True,\n})\n\nEXP_DISKS_LIST = [\n {\n \"format\": \"vmdk\",\n \"compression\": \"gzip\",\n \"virt-size\": 90000,\n \"real-size\": 203,\n \"path\": \"new_disk.cow.gz\",\n },\n {\n \"format\": \"cow\",\n \"virt-size\": 15,\n \"real-size\": 15,\n \"path\": \"new_disk.cow\",\n },\n]\nEXP_NETWORKS_LIST = [\n {\"mac\": \"aa:00:00:d8:2c:1e\", \"ip\":\"None\", \"link\":\"br0\",\n \"mode\":\"routed\", \"network\": \"test\"},\n]\nEXP_PARTIAL_GANETI_DICT = {\n \"hypervisor\": {\"name\": \"xen-kvm\"},\n \"os\": {\"name\": \"lenny-image\"},\n \"auto_balance\": \"True\",\n \"version\": \"0\",\n}\nEXP_GANETI_DICT = {\n \"tags\": None,\n \"auto_balance\": \"False\",\n \"hypervisor\": {\n \"root-path\": \"/dev/sda\",\n \"name\": \"xen-pvm\",\n \"kernel_args\": \"ro\"\n },\n \"version\": \"0\",\n \"disk_template\": None,\n \"os\": {\"name\": \"lenny-image\"}\n}\nEXP_NAME =\"xen-dev-i1\"\nEXP_VCPUS = 1\nEXP_MEMORY = 512\n\nEXPORT_EMPTY = (\"<Envelope xml:lang=\\\"en-US\\\" xmlns=\\\"http://schemas.dmtf.org/\"\n \"ovf/envelope/1\\\" xmlns:gnt=\\\"http://ganeti\\\" xmlns:ovf=\\\"\"\n \"http://schemas.dmtf.org/ovf/envelope/1\\\" xmlns:rasd=\\\"\"\n \"http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_Resource\"\n \"AllocationSettingData\\\" xmlns:vssd=\\\"http://schemas.dmtf.org\"\n \"/wbem/wscim/1/cim-schema/2/CIM_VirtualSystemSettingData\\\"\"\n \" xmlns:xsi=\\\"http://www.w3.org/2001/XMLSchema-instance\\\" />\")\nEXPORT_DISKS_EMPTY = (\"<References /><DiskSection><Info>Virtual disk\"\n \" information</Info></DiskSection>\")\nEXPORT_DISKS = (\"<References><File ovf:compression=\\\"gzip\\\" ovf:href=\\\"new_disk\"\n \".cow.gz\\\" ovf:id=\\\"file0\\\" ovf:size=\\\"203\\\" /><File ovf:href=\"\n \"\\\"new_disk.cow\\\" ovf:id=\\\"file1\\\" ovf:size=\\\"15\\\" />\"\n \"</References><DiskSection><Info>Virtual disk information\"\n \"</Info><Disk ovf:capacity=\\\"90000\\\" ovf:diskId=\\\"disk0\\\" ovf\"\n \":fileRef=\\\"file0\\\" ovf:format=\\\"http://www.vmware.com/\"\n \"interfaces/specifications/vmdk.html#monolithicSparse\\\" /><Disk\"\n \" ovf:capacity=\\\"15\\\" ovf:diskId=\\\"disk1\\\" ovf:fileRef\"\n \"=\\\"file1\\\" ovf:format=\\\"http://www.gnome.org/~markmc/qcow\"\n \"-image-format.html\\\" /></DiskSection>\")\nEXPORT_NETWORKS_EMPTY = (\"<NetworkSection><Info>List of logical networks</Info>\"\n \"</NetworkSection>\")\nEXPORT_NETWORKS = (\"<NetworkSection><Info>List of logical networks</Info>\"\n \"<Network ovf:name=\\\"routed0\\\" /></NetworkSection>\")\nEXPORT_GANETI_INCOMPLETE = (\"<gnt:GanetiSection><gnt:Version>0</gnt:Version>\"\n \"<gnt:AutoBalance>True</gnt:AutoBalance><gnt:\"\n \"OperatingSystem><gnt:Name>lenny-image</gnt:Name>\"\n \"<gnt:Parameters /></gnt:OperatingSystem><gnt:\"\n \"Hypervisor><gnt:Name>xen-kvm</gnt:Name><gnt:\"\n \"Parameters /></gnt:Hypervisor><gnt:Network><gnt:\"\n \"Nic ovf:name=\\\"routed0\\\"><gnt:Mode>routed</gnt:\"\n \"Mode><gnt:MACAddress>aa:00:00:d8:2c:1e</gnt:\"\n \"MACAddress><gnt:IPAddress>None</gnt:IPAddress>\"\n \"<gnt:Link>br0</gnt:Link><gnt:Net>test</gnt:Net>\"\n \"</gnt:Nic></gnt:Network></gnt:GanetiSection>\")\nEXPORT_GANETI = (\"<gnt:GanetiSection><gnt:Version>0</gnt:Version><gnt:\"\n \"AutoBalance>False</gnt:AutoBalance><gnt:OperatingSystem>\"\n \"<gnt:Name>lenny-image</gnt:Name><gnt:Parameters /></gnt:\"\n \"OperatingSystem><gnt:Hypervisor><gnt:Name>xen-pvm</gnt:Name>\"\n \"<gnt:Parameters><gnt:root-path>/dev/sda</gnt:root-path><gnt:\"\n \"kernel_args>ro</gnt:kernel_args></gnt:Parameters></gnt:\"\n \"Hypervisor><gnt:Network><gnt:Nic ovf:name=\\\"routed0\\\"><gnt:\"\n \"Mode>routed</gnt:Mode><gnt:MACAddress>aa:00:00:d8:2c:1e</gnt:\"\n \"MACAddress><gnt:IPAddress>None</gnt:IPAddress><gnt:Link>br0\"\n \"</gnt:Link><gnt:Net>test</gnt:Net></gnt:Nic></gnt:Network>\"\n \"</gnt:GanetiSection>\")\nEXPORT_SYSTEM = (\"<References><File ovf:compression=\\\"gzip\\\" ovf:href=\\\"new_\"\n \"disk.cow.gz\\\" ovf:id=\\\"file0\\\" ovf:size=\\\"203\\\" /><File ovf:\"\n \"href=\\\"new_disk.cow\\\" ovf:id=\\\"file1\\\" ovf:size=\\\"15\\\" />\"\n \"</References><DiskSection><Info>Virtual disk information\"\n \"</Info><Disk ovf:capacity=\\\"90000\\\" ovf:diskId=\\\"disk0\\\"\"\n \" ovf:fileRef=\\\"file0\\\" ovf:format=\\\"http://www.vmware.com\"\n \"/interfaces/specifications/vmdk.html#monolithicSparse\\\" />\"\n \"<Disk ovf:capacity=\\\"15\\\" ovf:diskId=\\\"disk1\\\" ovf:fileRef\"\n \"=\\\"file1\\\" ovf:format=\\\"http://www.gnome.org/~markmc/qcow\"\n \"-image-format.html\\\" /></DiskSection><NetworkSection><Info>\"\n \"List of logical networks</Info><Network ovf:name=\\\"routed0\\\"\"\n \" /></NetworkSection><VirtualSystem ovf:id=\\\"xen-dev-i1\\\">\"\n \"<Info>A virtual machine</Info><Name>xen-dev-i1</Name>\"\n \"<OperatingSystemSection ovf:id=\\\"0\\\"><Info>Installed guest\"\n \" operating system</Info></OperatingSystemSection><Virtual\"\n \"HardwareSection><Info>Virtual hardware requirements</Info>\"\n \"<System><vssd:ElementName>Virtual Hardware Family\"\n \"</vssd:ElementName><vssd:InstanceID>0</vssd:InstanceID><vssd:\"\n \"VirtualSystemIdentifier>xen-dev-i1</vssd:VirtualSystem\"\n \"Identifier><vssd:VirtualSystemType>ganeti-ovf</vssd:Virtual\"\n \"SystemType></System><Item><rasd:ElementName>1 virtual CPU(s)\"\n \"</rasd:ElementName><rasd:InstanceID>1</rasd:InstanceID><rasd:\"\n \"ResourceType>3</rasd:ResourceType><rasd:VirtualQuantity>1\"\n \"</rasd:VirtualQuantity></Item><Item><rasd:AllocationUnits>\"\n \"byte * 2^20</rasd:AllocationUnits><rasd:ElementName>512MB of\"\n \" memory</rasd:ElementName><rasd:InstanceID>2</rasd:\"\n \"InstanceID><rasd:ResourceType>4</rasd:ResourceType><rasd:\"\n \"VirtualQuantity>512</rasd:VirtualQuantity></Item><Item>\"\n \"<rasd:Address>0</rasd:Address><rasd:ElementName>scsi\"\n \"_controller0</rasd:ElementName><rasd:InstanceID>3\"\n \"</rasd:InstanceID><rasd:ResourceSubType>lsilogic</rasd\"\n \":ResourceSubType><rasd:ResourceType>6</rasd:ResourceType>\"\n \"</Item><Item><rasd:ElementName>disk0</rasd:ElementName><rasd\"\n \":HostResource>ovf:/disk/disk0</rasd:HostResource><rasd\"\n \":InstanceID>4</rasd:InstanceID><rasd:Parent>3</rasd:Parent>\"\n \"<rasd:ResourceType>17</rasd:ResourceType></Item><Item><rasd:\"\n \"ElementName>disk1</rasd:ElementName><rasd:HostResource>ovf:/\"\n \"disk/disk1</rasd:HostResource><rasd:InstanceID>5</rasd\"\n \":InstanceID><rasd:Parent>3</rasd:Parent><rasd:ResourceType>17\"\n \"</rasd:ResourceType></Item><Item><rasd:Address>aa:00\"\n \":00:d8:2c:1e</rasd:Address><rasd:Connection>routed0</rasd\"\n \":Connection><rasd:ElementName>routed0</rasd:ElementName><rasd\"\n \":InstanceID>6</rasd:InstanceID><rasd:ResourceType>10</rasd\"\n \":ResourceType></Item></VirtualHardwareSection>\"\n \"</VirtualSystem>\")\n\n\n\n\nOPTS_EMPTY = _GetArgs(ARGS_EMPTY)\nOPTS_EXPORT_NO_NAME = _GetArgs(ARGS_EXPORT_DIR)\nOPTS_EXPORT = _GetArgs(ARGS_EXPORT_DIR, with_name=True)\n\nEXP_OPTS = OPTS_EXPORT_NO_NAME\nEXP_OPTS_COMPRESSED = _GetArgs(EXP_ARGS_COMPRESSED)\n\nOPTS_VBOX = _GetArgs(ARGS_VBOX)\nOPTS_COMPLETE = _GetArgs(ARGS_COMPLETE)\nOPTS_NONIC_NODISK = _GetArgs(ARGS_BROKEN)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == \"__main__\":\n testutils.GanetiTestProgram()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _GetArgs(args, with_name=False):\n options = optparse.Values()\n needed = args\n if with_name:\n needed[\"name\"] = \"test-instance\"\n options._update_loose(needed)\n return options", "metadata": "root._GetArgs", "header": "['module', '___EOS___']", "index": 340 }, { "content": "def _GetFullFilename(file_name):\n file_path = \"%s/test/data/ovfdata/%s\" % (testutils.GetSourceDir(),\n file_name)\n file_path = os.path.abspath(file_path)\n return file_path", "metadata": "root._GetFullFilename", "header": "['module', '___EOS___']", "index": 361 }, { "content": "class BetterUnitTest(unittest.TestCase):", "metadata": "root.BetterUnitTest", "header": "['module', '___EOS___']", "index": 368 }, { "content": " def assertRaisesRegexp(self, exception, regexp_val, function, *args):\n try:\n function(*args)\n self.fail(\"Expected raising %s\" % exception)\n except exception, err:\n regexp = re.compile(regexp_val)\n if re.search(regexp, str(err)) == None:\n self.fail(\"Expected matching '%s', got '%s'\" %\n (regexp_val, str(err)))", "metadata": "root.BetterUnitTest.assertRaisesRegexp", "header": "['class', 'BetterUnitTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 369 }, { "content": "class TestOVFImporter(BetterUnitTest):\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.TestOVFImporter", "header": "['module', '___EOS___']", "index": 380 }, { "content": " def setUp(self):\n self.non_existing_file = _GetFullFilename(\"not_the_file.ovf\")\n self.ganeti_ovf = _GetFullFilename(\"ganeti.ovf\")\n self.virtualbox_ovf = _GetFullFilename(\"virtualbox.ovf\")\n self.ova_package = _GetFullFilename(\"ova.ova\")\n self.empty_ovf = _GetFullFilename(\"empty.ovf\")\n self.wrong_extension = _GetFullFilename(\"wrong_extension.ovd\")\n self.wrong_ova_archive = _GetFullFilename(\"wrong_ova.ova\")\n self.no_ovf_in_ova = _GetFullFilename(\"no_ovf.ova\")\n self.importer = None", "metadata": "root.TestOVFImporter.setUp", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 381 }, { "content": " def tearDown(self):\n if self.importer:\n self.importer.Cleanup()\n del_dir = os.path.abspath(OUTPUT_DIR)\n try:\n shutil.rmtree(del_dir)\n except OSError:\n pass", "metadata": "root.TestOVFImporter.tearDown", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 392 }, { "content": " def testFileDoesNotExistError(self):\n self.assertRaisesRegexp(errors.OpPrereqError, \"does not exist\",\n ovf.OVFImporter, self.non_existing_file, None)", "metadata": "root.TestOVFImporter.testFileDoesNotExistError", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 401 }, { "content": " def testWrongInputFileExtensionError(self):\n self.assertRaisesRegexp(errors.OpPrereqError,\n \"Unknown file extension\", ovf.OVFImporter,\n self.wrong_extension, None)", "metadata": "root.TestOVFImporter.testWrongInputFileExtensionError", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 405 }, { "content": " def testOVAUnpackingDirectories(self):\n self.importer = ovf.OVFImporter(self.ova_package, OPTS_EMPTY)\n self.assertTrue(self.importer.input_dir != None)\n self.assertEquals(self.importer.output_dir , pathutils.EXPORT_DIR)\n self.assertTrue(self.importer.temp_dir != None)", "metadata": "root.TestOVFImporter.testOVAUnpackingDirectories", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 410 }, { "content": " def testOVFUnpackingDirectories(self):\n self.importer = ovf.OVFImporter(self.virtualbox_ovf,\n OPTS_EMPTY)\n self.assertEquals(self.importer.input_dir , _GetFullFilename(\"\"))\n self.assertEquals(self.importer.output_dir , pathutils.EXPORT_DIR)\n self.assertEquals(self.importer.temp_dir , None)", "metadata": "root.TestOVFImporter.testOVFUnpackingDirectories", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 416 }, { "content": " def testOVFSetOutputDirDirectories(self):\n self.importer = ovf.OVFImporter(self.ganeti_ovf, OPTS_EXPORT)\n self.assertEquals(self.importer.input_dir , _GetFullFilename(\"\"))\n self.assertTrue(OUTPUT_DIR in self.importer.output_dir)\n self.assertEquals(self.importer.temp_dir , None)", "metadata": "root.TestOVFImporter.testOVFSetOutputDirDirectories", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 423 }, { "content": " def testWrongOVAArchiveError(self):\n self.assertRaisesRegexp(errors.OpPrereqError, \"not a proper tar\",\n ovf.OVFImporter, self.wrong_ova_archive, None)", "metadata": "root.TestOVFImporter.testWrongOVAArchiveError", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 429 }, { "content": " def testNoOVFFileInOVAPackageError(self):\n self.assertRaisesRegexp(errors.OpPrereqError, \"No .ovf file\",\n ovf.OVFImporter, self.no_ovf_in_ova, None)", "metadata": "root.TestOVFImporter.testNoOVFFileInOVAPackageError", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 433 }, { "content": " def testParseGanetiOvf(self):\n self.importer = ovf.OVFImporter(self.ganeti_ovf, OPTS_EXPORT_NO_NAME)\n self.importer.Parse()\n self.assertTrue(\"%s/ganeti-test-xen\" % OUTPUT_DIR in\n self.importer.output_dir)\n self.assertEqual(self.importer.results_disk, GANETI_DISKS)\n self.assertEqual(self.importer.results_network, GANETI_NETWORKS)\n self.assertEqual(self.importer.results_hypervisor, GANETI_HYPERVISOR)\n self.assertEqual(self.importer.results_os, GANETI_OS)\n self.assertEqual(self.importer.results_backend, GANETI_BACKEND)\n self.assertEqual(self.importer.results_name, GANETI_NAME)\n self.assertEqual(self.importer.results_template, GANETI_TEMPLATE)\n self.assertEqual(self.importer.results_tags, GANETI_TAGS)\n self.assertEqual(self.importer.results_version, GANETI_VERSION)", "metadata": "root.TestOVFImporter.testParseGanetiOvf", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 437 }, { "content": " def testParseVirtualboxOvf(self):\n self.importer = ovf.OVFImporter(self.virtualbox_ovf, OPTS_VBOX)\n self.importer.Parse()\n self.assertTrue(\"%s/test-instance\" % OUTPUT_DIR in self.importer.output_dir)\n self.assertEquals(self.importer.results_disk, VIRTUALBOX_DISKS)\n self.assertEquals(self.importer.results_network, VIRTUALBOX_NETWORKS)\n self.assertEquals(self.importer.results_hypervisor, CMDARGS_HYPERVISOR)\n self.assertEquals(self.importer.results_os, CMDARGS_OS)\n self.assertEquals(self.importer.results_backend, VIRTUALBOX_BACKEND)\n self.assertEquals(self.importer.results_name, CMDARGS_NAME)\n self.assertEquals(self.importer.results_template, VIRTUALBOX_TEMPLATE)\n self.assertEqual(self.importer.results_tags, VIRTUALBOX_TAGS)\n self.assertEqual(self.importer.results_version, constants.EXPORT_VERSION)", "metadata": "root.TestOVFImporter.testParseVirtualboxOvf", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 452 }, { "content": " def testParseEmptyOvf(self):\n self.importer = ovf.OVFImporter(self.empty_ovf, OPTS_COMPLETE)\n self.importer.Parse()\n self.assertTrue(\"%s/test-instance\" % OUTPUT_DIR in self.importer.output_dir)\n self.assertEquals(self.importer.results_disk, CMDARGS_DISKS)\n self.assertEquals(self.importer.results_network, CMDARGS_NETWORKS)\n self.assertEquals(self.importer.results_hypervisor, CMDARGS_HYPERVISOR)\n self.assertEquals(self.importer.results_os, CMDARGS_OS)\n self.assertEquals(self.importer.results_backend, CMDARGS_BACKEND)\n self.assertEquals(self.importer.results_name, CMDARGS_NAME)\n self.assertEquals(self.importer.results_template, CMDARGS_TEMPLATE)\n self.assertEqual(self.importer.results_tags, CMDARGS_TAGS)\n self.assertEqual(self.importer.results_version, constants.EXPORT_VERSION)", "metadata": "root.TestOVFImporter.testParseEmptyOvf", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 466 }, { "content": " def testParseNameOptions(self):\n self.importer = ovf.OVFImporter(self.empty_ovf, OPTS_COMPLETE)\n results = self.importer._ParseNameOptions()\n self.assertEquals(results, CMDARGS_NAME)", "metadata": "root.TestOVFImporter.testParseNameOptions", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 480 }, { "content": " def testParseHypervisorOptions(self):\n self.importer = ovf.OVFImporter(self.empty_ovf, OPTS_COMPLETE)\n results = self.importer._ParseHypervisorOptions()\n self.assertEquals(results, CMDARGS_HYPERVISOR)", "metadata": "root.TestOVFImporter.testParseHypervisorOptions", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 485 }, { "content": " def testParseOSOptions(self):\n self.importer = ovf.OVFImporter(self.empty_ovf, OPTS_COMPLETE)\n results = self.importer._ParseOSOptions()\n self.assertEquals(results, CMDARGS_OS)", "metadata": "root.TestOVFImporter.testParseOSOptions", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 490 }, { "content": " def testParseBackendOptions(self):\n self.importer = ovf.OVFImporter(self.empty_ovf, OPTS_COMPLETE)\n results = self.importer._ParseBackendOptions()\n self.assertEquals(results, CMDARGS_BACKEND)", "metadata": "root.TestOVFImporter.testParseBackendOptions", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 495 }, { "content": " def testParseTags(self):\n self.importer = ovf.OVFImporter(self.empty_ovf, OPTS_COMPLETE)\n results = self.importer._ParseTags()\n self.assertEquals(results, CMDARGS_TAGS)", "metadata": "root.TestOVFImporter.testParseTags", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 500 }, { "content": " def testParseNicOptions(self):\n self.importer = ovf.OVFImporter(self.empty_ovf, OPTS_COMPLETE)\n results = self.importer._ParseNicOptions()\n self.assertEquals(results, CMDARGS_NETWORKS)", "metadata": "root.TestOVFImporter.testParseNicOptions", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 505 }, { "content": " def testParseDiskOptionsFromGanetiOVF(self):\n self.importer = ovf.OVFImporter(self.ganeti_ovf, OPTS_EXPORT)\n os.mkdir(OUTPUT_DIR)\n results = self.importer._GetDiskInfo()\n self.assertEquals(results, GANETI_DISKS)", "metadata": "root.TestOVFImporter.testParseDiskOptionsFromGanetiOVF", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 510 }, { "content": " def testParseTemplateOptions(self):\n self.importer = ovf.OVFImporter(self.empty_ovf, OPTS_COMPLETE)\n results = self.importer._ParseTemplateOptions()\n self.assertEquals(results, GANETI_TEMPLATE)", "metadata": "root.TestOVFImporter.testParseTemplateOptions", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 516 }, { "content": " def testParseDiskOptionsFromCmdLine(self):\n self.importer = ovf.OVFImporter(self.empty_ovf, OPTS_COMPLETE)\n os.mkdir(OUTPUT_DIR)\n results = self.importer._ParseDiskOptions()\n self.assertEquals(results, CMDARGS_DISKS)", "metadata": "root.TestOVFImporter.testParseDiskOptionsFromCmdLine", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 521 }, { "content": " def testGetDiskFormat(self):\n self.importer = ovf.OVFImporter(self.ganeti_ovf, OPTS_EXPORT)\n disks_list = self.importer.ovf_reader.GetDisksNames()\n results = [self.importer._GetDiskQemuInfo(\"%s/%s\" %\n (self.importer.input_dir, path), \"file format: (\\S+)\")\n for (path, _) in disks_list]\n self.assertEqual(results, [\"vmdk\"])", "metadata": "root.TestOVFImporter.testGetDiskFormat", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 527 }, { "content": " def testNoInstanceNameOVF(self):\n self.importer = ovf.OVFImporter(self.empty_ovf, OPTS_EXPORT_NO_NAME)\n self.assertRaisesRegexp(errors.OpPrereqError, \"Name of instance\",\n self.importer.Parse)", "metadata": "root.TestOVFImporter.testNoInstanceNameOVF", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 535 }, { "content": " def testErrorNoOSNameOVF(self):\n self.importer = ovf.OVFImporter(self.virtualbox_ovf, OPTS_EXPORT)\n self.assertRaisesRegexp(errors.OpPrereqError, \"OS name\",\n self.importer.Parse)", "metadata": "root.TestOVFImporter.testErrorNoOSNameOVF", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 540 }, { "content": " def testErrorNoDiskAndNoNetwork(self):\n self.importer = ovf.OVFImporter(self.empty_ovf, OPTS_NONIC_NODISK)\n self.assertRaisesRegexp(errors.OpPrereqError,\n \"Either disk specification or network\"\n \" description\", self.importer.Parse)", "metadata": "root.TestOVFImporter.testErrorNoDiskAndNoNetwork", "header": "['class', 'TestOVFImporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 545 }, { "content": "class TestOVFExporter(BetterUnitTest):\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestOVFExporter", "header": "['module', '___EOS___']", "index": 552 }, { "content": " def setUp(self):\n self.exporter = None\n self.wrong_config_file = _GetFullFilename(\"wrong_config.ini\")\n self.unsafe_path_to_disk = _GetFullFilename(\"unsafe_path.ini\")\n self.disk_image_not_exist = _GetFullFilename(\"no_disk.ini\")\n self.empty_config = _GetFullFilename(\"empty.ini\")\n self.standard_export = _GetFullFilename(\"config.ini\")\n self.wrong_network_mode = self.disk_image_not_exist\n self.no_memory = self.disk_image_not_exist\n self.no_vcpus = self.disk_image_not_exist\n self.no_os = _GetFullFilename(\"no_os.ini\")\n self.no_hypervisor = self.disk_image_not_exist", "metadata": "root.TestOVFExporter.setUp", "header": "['class', 'TestOVFExporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 553 }, { "content": " def tearDown(self):\n if self.exporter:\n self.exporter.Cleanup()\n del_dir = os.path.abspath(OUTPUT_DIR)\n try:\n shutil.rmtree(del_dir)\n except OSError:\n pass", "metadata": "root.TestOVFExporter.tearDown", "header": "['class', 'TestOVFExporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 566 }, { "content": " def testErrorWrongConfigFile(self):\n self.assertRaisesRegexp(errors.OpPrereqError,\n \"Error when trying to read\", ovf.OVFExporter,\n self.wrong_config_file, EXP_OPTS)", "metadata": "root.TestOVFExporter.testErrorWrongConfigFile", "header": "['class', 'TestOVFExporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 575 }, { "content": " def testErrorPathToTheDiskIncorrect(self):\n self.exporter = ovf.OVFExporter(self.unsafe_path_to_disk, EXP_OPTS)\n self.assertRaisesRegexp(errors.OpPrereqError, \"contains a directory name\",\n self.exporter._ParseDisks)", "metadata": "root.TestOVFExporter.testErrorPathToTheDiskIncorrect", "header": "['class', 'TestOVFExporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 580 }, { "content": " def testErrorDiskImageNotExist(self):\n self.exporter = ovf.OVFExporter(self.disk_image_not_exist, EXP_OPTS)\n self.assertRaisesRegexp(errors.OpPrereqError, \"Disk image does not exist\",\n self.exporter._ParseDisks)", "metadata": "root.TestOVFExporter.testErrorDiskImageNotExist", "header": "['class', 'TestOVFExporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 585 }, { "content": " def testParseNetworks(self):\n self.exporter = ovf.OVFExporter(self.standard_export, EXP_OPTS)\n results = self.exporter._ParseNetworks()\n self.assertEqual(results, EXP_NETWORKS_LIST)", "metadata": "root.TestOVFExporter.testParseNetworks", "header": "['class', 'TestOVFExporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 590 }, { "content": " def testErrorWrongNetworkMode(self):\n self.exporter = ovf.OVFExporter(self.wrong_network_mode, EXP_OPTS)\n self.assertRaisesRegexp(errors.OpPrereqError,\n \"Network mode nic not recognized\", self.exporter._ParseNetworks)", "metadata": "root.TestOVFExporter.testErrorWrongNetworkMode", "header": "['class', 'TestOVFExporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 595 }, { "content": " def testParseVCPusMem(self):\n self.exporter = ovf.OVFExporter(self.standard_export, EXP_OPTS)\n vcpus = self.exporter._ParseVCPUs()\n memory = self.exporter._ParseMemory()\n self.assertEqual(vcpus, EXP_VCPUS)\n self.assertEqual(memory, EXP_MEMORY)", "metadata": "root.TestOVFExporter.testParseVCPusMem", "header": "['class', 'TestOVFExporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 600 }, { "content": " def testErrorNoVCPUs(self):\n self.exporter = ovf.OVFExporter(self.no_vcpus, EXP_OPTS)\n self.assertRaisesRegexp(errors.OpPrereqError, \"No CPU information found\",\n self.exporter._ParseVCPUs)", "metadata": "root.TestOVFExporter.testErrorNoVCPUs", "header": "['class', 'TestOVFExporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 607 }, { "content": " def testErrorNoMemory(self):\n self.exporter = ovf.OVFExporter(self.no_memory, EXP_OPTS)\n self.assertRaisesRegexp(errors.OpPrereqError, \"No memory information found\",\n self.exporter._ParseMemory)", "metadata": "root.TestOVFExporter.testErrorNoMemory", "header": "['class', 'TestOVFExporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 612 }, { "content": " def testParseGaneti(self):\n self.exporter = ovf.OVFExporter(self.standard_export, EXP_OPTS)\n results = self.exporter._ParseGaneti()\n self.assertEqual(results, EXP_GANETI_DICT)", "metadata": "root.TestOVFExporter.testParseGaneti", "header": "['class', 'TestOVFExporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 617 }, { "content": " def testErrorNoHypervisor(self):\n self.exporter = ovf.OVFExporter(self.no_hypervisor, EXP_OPTS)\n self.assertRaisesRegexp(errors.OpPrereqError,\n \"No hypervisor information found\", self.exporter._ParseGaneti)", "metadata": "root.TestOVFExporter.testErrorNoHypervisor", "header": "['class', 'TestOVFExporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 622 }, { "content": " def testErrorNoOS(self):\n self.exporter = ovf.OVFExporter(self.no_os, EXP_OPTS)\n self.assertRaisesRegexp(errors.OpPrereqError,\n \"No operating system information found\", self.exporter._ParseGaneti)", "metadata": "root.TestOVFExporter.testErrorNoOS", "header": "['class', 'TestOVFExporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 627 }, { "content": " def testErrorParseNoInstanceName(self):\n self.exporter = ovf.OVFExporter(self.empty_config, EXP_OPTS)\n self.assertRaisesRegexp(errors.OpPrereqError, \"No instance name found\",\n self.exporter.Parse)", "metadata": "root.TestOVFExporter.testErrorParseNoInstanceName", "header": "['class', 'TestOVFExporter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 632 }, { "content": "class TestOVFReader(BetterUnitTest):\n\n\n\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.TestOVFReader", "header": "['module', '___EOS___']", "index": 638 }, { "content": " def setUp(self):\n self.wrong_xml_file = _GetFullFilename(\"wrong_xml.ovf\")\n self.ganeti_ovf = _GetFullFilename(\"ganeti.ovf\")\n self.virtualbox_ovf = _GetFullFilename(\"virtualbox.ovf\")\n self.corrupted_ovf = _GetFullFilename(\"corrupted_resources.ovf\")\n self.wrong_manifest_ovf = _GetFullFilename(\"wrong_manifest.ovf\")\n self.no_disk_in_ref_ovf = _GetFullFilename(\"no_disk_in_ref.ovf\")\n self.empty_ovf = _GetFullFilename(\"empty.ovf\")\n self.compressed_disk = _GetFullFilename(\"gzip_disk.ovf\")", "metadata": "root.TestOVFReader.setUp", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 639 }, { "content": " def tearDown(self):\n pass", "metadata": "root.TestOVFReader.tearDown", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 649 }, { "content": " def testXMLParsingError(self):\n self.assertRaisesRegexp(errors.OpPrereqError,\n \"Error while reading .ovf\", ovf.OVFReader, self.wrong_xml_file)", "metadata": "root.TestOVFReader.testXMLParsingError", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 652 }, { "content": " def testFileInResourcesDoesNotExistError(self):\n self.assertRaisesRegexp(errors.OpPrereqError, \"does not exist\",\n ovf.OVFReader, self.corrupted_ovf)", "metadata": "root.TestOVFReader.testFileInResourcesDoesNotExistError", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 656 }, { "content": " def testWrongManifestChecksumError(self):\n reader = ovf.OVFReader(self.wrong_manifest_ovf)\n self.assertRaisesRegexp(errors.OpPrereqError,\n \"does not match the value in manifest file\", reader.VerifyManifest)", "metadata": "root.TestOVFReader.testWrongManifestChecksumError", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 660 }, { "content": " def testGoodManifestChecksum(self):\n reader = ovf.OVFReader(self.ganeti_ovf)\n self.assertEqual(reader.VerifyManifest(), None)", "metadata": "root.TestOVFReader.testGoodManifestChecksum", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 665 }, { "content": " def testGetDisksNamesOVFCorruptedError(self):\n reader = ovf.OVFReader(self.no_disk_in_ref_ovf)\n self.assertRaisesRegexp(errors.OpPrereqError,\n \"not found in references\", reader.GetDisksNames)", "metadata": "root.TestOVFReader.testGetDisksNamesOVFCorruptedError", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 669 }, { "content": " def testGetDisksNamesVirtualbox(self):\n reader = ovf.OVFReader(self.virtualbox_ovf)\n disk_names = reader.GetDisksNames()\n expected_names = [\n (\"new_disk.vmdk\", None) ,\n (\"second_disk.vmdk\", None),\n ]\n self.assertEqual(sorted(disk_names), sorted(expected_names))", "metadata": "root.TestOVFReader.testGetDisksNamesVirtualbox", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 674 }, { "content": " def testGetDisksNamesEmpty(self):\n reader = ovf.OVFReader(self.empty_ovf)\n disk_names = reader.GetDisksNames()\n self.assertEqual(disk_names, [])", "metadata": "root.TestOVFReader.testGetDisksNamesEmpty", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 683 }, { "content": " def testGetDisksNamesCompressed(self):\n reader = ovf.OVFReader(self.compressed_disk)\n disk_names = reader.GetDisksNames()\n self.assertEqual(disk_names, [(\"compr_disk.vmdk.gz\", \"gzip\")])", "metadata": "root.TestOVFReader.testGetDisksNamesCompressed", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 688 }, { "content": " def testGetNetworkDataGaneti(self):\n reader = ovf.OVFReader(self.ganeti_ovf)\n networks = reader.GetNetworkData()\n self.assertEqual(networks, GANETI_NETWORKS)", "metadata": "root.TestOVFReader.testGetNetworkDataGaneti", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 693 }, { "content": " def testGetNetworkDataVirtualbox(self):\n reader = ovf.OVFReader(self.virtualbox_ovf)\n networks = reader.GetNetworkData()\n self.assertEqual(networks, VIRTUALBOX_NETWORKS)", "metadata": "root.TestOVFReader.testGetNetworkDataVirtualbox", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 698 }, { "content": " def testGetNetworkDataEmpty(self):\n reader = ovf.OVFReader(self.empty_ovf)\n networks = reader.GetNetworkData()\n self.assertEqual(networks, EMPTY_NETWORKS)", "metadata": "root.TestOVFReader.testGetNetworkDataEmpty", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 703 }, { "content": " def testGetHypervisorDataGaneti(self):\n reader = ovf.OVFReader(self.ganeti_ovf)\n hypervisor = reader.GetHypervisorData()\n self.assertEqual(hypervisor, GANETI_HYPERVISOR)", "metadata": "root.TestOVFReader.testGetHypervisorDataGaneti", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 708 }, { "content": " def testGetHypervisorDataEmptyOvf(self):\n reader = ovf.OVFReader(self.empty_ovf)\n hypervisor = reader.GetHypervisorData()\n self.assertEqual(hypervisor, EMPTY_HYPERVISOR)", "metadata": "root.TestOVFReader.testGetHypervisorDataEmptyOvf", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 713 }, { "content": " def testGetOSDataGaneti(self):\n reader = ovf.OVFReader(self.ganeti_ovf)\n osys = reader.GetOSData()\n self.assertEqual(osys, GANETI_OS)", "metadata": "root.TestOVFReader.testGetOSDataGaneti", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 718 }, { "content": " def testGetOSDataEmptyOvf(self):\n reader = ovf.OVFReader(self.empty_ovf)\n osys = reader.GetOSData()\n self.assertEqual(osys, EMPTY_OS)", "metadata": "root.TestOVFReader.testGetOSDataEmptyOvf", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 723 }, { "content": " def testGetBackendDataGaneti(self):\n reader = ovf.OVFReader(self.ganeti_ovf)\n backend = reader.GetBackendData()\n self.assertEqual(backend, GANETI_BACKEND)", "metadata": "root.TestOVFReader.testGetBackendDataGaneti", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 728 }, { "content": " def testGetBackendDataVirtualbox(self):\n reader = ovf.OVFReader(self.virtualbox_ovf)\n backend = reader.GetBackendData()\n self.assertEqual(backend, VIRTUALBOX_BACKEND)", "metadata": "root.TestOVFReader.testGetBackendDataVirtualbox", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 733 }, { "content": " def testGetBackendDataEmptyOvf(self):\n reader = ovf.OVFReader(self.empty_ovf)\n backend = reader.GetBackendData()\n self.assertEqual(backend, EMPTY_BACKEND)", "metadata": "root.TestOVFReader.testGetBackendDataEmptyOvf", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 738 }, { "content": " def testGetInstanceNameGaneti(self):\n reader = ovf.OVFReader(self.ganeti_ovf)\n name = reader.GetInstanceName()\n self.assertEqual(name, GANETI_NAME)", "metadata": "root.TestOVFReader.testGetInstanceNameGaneti", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 743 }, { "content": " def testGetInstanceNameDataEmptyOvf(self):\n reader = ovf.OVFReader(self.empty_ovf)\n name = reader.GetInstanceName()\n self.assertEqual(name, EMPTY_NAME)", "metadata": "root.TestOVFReader.testGetInstanceNameDataEmptyOvf", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 748 }, { "content": " def testGetDiskTemplateGaneti(self):\n reader = ovf.OVFReader(self.ganeti_ovf)\n name = reader.GetDiskTemplate()\n self.assertEqual(name, GANETI_TEMPLATE)", "metadata": "root.TestOVFReader.testGetDiskTemplateGaneti", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 753 }, { "content": " def testGetDiskTemplateEmpty(self):\n reader = ovf.OVFReader(self.empty_ovf)\n name = reader.GetDiskTemplate()\n self.assertEqual(name, EMPTY_TEMPLATE)", "metadata": "root.TestOVFReader.testGetDiskTemplateEmpty", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 758 }, { "content": " def testGetTagsGaneti(self):\n reader = ovf.OVFReader(self.ganeti_ovf)\n tags = reader.GetTagsData()\n self.assertEqual(tags, GANETI_TAGS)", "metadata": "root.TestOVFReader.testGetTagsGaneti", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 763 }, { "content": " def testGetTagsEmpty(self):\n reader = ovf.OVFReader(self.empty_ovf)\n tags = reader.GetTagsData()\n self.assertEqual(tags, EMPTY_TAGS)", "metadata": "root.TestOVFReader.testGetTagsEmpty", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 768 }, { "content": " def testGetVersionGaneti(self):\n reader = ovf.OVFReader(self.ganeti_ovf)\n version = reader.GetVersionData()\n self.assertEqual(version, GANETI_VERSION)", "metadata": "root.TestOVFReader.testGetVersionGaneti", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 773 }, { "content": " def testGetVersionEmpty(self):\n reader = ovf.OVFReader(self.empty_ovf)\n version = reader.GetVersionData()\n self.assertEqual(version, EMPTY_VERSION)", "metadata": "root.TestOVFReader.testGetVersionEmpty", "header": "['class', 'TestOVFReader', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 778 }, { "content": "class TestOVFWriter(BetterUnitTest):\n\n\n\n\n\n\n\n\n", "metadata": "root.TestOVFWriter", "header": "['module', '___EOS___']", "index": 784 }, { "content": " def setUp(self):\n self.writer = ovf.OVFWriter(True)", "metadata": "root.TestOVFWriter.setUp", "header": "['class', 'TestOVFWriter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 785 }, { "content": " def tearDown(self):\n pass", "metadata": "root.TestOVFWriter.tearDown", "header": "['class', 'TestOVFWriter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 788 }, { "content": " def testOVFWriterInit(self):\n result = ET.tostring(self.writer.tree)\n self.assertTrue(EXPORT_EMPTY in result)", "metadata": "root.TestOVFWriter.testOVFWriterInit", "header": "['class', 'TestOVFWriter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 791 }, { "content": " def testSaveDisksDataEmpty(self):\n self.writer.SaveDisksData([])\n result = ET.tostring(self.writer.tree)\n self.assertTrue(EXPORT_DISKS_EMPTY in result)", "metadata": "root.TestOVFWriter.testSaveDisksDataEmpty", "header": "['class', 'TestOVFWriter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 795 }, { "content": " def testSaveDisksData(self):\n self.writer.SaveDisksData(EXP_DISKS_LIST)\n result = ET.tostring(self.writer.tree)\n self.assertTrue(EXPORT_DISKS in result)", "metadata": "root.TestOVFWriter.testSaveDisksData", "header": "['class', 'TestOVFWriter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 800 }, { "content": " def testSaveNetworkDataEmpty(self):\n self.writer.SaveNetworksData([])\n result = ET.tostring(self.writer.tree)\n self.assertTrue(EXPORT_NETWORKS_EMPTY in result)", "metadata": "root.TestOVFWriter.testSaveNetworkDataEmpty", "header": "['class', 'TestOVFWriter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 805 }, { "content": " def testSaveNetworksData(self):\n self.writer.SaveNetworksData(EXP_NETWORKS_LIST)\n result = ET.tostring(self.writer.tree)\n self.assertTrue(EXPORT_NETWORKS in result)", "metadata": "root.TestOVFWriter.testSaveNetworksData", "header": "['class', 'TestOVFWriter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 810 }, { "content": " def testSaveGanetiDataIncomplete(self):\n self.writer.SaveGanetiData(EXP_PARTIAL_GANETI_DICT, EXP_NETWORKS_LIST)\n result = ET.tostring(self.writer.tree)\n self.assertTrue(EXPORT_GANETI_INCOMPLETE in result)", "metadata": "root.TestOVFWriter.testSaveGanetiDataIncomplete", "header": "['class', 'TestOVFWriter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 815 }, { "content": " def testSaveGanetiDataComplete(self):\n self.writer.SaveGanetiData(EXP_GANETI_DICT, EXP_NETWORKS_LIST)\n result = ET.tostring(self.writer.tree)\n self.assertTrue(EXPORT_GANETI in result)", "metadata": "root.TestOVFWriter.testSaveGanetiDataComplete", "header": "['class', 'TestOVFWriter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 820 }, { "content": " def testSaveVirtualSystem(self):\n self.writer.SaveDisksData(EXP_DISKS_LIST)\n self.writer.SaveNetworksData(EXP_NETWORKS_LIST)\n self.writer.SaveVirtualSystemData(EXP_NAME, EXP_VCPUS, EXP_MEMORY)\n result = ET.tostring(self.writer.tree)\n self.assertTrue(EXPORT_SYSTEM in result)", "metadata": "root.TestOVFWriter.testSaveVirtualSystem", "header": "['class', 'TestOVFWriter', '(', 'BetterUnitTest', ')', ':', '___EOS___']", "index": 825 } ]
[ { "span": "import sys", "start_line": 39, "start_column": 0, "end_line": 39, "end_column": 10 }, { "span": "import tempfile", "start_line": 40, "start_column": 0, "end_line": 40, "end_column": 15 }, { "span": "from ganeti import utils", "start_line": 51, "start_column": 0, "end_line": 51, "end_column": 24 } ]
[]
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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2011", ",", " ", "2012", " ", "Goo", "gle", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "2", ".", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ER", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR_", "\\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_", "\"\"\"", "Script", " ", "for", " ", "testi", "ng", " ", "gane", "ti", ".", "ov", "f", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "optparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\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_", "xml_", "._", "etree_", "._", "Element", "Tree_", "as_", "ET_", "\\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_", "element", "tree_", "._", "Element", "Tree_", "as_", "ET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "gane", "ti_", "import_", "constants_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "import_", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "import_", "ov", "f_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "gane", "ti_", "import_", "path", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "testutils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "OUTPU", "T", "\\u", "DIR_", "=_", "\"", "newdi", "r", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "GAN", "ETI", "\\u", "DISK", "S_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "\\u", "count", "\"_", ":_", "\"", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "0", "\\u", "dump", "\"_", ":_", "\"", "new", "\\u", "disk", ".", "raw", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "0", "\\u", "size", "\"_", ":_", "\"", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "0", "\\u", "iv", "name", "\"_", ":_", "\"", "disk", "/", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GAN", "ETI", "\\u", "NET", "WORKS", "_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "\\u", "count", "\"_", ":_", "\"", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "0", "\\u", "mode", "\"_", ":_", "\"", "bridge", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "0", "\\u", "ip", "\"_", ":_", "\"", "none", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "0", "\\u", "mac", "\"_", ":_", "\"", "aa", ":", "00", ":", "00", ":", "d8", ":", "2c", ":", "1e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "0", "\\u", "link", "\"_", ":_", "\"", "xen", "-", "br", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "0", "\\u", "network", "\"_", ":_", "\"", "auto", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GAN", "ETI", "\\u", "HYP", "ERV", "ISO", "R_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hypervisor", "\\u", "name", "\"_", ":_", "\"", "xen", "-", "pv", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "root", "-", "path", "\"_", ":_", "\"/", "dev", "/", "sda", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "kernel", "\\u", "args", "\"_", ":_", "\"", "ro", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GAN", "ETI", "\\u", "OS_", "=_", "{_", "\"", "os", "\\u", "name", "\"_", ":_", "\"", "len", "ny", "-", "image", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GAN", "ETI", "\\u", "BACKEND_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vcpu", "s", "\"_", ":_", "\"", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "memory", "\"_", ":_", "\"", "204", "8", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "auto", "\\u", "balance", "\"_", ":_", "\"", "Fal", "se", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GAN", "ETI", "\\u", "NAME_", "=_", "\"", "gane", "ti", "-", "test", "-", "xen", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GAN", "ETI", "\\u", "TEMPLATE_", "=_", "\"", "plain", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GAN", "ETI", "\\u", "TAGS_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "GAN", "ETI", "\\u", "VERSION_", "=_", "\"", "0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "VIRTUAL", "BO", "X", "\\u", "DISK", "S_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "\\u", "count", "\"_", ":_", "\"", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "0", "\\u", "iv", "name", "\"_", ":_", "\"", "disk", "/", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "0", "\\u", "dump", "\"_", ":_", "\"", "new", "\\u", "disk", ".", "raw", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "0", "\\u", "size", "\"_", ":_", "\"", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "1", "\\u", "iv", "name", "\"_", ":_", "\"", "disk", "/", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "1", "\\u", "dump", "\"_", ":_", "\"", "second", "\\u", "disk", ".", "raw", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "1", "\\u", "size", "\"_", ":_", "\"", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIRTUAL", "BO", "X", "\\u", "NET", "WORKS", "_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "\\u", "count", "\"_", ":_", "\"", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "0", "\\u", "mode", "\"_", ":_", "\"", "bridge", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "0", "\\u", "ip", "\"_", ":_", "\"", "none", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "0", "\\u", "link", "\"_", ":_", "\"", "auto", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "0", "\\u", "mac", "\"_", ":_", "\"", "auto", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "0", "\\u", "network", "\"_", ":_", "\"", "auto", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIRTUAL", "BO", "X", "\\u", "HYP", "ERV", "ISO", "R_", "=_", "{_", "\"", "hypervisor", "\\u", "name", "\"_", ":_", "\"", "auto", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIRTUAL", "BO", "X", "\\u", "OS_", "=_", "{_", "\"", "os", "\\u", "name", "\"_", ":_", "None_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIRTUAL", "BO", "X", "\\u", "BACKEND_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vcpu", "s", "\"_", ":_", "\"", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "memory", "\"_", ":_", "\"", "204", "8", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "auto", "\\u", "balance", "\"_", ":_", "\"", "auto", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIRTUAL", "BO", "X", "\\u", "NAME_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIRTUAL", "BO", "X", "\\u", "TEMPLATE_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIRTUAL", "BO", "X", "\\u", "TAGS_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "VIRTUAL", "BO", "X", "\\u", "VERSION_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "EMP", "TY", "\\u", "DISK", "S_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EMP", "TY", "\\u", "NET", "WORKS", "_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EMP", "TY", "\\u", "HYP", "ERV", "ISO", "R_", "=_", "{_", "\"", "hypervisor", "\\u", "name", "\"_", ":_", "\"", "auto", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EMP", "TY", "\\u", "OS_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EMP", "TY", "\\u", "BACKEND_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vcpu", "s", "\"_", ":_", "\"", "auto", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "memory", "\"_", ":_", "\"", "auto", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "auto", "\\u", "balance", "\"_", ":_", "\"", "auto", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EMP", "TY", "\\u", "NAME_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EMP", "TY", "\\u", "TEMPLATE_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EMP", "TY", "\\u", "TAGS_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EMP", "TY", "\\u", "VERSION_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "CMD", "ARG", "S", "\\u", "DISK", "S_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "\\u", "count", "\"_", ":_", "\"", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "0", "\\u", "iv", "name", "\"_", ":_", "\"", "disk", "/", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "0", "\\u", "dump", "\"_", ":_", "\"", "disk", "0.", "raw", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "0", "\\u", "size", "\"_", ":_", "\"", "8", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CMD", "ARG", "S", "\\u", "NET", "WORKS", "_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "0", "\\u", "link", "\"_", ":_", "\"", "auto", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "0", "\\u", "mode", "\"_", ":_", "\"", "bridge", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "0", "\\u", "ip", "\"_", ":_", "\"", "none", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "0", "\\u", "mac", "\"_", ":_", "\"", "auto", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "\\u", "count", "\"_", ":_", "\"", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "0", "\\u", "network", "\"_", ":_", "\"", "auto", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CMD", "ARG", "S", "\\u", "HYP", "ERV", "ISO", "R_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hypervisor", "\\u", "name", "\"_", ":_", "\"", "xen", "-", "pv", "m", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CMD", "ARG", "S", "\\u", "OS_", "=_", "{_", "\"", "os", "\\u", "name", "\"_", ":_", "\"", "len", "ny", "-", "image", "\"_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CMD", "ARG", "S", "\\u", "BACKEND_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "auto", "\\u", "balance", "\"_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vcpu", "s", "\"_", ":_", "\"", "1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "memory", "\"_", ":_", "\"", "256", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CMD", "ARG", "S", "\\u", "NAME_", "=_", "\"", "test", "-", "instance", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CMD", "ARG", "S", "\\u", "TEMPLATE_", "=_", "\"", "plain", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CMD", "ARG", "S", "\\u", "TAGS_", "=_", "\"", "test", "-", "tag", "-1", ",", "test", "-", "tag", "-", "2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ARG", "S", "\\u", "EMPTY_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "output", "\\u", "dir", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "s", "\"_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disks", "\"_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "test", "-", "instance", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ova", "\\u", "package", "\"_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ext", "\\u", "usage", "\"_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "\\u", "format", "\"_", ":_", "\"", "cow", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "compress", "ion", "\"_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ARG", "S", "\\u", "EXPORT", "\\u", "DIR_", "=_", "dict_", "(_", "ARG", "S", "\\u", "EMPTY_", ",_", "**_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "output", "\\u", "dir", "\"_", ":_", "OUTPU", "T", "\\u", "DIR_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hypervisor", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "os", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "be", "params", "\"_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "no", "\\u", "nic", "s", "\"_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "\\u", "template", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tags", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ARG", "S", "\\u", "VB", "OX", "_", "=_", "dict_", "(_", "ARG", "S", "\\u", "EXPORT", "\\u", "DIR_", ",_", "**_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "output", "\\u", "dir", "\"_", ":_", "OUTPU", "T", "\\u", "DIR_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "test", "-", "instance", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "os", "\"_", ":_", "\"", "len", "ny", "-", "image", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hypervisor", "\"_", ":_", "(_", "\"", "xen", "-", "pv", "m", "\"_", ",_", "{_", "}_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "osp", "aram", "s", "\"_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "osp", "aram", "s", "\\u", "private", "\"_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disks", "\"_", ":_", "[_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ARG", "S", "\\u", "COMPLETE_", "=_", "dict_", "(_", "ARG", "S", "\\u", "VB", "OX", "_", ",_", "**_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "be", "params", "\"_", ":_", "{_", "\"", "vcpu", "s", "\"_", ":_", "\"", "1", "\"_", ",_", "\"", "memory", "\"_", ":_", "\"", "256", "\"_", ",_", "\"", "auto", "\\u", "balance", "\"_", ":_", "False_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disks", "\"_", ":_", "[_", "(_", "0_", ",_", "{_", "\"", "size", "\"_", ":_", "\"", "5", "mb", "\"_", "}_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "nic", "s", "\"_", ":_", "[_", "(_", "\"", "0", "\"_", ",_", "{_", "\"", "mode", "\"_", ":_", "\"", "bridge", "d", "\"_", "}_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "\\u", "template", "\"_", ":_", "\"", "plain", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tags", "\"_", ":_", "\"", "test", "-", "tag", "-1", ",", "test", "-", "tag", "-", "2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ARG", "S", "\\u", "BRO", "KEN", "_", "=_", "dict_", "(_", "ARG", "S", "\\u", "EXPORT", "\\u", "DIR_", ",_", "**_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "no", "\\u", "nic", "s", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "\\u", "template", "\"_", ":_", "\"", "disk", "less", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "test", "-", "instance", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "os", "\"_", ":_", "\"", "len", "ny", "-", "image", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "osp", "aram", "s", "\"_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "osp", "aram", "s", "\\u", "private", "\"_", ":_", "{_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "EXP", "\\u", "ARG", "S", "\\u", "COMPRESS", "ED_", "=_", "dict_", "(_", "ARG", "S", "\\u", "EXPORT", "\\u", "DIR_", ",_", "**_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "compress", "ion", "\"_", ":_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "EXP", "\\u", "DISK", "S", "\\u", "LIST_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "format", "\"_", ":_", "\"", "vmd", "k", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "compress", "ion", "\"_", ":_", "\"", "gzip", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "virt", "-", "size", "\"_", ":_", "9000", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "real", "-", "size", "\"_", ":_", "203_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "path", "\"_", ":_", "\"", "new", "\\u", "disk", ".", "cow", ".", "gz", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "format", "\"_", ":_", "\"", "cow", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "virt", "-", "size", "\"_", ":_", "15_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "real", "-", "size", "\"_", ":_", "15_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "path", "\"_", ":_", "\"", "new", "\\u", "disk", ".", "cow", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXP", "\\u", "NET", "WORKS", "\\u", "LIST_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "mac", "\"_", ":_", "\"", "aa", ":", "00", ":", "00", ":", "d8", ":", "2c", ":", "1e", "\"_", ",_", "\"", "ip", "\"_", ":_", "\"", "Non", "e", "\"_", ",_", "\"", "link", "\"_", ":_", "\"", "br", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mode", "\"_", ":_", "\"", "route", "d", "\"_", ",_", "\"", "network", "\"_", ":_", "\"", "test", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXP", "\\u", "PARTI", "AL", "\\u", "GAN", "ETI", "\\u", "DICT_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hypervisor", "\"_", ":_", "{_", "\"", "name", "\"_", ":_", "\"", "xen", "-", "kvm", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "os", "\"_", ":_", "{_", "\"", "name", "\"_", ":_", "\"", "len", "ny", "-", "image", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "auto", "\\u", "balance", "\"_", ":_", "\"", "Tru", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "version", "\"_", ":_", "\"", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXP", "\\u", "GAN", "ETI", "\\u", "DICT_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tags", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "auto", "\\u", "balance", "\"_", ":_", "\"", "Fal", "se", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "hypervisor", "\"_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "root", "-", "path", "\"_", ":_", "\"/", "dev", "/", "sda", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "name", "\"_", ":_", "\"", "xen", "-", "pv", "m", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "kernel", "\\u", "args", "\"_", ":_", "\"", "ro", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "version", "\"_", ":_", "\"", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "\\u", "template", "\"_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "os", "\"_", ":_", "{_", "\"", "name", "\"_", ":_", "\"", "len", "ny", "-", "image", "\"_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXP", "\\u", "NAME_", "=_", "\"", "xen", "-", "dev", "-", "i1", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXP", "\\u", "VC", "PU", "S_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXP", "\\u", "MEM", "ORY", "_", "=_", "512_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "EXPORT", "\\u", "EMPTY_", "=_", "(_", "\"<", "Env", "elope", " ", "xml", ":", "lang", "=\\\\\"", "en", "-", "US", "\\\\\"", " ", "xml", "ns", "=\\\\\"", "http", "://", "schema", "s", ".", "dm", "tf", ".", "org", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ov", "f", "/", "envelop", "e", "/", "1", "\\\\\"", " ", "xml", "ns", ":", "gn", "t", "=\\\\\"", "http", "://", "gane", "ti", "\\\\\"", " ", "xml", "ns", ":", "ov", "f", "=\\\\\"", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "http", "://", "schema", "s", ".", "dm", "tf", ".", "org", "/", "ov", "f", "/", "envelop", "e", "/", "1", "\\\\\"", " ", "xml", "ns", ":", "ras", "d", "=\\\\\"", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "http", "://", "schema", "s", ".", "dm", "tf", ".", "org", "/", "wb", "em", "/", "wsc", "im", "/", "1", "/", "cim", "-", "schema", "/", "2", "/", "CI", "M", "\\u", "Reso", "urc", "e", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Allocati", "on", "Sett", "ing", "Data", "\\\\\"", " ", "xml", "ns", ":", "vs", "sd", "=\\\\\"", "http", "://", "schema", "s", ".", "dm", "tf", ".", "org", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "wb", "em", "/", "wsc", "im", "/", "1", "/", "cim", "-", "schema", "/", "2", "/", "CI", "M", "\\u", "Virt", "ual", "System", "Sett", "ing", "Data", "\\\\\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "xml", "ns", ":", "xsi", "=\\\\\"", "http", "://", "www", ".", "w3", ".", "org", "/", "200", "1", "/", "XML", "Schema", "-", "instance", "\\\\\"", " ", "/>\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXPORT", "\\u", "DISK", "S", "\\u", "EMPTY_", "=_", "(_", "\"<", "Reference", "s", " ", "/>", "<", "Disk", "Sect", "ion", "><", "Info", ">", "Virt", "ual", " ", "disk", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "informati", "on", "</", "Info", "><", "/", "Disk", "Sect", "ion", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXPORT", "\\u", "DISK", "S_", "=_", "(_", "\"<", "Reference", "s", "><", "File", " ", "ov", "f", ":", "compress", "ion", "=\\\\\"", "gzip", "\\\\\"", " ", "ov", "f", ":", "href", "=\\\\\"", "new", "\\u", "disk", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\".", "cow", ".", "gz", "\\\\\"", " ", "ov", "f", ":", "id", "=\\\\\"", "file", "0", "\\\\\"", " ", "ov", "f", ":", "size", "=\\\\\"", "203", "\\\\\"", " ", "/>", "<", "File", " ", "ov", "f", ":", "href", "=\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\\\\"", "new", "\\u", "disk", ".", "cow", "\\\\\"", " ", "ov", "f", ":", "id", "=\\\\\"", "file", "1", "\\\\\"", " ", "ov", "f", ":", "size", "=\\\\\"", "15", "\\\\\"", " ", "/>\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "/", "Reference", "s", "><", "Disk", "Sect", "ion", "><", "Info", ">", "Virt", "ual", " ", "disk", " ", "informati", "on", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "/", "Info", "><", "Disk", " ", "ov", "f", ":", "capacit", "y", "=\\\\\"", "9000", "0", "\\\\\"", " ", "ov", "f", ":", "disk", "Id", "=\\\\\"", "disk", "0", "\\\\\"", " ", "ov", "f", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\":", "file", "Ref", "=\\\\\"", "file", "0", "\\\\\"", " ", "ov", "f", ":", "format", "=\\\\\"", "http", "://", "www", ".", "vmw", "are", ".", "com", "/\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "interface", "s", "/", "specifica", "tion", "s", "/", "vmd", "k", ".", "html", "#", "mono", "lith", "ic", "Spar", "se", "\\\\\"", " ", "/>", "<", "Disk", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "ov", "f", ":", "capacit", "y", "=\\\\\"", "15", "\\\\\"", " ", "ov", "f", ":", "disk", "Id", "=\\\\\"", "disk", "1", "\\\\\"", " ", "ov", "f", ":", "file", "Ref", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"=", "\\\\\"", "file", "1", "\\\\\"", " ", "ov", "f", ":", "format", "=\\\\\"", "http", "://", "www", ".", "gno", "me", ".", "org", "/", "~", "mark", "mc", "/", "qcow", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"-", "image", "-", "format", ".", "html", "\\\\\"", " ", "/>", "</", "Disk", "Sect", "ion", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXPORT", "\\u", "NET", "WORKS", "\\u", "EMPTY_", "=_", "(_", "\"<", "Network", "Sect", "ion", "><", "Info", ">", "List", " ", "of", " ", "logical", " ", "network", "s", "</", "Info", ">\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "/", "Network", "Sect", "ion", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXPORT", "\\u", "NET", "WORKS", "_", "=_", "(_", "\"<", "Network", "Sect", "ion", "><", "Info", ">", "List", " ", "of", " ", "logical", " ", "network", "s", "</", "Info", ">\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "Network", " ", "ov", "f", ":", "name", "=\\\\\"", "route", "d0", "\\\\\"", " ", "/>", "</", "Network", "Sect", "ion", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXPORT", "\\u", "GAN", "ETI", "\\u", "INCOM", "PLE", "TE_", "=_", "(_", "\"<", "gn", "t", ":", "Gan", "eti", "Sect", "ion", "><", "gn", "t", ":", "Version", ">", "0", "</", "gn", "t", ":", "Version", ">\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "gn", "t", ":", "Auto", "Balance", ">", "Tru", "e", "</", "gn", "t", ":", "Auto", "Balance", "><", "gn", "t", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Opera", "ting", "System", "><", "gn", "t", ":", "Name", ">", "len", "ny", "-", "image", "</", "gn", "t", ":", "Name", ">\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "gn", "t", ":", "Parameter", "s", " ", "/>", "</", "gn", "t", ":", "Opera", "ting", "System", "><", "gn", "t", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Hyper", "visor", "><", "gn", "t", ":", "Name", ">", "xen", "-", "kvm", "</", "gn", "t", ":", "Name", "><", "gn", "t", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Parameter", "s", " ", "/>", "</", "gn", "t", ":", "Hyper", "visor", "><", "gn", "t", ":", "Network", "><", "gn", "t", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Nic", " ", "ov", "f", ":", "name", "=\\\\\"", "route", "d0", "\\\\\"><", "gn", "t", ":", "Mode", ">", "route", "d", "</", "gn", "t", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Mode", "><", "gn", "t", ":", "MAC", "Address", ">", "aa", ":", "00", ":", "00", ":", "d8", ":", "2c", ":", "1e", "</", "gn", "t", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "MAC", "Address", "><", "gn", "t", ":", "IPA", "ddress", ">", "Non", "e", "</", "gn", "t", ":", "IPA", "ddress", ">\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "gn", "t", ":", "Link", ">", "br", "0", "</", "gn", "t", ":", "Link", "><", "gn", "t", ":", "Net", ">", "test", "</", "gn", "t", ":", "Net", ">\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "/", "gn", "t", ":", "Nic", "><", "/", "gn", "t", ":", "Network", "><", "/", "gn", "t", ":", "Gan", "eti", "Sect", "ion", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXPORT", "\\u", "GAN", "ETI", "_", "=_", "(_", "\"<", "gn", "t", ":", "Gan", "eti", "Sect", "ion", "><", "gn", "t", ":", "Version", ">", "0", "</", "gn", "t", ":", "Version", "><", "gn", "t", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Auto", "Balance", ">", "Fal", "se", "</", "gn", "t", ":", "Auto", "Balance", "><", "gn", "t", ":", "Opera", "ting", "System", ">\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "gn", "t", ":", "Name", ">", "len", "ny", "-", "image", "</", "gn", "t", ":", "Name", "><", "gn", "t", ":", "Parameter", "s", " ", "/>", "</", "gn", "t", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Opera", "ting", "System", "><", "gn", "t", ":", "Hyper", "visor", "><", "gn", "t", ":", "Name", ">", "xen", "-", "pv", "m", "</", "gn", "t", ":", "Name", ">\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "gn", "t", ":", "Parameter", "s", "><", "gn", "t", ":", "root", "-", "path", ">/", "dev", "/", "sda", "</", "gn", "t", ":", "root", "-", "path", "><", "gn", "t", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "kernel", "\\u", "args", ">", "ro", "</", "gn", "t", ":", "kernel", "\\u", "args", "><", "/", "gn", "t", ":", "Parameter", "s", "><", "/", "gn", "t", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Hyper", "visor", "><", "gn", "t", ":", "Network", "><", "gn", "t", ":", "Nic", " ", "ov", "f", ":", "name", "=\\\\\"", "route", "d0", "\\\\\"><", "gn", "t", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Mode", ">", "route", "d", "</", "gn", "t", ":", "Mode", "><", "gn", "t", ":", "MAC", "Address", ">", "aa", ":", "00", ":", "00", ":", "d8", ":", "2c", ":", "1e", "</", "gn", "t", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "MAC", "Address", "><", "gn", "t", ":", "IPA", "ddress", ">", "Non", "e", "</", "gn", "t", ":", "IPA", "ddress", "><", "gn", "t", ":", "Link", ">", "br", "0", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "/", "gn", "t", ":", "Link", "><", "gn", "t", ":", "Net", ">", "test", "</", "gn", "t", ":", "Net", "><", "/", "gn", "t", ":", "Nic", "><", "/", "gn", "t", ":", "Network", ">\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "/", "gn", "t", ":", "Gan", "eti", "Sect", "ion", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXPORT", "\\u", "SYSTEM", "_", "=_", "(_", "\"<", "Reference", "s", "><", "File", " ", "ov", "f", ":", "compress", "ion", "=\\\\\"", "gzip", "\\\\\"", " ", "ov", "f", ":", "href", "=\\\\\"", "new", "\\u\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", ".", "cow", ".", "gz", "\\\\\"", " ", "ov", "f", ":", "id", "=\\\\\"", "file", "0", "\\\\\"", " ", "ov", "f", ":", "size", "=\\\\\"", "203", "\\\\\"", " ", "/>", "<", "File", " ", "ov", "f", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "href", "=\\\\\"", "new", "\\u", "disk", ".", "cow", "\\\\\"", " ", "ov", "f", ":", "id", "=\\\\\"", "file", "1", "\\\\\"", " ", "ov", "f", ":", "size", "=\\\\\"", "15", "\\\\\"", " ", "/>\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "/", "Reference", "s", "><", "Disk", "Sect", "ion", "><", "Info", ">", "Virt", "ual", " ", "disk", " ", "informati", "on", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "/", "Info", "><", "Disk", " ", "ov", "f", ":", "capacit", "y", "=\\\\\"", "9000", "0", "\\\\\"", " ", "ov", "f", ":", "disk", "Id", "=\\\\\"", "disk", "0", "\\\\\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "ov", "f", ":", "file", "Ref", "=\\\\\"", "file", "0", "\\\\\"", " ", "ov", "f", ":", "format", "=\\\\\"", "http", "://", "www", ".", "vmw", "are", ".", "com", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "interface", "s", "/", "specifica", "tion", "s", "/", "vmd", "k", ".", "html", "#", "mono", "lith", "ic", "Spar", "se", "\\\\\"", " ", "/>\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "Disk", " ", "ov", "f", ":", "capacit", "y", "=\\\\\"", "15", "\\\\\"", " ", "ov", "f", ":", "disk", "Id", "=\\\\\"", "disk", "1", "\\\\\"", " ", "ov", "f", ":", "file", "Ref", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"=", "\\\\\"", "file", "1", "\\\\\"", " ", "ov", "f", ":", "format", "=\\\\\"", "http", "://", "www", ".", "gno", "me", ".", "org", "/", "~", "mark", "mc", "/", "qcow", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"-", "image", "-", "format", ".", "html", "\\\\\"", " ", "/>", "</", "Disk", "Sect", "ion", "><", "Network", "Sect", "ion", "><", "Info", ">\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "List", " ", "of", " ", "logical", " ", "network", "s", "</", "Info", "><", "Network", " ", "ov", "f", ":", "name", "=\\\\\"", "route", "d0", "\\\\\"\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "/>", "</", "Network", "Sect", "ion", "><", "Virt", "ual", "System", " ", "ov", "f", ":", "id", "=\\\\\"", "xen", "-", "dev", "-", "i1", "\\\\\">", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "Info", ">", "A", " ", "virtual", " ", "machine", "</", "Info", "><", "Name", ">", "xen", "-", "dev", "-", "i1", "</", "Name", ">\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "Opera", "ting", "System", "Sect", "ion", " ", "ov", "f", ":", "id", "=\\\\\"", "0", "\\\\\"><", "Info", ">", "Install", "ed", " ", "guest", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "operati", "ng", " ", "system", "</", "Info", "><", "/", "Opera", "ting", "System", "Sect", "ion", "><", "Virt", "ual", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Hard", "ware", "Sect", "ion", "><", "Info", ">", "Virt", "ual", " ", "hard", "ware", " ", "require", "ment", "s", "</", "Info", ">\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "System", "><", "vs", "sd", ":", "Element", "Name", ">", "Virt", "ual", " ", "Hard", "ware", " ", "Famil", "y", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "/", "vs", "sd", ":", "Element", "Name", "><", "vs", "sd", ":", "Insta", "nce", "ID", ">", "0", "</", "vs", "sd", ":", "Insta", "nce", "ID", "><", "vs", "sd", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Virt", "ual", "System", "Identifie", "r", ">", "xen", "-", "dev", "-", "i1", "</", "vs", "sd", ":", "Virt", "ual", "System", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Identifie", "r", "><", "vs", "sd", ":", "Virt", "ual", "System", "Type", ">", "gane", "ti", "-", "ov", "f", "</", "vs", "sd", ":", "Virt", "ual", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "System", "Type", "><", "/", "System", "><", "Item", "><", "ras", "d", ":", "Element", "Name", ">", "1", " ", "virtual", " ", "CPU", "(", "s", ")\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "/", "ras", "d", ":", "Element", "Name", "><", "ras", "d", ":", "Insta", "nce", "ID", ">", "1", "</", "ras", "d", ":", "Insta", "nce", "ID", "><", "ras", "d", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Reso", "urc", "e", "Type", ">", "3", "</", "ras", "d", ":", "Reso", "urc", "e", "Type", "><", "ras", "d", ":", "Virt", "ual", "Quanti", "ty", ">", "1", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "/", "ras", "d", ":", "Virt", "ual", "Quanti", "ty", "><", "/", "Item", "><", "Item", "><", "ras", "d", ":", "Allocati", "on", "Unit", "s", ">\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "byte", " ", "*", " ", "2", "^", "20", "</", "ras", "d", ":", "Allocati", "on", "Unit", "s", "><", "ras", "d", ":", "Element", "Name", ">", "512", "MB", " ", "of", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "memory", "</", "ras", "d", ":", "Element", "Name", "><", "ras", "d", ":", "Insta", "nce", "ID", ">", "2", "</", "ras", "d", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Insta", "nce", "ID", "><", "ras", "d", ":", "Reso", "urc", "e", "Type", ">", "4", "</", "ras", "d", ":", "Reso", "urc", "e", "Type", "><", "ras", "d", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Virt", "ual", "Quanti", "ty", ">", "512", "</", "ras", "d", ":", "Virt", "ual", "Quanti", "ty", "><", "/", "Item", "><", "Item", ">\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "ras", "d", ":", "Address", ">", "0", "</", "ras", "d", ":", "Address", "><", "ras", "d", ":", "Element", "Name", ">", "scs", "i", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"\\u", "controlle", "r", "0", "</", "ras", "d", ":", "Element", "Name", "><", "ras", "d", ":", "Insta", "nce", "ID", ">", "3", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "/", "ras", "d", ":", "Insta", "nce", "ID", "><", "ras", "d", ":", "Reso", "urc", "e", "Sub", "Type", ">", "lsi", "logic", "</", "ras", "d", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\":", "Reso", "urc", "e", "Sub", "Type", "><", "ras", "d", ":", "Reso", "urc", "e", "Type", ">", "6", "</", "ras", "d", ":", "Reso", "urc", "e", "Type", ">\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "/", "Item", "><", "Item", "><", "ras", "d", ":", "Element", "Name", ">", "disk", "0", "</", "ras", "d", ":", "Element", "Name", "><", "ras", "d", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\":", "Host", "Reso", "urc", "e", ">", "ov", "f", ":/", "disk", "/", "disk", "0", "</", "ras", "d", ":", "Host", "Reso", "urc", "e", "><", "ras", "d", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\":", "Insta", "nce", "ID", ">", "4", "</", "ras", "d", ":", "Insta", "nce", "ID", "><", "ras", "d", ":", "Parent", ">", "3", "</", "ras", "d", ":", "Parent", ">\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "ras", "d", ":", "Reso", "urc", "e", "Type", ">", "1", "7", "</", "ras", "d", ":", "Reso", "urc", "e", "Type", "><", "/", "Item", "><", "Item", "><", "ras", "d", ":\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Element", "Name", ">", "disk", "1", "</", "ras", "d", ":", "Element", "Name", "><", "ras", "d", ":", "Host", "Reso", "urc", "e", ">", "ov", "f", ":/", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "disk", "/", "disk", "1", "</", "ras", "d", ":", "Host", "Reso", "urc", "e", "><", "ras", "d", ":", "Insta", "nce", "ID", ">", "5", "</", "ras", "d", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\":", "Insta", "nce", "ID", "><", "ras", "d", ":", "Parent", ">", "3", "</", "ras", "d", ":", "Parent", "><", "ras", "d", ":", "Reso", "urc", "e", "Type", ">", "1", "7", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "/", "ras", "d", ":", "Reso", "urc", "e", "Type", "><", "/", "Item", "><", "Item", "><", "ras", "d", ":", "Address", ">", "aa", ":", "00", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\":", "00", ":", "d8", ":", "2c", ":", "1e", "</", "ras", "d", ":", "Address", "><", "ras", "d", ":", "Connect", "ion", ">", "route", "d0", "</", "ras", "d", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\":", "Connect", "ion", "><", "ras", "d", ":", "Element", "Name", ">", "route", "d0", "</", "ras", "d", ":", "Element", "Name", "><", "ras", "d", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\":", "Insta", "nce", "ID", ">", "6", "</", "ras", "d", ":", "Insta", "nce", "ID", "><", "ras", "d", ":", "Reso", "urc", "e", "Type", ">", "10", "</", "ras", "d", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\":", "Reso", "urc", "e", "Type", "><", "/", "Item", "><", "/", "Virt", "ual", "Hard", "ware", "Sect", "ion", ">\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"<", "/", "Virt", "ual", "System", ">\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "OPT", "S", "\\u", "EMPTY_", "=_", "\\u", "Get", "Args_", "(_", "ARG", "S", "\\u", "EMPTY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OPT", "S", "\\u", "EXPORT", "\\u", "NO", "\\u", "NAME_", "=_", "\\u", "Get", "Args_", "(_", "ARG", "S", "\\u", "EXPORT", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OPT", "S", "\\u", "EXPORT", "_", "=_", "\\u", "Get", "Args_", "(_", "ARG", "S", "\\u", "EXPORT", "\\u", "DIR_", ",_", "with", "\\u", "name_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "EXP", "\\u", "OPTS_", "=_", "OPT", "S", "\\u", "EXPORT", "\\u", "NO", "\\u", "NAME_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "EXP", "\\u", "OPT", "S", "\\u", "COMPRESS", "ED_", "=_", "\\u", "Get", "Args_", "(_", "EXP", "\\u", "ARG", "S", "\\u", "COMPRESS", "ED_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "OPT", "S", "\\u", "VB", "OX", "_", "=_", "\\u", "Get", "Args_", "(_", "ARG", "S", "\\u", "VB", "OX", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OPT", "S", "\\u", "COMPLETE_", "=_", "\\u", "Get", "Args_", "(_", "ARG", "S", "\\u", "COMPLETE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "OPT", "S", "\\u", "NON", "IC", "\\u", "NOD", "IS", "K_", "=_", "\\u", "Get", "Args_", "(_", "ARG", "S", "\\u", "BRO", "KEN", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "testutils_", "._", "Gan", "eti", "Test", "Program_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "Get", "Args_", "(_", "args_", ",_", "with", "\\u", "name_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "options_", "=_", "optparse_", "._", "Values_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "needed_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "with", "\\u", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "needed_", "[_", "\"", "name", "\"_", "]_", "=_", "\"", "test", "-", "instance", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "options_", "._", "\\u", "update", "\\u", "loose", "_", "(_", "needed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "Get", "Full", "Filename_", "(_", "file", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "path_", "=_", "\"%", "s", "/", "test", "/", "data", "/", "ov", "fdata", "/", "%", "s", "\"_", "%_", "(_", "testutils_", "._", "Get", "Sou", "rce", "Dir_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "file", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "\\u", "path_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "file", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "file", "\\u", "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_", "class_", "Bet", "ter", "Unit", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Bet", "ter", "Unit", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "assert", "Rai", "ses", "Regexp_", "(_", "self_", ",_", "exception_", ",_", "regexp", "\\u", "val_", ",_", "function_", ",_", "*_", "args_", ")_", ":_", "\\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 ", " _", "function_", "(_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fail_", "(_", "\"", "Expect", "ed", " ", "rais", "ing", " ", "%", "s", "\"_", "%_", "exception_", ")_", "\\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 ", " _", "regexp_", "=_", "re_", "._", "compile_", "(_", "regexp", "\\u", "val_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "re_", "._", "search_", "(_", "regexp_", ",_", "str_", "(_", "err_", ")_", ")_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Expect", "ed", " ", "matchi", "ng", " ", "'%", "s", "',", " ", "got", " ", "'%", "s", "'\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "regexp", "\\u", "val_", ",_", "str_", "(_", "err_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\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", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "non", "\\u", "exist", "ing", "\\u", "file_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "not", "\\u", "the", "\\u", "file", ".", "ov", "f", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "gane", "ti", "\\u", "ov", "f_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "gane", "ti", ".", "ov", "f", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "virtual", "box", "\\u", "ov", "f_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "virtual", "box", ".", "ov", "f", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ova", "\\u", "package_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "ova", ".", "ova", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "empty", "\\u", "ov", "f_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "empty", ".", "ov", "f", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wrong", "\\u", "extension_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "wrong", "\\u", "extensi", "on", ".", "ov", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wrong", "\\u", "ova", "\\u", "archive_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "wrong", "\\u", "ova", ".", "ova", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "no", "\\u", "ov", "f", "\\u", "in", "\\u", "ova", "_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "no", "\\u", "ov", "f", ".", "ova", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "importer_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "importer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "._", "Cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "OUTPU", "T", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "del", "\\u", "dir_", ")_", "\\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_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\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", "File", "Do", "es", "Not", "Exist", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\"", "doe", "s", " ", "not", " ", "exist", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", ",_", "self_", "._", "non", "\\u", "exist", "ing", "\\u", "file_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Wro", "ng", "Inp", "ut", "File", "Ext", "ensi", "on", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Un", "know", "n", " ", "file", " ", "extensi", "on", "\"_", ",_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wrong", "\\u", "extension_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "OV", "AU", "npa", "ck", "ing", "Director", "ies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "ova", "\\u", "package_", ",_", "OPT", "S", "\\u", "EMPTY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "importer_", "._", "input", "\\u", "dir_", "!=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "output", "\\u", "dir_", ",_", "path", "utils_", "._", "EXPORT", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "importer_", "._", "temp", "\\u", "dir_", "!=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "OV", "FU", "npa", "ck", "ing", "Director", "ies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "virtual", "box", "\\u", "ov", "f_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "OPT", "S", "\\u", "EMPTY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "input", "\\u", "dir_", ",_", "\\u", "Get", "Full", "Filename_", "(_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "output", "\\u", "dir_", ",_", "path", "utils_", "._", "EXPORT", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "temp", "\\u", "dir_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "OV", "FS", "et", "Output", "Dir", "Director", "ies_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "gane", "ti", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "EXPORT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "input", "\\u", "dir_", ",_", "\\u", "Get", "Full", "Filename_", "(_", "\"\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "OUTPU", "T", "\\u", "DIR_", "in_", "self_", "._", "importer_", "._", "output", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "temp", "\\u", "dir_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Wro", "ng", "OV", "AA", "rchi", "ve", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\"", "not", " ", "a", " ", "proper", " ", "tar", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", ",_", "self_", "._", "wrong", "\\u", "ova", "\\u", "archive_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "No", "OV", "FF", "ile", "In", "OV", "AP", "ack", "age", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\"", "No", " ", ".", "ov", "f", " ", "file", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", ",_", "self_", "._", "no", "\\u", "ov", "f", "\\u", "in", "\\u", "ova", "_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pars", "e", "Gan", "eti", "Ov", "f_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "gane", "ti", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "EXPORT", "\\u", "NO", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "importer_", "._", "Parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"%", "s", "/", "gane", "ti", "-", "test", "-", "xen", "\"_", "%_", "OUTPU", "T", "\\u", "DIR_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "importer_", "._", "output", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "disk_", ",_", "GAN", "ETI", "\\u", "DISK", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "network_", ",_", "GAN", "ETI", "\\u", "NET", "WORKS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "hypervisor", "_", ",_", "GAN", "ETI", "\\u", "HYP", "ERV", "ISO", "R_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "os_", ",_", "GAN", "ETI", "\\u", "OS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "backend_", ",_", "GAN", "ETI", "\\u", "BACKEND_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "name_", ",_", "GAN", "ETI", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "template_", ",_", "GAN", "ETI", "\\u", "TEMPLATE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "tags_", ",_", "GAN", "ETI", "\\u", "TAGS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "version_", ",_", "GAN", "ETI", "\\u", "VERSION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pars", "e", "Virt", "ual", "box", "Ov", "f_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "virtual", "box", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "VB", "OX", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "importer_", "._", "Parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"%", "s", "/", "test", "-", "instance", "\"_", "%_", "OUTPU", "T", "\\u", "DIR_", "in_", "self_", "._", "importer_", "._", "output", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "disk_", ",_", "VIRTUAL", "BO", "X", "\\u", "DISK", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "network_", ",_", "VIRTUAL", "BO", "X", "\\u", "NET", "WORKS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "hypervisor", "_", ",_", "CMD", "ARG", "S", "\\u", "HYP", "ERV", "ISO", "R_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "os_", ",_", "CMD", "ARG", "S", "\\u", "OS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "backend_", ",_", "VIRTUAL", "BO", "X", "\\u", "BACKEND_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "name_", ",_", "CMD", "ARG", "S", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "template_", ",_", "VIRTUAL", "BO", "X", "\\u", "TEMPLATE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "tags_", ",_", "VIRTUAL", "BO", "X", "\\u", "TAGS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "version_", ",_", "constants_", "._", "EXPORT", "\\u", "VERSION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pars", "e", "Emp", "ty", "Ov", "f_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "COMPLETE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "importer_", "._", "Parse_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "\"%", "s", "/", "test", "-", "instance", "\"_", "%_", "OUTPU", "T", "\\u", "DIR_", "in_", "self_", "._", "importer_", "._", "output", "\\u", "dir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "disk_", ",_", "CMD", "ARG", "S", "\\u", "DISK", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "network_", ",_", "CMD", "ARG", "S", "\\u", "NET", "WORKS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "hypervisor", "_", ",_", "CMD", "ARG", "S", "\\u", "HYP", "ERV", "ISO", "R_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "os_", ",_", "CMD", "ARG", "S", "\\u", "OS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "backend_", ",_", "CMD", "ARG", "S", "\\u", "BACKEND_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "name_", ",_", "CMD", "ARG", "S", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "template_", ",_", "CMD", "ARG", "S", "\\u", "TEMPLATE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "tags_", ",_", "CMD", "ARG", "S", "\\u", "TAGS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "self_", "._", "importer_", "._", "results", "\\u", "version_", ",_", "constants_", "._", "EXPORT", "\\u", "VERSION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pars", "e", "Name", "Options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "COMPLETE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "self_", "._", "importer_", "._", "\\u", "Pars", "e", "Name", "Options_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "results_", ",_", "CMD", "ARG", "S", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pars", "e", "Hyper", "visor", "Options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "COMPLETE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "self_", "._", "importer_", "._", "\\u", "Pars", "e", "Hyper", "visor", "Options_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "results_", ",_", "CMD", "ARG", "S", "\\u", "HYP", "ERV", "ISO", "R_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pars", "e", "OS", "Options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "COMPLETE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "self_", "._", "importer_", "._", "\\u", "Pars", "e", "OS", "Options_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "results_", ",_", "CMD", "ARG", "S", "\\u", "OS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pars", "e", "Back", "end", "Options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "COMPLETE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "self_", "._", "importer_", "._", "\\u", "Pars", "e", "Back", "end", "Options_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "results_", ",_", "CMD", "ARG", "S", "\\u", "BACKEND_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pars", "e", "Tags_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "COMPLETE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "self_", "._", "importer_", "._", "\\u", "Pars", "e", "Tags_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "results_", ",_", "CMD", "ARG", "S", "\\u", "TAGS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pars", "e", "Nic", "Options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "COMPLETE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "self_", "._", "importer_", "._", "\\u", "Pars", "e", "Nic", "Options_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "results_", ",_", "CMD", "ARG", "S", "\\u", "NET", "WORKS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pars", "e", "Disk", "Optio", "ns", "Fro", "m", "Gan", "eti", "OV", "F_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "gane", "ti", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "EXPORT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "OUTPU", "T", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "self_", "._", "importer_", "._", "\\u", "Get", "Disk", "Info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "results_", ",_", "GAN", "ETI", "\\u", "DISK", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pars", "e", "Templa", "te", "Options_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "COMPLETE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "self_", "._", "importer_", "._", "\\u", "Pars", "e", "Templa", "te", "Options_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "results_", ",_", "GAN", "ETI", "\\u", "TEMPLATE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pars", "e", "Disk", "Optio", "ns", "Fro", "m", "Cmd", "Line_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "COMPLETE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "mkdir_", "(_", "OUTPU", "T", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "self_", "._", "importer_", "._", "\\u", "Pars", "e", "Disk", "Options_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "results_", ",_", "CMD", "ARG", "S", "\\u", "DISK", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Disk", "Format_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "gane", "ti", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "EXPORT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disks", "\\u", "list_", "=_", "self_", "._", "importer_", "._", "ov", "f", "\\u", "reader_", "._", "Get", "Disk", "s", "Names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "[_", "self_", "._", "importer_", "._", "\\u", "Get", "Disk", "Qe", "mu", "Info_", "(_", "\"%", "s", "/", "%", "s", "\"_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "self_", "._", "importer_", "._", "input", "\\u", "dir_", ",_", "path_", ")_", ",_", "\"", "file", " ", "format", ":", " ", "(\\\\", "S", "+)\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "(_", "path_", ",_", "\\u_", ")_", "in_", "disks", "\\u", "list_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "results_", ",_", "[_", "\"", "vmd", "k", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "No", "Insta", "nce", "Name", "OV", "F_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "EXPORT", "\\u", "NO", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\"", "Name", " ", "of", " ", "instance", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "importer_", "._", "Parse_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Error", "No", "OS", "Name", "OV", "F_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "virtual", "box", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "EXPORT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\"", "OS", " ", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "importer_", "._", "Parse_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FI", "mpor", "ter_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Error", "No", "Disk", "And", "No", "Network_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "importer_", "=_", "ov", "f_", "._", "OV", "FI", "mpor", "ter_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ",_", "OPT", "S", "\\u", "NON", "IC", "\\u", "NOD", "IS", "K_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ei", "ther", " ", "disk", " ", "specifica", "tion", " ", "or", " ", "network", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "description", "\"_", ",_", "self_", "._", "importer_", "._", "Parse_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "OV", "FE", "xpo", "rte", "r_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "OV", "FE", "xpo", "rte", "r_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "exporter_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wrong", "\\u", "config", "\\u", "file_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "wrong", "\\u", "config", ".", "ini", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "unsafe", "\\u", "path", "\\u", "to", "\\u", "disk_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "unsafe", "\\u", "path", ".", "ini", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "disk", "\\u", "image", "\\u", "not", "\\u", "exist_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "no", "\\u", "disk", ".", "ini", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "empty", "\\u", "config_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "empty", ".", "ini", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "standard", "\\u", "export_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "config", ".", "ini", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wrong", "\\u", "network", "\\u", "mode_", "=_", "self_", "._", "disk", "\\u", "image", "\\u", "not", "\\u", "exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "no", "\\u", "memory_", "=_", "self_", "._", "disk", "\\u", "image", "\\u", "not", "\\u", "exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "no", "\\u", "vcpu", "s_", "=_", "self_", "._", "disk", "\\u", "image", "\\u", "not", "\\u", "exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "no", "\\u", "os_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "no", "\\u", "os", ".", "ini", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "no", "\\u", "hypervisor", "_", "=_", "self_", "._", "disk", "\\u", "image", "\\u", "not", "\\u", "exist_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FE", "xpo", "rte", "r_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "exporter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "exporter_", "._", "Cleanup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "del", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "OUTPU", "T", "\\u", "DIR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "shutil_", "._", "rmtree_", "(_", "del", "\\u", "dir_", ")_", "\\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_", "[SEP]_", "class_", "Test", "OV", "FE", "xpo", "rte", "r_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\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", "Error", "Wro", "ng", "Config", "File_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Error", " ", "whe", "n", " ", "try", "ing", " ", "to", " ", "read", "\"_", ",_", "ov", "f_", "._", "OV", "FE", "xpo", "rte", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "wrong", "\\u", "config", "\\u", "file_", ",_", "EXP", "\\u", "OPTS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FE", "xpo", "rte", "r_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Error", "Path", "To", "The", "Disk", "Inco", "rrect", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "exporter_", "=_", "ov", "f_", "._", "OV", "FE", "xpo", "rte", "r_", "(_", "self_", "._", "unsafe", "\\u", "path", "\\u", "to", "\\u", "disk_", ",_", "EXP", "\\u", "OPTS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\"", "contain", "s", " ", "a", " ", "director", "y", " ", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "exporter_", "._", "\\u", "Pars", "e", "Disk", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FE", "xpo", "rte", "r_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Error", "Disk", "Image", "Not", "Exist_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "exporter_", "=_", "ov", "f_", "._", "OV", "FE", "xpo", "rte", "r_", "(_", "self_", "._", "disk", "\\u", "image", "\\u", "not", "\\u", "exist_", ",_", "EXP", "\\u", "OPTS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\"", "Disk", " ", "image", " ", "doe", "s", " ", "not", " ", "exist", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "exporter_", "._", "\\u", "Pars", "e", "Disk", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FE", "xpo", "rte", "r_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pars", "e", "Network", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "exporter_", "=_", "ov", "f_", "._", "OV", "FE", "xpo", "rte", "r_", "(_", "self_", "._", "standard", "\\u", "export_", ",_", "EXP", "\\u", "OPTS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "self_", "._", "exporter_", "._", "\\u", "Pars", "e", "Network", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "results_", ",_", "EXP", "\\u", "NET", "WORKS", "\\u", "LIST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FE", "xpo", "rte", "r_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Error", "Wro", "ng", "Network", "Mode_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "exporter_", "=_", "ov", "f_", "._", "OV", "FE", "xpo", "rte", "r_", "(_", "self_", "._", "wrong", "\\u", "network", "\\u", "mode_", ",_", "EXP", "\\u", "OPTS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Network", " ", "mode", " ", "nic", " ", "not", " ", "recognize", "d", "\"_", ",_", "self_", "._", "exporter_", "._", "\\u", "Pars", "e", "Network", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FE", "xpo", "rte", "r_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pars", "e", "VC", "Pu", "s", "Mem", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "exporter_", "=_", "ov", "f_", "._", "OV", "FE", "xpo", "rte", "r_", "(_", "self_", "._", "standard", "\\u", "export_", ",_", "EXP", "\\u", "OPTS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vcpu", "s_", "=_", "self_", "._", "exporter_", "._", "\\u", "Pars", "e", "VC", "PU", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "memory_", "=_", "self_", "._", "exporter_", "._", "\\u", "Pars", "e", "Memory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "vcpu", "s_", ",_", "EXP", "\\u", "VC", "PU", "S_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "memory_", ",_", "EXP", "\\u", "MEM", "ORY", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FE", "xpo", "rte", "r_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Error", "No", "VC", "PU", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "exporter_", "=_", "ov", "f_", "._", "OV", "FE", "xpo", "rte", "r_", "(_", "self_", "._", "no", "\\u", "vcpu", "s_", ",_", "EXP", "\\u", "OPTS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\"", "No", " ", "CPU", " ", "informati", "on", " ", "found", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "exporter_", "._", "\\u", "Pars", "e", "VC", "PU", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FE", "xpo", "rte", "r_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Error", "No", "Memory_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "exporter_", "=_", "ov", "f_", "._", "OV", "FE", "xpo", "rte", "r_", "(_", "self_", "._", "no", "\\u", "memory_", ",_", "EXP", "\\u", "OPTS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\"", "No", " ", "memory", " ", "informati", "on", " ", "found", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "exporter_", "._", "\\u", "Pars", "e", "Memory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FE", "xpo", "rte", "r_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Pars", "e", "Gan", "eti", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "exporter_", "=_", "ov", "f_", "._", "OV", "FE", "xpo", "rte", "r_", "(_", "self_", "._", "standard", "\\u", "export_", ",_", "EXP", "\\u", "OPTS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "results_", "=_", "self_", "._", "exporter_", "._", "\\u", "Pars", "e", "Gan", "eti", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "results_", ",_", "EXP", "\\u", "GAN", "ETI", "\\u", "DICT_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FE", "xpo", "rte", "r_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Error", "No", "Hyper", "visor", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "exporter_", "=_", "ov", "f_", "._", "OV", "FE", "xpo", "rte", "r_", "(_", "self_", "._", "no", "\\u", "hypervisor", "_", ",_", "EXP", "\\u", "OPTS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "No", " ", "hypervisor", " ", "informati", "on", " ", "found", "\"_", ",_", "self_", "._", "exporter_", "._", "\\u", "Pars", "e", "Gan", "eti", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FE", "xpo", "rte", "r_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Error", "No", "OS_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "exporter_", "=_", "ov", "f_", "._", "OV", "FE", "xpo", "rte", "r_", "(_", "self_", "._", "no", "\\u", "os_", ",_", "EXP", "\\u", "OPTS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "No", " ", "operati", "ng", " ", "system", " ", "informati", "on", " ", "found", "\"_", ",_", "self_", "._", "exporter_", "._", "\\u", "Pars", "e", "Gan", "eti", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FE", "xpo", "rte", "r_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Error", "Pars", "e", "No", "Insta", "nce", "Name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "exporter_", "=_", "ov", "f_", "._", "OV", "FE", "xpo", "rte", "r_", "(_", "self_", "._", "empty", "\\u", "config_", ",_", "EXP", "\\u", "OPTS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\"", "No", " ", "instance", " ", "name", " ", "found", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "exporter_", "._", "Parse_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "wrong", "\\u", "xml", "\\u", "file_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "wrong", "\\u", "xml", ".", "ov", "f", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "gane", "ti", "\\u", "ov", "f_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "gane", "ti", ".", "ov", "f", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "virtual", "box", "\\u", "ov", "f_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "virtual", "box", ".", "ov", "f", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "corrupted", "\\u", "ov", "f_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "corrupted", "\\u", "resource", "s", ".", "ov", "f", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wrong", "\\u", "manifest", "\\u", "ov", "f_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "wrong", "\\u", "manifest", ".", "ov", "f", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "no", "\\u", "disk", "\\u", "in", "\\u", "ref", "\\u", "ov", "f_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "no", "\\u", "disk", "\\u", "in", "\\u", "ref", ".", "ov", "f", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "empty", "\\u", "ov", "f_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "empty", ".", "ov", "f", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "compress", "ed", "\\u", "disk_", "=_", "\\u", "Get", "Full", "Filename_", "(_", "\"", "gzip", "\\u", "disk", ".", "ov", "f", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "XML", "Pars", "ing", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Error", " ", "whi", "le", " ", "readi", "ng", " ", ".", "ov", "f", "\"_", ",_", "ov", "f_", "._", "OV", "FR", "eader", "_", ",_", "self_", "._", "wrong", "\\u", "xml", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "File", "In", "Reso", "urc", "es", "Do", "es", "Not", "Exist", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\"", "doe", "s", " ", "not", " ", "exist", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ov", "f_", "._", "OV", "FR", "eader", "_", ",_", "self_", "._", "corrupted", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Wro", "ng", "Manifest", "Checksum", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "wrong", "\\u", "manifest", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "doe", "s", " ", "not", " ", "match", " ", "the", " ", "value", " ", "in", " ", "manifest", " ", "file", "\"_", ",_", "reader_", "._", "Verify", "Manifest", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Good", "Manifest", "Checksum", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "gane", "ti", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "reader_", "._", "Verify", "Manifest", "_", "(_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Disk", "s", "Names", "OV", "FC", "orr", "upt", "ed", "Error_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "no", "\\u", "disk", "\\u", "in", "\\u", "ref", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Rai", "ses", "Regexp_", "(_", "errors_", "._", "Op", "Pre", "req", "Error_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "not", " ", "found", " ", "in", " ", "reference", "s", "\"_", ",_", "reader_", "._", "Get", "Disk", "s", "Names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Disk", "s", "Names", "Virt", "ual", "box_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "virtual", "box", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk", "\\u", "names_", "=_", "reader_", "._", "Get", "Disk", "s", "Names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "names_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "new", "\\u", "disk", ".", "vmd", "k", "\"_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "\"", "second", "\\u", "disk", ".", "vmd", "k", "\"_", ",_", "None_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "sorted_", "(_", "disk", "\\u", "names_", ")_", ",_", "sorted_", "(_", "expected", "\\u", "names_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Disk", "s", "Names", "Empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk", "\\u", "names_", "=_", "reader_", "._", "Get", "Disk", "s", "Names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "disk", "\\u", "names_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Disk", "s", "Names", "Compress", "ed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "compress", "ed", "\\u", "disk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "disk", "\\u", "names_", "=_", "reader_", "._", "Get", "Disk", "s", "Names_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "disk", "\\u", "names_", ",_", "[_", "(_", "\"", "compr", "\\u", "disk", ".", "vmd", "k", ".", "gz", "\"_", ",_", "\"", "gzip", "\"_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Network", "Data", "Gan", "eti", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "gane", "ti", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "networks_", "=_", "reader_", "._", "Get", "Network", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "networks_", ",_", "GAN", "ETI", "\\u", "NET", "WORKS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Network", "Data", "Virt", "ual", "box_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "virtual", "box", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "networks_", "=_", "reader_", "._", "Get", "Network", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "networks_", ",_", "VIRTUAL", "BO", "X", "\\u", "NET", "WORKS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Network", "Data", "Empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "networks_", "=_", "reader_", "._", "Get", "Network", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "networks_", ",_", "EMP", "TY", "\\u", "NET", "WORKS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Hyper", "visor", "Data", "Gan", "eti", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "gane", "ti", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hypervisor", "_", "=_", "reader_", "._", "Get", "Hyper", "visor", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hypervisor", "_", ",_", "GAN", "ETI", "\\u", "HYP", "ERV", "ISO", "R_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Hyper", "visor", "Data", "Emp", "ty", "Ov", "f_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hypervisor", "_", "=_", "reader_", "._", "Get", "Hyper", "visor", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "hypervisor", "_", ",_", "EMP", "TY", "\\u", "HYP", "ERV", "ISO", "R_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "OS", "Data", "Gan", "eti", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "gane", "ti", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os", "ys_", "=_", "reader_", "._", "Get", "OS", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "os", "ys_", ",_", "GAN", "ETI", "\\u", "OS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "OS", "Data", "Emp", "ty", "Ov", "f_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os", "ys_", "=_", "reader_", "._", "Get", "OS", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "os", "ys_", ",_", "EMP", "TY", "\\u", "OS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Back", "end", "Data", "Gan", "eti", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "gane", "ti", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "backend_", "=_", "reader_", "._", "Get", "Back", "end", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "backend_", ",_", "GAN", "ETI", "\\u", "BACKEND_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Back", "end", "Data", "Virt", "ual", "box_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "virtual", "box", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "backend_", "=_", "reader_", "._", "Get", "Back", "end", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "backend_", ",_", "VIRTUAL", "BO", "X", "\\u", "BACKEND_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Back", "end", "Data", "Emp", "ty", "Ov", "f_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "backend_", "=_", "reader_", "._", "Get", "Back", "end", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "backend_", ",_", "EMP", "TY", "\\u", "BACKEND_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Insta", "nce", "Name", "Gan", "eti", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "gane", "ti", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "reader_", "._", "Get", "Insta", "nce", "Name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "name_", ",_", "GAN", "ETI", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Insta", "nce", "Name", "Data", "Emp", "ty", "Ov", "f_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "reader_", "._", "Get", "Insta", "nce", "Name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "name_", ",_", "EMP", "TY", "\\u", "NAME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Disk", "Templa", "te", "Gan", "eti", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "gane", "ti", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "reader_", "._", "Get", "Disk", "Template_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "name_", ",_", "GAN", "ETI", "\\u", "TEMPLATE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Disk", "Templa", "te", "Empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "reader_", "._", "Get", "Disk", "Template_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "name_", ",_", "EMP", "TY", "\\u", "TEMPLATE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Ta", "gs", "Gan", "eti", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "gane", "ti", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "=_", "reader_", "._", "Get", "Ta", "gs", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tags_", ",_", "GAN", "ETI", "\\u", "TAGS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Ta", "gs", "Empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tags_", "=_", "reader_", "._", "Get", "Ta", "gs", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "tags_", ",_", "EMP", "TY", "\\u", "TAGS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Version", "Gan", "eti", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "gane", "ti", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "reader_", "._", "Get", "Version", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "version_", ",_", "GAN", "ETI", "\\u", "VERSION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FR", "eader", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Get", "Version", "Empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "reader_", "=_", "ov", "f_", "._", "OV", "FR", "eader", "_", "(_", "self_", "._", "empty", "\\u", "ov", "f_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "version_", "=_", "reader_", "._", "Get", "Version", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "version_", ",_", "EMP", "TY", "\\u", "VERSION_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "OV", "FW", "riter", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "OV", "FW", "riter", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "writer_", "=_", "ov", "f_", "._", "OV", "FW", "riter", "_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FW", "riter", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FW", "riter", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "OV", "FW", "riter", "Init_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "=_", "ET_", "._", "tostring_", "(_", "self_", "._", "writer_", "._", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "EXPORT", "\\u", "EMPTY_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FW", "riter", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Save", "Disk", "s", "Data", "Empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "writer_", "._", "Save", "Disk", "s", "Data_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "ET_", "._", "tostring_", "(_", "self_", "._", "writer_", "._", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "EXPORT", "\\u", "DISK", "S", "\\u", "EMPTY_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FW", "riter", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Save", "Disk", "s", "Data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "writer_", "._", "Save", "Disk", "s", "Data_", "(_", "EXP", "\\u", "DISK", "S", "\\u", "LIST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "ET_", "._", "tostring_", "(_", "self_", "._", "writer_", "._", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "EXPORT", "\\u", "DISK", "S_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FW", "riter", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Save", "Network", "Data", "Empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "writer_", "._", "Save", "Network", "s", "Data_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "ET_", "._", "tostring_", "(_", "self_", "._", "writer_", "._", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "EXPORT", "\\u", "NET", "WORKS", "\\u", "EMPTY_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FW", "riter", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Save", "Network", "s", "Data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "writer_", "._", "Save", "Network", "s", "Data_", "(_", "EXP", "\\u", "NET", "WORKS", "\\u", "LIST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "ET_", "._", "tostring_", "(_", "self_", "._", "writer_", "._", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "EXPORT", "\\u", "NET", "WORKS", "_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FW", "riter", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Save", "Gan", "eti", "Data", "Incomp", "lete", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "writer_", "._", "Save", "Gan", "eti", "Data_", "(_", "EXP", "\\u", "PARTI", "AL", "\\u", "GAN", "ETI", "\\u", "DICT_", ",_", "EXP", "\\u", "NET", "WORKS", "\\u", "LIST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "ET_", "._", "tostring_", "(_", "self_", "._", "writer_", "._", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "EXPORT", "\\u", "GAN", "ETI", "\\u", "INCOM", "PLE", "TE_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FW", "riter", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Save", "Gan", "eti", "Data", "Complete_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "writer_", "._", "Save", "Gan", "eti", "Data_", "(_", "EXP", "\\u", "GAN", "ETI", "\\u", "DICT_", ",_", "EXP", "\\u", "NET", "WORKS", "\\u", "LIST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "ET_", "._", "tostring_", "(_", "self_", "._", "writer_", "._", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "EXPORT", "\\u", "GAN", "ETI", "_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "OV", "FW", "riter", "_", "(_", "Bet", "ter", "Unit", "Test_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Save", "Virt", "ual", "System_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "writer_", "._", "Save", "Disk", "s", "Data_", "(_", "EXP", "\\u", "DISK", "S", "\\u", "LIST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "writer_", "._", "Save", "Network", "s", "Data_", "(_", "EXP", "\\u", "NET", "WORKS", "\\u", "LIST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "writer_", "._", "Save", "Virt", "ual", "System", "Data_", "(_", "EXP", "\\u", "NAME_", ",_", "EXP", "\\u", "VC", "PU", "S_", ",_", "EXP", "\\u", "MEM", "ORY", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "ET_", "._", "tostring_", "(_", "self_", "._", "writer_", "._", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "EXPORT", "\\u", "SYSTEM", "_", "in_", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
gwongz/flask-apiblueprint/setup.py
[ { "content": "\"\"\"\nFlask-APIBlueprint\n-------------\n\nRoute inheritance for Flask Blueprints.\n\n\"\"\"\nfrom setuptools import setup\n\ntry:\n with open('LONG_DESCRIPTION.rst') as f:\n long_description = f.read()\nexcept:\n long_description = 'Route inheritance for Flask Blueprints'\n\n\nsetup(\n name='Flask-APIBlueprint',\n version='0.2',\n url='https://github.com/gwongz/flask-apiblueprint',\n license='BSD',\n author='Grace Wong',\n author_email='[email protected]',\n description='Route inheritance for Flask Blueprints',\n long_description=long_description,\n packages=['flask_apiblueprint'],\n zip_safe=False,\n include_package_data=True,\n download_url='https://github.com/gwongz/flask-apiblueprint/tarball/0.2',\n platforms='any',\n install_requires=[\n 'Flask'\n ],\n test_suite='test_apiblueprint',\n classifiers=[\n 'Environment :: Web Environment',\n 'Intended Audience :: Developers',\n 'License :: OSI Approved :: BSD License',\n 'Operating System :: OS Independent',\n 'Programming Language :: Python',\n 'Topic :: Internet :: WWW/HTTP :: Dynamic Content',\n 'Topic :: Software Development :: Libraries :: Python Modules',\n 'Programming Language :: Python :: 2',\n 'Programming Language :: Python :: 2.6',\n 'Programming Language :: Python :: 2.7'\n ]\n)", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Fla", "sk", "-", "API", "Blue", "print", "\\", "10", ";", "-------------", "\\", "10", ";", "\\", "10", ";", "Route", " ", "inherita", "nce", " ", "for", " ", "Fla", "sk", " ", "Blue", "print", "s", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "setuptools_", "import_", "setup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "'", "LONG", "\\u", "DESCRIPT", "ION", ".", "rst", "'_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "long", "\\u", "description_", "=_", "f_", "._", "read_", "(_", ")_", "\\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 ", " _", "long", "\\u", "description_", "=_", "'", "Route", " ", "inherita", "nce", " ", "for", " ", "Fla", "sk", " ", "Blue", "print", "s", "'_", "\\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_", "=_", "'", "Fla", "sk", "-", "API", "Blue", "print", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "version_", "=_", "'", "0.", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "gw", "ong", "z", "/", "fla", "sk", "-", "api", "blue", "print", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "license_", "=_", "'", "BS", "D", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author_", "=_", "'", "Gra", "ce", " ", "Wo", "ng", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "author", "\\u", "email_", "=_", "'", "gw", "ong", "z", "@", "gma", "il", ".", "com", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "description_", "=_", "'", "Route", " ", "inherita", "nce", " ", "for", " ", "Fla", "sk", " ", "Blue", "print", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "long", "\\u", "description_", "=_", "long", "\\u", "description_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "packages_", "=_", "[_", "'", "fla", "sk", "\\u", "api", "blue", "print", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "zip", "\\u", "safe_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "include", "\\u", "package", "\\u", "data_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "download", "\\u", "url_", "=_", "'", "https", "://", "git", "hub", ".", "com", "/", "gw", "ong", "z", "/", "fla", "sk", "-", "api", "blue", "print", "/", "tarball", "/", "0.", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "platforms_", "=_", "'", "any", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "install", "\\u", "requires_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Fla", "sk", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "test\\u", "suite_", "=_", "'", "test\\u", "api", "blue", "print", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "classifiers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Environ", "ment", " ", "::", " ", "Web", " ", "Environ", "ment", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inten", "ded", " ", "Audi", "ence", " ", "::", " ", "Dev", "elope", "rs", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "License", " ", "::", " ", "OSI", " ", "Appro", "ved", " ", "::", " ", "BS", "D", " ", "License", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Opera", "ting", " ", "System", " ", "::", " ", "OS", " ", "Inde", "pend", "ent", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Topic", " ", "::", " ", "Intern", "et", " ", "::", " ", "WW", "W", "/", "HTTP", " ", "::", " ", "Dynamic", " ", "Conten", "t", "'_", ",_", "\\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_", "'", "Programm", "ing", " ", "Lang", "ua", "ge", " ", "::", " ", "Pyth", "on", " ", "::", " ", "2", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Programm", "ing", " ", "Lang", "ua", "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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 import
django-oscar/django-oscar-accounts/tests/unit/transfer_tests.py
[ { "content": "from decimal import Decimal as D\n\nfrom django.contrib.auth.models import User\nfrom django.test import TestCase\nfrom django.utils import timezone\nfrom oscar.test.factories import UserFactory\n\nfrom oscar_accounts import exceptions\nfrom oscar_accounts.models import Account, Transfer\nfrom oscar_accounts.test_factories import AccountFactory\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestASuccessfulTransfer(TestCase):\n\n\n\n\n\n\n", "metadata": "root.TestASuccessfulTransfer", "header": "['module', '___EOS___']", "index": 12 }, { "content": " def setUp(self):\n self.user = UserFactory(username=\"barry\")\n source = AccountFactory(primary_user=None, credit_limit=None)\n destination = AccountFactory()\n self.transfer = Transfer.objects.create(source, destination,\n D('10.00'), user=self.user)", "metadata": "root.TestASuccessfulTransfer.setUp", "header": "['class', 'TestASuccessfulTransfer', '(', 'TestCase', ')', ':', '___EOS___']", "index": 14 }, { "content": " def test_creates_2_transactions(self):\n self.assertEqual(2, self.transfer.transactions.all().count())", "metadata": "root.TestASuccessfulTransfer.test_creates_2_transactions", "header": "['class', 'TestASuccessfulTransfer', '(', 'TestCase', ')', ':', '___EOS___']", "index": 21 }, { "content": " def test_records_the_transferred_amount(self):\n self.assertEqual(D('10.00'), self.transfer.amount)", "metadata": "root.TestASuccessfulTransfer.test_records_the_transferred_amount", "header": "['class', 'TestASuccessfulTransfer', '(', 'TestCase', ')', ':', '___EOS___']", "index": 24 }, { "content": " def test_updates_source_balance(self):\n self.assertEqual(-D('10.00'), self.transfer.source.balance)", "metadata": "root.TestASuccessfulTransfer.test_updates_source_balance", "header": "['class', 'TestASuccessfulTransfer', '(', 'TestCase', ')', ':', '___EOS___']", "index": 27 }, { "content": " def test_updates_destination_balance(self):\n self.assertEqual(D('10.00'), self.transfer.destination.balance)", "metadata": "root.TestASuccessfulTransfer.test_updates_destination_balance", "header": "['class', 'TestASuccessfulTransfer', '(', 'TestCase', ')', ':', '___EOS___']", "index": 30 }, { "content": " def test_cannot_be_deleted(self):\n with self.assertRaises(RuntimeError):\n self.transfer.delete()", "metadata": "root.TestASuccessfulTransfer.test_cannot_be_deleted", "header": "['class', 'TestASuccessfulTransfer', '(', 'TestCase', ')', ':', '___EOS___']", "index": 33 }, { "content": " def test_records_static_user_information_in_case_user_is_deleted(self):\n self.assertEqual('barry', self.transfer.authorisor_username)\n self.user.delete()\n transfer = Transfer.objects.get(id=self.transfer.id)\n self.assertEqual('barry', transfer.authorisor_username)", "metadata": "root.TestASuccessfulTransfer.test_records_static_user_information_in_case_user_is_deleted", "header": "['class', 'TestASuccessfulTransfer', '(', 'TestCase', ')', ':', '___EOS___']", "index": 37 }, { "content": "class TestATransferToAnInactiveAccount(TestCase):\n", "metadata": "root.TestATransferToAnInactiveAccount", "header": "['module', '___EOS___']", "index": 44 }, { "content": " def test_is_permitted(self):\n self.user = UserFactory()\n now = timezone.now()\n source = AccountFactory(primary_user=None, credit_limit=None)\n destination = AccountFactory(end_date=now - timezone.timedelta(days=1))\n try:\n Transfer.objects.create(source, destination,\n D('20.00'), user=self.user)\n except exceptions.AccountException as e:\n self.fail(\"Transfer failed: %s\" % e)", "metadata": "root.TestATransferToAnInactiveAccount.test_is_permitted", "header": "['class', 'TestATransferToAnInactiveAccount', '(', 'TestCase', ')', ':', '___EOS___']", "index": 46 }, { "content": "class TestATransferFromAnInactiveAccount(TestCase):\n", "metadata": "root.TestATransferFromAnInactiveAccount", "header": "['module', '___EOS___']", "index": 58 }, { "content": " def test_is_permitted(self):\n self.user = UserFactory()\n now = timezone.now()\n source = AccountFactory(\n credit_limit=None, primary_user=None,\n end_date=now - timezone.timedelta(days=1))\n destination = AccountFactory()\n try:\n Transfer.objects.create(\n source, destination, D('20.00'), user=self.user)\n except exceptions.AccountException as e:\n self.fail(\"Transfer failed: %s\" % e)", "metadata": "root.TestATransferFromAnInactiveAccount.test_is_permitted", "header": "['class', 'TestATransferFromAnInactiveAccount', '(', 'TestCase', ')', ':', '___EOS___']", "index": 60 }, { "content": "class TestAnAttemptedTransfer(TestCase):\n\n\n\n\n", "metadata": "root.TestAnAttemptedTransfer", "header": "['module', '___EOS___']", "index": 74 }, { "content": " def setUp(self):\n self.user = UserFactory()", "metadata": "root.TestAnAttemptedTransfer.setUp", "header": "['class', 'TestAnAttemptedTransfer', '(', 'TestCase', ')', ':', '___EOS___']", "index": 76 }, { "content": " def test_raises_an_exception_when_trying_to_exceed_credit_limit_of_source(self):\n source = AccountFactory(primary_user=None, credit_limit=D('10.00'))\n destination = AccountFactory()\n with self.assertRaises(exceptions.InsufficientFunds):\n Transfer.objects.create(source, destination,\n D('20.00'), user=self.user)", "metadata": "root.TestAnAttemptedTransfer.test_raises_an_exception_when_trying_to_exceed_credit_limit_of_source", "header": "['class', 'TestAnAttemptedTransfer', '(', 'TestCase', ')', ':', '___EOS___']", "index": 79 }, { "content": " def test_raises_an_exception_when_trying_to_debit_negative_value(self):\n source = AccountFactory(credit_limit=None)\n destination = AccountFactory()\n with self.assertRaises(exceptions.InvalidAmount):\n Transfer.objects.create(source, destination,\n D('-20.00'), user=self.user)", "metadata": "root.TestAnAttemptedTransfer.test_raises_an_exception_when_trying_to_debit_negative_value", "header": "['class', 'TestAnAttemptedTransfer', '(', 'TestCase', ')', ':', '___EOS___']", "index": 86 }, { "content": " def test_raises_an_exception_when_trying_to_use_closed_source(self):\n source = AccountFactory(credit_limit=None)\n source.close()\n destination = AccountFactory()\n with self.assertRaises(exceptions.ClosedAccount):\n Transfer.objects.create(source, destination,\n D('20.00'), user=self.user)", "metadata": "root.TestAnAttemptedTransfer.test_raises_an_exception_when_trying_to_use_closed_source", "header": "['class', 'TestAnAttemptedTransfer', '(', 'TestCase', ')', ':', '___EOS___']", "index": 93 }, { "content": " def test_raises_an_exception_when_trying_to_use_closed_destination(self):\n source = AccountFactory(primary_user=None, credit_limit=None)\n destination = AccountFactory()\n destination.close()\n with self.assertRaises(exceptions.ClosedAccount):\n Transfer.objects.create(\n source, destination, D('20.00'), user=self.user)", "metadata": "root.TestAnAttemptedTransfer.test_raises_an_exception_when_trying_to_use_closed_destination", "header": "['class', 'TestAnAttemptedTransfer', '(', 'TestCase', ')', ':', '___EOS___']", "index": 101 } ]
[ { "span": "from django.contrib.auth.models import User", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 43 }, { "span": "from oscar_accounts.models import Account, Transfer", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 51 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "decimal_", "import_", "Decimal_", "as_", "D_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "django_", "._", "contrib_", "._", "auth_", "._", "models_", "import_", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "test_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "import_", "timezone_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "osc", "ar_", "._", "test_", "._", "factories_", "import_", "User", "Factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "osc", "ar", "\\u", "accounts_", "import_", "exceptions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "osc", "ar", "\\u", "accounts_", "._", "models_", "import_", "Account_", ",_", "Transfer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "osc", "ar", "\\u", "accounts_", "._", "test\\u", "factories_", "import_", "Account", "Factory_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "AS", "ucc", "ess", "ful", "Transfer", "_", "(_", "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_", "Test", "AS", "ucc", "ess", "ful", "Transfer", "_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user_", "=_", "User", "Factory_", "(_", "username_", "=_", "\"", "barr", "y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "Account", "Factory_", "(_", "primary", "\\u", "user_", "=_", "None_", ",_", "credit", "\\u", "limit_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "destination_", "=_", "Account", "Factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "transfer_", "=_", "Transfer", "_", "._", "objects_", "._", "create_", "(_", "source_", ",_", "destination_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "D_", "(_", "'", "10.", "00", "'_", ")_", ",_", "user_", "=_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "ucc", "ess", "ful", "Transfer", "_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "create", "s", "\\u", "2", "\\u", "transactions_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "2_", ",_", "self_", "._", "transfer_", "._", "transactions_", "._", "all_", "(_", ")_", "._", "count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "ucc", "ess", "ful", "Transfer", "_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "record", "s", "\\u", "the", "\\u", "transferred", "\\u", "amount_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "D_", "(_", "'", "10.", "00", "'_", ")_", ",_", "self_", "._", "transfer_", "._", "amount_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "ucc", "ess", "ful", "Transfer", "_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "s", "\\u", "source", "\\u", "balance_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "-_", "D_", "(_", "'", "10.", "00", "'_", ")_", ",_", "self_", "._", "transfer_", "._", "source_", "._", "balance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "ucc", "ess", "ful", "Transfer", "_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "update", "s", "\\u", "destinat", "ion", "\\u", "balance_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "D_", "(_", "'", "10.", "00", "'_", ")_", ",_", "self_", "._", "transfer_", "._", "destination_", "._", "balance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "ucc", "ess", "ful", "Transfer", "_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "cann", "ot", "\\u", "be", "\\u", "deleted_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "self_", "._", "assert", "Raises_", "(_", "Run", "time", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "transfer_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "AS", "ucc", "ess", "ful", "Transfer", "_", "(_", "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", "record", "s", "\\u", "static", "\\u", "user", "\\u", "informati", "on", "\\u", "in", "\\u", "case", "\\u", "user", "\\u", "is", "\\u", "deleted_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "'", "barr", "y", "'_", ",_", "self_", "._", "transfer_", "._", "authori", "sor", "\\u", "username_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "user_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "transfer_", "=_", "Transfer", "_", "._", "objects_", "._", "get_", "(_", "id_", "=_", "self_", "._", "transfer_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "barr", "y", "'_", ",_", "transfer_", "._", "authori", "sor", "\\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_", "class_", "Test", "AT", "ransf", "er", "To", "An", "Ina", "ctive", "Account_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "AT", "ransf", "er", "To", "An", "Ina", "ctive", "Account_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "is", "\\u", "permit", "ted_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user_", "=_", "User", "Factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "timezone_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "Account", "Factory_", "(_", "primary", "\\u", "user_", "=_", "None_", ",_", "credit", "\\u", "limit_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "destination_", "=_", "Account", "Factory_", "(_", "end", "\\u", "date_", "=_", "now_", "-_", "timezone_", "._", "timedelta_", "(_", "days_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Transfer", "_", "._", "objects_", "._", "create_", "(_", "source_", ",_", "destination_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "D_", "(_", "'", "20.", "00", "'_", ")_", ",_", "user_", "=_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exceptions_", "._", "Account", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Transfer", " ", "fail", "ed", ":", " ", "%", "s", "\"_", "%_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "AT", "ransf", "er", "Fro", "m", "An", "Ina", "ctive", "Account_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "AT", "ransf", "er", "Fro", "m", "An", "Ina", "ctive", "Account_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "is", "\\u", "permit", "ted_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user_", "=_", "User", "Factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "now_", "=_", "timezone_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "=_", "Account", "Factory_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "credit", "\\u", "limit_", "=_", "None_", ",_", "primary", "\\u", "user_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "\\u", "date_", "=_", "now_", "-_", "timezone_", "._", "timedelta_", "(_", "days_", "=_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "destination_", "=_", "Account", "Factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Transfer", "_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "source_", ",_", "destination_", ",_", "D_", "(_", "'", "20.", "00", "'_", ")_", ",_", "user_", "=_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exceptions_", "._", "Account", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "fail_", "(_", "\"", "Transfer", " ", "fail", "ed", ":", " ", "%", "s", "\"_", "%_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "An", "Atte", "mpte", "d", "Transfer", "_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "An", "Atte", "mpte", "d", "Transfer", "_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "user_", "=_", "User", "Factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "An", "Atte", "mpte", "d", "Transfer", "_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "raise", "s", "\\u", "an", "\\u", "exception", "\\u", "whe", "n", "\\u", "try", "ing", "\\u", "to", "\\u", "exceed", "\\u", "credit", "\\u", "limit", "\\u", "of", "\\u", "source_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "Account", "Factory_", "(_", "primary", "\\u", "user_", "=_", "None_", ",_", "credit", "\\u", "limit_", "=_", "D_", "(_", "'", "10.", "00", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "destination_", "=_", "Account", "Factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "exceptions_", "._", "Ins", "uff", "icient", "Fund", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Transfer", "_", "._", "objects_", "._", "create_", "(_", "source_", ",_", "destination_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "D_", "(_", "'", "20.", "00", "'_", ")_", ",_", "user_", "=_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "An", "Atte", "mpte", "d", "Transfer", "_", "(_", "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", "raise", "s", "\\u", "an", "\\u", "exception", "\\u", "whe", "n", "\\u", "try", "ing", "\\u", "to", "\\u", "debit", "\\u", "negati", "ve", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "Account", "Factory_", "(_", "credit", "\\u", "limit_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "destination_", "=_", "Account", "Factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "exceptions_", "._", "Inva", "lid", "Amount_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Transfer", "_", "._", "objects_", "._", "create_", "(_", "source_", ",_", "destination_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "D_", "(_", "'-", "20.", "00", "'_", ")_", ",_", "user_", "=_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "An", "Atte", "mpte", "d", "Transfer", "_", "(_", "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", "raise", "s", "\\u", "an", "\\u", "exception", "\\u", "whe", "n", "\\u", "try", "ing", "\\u", "to", "\\u", "use", "\\u", "close", "d\\u", "source_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "Account", "Factory_", "(_", "credit", "\\u", "limit_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "source_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "destination_", "=_", "Account", "Factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "exceptions_", "._", "Clos", "ed", "Account_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Transfer", "_", "._", "objects_", "._", "create_", "(_", "source_", ",_", "destination_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "D_", "(_", "'", "20.", "00", "'_", ")_", ",_", "user_", "=_", "self_", "._", "user_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "An", "Atte", "mpte", "d", "Transfer", "_", "(_", "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", "raise", "s", "\\u", "an", "\\u", "exception", "\\u", "whe", "n", "\\u", "try", "ing", "\\u", "to", "\\u", "use", "\\u", "close", "d\\u", "destination_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "source_", "=_", "Account", "Factory_", "(_", "primary", "\\u", "user_", "=_", "None_", ",_", "credit", "\\u", "limit_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "destination_", "=_", "Account", "Factory_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "destination_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "self_", "._", "assert", "Raises_", "(_", "exceptions_", "._", "Clos", "ed", "Account_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Transfer", "_", "._", "objects_", "._", "create_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "source_", ",_", "destination_", ",_", "D_", "(_", "'", "20.", "00", "'_", ")_", ",_", "user_", "=_", "self_", "._", "user_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused local variable
nskinkel/oppy/oppy/tests/unit/connection/test_connectionbuildtask.py
[ { "content": " def test_getCertsFromCell(self):\n lc = test_cert_der\n link_cert = CertsCellPayloadItem(LINK_CERT_TYPE, len(lc), lc)\n ic = test_cert_der\n id_cert = CertsCellPayloadItem(ID_CERT_TYPE, len(ic), ic)\n\n cell = CertsCell.make(0, [link_cert, id_cert])\n\n res1 = crypto.load_certificate(crypto.FILETYPE_ASN1, lc)\n res2 = crypto.load_certificate(crypto.FILETYPE_ASN1, ic)\n\n l, i = connectionbuildtask._getCertsFromCell(cell)\n\n self.assertEqual(crypto.dump_certificate(crypto.FILETYPE_ASN1, l), lc)\n self.assertEqual(crypto.dump_certificate(crypto.FILETYPE_ASN1, i), ic)", "metadata": "root.ConnectionBuildTaskTest.test_getCertsFromCell", "header": "['class', 'ConnectionBuildTaskTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 485 } ]
[ { "span": "res1 ", "start_line": 493, "start_column": 8, "end_line": 493, "end_column": 12 }, { "span": "res2 ", "start_line": 494, "start_column": 8, "end_line": 494, "end_column": 12 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Connect", "ion", "Build", "Task", "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", "get", "Cert", "s", "Fro", "m", "Cell_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "lc_", "=_", "test\\u", "cert", "\\u", "der_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link", "\\u", "cert_", "=_", "Cert", "s", "Cel", "l", "Pay", "load", "Item_", "(_", "LINK", "\\u", "CERT", "\\u", "TYPE_", ",_", "len_", "(_", "lc_", ")_", ",_", "lc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ic_", "=_", "test\\u", "cert", "\\u", "der_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id", "\\u", "cert_", "=_", "Cert", "s", "Cel", "l", "Pay", "load", "Item_", "(_", "ID", "\\u", "CERT", "\\u", "TYPE_", ",_", "len_", "(_", "ic_", ")_", ",_", "ic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cell_", "=_", "Cert", "s", "Cell_", "._", "make_", "(_", "0_", ",_", "[_", "link", "\\u", "cert_", ",_", "id", "\\u", "cert_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res1_", "=_", "crypto_", "._", "load", "\\u", "certificate_", "(_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ",_", "lc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res2_", "=_", "crypto_", "._", "load", "\\u", "certificate_", "(_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ",_", "ic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "l_", ",_", "i_", "=_", "connecti", "on", "build", "task_", "._", "\\u", "get", "Cert", "s", "Fro", "m", "Cell_", "(_", "cell_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "crypto_", "._", "dump", "\\u", "certificate_", "(_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ",_", "l_", ")_", ",_", "lc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "crypto_", "._", "dump", "\\u", "certificate_", "(_", "crypto_", "._", "FILET", "YP", "E", "\\u", "AS", "N1_", ",_", "i_", ")_", ",_", "ic_", ")_", "\\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, 0, 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 ]
Unused local variable
dongying/dear/dear/spectrum/auditory.py
[ { "content": " @staticmethod\n def make_erb_filter_coeffiences(samplerate, N=64, freq_base=A2, freq_max=C8):\n fc = GammatoneSpectrum.erb_space(N, freq_base, freq_max)\n #\n pi = np.pi\n sin = np.sin\n cos = np.cos\n exp = np.exp\n sqrt = np.sqrt\n #\n EarQ = 9.26449\n minBW = 24.7\n order = 1.\n #ERB = ((fc/EarQ)**order + minBW**order) ** (1./order)\n ERB = 0.108*fc + minBW\n BW = 1.019*2*pi*ERB\n #\n T = 1./samplerate\n fct = np.flipud(fc*T)\n bwt = np.flipud(BW*T)\n a0 = T\n a2 = 0\n b0 = 1\n b1 = -2*cos(2*pi*fct) / exp(bwt)\n b2 = exp(-2*bwt)\n a11 = -(2*T*cos(2*pi*fct)/exp(bwt)+2*T*sqrt(3+2**1.5)*sin(2*pi*fct)/exp(bwt)) / 2\n a12 = -(2*T*cos(2*pi*fct)/exp(bwt)-2*T*sqrt(3+2**1.5)*sin(2*pi*fct)/exp(bwt)) / 2\n a13 = -(2*T*cos(2*pi*fct)/exp(bwt)+2*T*sqrt(3-2**1.5)*sin(2*pi*fct)/exp(bwt)) / 2\n a14 = -(2*T*cos(2*pi*fct)/exp(bwt)-2*T*sqrt(3-2**1.5)*sin(2*pi*fct)/exp(bwt)) / 2\n gain = np.abs(\n (-2*exp(4j*pi*fct)*T + 2*exp(2j*pi*fct-bwt)*T*(cos(2*pi*fct) - sqrt(3-2**1.5)*sin(2*pi*fct)))\\\n * (-2*exp(4j*pi*fct)*T + 2*exp(2j*pi*fct-bwt)*T*(cos(2*pi*fct) + sqrt(3-2**1.5)*sin(2*pi*fct)))\\\n * (-2*exp(4j*pi*fct)*T + 2*exp(2j*pi*fct-bwt)*T*(cos(2*pi*fct) - sqrt(3+2**1.5)*sin(2*pi*fct)))\\\n * (-2*exp(4j*pi*fct)*T + 2*exp(2j*pi*fct-bwt)*T*(cos(2*pi*fct) + sqrt(3+2**1.5)*sin(2*pi*fct)))\\\n / (-2/exp(2*bwt) - 2*exp(4j*pi*fct) + 2*(1+exp(4j*pi*fct))/exp(bwt)) ** 4)\n #\n #return a0,a11,a12,a13,a14,a2,b0,b1,b2,gain\n coeffies = np.zeros((5, N, 3))\n coeffies[0][...,0], coeffies[0][...,1], coeffies[0][...,2] = b0, b1, b2\n coeffies[1:,:,0], coeffies[1:,:,2] = a0, a2\n for i,p1 in enumerate([a11,a12,a13,a14]):\n coeffies[i+1,:,1] = p1\n coeffies[1,:,[0,1,2]] /= gain\n return coeffies", "metadata": "root.GammatoneSpectrum.make_erb_filter_coeffiences", "header": "['class', 'GammatoneSpectrum', '(', 'SpectrumBase', ')', ':', '___EOS___']", "index": 22 } ]
[ { "span": "EarQ ", "start_line": 32, "start_column": 8, "end_line": 32, "end_column": 12 }, { "span": "order ", "start_line": 34, "start_column": 8, "end_line": 34, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Gamma", "tone", "Spectrum_", "(_", "Spect", "rum", "Base_", ")_", ":_", "\\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_", "make", "\\u", "erb", "\\u", "filter", "\\u", "coef", "fie", "nces_", "(_", "samplerate", "_", ",_", "N_", "=_", "64_", ",_", "freq", "\\u", "base_", "=_", "A2_", ",_", "freq", "\\u", "max_", "=_", "C8", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fc_", "=_", "Gamma", "tone", "Spectrum_", "._", "erb", "\\u", "space_", "(_", "N_", ",_", "freq", "\\u", "base_", ",_", "freq", "\\u", "max_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "pi_", "=_", "np_", "._", "pi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sin_", "=_", "np_", "._", "sin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cos_", "=_", "np_", "._", "cos_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exp_", "=_", "np_", "._", "exp_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sqrt_", "=_", "np_", "._", "sqrt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "Ear", "Q_", "=_", "9.2", "644", "9_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "BW", "_", "=_", "24.", "7_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "=_", "1._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "ER", "B", " ", "=", " ", "((", "fc", "/", "Ear", "Q", ")**", "order", " ", "+", " ", "min", "BW", "**", "order", ")", " ", "**", " ", "(", "1", "./", "order", ")_", "\\u\\u\\uNL\\u\\u\\u_", "ER", "B_", "=_", "0.10", "8_", "*_", "fc_", "+_", "min", "BW", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BW", "_", "=_", "1.01", "9_", "*_", "2_", "*_", "pi_", "*_", "ER", "B_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "T_", "=_", "1._", "/_", "samplerate", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fct", "_", "=_", "np_", "._", "flip", "ud_", "(_", "fc_", "*_", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bw", "t_", "=_", "np_", "._", "flip", "ud_", "(_", "BW", "_", "*_", "T_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a0_", "=_", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a2_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b0_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b1_", "=_", "-_", "2_", "*_", "cos_", "(_", "2_", "*_", "pi_", "*_", "fct", "_", ")_", "/_", "exp_", "(_", "bw", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b2_", "=_", "exp_", "(_", "-_", "2_", "*_", "bw", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a1", "1_", "=_", "-_", "(_", "2_", "*_", "T_", "*_", "cos_", "(_", "2_", "*_", "pi_", "*_", "fct", "_", ")_", "/_", "exp_", "(_", "bw", "t_", ")_", "+_", "2_", "*_", "T_", "*_", "sqrt_", "(_", "3_", "+_", "2_", "**_", "1.5_", ")_", "*_", "sin_", "(_", "2_", "*_", "pi_", "*_", "fct", "_", ")_", "/_", "exp_", "(_", "bw", "t_", ")_", ")_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a1", "2_", "=_", "-_", "(_", "2_", "*_", "T_", "*_", "cos_", "(_", "2_", "*_", "pi_", "*_", "fct", "_", ")_", "/_", "exp_", "(_", "bw", "t_", ")_", "-_", "2_", "*_", "T_", "*_", "sqrt_", "(_", "3_", "+_", "2_", "**_", "1.5_", ")_", "*_", "sin_", "(_", "2_", "*_", "pi_", "*_", "fct", "_", ")_", "/_", "exp_", "(_", "bw", "t_", ")_", ")_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a1", "3_", "=_", "-_", "(_", "2_", "*_", "T_", "*_", "cos_", "(_", "2_", "*_", "pi_", "*_", "fct", "_", ")_", "/_", "exp_", "(_", "bw", "t_", ")_", "+_", "2_", "*_", "T_", "*_", "sqrt_", "(_", "3_", "-_", "2_", "**_", "1.5_", ")_", "*_", "sin_", "(_", "2_", "*_", "pi_", "*_", "fct", "_", ")_", "/_", "exp_", "(_", "bw", "t_", ")_", ")_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a1", "4_", "=_", "-_", "(_", "2_", "*_", "T_", "*_", "cos_", "(_", "2_", "*_", "pi_", "*_", "fct", "_", ")_", "/_", "exp_", "(_", "bw", "t_", ")_", "-_", "2_", "*_", "T_", "*_", "sqrt_", "(_", "3_", "-_", "2_", "**_", "1.5_", ")_", "*_", "sin_", "(_", "2_", "*_", "pi_", "*_", "fct", "_", ")_", "/_", "exp_", "(_", "bw", "t_", ")_", ")_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gain_", "=_", "np_", "._", "abs_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "-_", "2_", "*_", "exp_", "(_", "4j", "_", "*_", "pi_", "*_", "fct", "_", ")_", "*_", "T_", "+_", "2_", "*_", "exp_", "(_", "2j", "_", "*_", "pi_", "*_", "fct", "_", "-_", "bw", "t_", ")_", "*_", "T_", "*_", "(_", "cos_", "(_", "2_", "*_", "pi_", "*_", "fct", "_", ")_", "-_", "sqrt_", "(_", "3_", "-_", "2_", "**_", "1.5_", ")_", "*_", "sin_", "(_", "2_", "*_", "pi_", "*_", "fct", "_", ")_", ")_", ")_", "*_", "(_", "-_", "2_", "*_", "exp_", "(_", "4j", "_", "*_", "pi_", "*_", "fct", "_", ")_", "*_", "T_", "+_", "2_", "*_", "exp_", "(_", "2j", "_", "*_", "pi_", "*_", "fct", "_", "-_", "bw", "t_", ")_", "*_", "T_", "*_", "(_", "cos_", "(_", "2_", "*_", "pi_", "*_", "fct", "_", ")_", "+_", "sqrt_", "(_", "3_", "-_", "2_", "**_", "1.5_", ")_", "*_", "sin_", "(_", "2_", "*_", "pi_", "*_", "fct", "_", ")_", ")_", ")_", "*_", "(_", "-_", "2_", "*_", "exp_", "(_", "4j", "_", "*_", "pi_", "*_", "fct", "_", ")_", "*_", "T_", "+_", "2_", "*_", "exp_", "(_", "2j", "_", "*_", "pi_", "*_", "fct", "_", "-_", "bw", "t_", ")_", "*_", "T_", "*_", "(_", "cos_", "(_", "2_", "*_", "pi_", "*_", "fct", "_", ")_", "-_", "sqrt_", "(_", "3_", "+_", "2_", "**_", "1.5_", ")_", "*_", "sin_", "(_", "2_", "*_", "pi_", "*_", "fct", "_", ")_", ")_", ")_", "*_", "(_", "-_", "2_", "*_", "exp_", "(_", "4j", "_", "*_", "pi_", "*_", "fct", "_", ")_", "*_", "T_", "+_", "2_", "*_", "exp_", "(_", "2j", "_", "*_", "pi_", "*_", "fct", "_", "-_", "bw", "t_", ")_", "*_", "T_", "*_", "(_", "cos_", "(_", "2_", "*_", "pi_", "*_", "fct", "_", ")_", "+_", "sqrt_", "(_", "3_", "+_", "2_", "**_", "1.5_", ")_", "*_", "sin_", "(_", "2_", "*_", "pi_", "*_", "fct", "_", ")_", ")_", ")_", "/_", "(_", "-_", "2_", "/_", "exp_", "(_", "2_", "*_", "bw", "t_", ")_", "-_", "2_", "*_", "exp_", "(_", "4j", "_", "*_", "pi_", "*_", "fct", "_", ")_", "+_", "2_", "*_", "(_", "1_", "+_", "exp_", "(_", "4j", "_", "*_", "pi_", "*_", "fct", "_", ")_", ")_", "/_", "exp_", "(_", "bw", "t_", ")_", ")_", "**_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "return", " ", "a0", ",", "a1", "1", ",", "a1", "2", ",", "a1", "3", ",", "a1", "4", ",", "a2", ",", "b0", ",", "b1", ",", "b2", ",", "gain_", "\\u\\u\\uNL\\u\\u\\u_", "coef", "fie", "s_", "=_", "np_", "._", "zeros_", "(_", "(_", "5_", ",_", "N_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coef", "fie", "s_", "[_", "0_", "]_", "[_", "..._", ",_", "0_", "]_", ",_", "coef", "fie", "s_", "[_", "0_", "]_", "[_", "..._", ",_", "1_", "]_", ",_", "coef", "fie", "s_", "[_", "0_", "]_", "[_", "..._", ",_", "2_", "]_", "=_", "b0_", ",_", "b1_", ",_", "b2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coef", "fie", "s_", "[_", "1_", ":_", ",_", ":_", ",_", "0_", "]_", ",_", "coef", "fie", "s_", "[_", "1_", ":_", ",_", ":_", ",_", "2_", "]_", "=_", "a0_", ",_", "a2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "p1_", "in_", "enumerate_", "(_", "[_", "a1", "1_", ",_", "a1", "2_", ",_", "a1", "3_", ",_", "a1", "4_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "coef", "fie", "s_", "[_", "i_", "+_", "1_", ",_", ":_", ",_", "1_", "]_", "=_", "p1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "coef", "fie", "s_", "[_", "1_", ",_", ":_", ",_", "[_", "0_", ",_", "1_", ",_", "2_", "]_", "]_", "/=_", "gain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_",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/quickopen/src/basename_ranker_test.py
[ { "content": " def _assertRankDecreasesOrStaysTheSame(self, query, names):\n \"\"\"\n Makes suer that the first element in the array has highest rank\n and subsequent items have decreasing or equal rank.\n \"\"\"\n ranks = [self.ranker.rank_query(query, n) for n in names]\n nw = [self.ranker.get_num_words(n) for n in names]\n basic_ranks = [self.ranker._get_basic_rank(query, n) for n in names]\n for i in range(1, len(ranks)):\n changeInRank = ranks[i] - ranks[i-1]\n self.assertTrue(changeInRank <= 0)", "metadata": "root.BasenameRankerTest._assertRankDecreasesOrStaysTheSame", "header": "['class', 'BasenameRankerTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 159 }, { "content": " def test_rank_order_for_hierarchy_puts_prefixed_second(self):\n q = \"ccframerate\"\n a = self.ranker.rank_query(q, 'CCFrameRateController.cpp')\n b1 = self.ranker.rank_query(q, 'webcore_platform.CCFrameRateController.o.d')\n b2 = self.ranker.rank_query(q, 'webkit_unit_tests.CCFrameRateControllerTest.o.d')\n self.assertTrue(a > b1);\n # FAILS because ccframera(te) ties to (Te)st\n # self.assertTrue(a > b2);", "metadata": "root.BasenameRankerTest.test_rank_order_for_hierarchy_puts_prefixed_second", "header": "['class', 'BasenameRankerTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 194 } ]
[ { "span": "nw ", "start_line": 165, "start_column": 4, "end_line": 165, "end_column": 6 }, { "span": "basic_ranks ", "start_line": 166, "start_column": 4, "end_line": 166, "end_column": 15 }, { "span": "b2 ", "start_line": 198, "start_column": 4, "end_line": 198, "end_column": 6 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Base", "name", "Rank", "er", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "assert", "Rank", "Decre", "ases", "Or", "Sta", "ys", "The", "Sam", "e_", "(_", "self_", ",_", "query_", ",_", "names_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Make", "s", " ", "su", "er", " ", "tha", "t", " ", "the", " ", "first", " ", "element", " ", "in", " ", "the", " ", "array", " ", "has", " ", "high", "est", " ", "rank", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "subsequen", "t", " ", "items", " ", "have", " ", "decre", "asin", "g", " ", "or", " ", "equal", " ", "rank", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ranks_", "=_", "[_", "self_", "._", "rank", "er_", "._", "rank", "\\u", "query_", "(_", "query_", ",_", "n_", ")_", "for_", "n_", "in_", "names_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nw_", "=_", "[_", "self_", "._", "rank", "er_", "._", "get", "\\u", "num", "\\u", "words_", "(_", "n_", ")_", "for_", "n_", "in_", "names_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "basic", "\\u", "ranks_", "=_", "[_", "self_", "._", "rank", "er_", "._", "\\u", "get", "\\u", "basic", "\\u", "rank_", "(_", "query_", ",_", "n_", ")_", "for_", "n_", "in_", "names_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "range_", "(_", "1_", ",_", "len_", "(_", "ranks_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "change", "In", "Rank_", "=_", "ranks_", "[_", "i_", "]_", "-_", "ranks_", "[_", "i_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "change", "In", "Rank_", "<=_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "name", "Rank", "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\\u", "rank", "\\u", "order", "\\u", "for", "\\u", "hier", "arch", "y", "\\u", "puts", "\\u", "prefixed", "\\u", "second_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "\"", "ccf", "rame", "rate", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "a_", "=_", "self_", "._", "rank", "er_", "._", "rank", "\\u", "query_", "(_", "q_", ",_", "'", "CC", "Frame", "Rat", "e", "Controlle", "r", ".", "cpp", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b1_", "=_", "self_", "._", "rank", "er_", "._", "rank", "\\u", "query_", "(_", "q_", ",_", "'", "webc", "ore", "\\u", "platform", ".", "CC", "Frame", "Rat", "e", "Controlle", "r", ".", "o", ".", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b2_", "=_", "self_", "._", "rank", "er_", "._", "rank", "\\u", "query_", "(_", "q_", ",_", "'", "webkit", "\\u", "unit", "\\u", "tests", ".", "CC", "Frame", "Rat", "e", "Controlle", "r", "Test", ".", "o", ".", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "a_", ">_", "b1_", ")_", ";_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FAIL", "S", " ", "bec", "aus", "e", " ", "ccf", "rame", "ra", "(", "te", ")", " ", "ties", " ", "to", " ", "(", "Te", ")", "st_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "assert", "Tru", "e", "(", "a", " ", ">", " ", "b2", ");", "_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
google/pywebsocket/test/test_extensions.py
[ { "content": "#!/usr/bin/env python\n#\n# Copyright 2012, Google Inc.\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are\n# met:\n#\n# * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n# * Redistributions in binary form must reproduce the above\n# copyright notice, this list of conditions and the following disclaimer\n# in the documentation and/or other materials provided with the\n# distribution.\n# * Neither the name of Google Inc. nor the names of its\n# contributors may be used to endorse or promote products derived from\n# this software without specific prior written permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n\n\"\"\"Tests for extensions module.\"\"\"\n\n\nimport unittest\nimport zlib\n\nimport set_sys_path # Update sys.path to locate mod_pywebsocket module.\n\nfrom mod_pywebsocket import common\nfrom mod_pywebsocket import extensions\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n unittest.main()\n\n\n# vi:sts=4 sw=4 et\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ExtensionsTest(unittest.TestCase):\n \"\"\"A unittest for non-class methods in extensions.py\"\"\"\n", "metadata": "root.ExtensionsTest", "header": "['module', '___EOS___']", "index": 44 }, { "content": " def test_parse_window_bits(self):\n self.assertRaises(ValueError, extensions._parse_window_bits, None)\n self.assertRaises(ValueError, extensions._parse_window_bits, 'foobar')\n self.assertRaises(ValueError, extensions._parse_window_bits, ' 8 ')\n self.assertRaises(ValueError, extensions._parse_window_bits, 'a8a')\n self.assertRaises(ValueError, extensions._parse_window_bits, '00000')\n self.assertRaises(ValueError, extensions._parse_window_bits, '00008')\n self.assertRaises(ValueError, extensions._parse_window_bits, '0x8')\n\n self.assertRaises(ValueError, extensions._parse_window_bits, '9.5')\n self.assertRaises(ValueError, extensions._parse_window_bits, '8.0')\n\n self.assertTrue(extensions._parse_window_bits, '8')\n self.assertTrue(extensions._parse_window_bits, '15')\n\n self.assertRaises(ValueError, extensions._parse_window_bits, '-8')\n self.assertRaises(ValueError, extensions._parse_window_bits, '0')\n self.assertRaises(ValueError, extensions._parse_window_bits, '7')\n\n self.assertRaises(ValueError, extensions._parse_window_bits, '16')\n self.assertRaises(\n ValueError, extensions._parse_window_bits, '10000000')", "metadata": "root.ExtensionsTest.test_parse_window_bits", "header": "['class', 'ExtensionsTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 47 }, { "content": "class DeflateFrameExtensionProcessorParsingTest(unittest.TestCase):\n \"\"\"A unittest for checking that DeflateFrameExtensionProcessor parses given\n extension parameter correctly.\n \"\"\"\n\n\n\n\n\n\n\n", "metadata": "root.DeflateFrameExtensionProcessorParsingTest", "header": "['module', '___EOS___']", "index": 71 }, { "content": " def test_registry(self):\n processor = extensions.get_extension_processor(\n common.ExtensionParameter('deflate-frame'))\n self.assertIsInstance(processor,\n extensions.DeflateFrameExtensionProcessor)\n\n processor = extensions.get_extension_processor(\n common.ExtensionParameter('x-webkit-deflate-frame'))\n self.assertIsInstance(processor,\n extensions.DeflateFrameExtensionProcessor)", "metadata": "root.DeflateFrameExtensionProcessorParsingTest.test_registry", "header": "['class', 'DeflateFrameExtensionProcessorParsingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 76 }, { "content": " def test_minimal_offer(self):\n processor = extensions.DeflateFrameExtensionProcessor(\n common.ExtensionParameter('perframe-deflate'))\n\n response = processor.get_extension_response()\n self.assertEqual('perframe-deflate', response.name())\n self.assertEqual(0, len(response.get_parameters()))\n\n self.assertEqual(zlib.MAX_WBITS,\n processor._rfc1979_deflater._window_bits)\n self.assertFalse(processor._rfc1979_deflater._no_context_takeover)", "metadata": "root.DeflateFrameExtensionProcessorParsingTest.test_minimal_offer", "header": "['class', 'DeflateFrameExtensionProcessorParsingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 87 }, { "content": " def test_offer_with_max_window_bits(self):\n parameter = common.ExtensionParameter('perframe-deflate')\n parameter.add_parameter('max_window_bits', '10')\n processor = extensions.DeflateFrameExtensionProcessor(parameter)\n\n response = processor.get_extension_response()\n self.assertEqual('perframe-deflate', response.name())\n self.assertEqual(0, len(response.get_parameters()))\n\n self.assertEqual(10, processor._rfc1979_deflater._window_bits)", "metadata": "root.DeflateFrameExtensionProcessorParsingTest.test_offer_with_max_window_bits", "header": "['class', 'DeflateFrameExtensionProcessorParsingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 99 }, { "content": " def test_offer_with_out_of_range_max_window_bits(self):\n parameter = common.ExtensionParameter('perframe-deflate')\n parameter.add_parameter('max_window_bits', '0')\n processor = extensions.DeflateFrameExtensionProcessor(parameter)\n\n self.assertIsNone(processor.get_extension_response())", "metadata": "root.DeflateFrameExtensionProcessorParsingTest.test_offer_with_out_of_range_max_window_bits", "header": "['class', 'DeflateFrameExtensionProcessorParsingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 110 }, { "content": " def test_offer_with_max_window_bits_without_value(self):\n parameter = common.ExtensionParameter('perframe-deflate')\n parameter.add_parameter('max_window_bits', None)\n processor = extensions.DeflateFrameExtensionProcessor(parameter)\n\n self.assertIsNone(processor.get_extension_response())", "metadata": "root.DeflateFrameExtensionProcessorParsingTest.test_offer_with_max_window_bits_without_value", "header": "['class', 'DeflateFrameExtensionProcessorParsingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 117 }, { "content": " def test_offer_with_no_context_takeover(self):\n parameter = common.ExtensionParameter('perframe-deflate')\n parameter.add_parameter('no_context_takeover', None)\n processor = extensions.DeflateFrameExtensionProcessor(parameter)\n\n response = processor.get_extension_response()\n self.assertEqual('perframe-deflate', response.name())\n self.assertEqual(0, len(response.get_parameters()))\n\n self.assertTrue(processor._rfc1979_deflater._no_context_takeover)", "metadata": "root.DeflateFrameExtensionProcessorParsingTest.test_offer_with_no_context_takeover", "header": "['class', 'DeflateFrameExtensionProcessorParsingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 124 }, { "content": " def test_offer_with_no_context_takeover_with_value(self):\n parameter = common.ExtensionParameter('perframe-deflate')\n parameter.add_parameter('no_context_takeover', 'foobar')\n processor = extensions.DeflateFrameExtensionProcessor(parameter)\n\n self.assertIsNone(processor.get_extension_response())", "metadata": "root.DeflateFrameExtensionProcessorParsingTest.test_offer_with_no_context_takeover_with_value", "header": "['class', 'DeflateFrameExtensionProcessorParsingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 135 }, { "content": " def test_offer_with_unknown_parameter(self):\n parameter = common.ExtensionParameter('perframe-deflate')\n parameter.add_parameter('foo', 'bar')\n processor = extensions.DeflateFrameExtensionProcessor(parameter)\n\n response = processor.get_extension_response()\n self.assertEqual('perframe-deflate', response.name())\n self.assertEqual(0, len(response.get_parameters()))", "metadata": "root.DeflateFrameExtensionProcessorParsingTest.test_offer_with_unknown_parameter", "header": "['class', 'DeflateFrameExtensionProcessorParsingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 142 }, { "content": "class PerMessageDeflateExtensionProcessorParsingTest(unittest.TestCase):\n \"\"\"A unittest for checking that PerMessageDeflateExtensionProcessor parses\n given extension parameter correctly.\n \"\"\"\n\n\n\n\n\n\n\n", "metadata": "root.PerMessageDeflateExtensionProcessorParsingTest", "header": "['module', '___EOS___']", "index": 152 }, { "content": " def test_registry(self):\n processor = extensions.get_extension_processor(\n common.ExtensionParameter('permessage-deflate'))\n self.assertIsInstance(processor,\n extensions.PerMessageDeflateExtensionProcessor)", "metadata": "root.PerMessageDeflateExtensionProcessorParsingTest.test_registry", "header": "['class', 'PerMessageDeflateExtensionProcessorParsingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 157 }, { "content": " def test_minimal_offer(self):\n processor = extensions.PerMessageDeflateExtensionProcessor(\n common.ExtensionParameter('permessage-deflate'))\n\n response = processor.get_extension_response()\n self.assertEqual('permessage-deflate', response.name())\n self.assertEqual(0, len(response.get_parameters()))\n\n self.assertEqual(zlib.MAX_WBITS,\n processor._rfc1979_deflater._window_bits)\n self.assertFalse(processor._rfc1979_deflater._no_context_takeover)", "metadata": "root.PerMessageDeflateExtensionProcessorParsingTest.test_minimal_offer", "header": "['class', 'PerMessageDeflateExtensionProcessorParsingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 163 }, { "content": " def test_offer_with_max_window_bits(self):\n parameter = common.ExtensionParameter('permessage-deflate')\n parameter.add_parameter('server_max_window_bits', '10')\n processor = extensions.PerMessageDeflateExtensionProcessor(parameter)\n\n response = processor.get_extension_response()\n self.assertEqual('permessage-deflate', response.name())\n self.assertEqual([('server_max_window_bits', '10')],\n response.get_parameters())\n\n self.assertEqual(10, processor._rfc1979_deflater._window_bits)", "metadata": "root.PerMessageDeflateExtensionProcessorParsingTest.test_offer_with_max_window_bits", "header": "['class', 'PerMessageDeflateExtensionProcessorParsingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 175 }, { "content": " def test_offer_with_out_of_range_max_window_bits(self):\n parameter = common.ExtensionParameter('permessage-deflate')\n parameter.add_parameter('server_max_window_bits', '0')\n processor = extensions.PerMessageDeflateExtensionProcessor(parameter)\n\n self.assertIsNone(processor.get_extension_response())", "metadata": "root.PerMessageDeflateExtensionProcessorParsingTest.test_offer_with_out_of_range_max_window_bits", "header": "['class', 'PerMessageDeflateExtensionProcessorParsingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 187 }, { "content": " def test_offer_with_max_window_bits_without_value(self):\n parameter = common.ExtensionParameter('permessage-deflate')\n parameter.add_parameter('server_max_window_bits', None)\n processor = extensions.PerMessageDeflateExtensionProcessor(parameter)\n\n self.assertIsNone(processor.get_extension_response())", "metadata": "root.PerMessageDeflateExtensionProcessorParsingTest.test_offer_with_max_window_bits_without_value", "header": "['class', 'PerMessageDeflateExtensionProcessorParsingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 194 }, { "content": " def test_offer_with_no_context_takeover(self):\n parameter = common.ExtensionParameter('permessage-deflate')\n parameter.add_parameter('server_no_context_takeover', None)\n processor = extensions.PerMessageDeflateExtensionProcessor(parameter)\n\n response = processor.get_extension_response()\n self.assertEqual('permessage-deflate', response.name())\n self.assertEqual([('server_no_context_takeover', None)],\n response.get_parameters())\n\n self.assertTrue(processor._rfc1979_deflater._no_context_takeover)", "metadata": "root.PerMessageDeflateExtensionProcessorParsingTest.test_offer_with_no_context_takeover", "header": "['class', 'PerMessageDeflateExtensionProcessorParsingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 201 }, { "content": " def test_offer_with_no_context_takeover_with_value(self):\n parameter = common.ExtensionParameter('permessage-deflate')\n parameter.add_parameter('server_no_context_takeover', 'foobar')\n processor = extensions.PerMessageDeflateExtensionProcessor(parameter)\n\n self.assertIsNone(processor.get_extension_response())", "metadata": "root.PerMessageDeflateExtensionProcessorParsingTest.test_offer_with_no_context_takeover_with_value", "header": "['class', 'PerMessageDeflateExtensionProcessorParsingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 213 }, { "content": " def test_offer_with_unknown_parameter(self):\n parameter = common.ExtensionParameter('permessage-deflate')\n parameter.add_parameter('foo', 'bar')\n processor = extensions.PerMessageDeflateExtensionProcessor(parameter)\n\n self.assertIsNone(processor.get_extension_response())", "metadata": "root.PerMessageDeflateExtensionProcessorParsingTest.test_offer_with_unknown_parameter", "header": "['class', 'PerMessageDeflateExtensionProcessorParsingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 220 }, { "content": "class PerMessageDeflateExtensionProcessorBuildingTest(unittest.TestCase):\n \"\"\"A unittest for checking that PerMessageDeflateExtensionProcessor builds\n a response based on specified options correctly.\n \"\"\"\n\n\n\n", "metadata": "root.PerMessageDeflateExtensionProcessorBuildingTest", "header": "['module', '___EOS___']", "index": 228 }, { "content": " def test_response_with_max_window_bits(self):\n parameter = common.ExtensionParameter('permessage-deflate')\n parameter.add_parameter('client_max_window_bits', None)\n processor = extensions.PerMessageDeflateExtensionProcessor(parameter)\n processor.set_client_max_window_bits(10)\n\n response = processor.get_extension_response()\n self.assertEqual('permessage-deflate', response.name())\n self.assertEqual([('client_max_window_bits', '10')],\n response.get_parameters())", "metadata": "root.PerMessageDeflateExtensionProcessorBuildingTest.test_response_with_max_window_bits", "header": "['class', 'PerMessageDeflateExtensionProcessorBuildingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 233 }, { "content": " def test_response_with_max_window_bits_without_client_permission(self):\n processor = extensions.PerMessageDeflateExtensionProcessor(\n common.ExtensionParameter('permessage-deflate'))\n processor.set_client_max_window_bits(10)\n\n response = processor.get_extension_response()\n self.assertIsNone(response)", "metadata": "root.PerMessageDeflateExtensionProcessorBuildingTest.test_response_with_max_window_bits_without_client_permission", "header": "['class', 'PerMessageDeflateExtensionProcessorBuildingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 244 }, { "content": " def test_response_with_true_for_no_context_takeover(self):\n processor = extensions.PerMessageDeflateExtensionProcessor(\n common.ExtensionParameter('permessage-deflate'))\n\n processor.set_client_no_context_takeover(True)\n\n response = processor.get_extension_response()\n self.assertEqual('permessage-deflate', response.name())\n self.assertEqual([('client_no_context_takeover', None)],\n response.get_parameters())", "metadata": "root.PerMessageDeflateExtensionProcessorBuildingTest.test_response_with_true_for_no_context_takeover", "header": "['class', 'PerMessageDeflateExtensionProcessorBuildingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 252 }, { "content": " def test_response_with_false_for_no_context_takeover(self):\n processor = extensions.PerMessageDeflateExtensionProcessor(\n common.ExtensionParameter('permessage-deflate'))\n\n processor.set_client_no_context_takeover(False)\n\n response = processor.get_extension_response()\n self.assertEqual('permessage-deflate', response.name())\n self.assertEqual(0, len(response.get_parameters()))", "metadata": "root.PerMessageDeflateExtensionProcessorBuildingTest.test_response_with_false_for_no_context_takeover", "header": "['class', 'PerMessageDeflateExtensionProcessorBuildingTest', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 263 } ]
[ { "span": "import set_sys_path ", "start_line": 38, "start_column": 0, "end_line": 38, "end_column": 19 } ]
[]
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", " ", "2012", ",", " ", "Goo", "gle", " ", "Inc", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "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", " ", "follow", "ing", " ", "discl", "aime", "r_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "Goo", "gle", " ", "Inc", ".", " ", "nor", " ", "the", " ", "names", " ", "of", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "contributor", "s", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products", " ", "derive", "d", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "writt", "en", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "\"", "AS", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", " ", "COPY", "RIGHT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OWNER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", " ", "INC", "IDENT", "AL", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Test", "s", " ", "for", " ", "extensi", "ons", " ", "module", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "set\\u", "sys", "\\u", "path_", "#", " ", "Update", " ", "sys", ".", "path", " ", "to", " ", "locat", "e", " ", "mod", "\\u", "pyw", "ebs", "ocket", " ", "module", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "mod", "\\u", "pyw", "ebs", "ocket", "_", "import_", "common_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mod", "\\u", "pyw", "ebs", "ocket", "_", "import_", "extensions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "unittest_", "._", "main_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "vi", ":", "sts", "=", "4", " ", "sw", "=", "4", " ", "et_", "\\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_", "Ext", "ensi", "ons", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "unittest", " ", "for", " ", "non", "-", "class", " ", "method", "s", " ", "in", " ", "extensi", "ons", ".", "py", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Ext", "ensi", "ons", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "parse", "\\u", "window", "\\u", "bits_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "extensions_", "._", "\\u", "parse", "\\u", "window", "\\u", "bits_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "extensions_", "._", "\\u", "parse", "\\u", "window", "\\u", "bits_", ",_", "'", "fooba", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "extensions_", "._", "\\u", "parse", "\\u", "window", "\\u", "bits_", ",_", "'", " ", "8", " ", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "extensions_", "._", "\\u", "parse", "\\u", "window", "\\u", "bits_", ",_", "'", "a8", "a", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "extensions_", "._", "\\u", "parse", "\\u", "window", "\\u", "bits_", ",_", "'", "00000", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "extensions_", "._", "\\u", "parse", "\\u", "window", "\\u", "bits_", ",_", "'", "0000", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "extensions_", "._", "\\u", "parse", "\\u", "window", "\\u", "bits_", ",_", "'", "0x8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "extensions_", "._", "\\u", "parse", "\\u", "window", "\\u", "bits_", ",_", "'", "9.5", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "extensions_", "._", "\\u", "parse", "\\u", "window", "\\u", "bits_", ",_", "'", "8.0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "extensions_", "._", "\\u", "parse", "\\u", "window", "\\u", "bits_", ",_", "'", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "extensions_", "._", "\\u", "parse", "\\u", "window", "\\u", "bits_", ",_", "'", "15", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "extensions_", "._", "\\u", "parse", "\\u", "window", "\\u", "bits_", ",_", "'-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "extensions_", "._", "\\u", "parse", "\\u", "window", "\\u", "bits_", ",_", "'", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "extensions_", "._", "\\u", "parse", "\\u", "window", "\\u", "bits_", ",_", "'", "7", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "Value", "Error_", ",_", "extensions_", "._", "\\u", "parse", "\\u", "window", "\\u", "bits_", ",_", "'", "16", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Value", "Error_", ",_", "extensions_", "._", "\\u", "parse", "\\u", "window", "\\u", "bits_", ",_", "'", "10000000", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Def", "late", "Frame", "Ext", "ensi", "on", "Process", "or", "Pars", "ing", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "unittest", " ", "for", " ", "checking", " ", "tha", "t", " ", "Def", "late", "Frame", "Ext", "ensi", "on", "Process", "or", " ", "parse", "s", " ", "give", "n", "\\", "10", ";", " ", " ", " ", " ", "extensi", "on", " ", "parameter", " ", "correct", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Def", "late", "Frame", "Ext", "ensi", "on", "Process", "or", "Pars", "ing", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "registry_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "processor_", "=_", "extensions_", "._", "get", "\\u", "extensi", "on", "\\u", "processor_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "deflate", "-", "frame", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "processor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "._", "Def", "late", "Frame", "Ext", "ensi", "on", "Processor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "processor_", "=_", "extensions_", "._", "get", "\\u", "extensi", "on", "\\u", "processor_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "x", "-", "webkit", "-", "deflate", "-", "frame", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "processor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "._", "Def", "late", "Frame", "Ext", "ensi", "on", "Processor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Def", "late", "Frame", "Ext", "ensi", "on", "Process", "or", "Pars", "ing", "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", "minima", "l\\u", "offer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "processor_", "=_", "extensions_", "._", "Def", "late", "Frame", "Ext", "ensi", "on", "Processor_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "perf", "rame", "-", "deflate", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "processor_", "._", "get", "\\u", "extensi", "on", "\\u", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "perf", "rame", "-", "deflate", "'_", ",_", "response_", "._", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "response_", "._", "get", "\\u", "parameters_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "zlib_", "._", "MAX", "\\u", "WB", "IT", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "processor_", "._", "\\u", "rfc", "1979", "\\u", "deflate", "r_", "._", "\\u", "window", "\\u", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "processor_", "._", "\\u", "rfc", "1979", "\\u", "deflate", "r_", "._", "\\u", "no", "\\u", "context", "\\u", "take", "over_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Def", "late", "Frame", "Ext", "ensi", "on", "Process", "or", "Pars", "ing", "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", "off", "er", "\\u", "with", "\\u", "max", "\\u", "window", "\\u", "bits_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameter_", "=_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "perf", "rame", "-", "deflate", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameter_", "._", "add", "\\u", "parameter_", "(_", "'", "max", "\\u", "window", "\\u", "bits", "'_", ",_", "'", "10", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "=_", "extensions_", "._", "Def", "late", "Frame", "Ext", "ensi", "on", "Processor_", "(_", "parameter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "processor_", "._", "get", "\\u", "extensi", "on", "\\u", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "perf", "rame", "-", "deflate", "'_", ",_", "response_", "._", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "response_", "._", "get", "\\u", "parameters_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "10_", ",_", "processor_", "._", "\\u", "rfc", "1979", "\\u", "deflate", "r_", "._", "\\u", "window", "\\u", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Def", "late", "Frame", "Ext", "ensi", "on", "Process", "or", "Pars", "ing", "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", "off", "er", "\\u", "with", "\\u", "out", "\\u", "of", "\\u", "range", "\\u", "max", "\\u", "window", "\\u", "bits_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameter_", "=_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "perf", "rame", "-", "deflate", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameter_", "._", "add", "\\u", "parameter_", "(_", "'", "max", "\\u", "window", "\\u", "bits", "'_", ",_", "'", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "=_", "extensions_", "._", "Def", "late", "Frame", "Ext", "ensi", "on", "Processor_", "(_", "parameter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "processor_", "._", "get", "\\u", "extensi", "on", "\\u", "response_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Def", "late", "Frame", "Ext", "ensi", "on", "Process", "or", "Pars", "ing", "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", "off", "er", "\\u", "with", "\\u", "max", "\\u", "window", "\\u", "bits", "\\u", "with", "out", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameter_", "=_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "perf", "rame", "-", "deflate", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameter_", "._", "add", "\\u", "parameter_", "(_", "'", "max", "\\u", "window", "\\u", "bits", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "=_", "extensions_", "._", "Def", "late", "Frame", "Ext", "ensi", "on", "Processor_", "(_", "parameter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "processor_", "._", "get", "\\u", "extensi", "on", "\\u", "response_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Def", "late", "Frame", "Ext", "ensi", "on", "Process", "or", "Pars", "ing", "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", "off", "er", "\\u", "with", "\\u", "no", "\\u", "context", "\\u", "take", "over_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameter_", "=_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "perf", "rame", "-", "deflate", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameter_", "._", "add", "\\u", "parameter_", "(_", "'", "no", "\\u", "context", "\\u", "take", "over", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "=_", "extensions_", "._", "Def", "late", "Frame", "Ext", "ensi", "on", "Processor_", "(_", "parameter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "processor_", "._", "get", "\\u", "extensi", "on", "\\u", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "perf", "rame", "-", "deflate", "'_", ",_", "response_", "._", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "response_", "._", "get", "\\u", "parameters_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "processor_", "._", "\\u", "rfc", "1979", "\\u", "deflate", "r_", "._", "\\u", "no", "\\u", "context", "\\u", "take", "over_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Def", "late", "Frame", "Ext", "ensi", "on", "Process", "or", "Pars", "ing", "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", "off", "er", "\\u", "with", "\\u", "no", "\\u", "context", "\\u", "take", "over", "\\u", "with", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameter_", "=_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "perf", "rame", "-", "deflate", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameter_", "._", "add", "\\u", "parameter_", "(_", "'", "no", "\\u", "context", "\\u", "take", "over", "'_", ",_", "'", "fooba", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "=_", "extensions_", "._", "Def", "late", "Frame", "Ext", "ensi", "on", "Processor_", "(_", "parameter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "processor_", "._", "get", "\\u", "extensi", "on", "\\u", "response_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Def", "late", "Frame", "Ext", "ensi", "on", "Process", "or", "Pars", "ing", "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", "off", "er", "\\u", "with", "\\u", "unknown", "\\u", "parameter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameter_", "=_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "perf", "rame", "-", "deflate", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameter_", "._", "add", "\\u", "parameter_", "(_", "'", "foo", "'_", ",_", "'", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "=_", "extensions_", "._", "Def", "late", "Frame", "Ext", "ensi", "on", "Processor_", "(_", "parameter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "processor_", "._", "get", "\\u", "extensi", "on", "\\u", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "perf", "rame", "-", "deflate", "'_", ",_", "response_", "._", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "response_", "._", "get", "\\u", "parameters_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Process", "or", "Pars", "ing", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "unittest", " ", "for", " ", "checking", " ", "tha", "t", " ", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Process", "or", " ", "parse", "s", "\\", "10", ";", " ", " ", " ", " ", "give", "n", " ", "extensi", "on", " ", "parameter", " ", "correct", "ly", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Process", "or", "Pars", "ing", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "registry_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "processor_", "=_", "extensions_", "._", "get", "\\u", "extensi", "on", "\\u", "processor_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "perm", "essage", "-", "deflate", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "processor_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "._", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Processor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Process", "or", "Pars", "ing", "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", "minima", "l\\u", "offer_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "processor_", "=_", "extensions_", "._", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Processor_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "perm", "essage", "-", "deflate", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "processor_", "._", "get", "\\u", "extensi", "on", "\\u", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "perm", "essage", "-", "deflate", "'_", ",_", "response_", "._", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "response_", "._", "get", "\\u", "parameters_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "zlib_", "._", "MAX", "\\u", "WB", "IT", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "processor_", "._", "\\u", "rfc", "1979", "\\u", "deflate", "r_", "._", "\\u", "window", "\\u", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "processor_", "._", "\\u", "rfc", "1979", "\\u", "deflate", "r_", "._", "\\u", "no", "\\u", "context", "\\u", "take", "over_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Process", "or", "Pars", "ing", "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", "off", "er", "\\u", "with", "\\u", "max", "\\u", "window", "\\u", "bits_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameter_", "=_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "perm", "essage", "-", "deflate", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameter_", "._", "add", "\\u", "parameter_", "(_", "'", "server", "\\u", "max", "\\u", "window", "\\u", "bits", "'_", ",_", "'", "10", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "=_", "extensions_", "._", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Processor_", "(_", "parameter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "processor_", "._", "get", "\\u", "extensi", "on", "\\u", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "perm", "essage", "-", "deflate", "'_", ",_", "response_", "._", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "(_", "'", "server", "\\u", "max", "\\u", "window", "\\u", "bits", "'_", ",_", "'", "10", "'_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "get", "\\u", "parameters_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "10_", ",_", "processor_", "._", "\\u", "rfc", "1979", "\\u", "deflate", "r_", "._", "\\u", "window", "\\u", "bits_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Process", "or", "Pars", "ing", "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", "off", "er", "\\u", "with", "\\u", "out", "\\u", "of", "\\u", "range", "\\u", "max", "\\u", "window", "\\u", "bits_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameter_", "=_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "perm", "essage", "-", "deflate", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameter_", "._", "add", "\\u", "parameter_", "(_", "'", "server", "\\u", "max", "\\u", "window", "\\u", "bits", "'_", ",_", "'", "0", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "=_", "extensions_", "._", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Processor_", "(_", "parameter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "processor_", "._", "get", "\\u", "extensi", "on", "\\u", "response_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Process", "or", "Pars", "ing", "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", "off", "er", "\\u", "with", "\\u", "max", "\\u", "window", "\\u", "bits", "\\u", "with", "out", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameter_", "=_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "perm", "essage", "-", "deflate", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameter_", "._", "add", "\\u", "parameter_", "(_", "'", "server", "\\u", "max", "\\u", "window", "\\u", "bits", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "=_", "extensions_", "._", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Processor_", "(_", "parameter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "processor_", "._", "get", "\\u", "extensi", "on", "\\u", "response_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Process", "or", "Pars", "ing", "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", "off", "er", "\\u", "with", "\\u", "no", "\\u", "context", "\\u", "take", "over_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameter_", "=_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "perm", "essage", "-", "deflate", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameter_", "._", "add", "\\u", "parameter_", "(_", "'", "server", "\\u", "no", "\\u", "context", "\\u", "take", "over", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "=_", "extensions_", "._", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Processor_", "(_", "parameter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "processor_", "._", "get", "\\u", "extensi", "on", "\\u", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "perm", "essage", "-", "deflate", "'_", ",_", "response_", "._", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "(_", "'", "server", "\\u", "no", "\\u", "context", "\\u", "take", "over", "'_", ",_", "None_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "get", "\\u", "parameters_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "processor_", "._", "\\u", "rfc", "1979", "\\u", "deflate", "r_", "._", "\\u", "no", "\\u", "context", "\\u", "take", "over_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Process", "or", "Pars", "ing", "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", "off", "er", "\\u", "with", "\\u", "no", "\\u", "context", "\\u", "take", "over", "\\u", "with", "\\u", "value_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameter_", "=_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "perm", "essage", "-", "deflate", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameter_", "._", "add", "\\u", "parameter_", "(_", "'", "server", "\\u", "no", "\\u", "context", "\\u", "take", "over", "'_", ",_", "'", "fooba", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "=_", "extensions_", "._", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Processor_", "(_", "parameter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "processor_", "._", "get", "\\u", "extensi", "on", "\\u", "response_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Process", "or", "Pars", "ing", "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", "off", "er", "\\u", "with", "\\u", "unknown", "\\u", "parameter_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameter_", "=_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "perm", "essage", "-", "deflate", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameter_", "._", "add", "\\u", "parameter_", "(_", "'", "foo", "'_", ",_", "'", "bar", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "=_", "extensions_", "._", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Processor_", "(_", "parameter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "processor_", "._", "get", "\\u", "extensi", "on", "\\u", "response_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Process", "or", "Building", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "unittest", " ", "for", " ", "checking", " ", "tha", "t", " ", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Process", "or", " ", "builds", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "response", " ", "based", " ", "on", " ", "specified", " ", "options", " ", "correct", "ly", ".", "\\", "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_", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Process", "or", "Building", "Test_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "test\\u", "response", "\\u", "with", "\\u", "max", "\\u", "window", "\\u", "bits_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parameter_", "=_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "perm", "essage", "-", "deflate", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "parameter_", "._", "add", "\\u", "parameter_", "(_", "'", "client", "\\u", "max", "\\u", "window", "\\u", "bits", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "=_", "extensions_", "._", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Processor_", "(_", "parameter_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "._", "set\\u", "client", "\\u", "max", "\\u", "window", "\\u", "bits_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "processor_", "._", "get", "\\u", "extensi", "on", "\\u", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "perm", "essage", "-", "deflate", "'_", ",_", "response_", "._", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "(_", "'", "client", "\\u", "max", "\\u", "window", "\\u", "bits", "'_", ",_", "'", "10", "'_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "get", "\\u", "parameters_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Process", "or", "Building", "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", "response", "\\u", "with", "\\u", "max", "\\u", "window", "\\u", "bits", "\\u", "with", "out", "\\u", "client", "\\u", "permission_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "processor_", "=_", "extensions_", "._", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Processor_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "perm", "essage", "-", "deflate", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "processor_", "._", "set\\u", "client", "\\u", "max", "\\u", "window", "\\u", "bits_", "(_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "processor_", "._", "get", "\\u", "extensi", "on", "\\u", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "None_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Process", "or", "Building", "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", "response", "\\u", "with", "\\u", "true", "\\u", "for", "\\u", "no", "\\u", "context", "\\u", "take", "over_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "processor_", "=_", "extensions_", "._", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Processor_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "perm", "essage", "-", "deflate", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "processor_", "._", "set\\u", "client", "\\u", "no", "\\u", "context", "\\u", "take", "over_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "processor_", "._", "get", "\\u", "extensi", "on", "\\u", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "perm", "essage", "-", "deflate", "'_", ",_", "response_", "._", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "[_", "(_", "'", "client", "\\u", "no", "\\u", "context", "\\u", "take", "over", "'_", ",_", "None_", ")_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "._", "get", "\\u", "parameters_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Process", "or", "Building", "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", "response", "\\u", "with", "\\u", "fal", "se", "\\u", "for", "\\u", "no", "\\u", "context", "\\u", "take", "over_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "processor_", "=_", "extensions_", "._", "Per", "Messag", "e", "Def", "late", "Ext", "ensi", "on", "Processor_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "common_", "._", "Ext", "ensi", "on", "Parameter_", "(_", "'", "perm", "essage", "-", "deflate", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "processor_", "._", "set\\u", "client", "\\u", "no", "\\u", "context", "\\u", "take", "over_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "processor_", "._", "get", "\\u", "extensi", "on", "\\u", "response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "'", "perm", "essage", "-", "deflate", "'_", ",_", "response_", "._", "name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "0_", ",_", "len_", "(_", "response_", "._", "get", "\\u", "parameters_", "(_", ")_", ")_", ")_", "\\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, 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 ]
Unused import
ReactiveX/RxPY/tests/test_observable/test_count.py
[ { "content": "import unittest\n\nfrom rx import Observable\nfrom rx.testing import TestScheduler, ReactiveTest, is_prime, MockDisposable\nfrom rx.disposables import Disposable, SerialDisposable\n\non_next = ReactiveTest.on_next\non_completed = ReactiveTest.on_completed\non_error = ReactiveTest.on_error\nsubscribe = ReactiveTest.subscribe\nsubscribed = ReactiveTest.subscribed\ndisposed = ReactiveTest.disposed\ncreated = ReactiveTest.created\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestCount(unittest.TestCase):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.TestCount", "header": "['module', '___EOS___']", "index": 14 }, { "content": " def test_count_empty(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_completed(250))\n res = scheduler.start(create=lambda: xs.count()).messages\n res.assert_equal(on_next(250, 0), on_completed(250))", "metadata": "root.TestCount.test_count_empty", "header": "['class', 'TestCount', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 15 }, { "content": " def test_count_empty_ii(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_completed(250))\n\n def create():\n return xs.count()\n\n res = scheduler.start(create=create).messages\n res.assert_equal(on_next(250, 1), on_completed(250))", "metadata": "root.TestCount.test_count_empty_ii", "header": "['class', 'TestCount', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 21 }, { "content": " def test_count_some(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_completed(250))\n res = scheduler.start(create=lambda: xs.count()).messages\n res.assert_equal(on_next(250, 3), on_completed(250))", "metadata": "root.TestCount.test_count_some", "header": "['class', 'TestCount', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 31 }, { "content": " def test_count_throw(self):\n ex = 'ex'\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_error(210, ex))\n res = scheduler.start(create=lambda: xs.count()).messages\n res.assert_equal(on_error(210, ex))", "metadata": "root.TestCount.test_count_throw", "header": "['class', 'TestCount', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 37 }, { "content": " def test_count_never(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1))\n res = scheduler.start(create=lambda: xs.count()).messages\n res.assert_equal()", "metadata": "root.TestCount.test_count_never", "header": "['class', 'TestCount', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 44 }, { "content": " def test_count_predicate_empty_true(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_completed(250))\n\n def create():\n return xs.count(lambda _: True)\n\n res = scheduler.start(create=create)\n\n res.messages.assert_equal(on_next(250, 0), on_completed(250))\n xs.subscriptions.assert_equal(subscribe(200, 250))", "metadata": "root.TestCount.test_count_predicate_empty_true", "header": "['class', 'TestCount', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 50 }, { "content": " def test_count_predicate_empty_false(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_completed(250))\n\n def create():\n return xs.count(lambda _: False)\n\n res = scheduler.start(create=create)\n\n res.messages.assert_equal(on_next(250, 0), on_completed(250))\n xs.subscriptions.assert_equal(subscribe(200, 250))", "metadata": "root.TestCount.test_count_predicate_empty_false", "header": "['class', 'TestCount', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 62 }, { "content": " def test_count_predicate_return_true(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_completed(250))\n\n def create():\n return xs.count(lambda _: True)\n\n res = scheduler.start(create=create)\n\n res.messages.assert_equal(on_next(250, 1), on_completed(250))\n xs.subscriptions.assert_equal(subscribe(200, 250))", "metadata": "root.TestCount.test_count_predicate_return_true", "header": "['class', 'TestCount', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 74 }, { "content": " def test_count_predicate_return_false(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_completed(250))\n\n def create():\n return xs.count(lambda _: False)\n\n res = scheduler.start(create=create)\n\n res.messages.assert_equal(on_next(250, 0), on_completed(250))\n xs.subscriptions.assert_equal(subscribe(200, 250))", "metadata": "root.TestCount.test_count_predicate_return_false", "header": "['class', 'TestCount', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 86 }, { "content": " def test_count_predicate_some_all(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_completed(250))\n\n def create():\n return xs.count(lambda x: x < 10)\n\n res = scheduler.start(create=create)\n\n res.messages.assert_equal(on_next(250, 3), on_completed(250))\n xs.subscriptions.assert_equal(subscribe(200, 250))", "metadata": "root.TestCount.test_count_predicate_some_all", "header": "['class', 'TestCount', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 98 }, { "content": " def test_count_predicate_some_none(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_completed(250))\n\n def create():\n return xs.count(lambda x: x > 10)\n\n res = scheduler.start(create=create)\n\n res.messages.assert_equal(on_next(250, 0), on_completed(250))\n xs.subscriptions.assert_equal(subscribe(200, 250))", "metadata": "root.TestCount.test_count_predicate_some_none", "header": "['class', 'TestCount', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 110 }, { "content": " def test_count_predicate_some_even(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(220, 3), on_next(230, 4), on_completed(250))\n\n def create():\n return xs.count(lambda x: x % 2 == 0)\n\n res = scheduler.start(create=create)\n\n res.messages.assert_equal(on_next(250, 2), on_completed(250))\n xs.subscriptions.assert_equal(subscribe(200, 250))", "metadata": "root.TestCount.test_count_predicate_some_even", "header": "['class', 'TestCount', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 122 }, { "content": " def test_count_predicate_throw_true(self):\n ex = 'ex'\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_error(210, ex))\n\n def create():\n return xs.count(lambda _: True)\n\n res = scheduler.start(create=create)\n\n res.messages.assert_equal(on_error(210, ex))\n xs.subscriptions.assert_equal(subscribe(200, 210))", "metadata": "root.TestCount.test_count_predicate_throw_true", "header": "['class', 'TestCount', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 134 }, { "content": " def test_count_predicate_throw_false(self):\n ex = 'ex'\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_error(210, ex))\n\n def create():\n return xs.count(lambda _: False)\n\n res = scheduler.start(create=create)\n\n res.messages.assert_equal(on_error(210, ex))\n xs.subscriptions.assert_equal(subscribe(200, 210))", "metadata": "root.TestCount.test_count_predicate_throw_false", "header": "['class', 'TestCount', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 147 }, { "content": " def test_count_predicate_never(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1))\n\n def create():\n return xs.count(lambda _: True)\n\n res = scheduler.start(create=create)\n\n res.messages.assert_equal()\n xs.subscriptions.assert_equal(subscribe(200, 1000))", "metadata": "root.TestCount.test_count_predicate_never", "header": "['class', 'TestCount', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 160 }, { "content": " def test_count_predicate_predicate_throws(self):\n ex = 'ex'\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(150, 1), on_next(210, 2), on_next(230, 3), on_completed(240))\n\n def create():\n def predicate(x):\n if x == 3:\n raise Exception(ex)\n else:\n return True\n\n return xs.count(predicate)\n\n res = scheduler.start(create=create)\n\n res.messages.assert_equal(on_error(230, ex))\n xs.subscriptions.assert_equal(subscribe(200, 230))", "metadata": "root.TestCount.test_count_predicate_predicate_throws", "header": "['class', 'TestCount', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 172 } ]
[ { "span": "from rx import Observable", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 25 }, { "span": "from rx.testing import TestScheduler, ReactiveTest, is_prime, MockDisposable", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 76 }, { "span": "from rx.disposables import Disposable, SerialDisposable", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 55 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "rx_", "import_", "Observable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rx_", "._", "testing_", "import_", "Test", "Scheduler_", ",_", "React", "ive", "Test_", ",_", "is", "\\u", "prime_", ",_", "Moc", "k", "Dispo", "sab", "le_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "rx_", "._", "dispo", "sab", "les_", "import_", "Dispo", "sab", "le_", ",_", "Ser", "ial", "Dispo", "sab", "le_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "on", "\\u", "next_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "on", "\\u", "completed_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "completed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "on", "\\u", "error_", "=_", "React", "ive", "Test_", "._", "on", "\\u", "error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscribe_", "=_", "React", "ive", "Test_", "._", "subscribe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subscribed", "_", "=_", "React", "ive", "Test_", "._", "subscribed", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dispose", "d_", "=_", "React", "ive", "Test_", "._", "dispose", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "created_", "=_", "React", "ive", "Test_", "._", "created_", "\\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_", "Test", "Count_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "Count_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "test\\u", "count", "\\u", "empty_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "lambda_", ":_", "xs_", "._", "count_", "(_", ")_", ")_", "._", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "250_", ",_", "0_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Count_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "count", "\\u", "empty", "\\u", "ii_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "._", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "250_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Count_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "count", "\\u", "some", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "220_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "230_", ",_", "4_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "lambda_", ":_", "xs_", "._", "count_", "(_", ")_", ")_", "._", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "250_", ",_", "3_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Count_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "count", "\\u", "throw_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "error_", "(_", "210_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "lambda_", ":_", "xs_", "._", "count_", "(_", ")_", ")_", "._", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "error_", "(_", "210_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Count_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "count", "\\u", "neve", "r_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "lambda_", ":_", "xs_", "._", "count_", "(_", ")_", ")_", "._", "messages_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "assert", "\\u", "equal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Count_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "count", "\\u", "predica", "te", "\\u", "empty", "\\u", "true_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "count_", "(_", "lambda_", "\\u_", ":_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "250_", ",_", "0_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Count_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "count", "\\u", "predica", "te", "\\u", "empty", "\\u", "false_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "count_", "(_", "lambda_", "\\u_", ":_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "250_", ",_", "0_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Count_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "count", "\\u", "predica", "te", "\\u", "return", "\\u", "true_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "count_", "(_", "lambda_", "\\u_", ":_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "250_", ",_", "1_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Count_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "count", "\\u", "predica", "te", "\\u", "return", "\\u", "false_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "count_", "(_", "lambda_", "\\u_", ":_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "250_", ",_", "0_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Count_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "count", "\\u", "predica", "te", "\\u", "some", "\\u", "all_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "220_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "230_", ",_", "4_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "count_", "(_", "lambda_", "x_", ":_", "x_", "<_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "250_", ",_", "3_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Count_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "count", "\\u", "predica", "te", "\\u", "some", "\\u", "none_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "220_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "230_", ",_", "4_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "count_", "(_", "lambda_", "x_", ":_", "x_", ">_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "250_", ",_", "0_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Count_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "count", "\\u", "predica", "te", "\\u", "some", "\\u", "even_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "220_", ",_", "3_", ")_", ",_", "on", "\\u", "next_", "(_", "230_", ",_", "4_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "count_", "(_", "lambda_", "x_", ":_", "x_", "%_", "2_", "==_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "next_", "(_", "250_", ",_", "2_", ")_", ",_", "on", "\\u", "completed_", "(_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "250_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Count_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "count", "\\u", "predica", "te", "\\u", "throw", "\\u", "true_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "error_", "(_", "210_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "count_", "(_", "lambda_", "\\u_", ":_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "error_", "(_", "210_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "210_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Count_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "count", "\\u", "predica", "te", "\\u", "throw", "\\u", "false_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "error_", "(_", "210_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "count_", "(_", "lambda_", "\\u_", ":_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "error_", "(_", "210_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "210_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Count_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "count", "\\u", "predica", "te", "\\u", "neve", "r_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "xs_", "._", "count_", "(_", "lambda_", "\\u_", ":_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "1000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Count_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "count", "\\u", "predica", "te", "\\u", "predica", "te", "\\u", "throw", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ex_", "=_", "'", "ex", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "scheduler_", "=_", "Test", "Scheduler_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "=_", "scheduler_", "._", "create", "\\u", "hot", "\\u", "observable_", "(_", "on", "\\u", "next_", "(_", "150_", ",_", "1_", ")_", ",_", "on", "\\u", "next_", "(_", "210_", ",_", "2_", ")_", ",_", "on", "\\u", "next_", "(_", "230_", ",_", "3_", ")_", ",_", "on", "\\u", "completed_", "(_", "240_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "create_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "predicate_", "(_", "x_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "x_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Exception_", "(_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "xs_", "._", "count_", "(_", "predicate_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "res_", "=_", "scheduler_", "._", "start_", "(_", "create_", "=_", "create_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "._", "messages_", "._", "assert", "\\u", "equal_", "(_", "on", "\\u", "error_", "(_", "230_", ",_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xs_", "._", "subscriptions_", "._", "assert", "\\u", "equal_", "(_", "subscribe_", "(_", "200_", ",_", "230_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 0, 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, 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,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
AppScale/appscale/AppServer/lib/django-1.3/django/core/handlers/base.py
[ { "content": " def get_response(self, request):\n \"Returns an HttpResponse object for the given HttpRequest\"\n from django.core import exceptions, urlresolvers\n from django.conf import settings\n\n try:\n # Setup default url resolver for this thread, this code is outside\n # the try/except so we don't get a spurious \"unbound local\n # variable\" exception in the event an exception is raised before\n # resolver is set\n urlconf = settings.ROOT_URLCONF\n urlresolvers.set_urlconf(urlconf)\n resolver = urlresolvers.RegexURLResolver(r'^/', urlconf)\n try:\n response = None\n # Apply request middleware\n for middleware_method in self._request_middleware:\n response = middleware_method(request)\n if response:\n break\n\n if response is None:\n if hasattr(request, \"urlconf\"):\n # Reset url resolver with a custom urlconf.\n urlconf = request.urlconf\n urlresolvers.set_urlconf(urlconf)\n resolver = urlresolvers.RegexURLResolver(r'^/', urlconf)\n\n callback, callback_args, callback_kwargs = resolver.resolve(\n request.path_info)\n\n # Apply view middleware\n for middleware_method in self._view_middleware:\n response = middleware_method(request, callback, callback_args, callback_kwargs)\n if response:\n break\n\n if response is None:\n try:\n response = callback(request, *callback_args, **callback_kwargs)\n except Exception, e:\n # If the view raised an exception, run it through exception\n # middleware, and if the exception middleware returns a\n # response, use that. Otherwise, reraise the exception.\n for middleware_method in self._exception_middleware:\n response = middleware_method(request, e)\n if response:\n break\n if response is None:\n raise\n\n # Complain if the view returned None (a common error).\n if response is None:\n try:\n view_name = callback.func_name # If it's a function\n except AttributeError:\n view_name = callback.__class__.__name__ + '.__call__' # If it's a class\n raise ValueError(\"The view %s.%s didn't return an HttpResponse object.\" % (callback.__module__, view_name))\n\n # If the response supports deferred rendering, apply template\n # response middleware and the render the response\n if hasattr(response, 'render') and callable(response.render):\n for middleware_method in self._template_response_middleware:\n response = middleware_method(request, response)\n response = response.render()\n\n except http.Http404, e:\n logger.warning('Not Found: %s' % request.path,\n extra={\n 'status_code': 404,\n 'request': request\n })\n if settings.DEBUG:\n from django.views import debug\n response = debug.technical_404_response(request, e)\n else:\n try:\n callback, param_dict = resolver.resolve404()\n response = callback(request, **param_dict)\n except:\n try:\n response = self.handle_uncaught_exception(request, resolver, sys.exc_info())\n finally:\n receivers = signals.got_request_exception.send(sender=self.__class__, request=request)\n except exceptions.PermissionDenied:\n logger.warning('Forbidden (Permission denied): %s' % request.path,\n extra={\n 'status_code': 403,\n 'request': request\n })\n response = http.HttpResponseForbidden('<h1>Permission denied</h1>')\n except SystemExit:\n # Allow sys.exit() to actually exit. See tickets #1023 and #4701\n raise\n except: # Handle everything else, including SuspiciousOperation, etc.\n # Get the exception info now, in case another exception is thrown later.\n receivers = signals.got_request_exception.send(sender=self.__class__, request=request)\n response = self.handle_uncaught_exception(request, resolver, sys.exc_info())\n finally:\n # Reset URLconf for this thread on the way out for complete\n # isolation of request.urlconf\n urlresolvers.set_urlconf(None)\n\n try:\n # Apply response middleware, regardless of the response\n for middleware_method in self._response_middleware:\n response = middleware_method(request, response)\n response = self.apply_response_fixes(request, response)\n except: # Any exception should be gathered and handled\n receivers = signals.got_request_exception.send(sender=self.__class__, request=request)\n response = self.handle_uncaught_exception(request, resolver, sys.exc_info())\n\n return response", "metadata": "root.BaseHandler.get_response", "header": "['class', 'BaseHandler', '(', 'object', ')', ':', '___NEWLINE___', '# Changes that are always applied to a response (in this order).', '___NL___', '___EOS___']", "index": 71 } ]
[ { "span": "except:", "start_line": 150, "start_column": 20, "end_line": 150, "end_column": 27 }, { "span": "except: ", "start_line": 165, "start_column": 12, "end_line": 165, "end_column": 19 }, { "span": "except: ", "start_line": 179, "start_column": 8, "end_line": 179, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Base", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Change", "s", " ", "tha", "t", " ", "are", " ", "alw", "ay", "s", " ", "applied", " ", "to", " ", "a", " ", "response", " ", "(", "in", " ", "this", " ", "order", ").", "_", "\\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_", "get", "\\u", "response_", "(_", "self_", ",_", "request_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"", "Return", "s", " ", "an", " ", "Http", "Respons", "e", " ", "object", " ", "for", " ", "the", " ", "give", "n", " ", "Http", "Request", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "import_", "exceptions_", ",_", "urlresolvers_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", "up", " ", "default", " ", "url", " ", "resolver", " ", "for", " ", "this", " ", "thread", ",", " ", "this", " ", "code", " ", "is", " ", "outsi", "de_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "try", "/", "except", " ", "so", " ", "we", " ", "don", "'", "t", " ", "get", " ", "a", " ", "spu", "rio", "us", " ", "\"", "unbound", " ", "local_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "variab", "le", "\"", " ", "exception", " ", "in", " ", "the", " ", "event", " ", "an", " ", "exception", " ", "is", " ", "raise", "d", " ", "before_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "resolver", " ", "is", " ", "set_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url", "conf_", "=_", "settings_", "._", "ROO", "T", "\\u", "URLCONF_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urlresolvers_", "._", "set\\u", "url", "conf_", "(_", "url", "conf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resolver_", "=_", "urlresolvers_", "._", "Rege", "x", "URL", "Resolver_", "(_", "r", "'", "^", "/'_", ",_", "url", "conf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Apply", " ", "request", " ", "middleware_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "middle", "ware", "\\u", "method_", "in_", "self_", "._", "\\u", "request", "\\u", "middleware_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "response_", "=_", "middle", "ware", "\\u", "method_", "(_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", ":_", "\\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_", "if_", "response_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "hasattr_", "(_", "request_", ",_", "\"", "url", "conf", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Reset", " ", "url", " ", "resolver", " ", "with", " ", "a", " ", "custom", " ", "url", "conf", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "url", "conf_", "=_", "request_", "._", "url", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "urlresolvers_", "._", "set\\u", "url", "conf_", "(_", "url", "conf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resolver_", "=_", "urlresolvers_", "._", "Rege", "x", "URL", "Resolver_", "(_", "r", "'", "^", "/'_", ",_", "url", "conf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "callback_", ",_", "callback", "\\u", "args_", ",_", "callback", "\\u", "kwargs_", "=_", "resolver_", "._", "resolve_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "._", "path", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Apply", " ", "view", " ", "middleware_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "middle", "ware", "\\u", "method_", "in_", "self_", "._", "\\u", "view", "\\u", "middleware_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "response_", "=_", "middle", "ware", "\\u", "method_", "(_", "request_", ",_", "callback_", ",_", "callback", "\\u", "args_", ",_", "callback", "\\u", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "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 ", " ", " _", "response_", "=_", "callback_", "(_", "request_", ",_", "*_", "callback", "\\u", "args_", ",_", "**_", "callback", "\\u", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "view", " ", "raise", "d", " ", "an", " ", "exception", ",", " ", "run", " ", "it", " ", "through", " ", "exception_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "middle", "ware", ",", " ", "and", " ", "if", " ", "the", " ", "exception", " ", "middle", "ware", " ", "return", "s", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "response", ",", " ", "use", " ", "tha", "t", ".", " ", "Ot", "her", "wis", "e", ",", " ", "reraise", " ", "the", " ", "exception", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "for_", "middle", "ware", "\\u", "method_", "in_", "self_", "._", "\\u", "exception", "\\u", "middleware_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "response_", "=_", "middle", "ware", "\\u", "method_", "(_", "request_", ",_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "is_", "None_", ":_", "\\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_", "#", " ", "Comp", "lain", " ", "if", " ", "the", " ", "view", " ", "return", "ed", " ", "Non", "e", " ", "(", "a", " ", "common", " ", "error", ").", "_", "\\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_", "response_", "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 ", " ", " _", "view", "\\u", "name_", "=_", "callback_", "._", "func", "\\u", "name_", "#", " ", "If", " ", "it", "'", "s", " ", "a", " ", "function_", "\\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 ", " ", " _", "view", "\\u", "name_", "=_", "callback_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", "+_", "'.", "\\u\\u", "call", "\\u\\u'_", "#", " ", "If", " ", "it", "'", "s", " ", "a", " ", "class_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "raise_", "Value", "Error_", "(_", "\"", "The", " ", "view", " ", "%", "s", ".", "%", "s", " ", "did", "n", "'", "t", " ", "return", " ", "an", " ", "Http", "Respons", "e", " ", "object", ".\"_", "%_", "(_", "callback_", "._", "\\u\\u", "module\\u\\u_", ",_", "view", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "response", " ", "support", "s", " ", "defer", "red", " ", "render", "ing", ",", " ", "appl", "y", " ", "template_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "response", " ", "middle", "ware", " ", "and", " ", "the", " ", "render", " ", "the", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "hasattr_", "(_", "response_", ",_", "'", "render", "'_", ")_", "and_", "callable_", "(_", "response_", "._", "render_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "for_", "middle", "ware", "\\u", "method_", "in_", "self_", "._", "\\u", "template", "\\u", "response", "\\u", "middleware_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "response_", "=_", "middle", "ware", "\\u", "method_", "(_", "request_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "response_", "._", "render_", "(_", ")_", "\\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_", "http_", "._", "Http404_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "'", "Not", " ", "Foun", "d", ":", " ", "%", "s", "'_", "%_", "request_", "._", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "\\u", "code", "'_", ":_", "404_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "request_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "settings_", "._", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "from_", "django_", "._", "views_", "import_", "debug_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "debug_", "._", "technical", "\\u", "404", "\\u", "response_", "(_", "request_", ",_", "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 ", " ", "_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "callback_", ",_", "param", "\\u", "dict_", "=_", "resolver_", "._", "resolve", "404_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "callback_", "(_", "request_", ",_", "**_", "param", "\\u", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "response_", "=_", "self_", "._", "handle", "\\u", "unca", "ugh", "t", "\\u", "exception_", "(_", "request_", ",_", "resolver_", ",_", "sys_", "._", "exc", "\\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 ", " ", " _", "receivers_", "=_", "signals_", "._", "got", "\\u", "request", "\\u", "exception_", "._", "send_", "(_", "sender_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "request_", "=_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exceptions_", "._", "Permi", "ssion", "Denied_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logger_", "._", "warning_", "(_", "'", "For", "bid", "den", " ", "(", "Permi", "ssion", " ", "deni", "ed", "):", " ", "%", "s", "'_", "%_", "request_", "._", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extra_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "\\u", "code", "'_", ":_", "403_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "request", "'_", ":_", "request_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "http_", "._", "Http", "Respons", "e", "Forbidden_", "(_", "'<", "h1", ">", "Permi", "ssion", " ", "deni", "ed", "</", "h1", ">'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "System", "Exit_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "All", "ow", " ", "sys", ".", "exit", "()", " ", "to", " ", "actual", "ly", " ", "exit", ".", " ", "See", " ", "tick", "ets", " ", "#", "1023", " ", "and", " ", "#", "470", "1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "#", " ", "Handle", " ", "every", "thing", " ", "else", ",", " ", "inclu", "ding", " ", "Sus", "picio", "us", "Opera", "tion", ",", " ", "etc", "._", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "exception", " ", "info", " ", "now", ",", " ", "in", " ", "case", " ", "anot", "her", " ", "exception", " ", "is", " ", "throw", "n", " ", "late", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "receivers_", "=_", "signals_", "._", "got", "\\u", "request", "\\u", "exception_", "._", "send_", "(_", "sender_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "request_", "=_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "handle", "\\u", "unca", "ugh", "t", "\\u", "exception_", "(_", "request_", ",_", "resolver_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Reset", " ", "URL", "conf", " ", "for", " ", "this", " ", "thread", " ", "on", " ", "the", " ", "way", " ", "out", " ", "for", " ", "complete_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "isolation", " ", "of", " ", "request", ".", "url", "conf_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "urlresolvers_", "._", "set\\u", "url", "conf_", "(_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Apply", " ", "response", " ", "middle", "ware", ",", " ", "rega", "rd", "less", " ", "of", " ", "the", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "middle", "ware", "\\u", "method_", "in_", "self_", "._", "\\u", "response", "\\u", "middleware_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "middle", "ware", "\\u", "method_", "(_", "request_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "self_", "._", "appl", "y", "\\u", "response", "\\u", "fixes", "_", "(_", "request_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "#", " ", "Any", " ", "exception", " ", "shou", "ld", " ", "be", " ", "gather", "ed", " ", "and", " ", "handled_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "receivers_", "=_", "signals_", "._", "got", "\\u", "request", "\\u", "exception_", "._", "send_", "(_", "sender_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", ",_", "request_", "=_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "self_", "._", "handle", "\\u", "unca", "ugh", "t", "\\u", "exception_", "(_", "request_", ",_", "resolver_", ",_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", ")_", "\\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, 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 ]
Unused import
coinkite/coinkite-real-time-invoice/main.py
[ { "content": "#!/usr/bin/env python\n#\n\n# Search for libraries also under ./lib\nimport os, sys, logging\nsys.path.insert(1, os.path.join(os.path.abspath('.'), 'lib'))\n\nimport webapp2, jinja2\nfrom decimal import Decimal\nfrom base64 import b32encode\nfrom cStringIO import StringIO\nfrom jinja2 import Markup\nfrom urllib import urlencode\nfrom urllib import quote as url_quote\nfrom google.appengine.api import memcache\n\nimport qrcode\nfrom qrcode.image.svg import SvgPathImage, SvgFragmentImage\nfrom qrcode.image.pil import PilImage\n\nfrom ckapi import CKRequestor, CKReqReceive, CKObject\n\nfrom models import MyInvoice, MAX_PAY_TIME\n\nlogger = logging.getLogger(__name__)\n\n# path to CK API\nJINJA_ENV = jinja2.Environment(\n loader=jinja2.FileSystemLoader(os.path.join(os.path.dirname(__file__), 'templates')),\n extensions=['jinja2.ext.autoescape'],\n autoescape=True)\n\n# API Keys and other unique configuration goes into \"settings.py\"\ntry:\n # normally, you should put your settings into settings.py\n from settings import *\nexcept NotImplementedError:\n # if \"settings_dev.py\" exists, use that instead (so I don't have to commit my keys)\n from settings_dev import *\n\n\n\n\n\n\n\n \n\n\n\n \n# Add some custom filters\nJINJA_ENV.filters.update({\n 'svg_qr': inline_svg_qr,\n 'urlencode': url_quote, # very poor verison of Jinja 2.7 code, but good enough?\n})\n\n# Explicit routing goes here.\n#\napp = webapp2.WSGIApplication([\n ('/', MainHandler),\n ('/make', MakeHandler),\n ('/invoice/(\\w+)', InvoiceHandler),\n ('/test/(\\w+)/(\\w+)', TestHandler),\n ('/invoice/(example).(\\w+)', InvoiceHandler),\n ('/qr/(\\w+).(png|svg)', QRHandler),\n], debug=True)\n\n# EOF\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_pubnub_auth():\n # Get the auth details needed for Pubnub (cached)\n d = memcache.get('pubnub')\n if d:\n return d\n\n d = CK_API.pubnub_enable()\n memcache.add('pubnub', d)\n\n return d", "metadata": "root.get_pubnub_auth", "header": "['module', '___EOS___']", "index": 40 }, { "content": "def get_ck_detail(refnum, cache_ttl=15):\n # Get the info on an CK object, with cache\n rk = 'detail.%s' % refnum\n d = memcache.get(rk)\n if d: return d\n\n d = CK_API.get_detail(refnum)\n memcache.add(rk, d, time=cache_ttl)\n\n return d", "metadata": "root.get_ck_detail", "header": "['module', '___EOS___']", "index": 51 }, { "content": "class MainHandler(webapp2.RequestHandler):", "metadata": "root.MainHandler", "header": "['module', '___EOS___']", "index": 63 }, { "content": " def get(self):\n #self.response.write('Hello world!')\n\n template_values = {}\n template = JINJA_ENV.get_template('index.html')\n self.response.write(template.render(template_values))", "metadata": "root.MainHandler.get", "header": "['class', 'MainHandler', '(', 'webapp2', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 64 }, { "content": "class InvoiceHandler(webapp2.RequestHandler):", "metadata": "root.InvoiceHandler", "header": "['module', '___EOS___']", "index": 71 }, { "content": " def get(self, token, example='btc'):\n ctx = CKObject(max_time = MAX_PAY_TIME)\n if token == 'example':\n cct = example.upper()\n ctx.cct = cct\n ctx.payable = Decimal('0.1612')\n ctx.payable_cct = cct\n ctx.amount_cct = 'USD'\n ctx.amount = Decimal('100.00')\n ctx.show_fiat = True\n ctx.label = 'Doggy Dash Crypto Cash'\n ctx.pubkey = 'n1EeygjWd6WSWxMyUx8Y6RBts3Mo8aZr3S'\n ctx.time_left = 10*60\n ctx.is_paid = False\n else:\n # find in DB\n inv = MyInvoice.get_by_token(token)\n\n if not inv:\n ctx.token = token\n template = JINJA_ENV.get_template('missing.html')\n self.response.write(template.render(ctx))\n return\n\n ctx.update(inv.to_dict())\n cct = inv.payable_cct\n ctx.label = ctx.label or ''\n ctx.time_left = inv.get_time_left()\n\n d = get_ck_detail(inv.ck_refnum)\n print \"details = %r\" % d\n\n # Has it been paid?? Limitations here:\n # - should handle amounts less that desired total, for wallets that sometimes\n # round down by a few satoshis.\n # - check # of confirmations are suitable for risk preferences\n #\n ctx.is_paid = d.is_completed or (d.amount_so_far.decimal >= ctx.payable)\n\n assert ctx.pubkey == d.coin.address\n \n if ctx.show_fiat: \n ctx.exchange_rates = [\n ('1 %s' % cct, '$612 USD'), \n ('%s %s' % (ctx.amount, cct), '$612 USD'), \n ]\n\n # a small dictionary of values we need to connect to pubnub\n ctx.pubnub_auth = get_pubnub_auth()\n\n ctx.bitcoin_link = ('bitcoin:%s?' % ctx.pubkey) + urlencode(dict(\n amount = ctx.amount, message = ctx.label[0:40]))\n \n template = JINJA_ENV.get_template('invoice.html')\n self.response.write(template.render(ctx))", "metadata": "root.InvoiceHandler.get", "header": "['class', 'InvoiceHandler', '(', 'webapp2', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 72 }, { "content": "class QRHandler(webapp2.RequestHandler):", "metadata": "root.QRHandler", "header": "['module', '___EOS___']", "index": 128 }, { "content": " def get(self, nonce, extension):\n\n # Render a QR into an image.\n qr = qrcode.QRCode(error_correction=qrcode.ERROR_CORRECT_H)\n qr.add_data(\"Hello bitcoin world...\")\n \n mime, factory = {\n 'svg': ('image/svg+xml', SvgPathImage),\n 'png': ('image/png', PilImage),\n }[extension]\n\n qr_img = qr.make_image(image_factory = factory)\n\n self.response.content_type = mime\n self.response.content_type_params = {}\n\n body = StringIO()\n qr_img.save(body)\n self.response.write(body.getvalue())", "metadata": "root.QRHandler.get", "header": "['class', 'QRHandler', '(', 'webapp2', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 129 }, { "content": "class TestHandler(webapp2.RequestHandler):", "metadata": "root.TestHandler", "header": "['module', '___EOS___']", "index": 149 }, { "content": " def get(self, token, test_case):\n # Hack to simulate payment.\n inv = MyInvoice.get_by_token(token)\n\n if test_case == '0':\n msg = dict(event_code = 'credit_0',\n activity = 'acccc-acccccc',\n desc = \"Unconfirmed credit\", \n request = inv.ck_refnum)\n ret = CK_API.pubnub_send(msg)\n\n else:\n self.error(404)\n\n self.response.content_type = 'text/plain'\n self.response.write(repr(ret))", "metadata": "root.TestHandler.get", "header": "['class', 'TestHandler', '(', 'webapp2', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 150 }, { "content": "class MakeHandler(webapp2.RequestHandler):\n \n", "metadata": "root.MakeHandler", "header": "['module', '___EOS___']", "index": 168 }, { "content": " def get(self):\n # provide a blank form.\n template = JINJA_ENV.get_template('make.html')\n ctx = CKObject()\n ctx.valid_coins = ACCOUNT_MAP.keys()\n recent = MyInvoice.recent_invoices().fetch(40)\n ctx.recent_invoices = recent\n\n for inv in recent:\n if inv.paid_at != None:\n inv.text_status = 'PAID'\n continue\n\n # check if paid.\n try:\n d = get_ck_detail(inv.ck_refnum)\n except:\n logger.error(\"Failed on %s\" % inv.ck_refnum, exc_info=1)\n continue\n\n inv.details = d\n if d.is_completed or d.amount_so_far.decimal:\n # TODO: should expose total paid so far (for tips and underpayment)\n # and link to transaction numbers displayed at blockr and so on.\n conf = d.events[0].confirmed_at\n if conf != None:\n inv.paid_at = conf\n inv.text_status = 'PAID'\n inv.put_async()\n else:\n inv.text_status = 'pending'\n else:\n inv.text_status = 'unpaid'\n\n self.response.write(template.render(ctx))", "metadata": "root.MakeHandler.get", "header": "['class', 'MakeHandler', '(', 'webapp2', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 169 }, { "content": " def post(self):\n # build it and redirect to something.\n # NOTE: setting in app.yaml protects this for admin-only access.\n\n # NOTE: A real program would have validation here\n amount = Decimal(self.request.get('amount', 0))\n amount_cct = self.request.get('amount_cct', 'BTC')[0:3].upper()\n payable_cct = self.request.get('payable_cct', 'BTC')[0:3].upper()\n label = self.request.get('label', None)\n show_fiat = self.request.get('show_fiat', False)\n\n n = MyInvoice()\n n.amount_cct = amount_cct\n n.payable_cct = payable_cct\n\n if amount_cct == payable_cct:\n n.payable = amount\n n.amount = amount\n else:\n # get a spot quote.\n q = CK_API.get('/v1/spot_quote/%s/%s/%s' % (payable_cct, amount_cct, amount))\n n.payable = q.result.decimal.quantize(Decimal('0.0001'))\n n.amount = amount\n\n n.label = label[0:190] if label else None\n n.show_fiat = bool(show_fiat)\n\n n.token = b32encode(os.urandom(10))\n\n # TODO get a pubkey for the request\n acct = ACCOUNT_MAP[payable_cct]\n r = CK_API.put('/v1/new/receive', account = acct,\n memo = 'See %s' % n.get_url(), amount = n.payable)\n\n req = r.result\n n.pubkey = req.coin.address\n n.ck_refnum = req.ref_number\n \n # save it.\n key = n.put()\n\n # bugfix: not seeing the new entry in the list after redirect\n # TODO: this doesn't help! need a fix for this issue\n from google.appengine.ext import ndb\n ndb.get_context().clear_cache()\n\n # redirect to making page.\n self.redirect('/make')", "metadata": "root.MakeHandler.post", "header": "['class', 'MakeHandler', '(', 'webapp2', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 206 }, { "content": "def inline_svg_qr(contents, boxsize=10):\n # provide SVG inline, which is a SVG image of QR needed!\n qr = qrcode.QRCode(error_correction=qrcode.ERROR_CORRECT_H, box_size=boxsize)\n qr.add_data(contents)\n qr_img = qr.make_image(image_factory = SvgPathImage)\n\n body = StringIO()\n qr_img.save(body)\n\n return Markup(body.getvalue())", "metadata": "root.inline_svg_qr", "header": "['module', '___EOS___']", "index": 255 } ]
[ { "span": "from qrcode.image.svg import SvgPathImage, SvgFragmentImage", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 59 }, { "span": "from ckapi import CKRequestor, CKReqReceive, CKObject", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 53 } ]
[]
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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sear", "ch", " ", "for", " ", "librar", "ies", " ", "als", "o", " ", "under", " ", "./", "lib_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", ",_", "sys_", ",_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "insert_", "(_", "1_", ",_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "'.'_", ")_", ",_", "'", "lib", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "webapp2_", ",_", "jinja2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "decimal_", "import_", "Decimal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "base64_", "import_", "b3", "2e", "ncode", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "c", "String", "IO_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "jinja2_", "import_", "Markup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "import_", "urlencode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "urllib_", "import_", "quote_", "as_", "url", "\\u", "quote_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "memcache_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "qrc", "ode_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "qrc", "ode_", "._", "image_", "._", "svg_", "import_", "Svg", "Path", "Image_", ",_", "Svg", "Fragment", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "qrc", "ode_", "._", "image_", "._", "pil", "_", "import_", "Pil", "Image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "ck", "api_", "import_", "CK", "Request", "or_", ",_", "CK", "Re", "q", "Receive", "_", ",_", "CK", "Object_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "models_", "import_", "My", "Invoice", "_", ",_", "MAX", "\\u", "PAY", "\\u", "TIME_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logger_", "=_", "logging_", "._", "get", "Logger_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "path", " ", "to", " ", "CK", " ", "API_", "\\u\\u\\uNL\\u\\u\\u_", "JI", "NJ", "A", "\\u", "ENV_", "=_", "jinja2_", "._", "Environment_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "loader_", "=_", "jinja2_", "._", "File", "System", "Loader_", "(_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'", "template", "s", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "extensions_", "=_", "[_", "'", "jin", "ja", "2", ".", "ext", ".", "autoe", "scap", "e", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "autoe", "scap", "e_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "API", " ", "Keys", " ", "and", " ", "other", " ", "unique", " ", "configura", "tion", " ", "go", "es", " ", "int", "o", " ", "\"", "settings", ".", "py", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "normal", "ly", ",", " ", "you", " ", "shou", "ld", " ", "put", " ", "your", " ", "settings", " ", "int", "o", " ", "settings", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "settings_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Not", "Impl", "ement", "ed", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "if", " ", "\"", "settings", "\\u", "dev", ".", "py", "\"", " ", "exist", "s", ",", " ", "use", " ", "tha", "t", " ", "inst", "ead", " ", "(", "so", " ", "I", " ", "don", "'", "t", " ", "have", " ", "to", " ", "commit", " ", "my", " ", "keys", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "settings", "\\u", "dev_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#", " ", "Add", " ", "some", " ", "custom", " ", "filters_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "JI", "NJ", "A", "\\u", "ENV_", "._", "filters_", "._", "update_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "svg", "\\u", "qr", "'_", ":_", "inline", "\\u", "svg", "\\u", "qr_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "encode", "'_", ":_", "url", "\\u", "quote_", ",_", "#", " ", "very", " ", "poo", "r", " ", "veri", "son", " ", "of", " ", "Jin", "ja", " ", "2.7", " ", "code", ",", " ", "but", " ", "good", " ", "eno", "ugh", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Exp", "licit", " ", "routin", "g", " ", "go", "es", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "=_", "webapp2_", "._", "WS", "GI", "Application_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/'_", ",_", "Main", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "make", "'_", ",_", "Make", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "invoic", "e", "/(", "\\\\", "w", "+)'_", ",_", "Invoice", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "test", "/(", "\\\\", "w", "+)/(", "\\\\", "w", "+)'_", ",_", "Test", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "invoic", "e", "/(", "example", ").", "(\\\\", "w", "+)'_", ",_", "Invoice", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'/", "qr", "/(", "\\\\", "w", "+)", ".(", "png", "|", "svg", ")'_", ",_", "QR", "Handler_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "debug_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "EOF_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "pub", "nu", "b", "\\u", "auth_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "auth", " ", "deta", "il", "s", " ", "need", "ed", " ", "for", " ", "Pub", "nu", "b", " ", "(", "cache", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "memcache_", "._", "get_", "(_", "'", "pub", "nu", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "d_", "=_", "CK", "\\u", "API_", "._", "pub", "nu", "b", "\\u", "enable_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "memcache_", "._", "add_", "(_", "'", "pub", "nu", "b", "'_", ",_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "ck", "\\u", "detail_", "(_", "refn", "um_", ",_", "cache", "\\u", "ttl_", "=_", "15_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "info", " ", "on", " ", "an", " ", "CK", " ", "object", ",", " ", "with", " ", "cache_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rk_", "=_", "'", "deta", "il", ".", "%", "s", "'_", "%_", "refn", "um_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "d_", "=_", "memcache_", "._", "get_", "(_", "rk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "d_", ":_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "CK", "\\u", "API_", "._", "get", "\\u", "detail_", "(_", "refn", "um_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "memcache_", "._", "add_", "(_", "rk_", ",_", "d_", ",_", "time_", "=_", "cache", "\\u", "ttl_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Main", "Handler_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Main", "Handler_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".", "response", ".", "write", "('", "Hell", "o", " ", "world", "!'", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template", "\\u", "values_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template_", "=_", "JI", "NJ", "A", "\\u", "ENV_", "._", "get", "\\u", "template_", "(_", "'", "index", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "._", "write_", "(_", "template_", "._", "render_", "(_", "template", "\\u", "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_", "Invoice", "Handler_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Invoice", "Handler_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ",_", "token_", ",_", "example_", "=_", "'", "btc", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "=_", "CK", "Object_", "(_", "max", "\\u", "time_", "=_", "MAX", "\\u", "PAY", "\\u", "TIME_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "token_", "==_", "'", "example", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cct", "_", "=_", "example_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "cct", "_", "=_", "cct", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "pay", "able_", "=_", "Decimal_", "(_", "'", "0.16", "1", "2", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "pay", "able", "\\u", "cct", "_", "=_", "cct", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "amo", "unt", "\\u", "cct", "_", "=_", "'", "US", "D", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "amount_", "=_", "Decimal_", "(_", "'", "100", ".00", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "show", "\\u", "fia", "t_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "label_", "=_", "'", "Dog", "gy", " ", "Dash", " ", "Crypto", " ", "Cas", "h", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "pubkey_", "=_", "'", "n1", "Ee", "yg", "j", "Wd", "6", "WS", "Wx", "My", "U", "x8", "Y", "6", "RB", "ts", "3", "Mo", "8a", "Z", "r3", "S", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "time", "\\u", "left_", "=_", "10_", "*_", "60_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "is", "\\u", "paid", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "find", " ", "in", " ", "DB_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inv_", "=_", "My", "Invoice", "_", "._", "get", "\\u", "by", "\\u", "token_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "inv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "token_", "=_", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "template_", "=_", "JI", "NJ", "A", "\\u", "ENV_", "._", "get", "\\u", "template_", "(_", "'", "missi", "ng", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "._", "write_", "(_", "template_", "._", "render_", "(_", "ctx_", ")_", ")_", "\\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_", "ctx_", "._", "update_", "(_", "inv_", "._", "to", "\\u", "dict_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cct", "_", "=_", "inv_", "._", "pay", "able", "\\u", "cct", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "label_", "=_", "ctx_", "._", "label_", "or_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "time", "\\u", "left_", "=_", "inv_", "._", "get", "\\u", "time", "\\u", "left_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "get", "\\u", "ck", "\\u", "detail_", "(_", "inv_", "._", "ck", "\\u", "refn", "um_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "deta", "il", "s", " ", "=", " ", "%", "r", "\"_", "%_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Has", " ", "it", " ", "bee", "n", " ", "paid", "??", " ", "Limit", "ation", "s", " ", "here", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "shou", "ld", " ", "handle", " ", "amounts", " ", "less", " ", "tha", "t", " ", "desi", "red", " ", "total", ",", " ", "for", " ", "walle", "ts", " ", "tha", "t", " ", "somet", "imes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "round", " ", "down", " ", "by", " ", "a", " ", "few", " ", "sat", "osh", "is", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "check", " ", "#", " ", "of", " ", "confirmation", "s", " ", "are", " ", "suit", "able", " ", "for", " ", "risk", " ", "preferences_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "ctx_", "._", "is", "\\u", "paid", "_", "=_", "d_", "._", "is", "\\u", "completed_", "or_", "(_", "d_", "._", "amo", "unt", "\\u", "so", "\\u", "far_", "._", "decimal_", ">=_", "ctx_", "._", "pay", "able_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "ctx_", "._", "pubkey_", "==_", "d_", "._", "coin_", "._", "address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ctx_", "._", "show", "\\u", "fia", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ctx_", "._", "exchange", "\\u", "rates_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "1", " ", "%", "s", "'_", "%_", "cct", "_", ",_", "'$", "612", " ", "US", "D", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'%", "s", " ", "%", "s", "'_", "%_", "(_", "ctx_", "._", "amount_", ",_", "cct", "_", ")_", ",_", "'$", "612", " ", "US", "D", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "a", " ", "small", " ", "dictionar", "y", " ", "of", " ", "values", " ", "we", " ", "need", " ", "to", " ", "connect", " ", "to", " ", "pub", "nu", "b_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ctx_", "._", "pub", "nu", "b", "\\u", "auth_", "=_", "get", "\\u", "pub", "nu", "b", "\\u", "auth_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ctx_", "._", "bitcoin", "\\u", "link_", "=_", "(_", "'", "bitcoin", ":", "%", "s", "?'_", "%_", "ctx_", "._", "pubkey_", ")_", "+_", "urlencode_", "(_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "amount_", "=_", "ctx_", "._", "amount_", ",_", "message_", "=_", "ctx_", "._", "label_", "[_", "0_", ":_", "40_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "template_", "=_", "JI", "NJ", "A", "\\u", "ENV_", "._", "get", "\\u", "template_", "(_", "'", "invoic", "e", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "._", "write_", "(_", "template_", "._", "render_", "(_", "ctx_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "QR", "Handler_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "QR", "Handler_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ",_", "nonce_", ",_", "extension_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Render", " ", "a", " ", "QR", " ", "int", "o", " ", "an", " ", "image", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qr_", "=_", "qrc", "ode_", "._", "QR", "Code_", "(_", "error", "\\u", "correction_", "=_", "qrc", "ode_", "._", "ERROR", "\\u", "CORREC", "T", "\\u", "H_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr_", "._", "add", "\\u", "data_", "(_", "\"", "Hell", "o", " ", "bitcoin", " ", "world", "...\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mime_", ",_", "factory_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "svg", "'_", ":_", "(_", "'", "image", "/", "svg", "+", "xml", "'_", ",_", "Svg", "Path", "Image_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "png", "'_", ":_", "(_", "'", "image", "/", "png", "'_", ",_", "Pil", "Image_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "[_", "extension_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "qr", "\\u", "img_", "=_", "qr_", "._", "make", "\\u", "image_", "(_", "image", "\\u", "factory_", "=_", "factory_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "response_", "._", "content", "\\u", "type_", "=_", "mime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "._", "content", "\\u", "type", "\\u", "params_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr", "\\u", "img_", "._", "save_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "._", "write_", "(_", "body_", "._", "getvalue_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Test", "Handler_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Handler_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ",_", "token_", ",_", "test\\u", "case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Hack", " ", "to", " ", "simulat", "e", " ", "pay", "ment", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inv_", "=_", "My", "Invoice", "_", "._", "get", "\\u", "by", "\\u", "token_", "(_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "test\\u", "case_", "==_", "'", "0", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "dict_", "(_", "event", "\\u", "code_", "=_", "'", "credit", "\\u", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "activity_", "=_", "'", "acc", "cc", "-", "acc", "ccc", "c", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "desc_", "=_", "\"", "Unco", "nfi", "rmed", " ", "credit", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request_", "=_", "inv_", "._", "ck", "\\u", "refn", "um_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ret_", "=_", "CK", "\\u", "API_", "._", "pub", "nu", "b", "\\u", "send_", "(_", "msg_", ")_", "\\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 ", " _", "self_", "._", "error_", "(_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "response_", "._", "content", "\\u", "type_", "=_", "'", "text", "/", "plain", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "._", "write_", "(_", "repr_", "(_", "ret_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Make", "Handler_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Make", "Handler_", "(_", "webapp2_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "provide", " ", "a", " ", "blank", " ", "form", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "template_", "=_", "JI", "NJ", "A", "\\u", "ENV_", "._", "get", "\\u", "template_", "(_", "'", "make", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "=_", "CK", "Object_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "valid", "\\u", "coins_", "=_", "ACCOUNT", "\\u", "MAP_", "._", "keys_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "recent_", "=_", "My", "Invoice", "_", "._", "recent", "\\u", "invoices", "_", "(_", ")_", "._", "fetch_", "(_", "40_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ctx_", "._", "recent", "\\u", "invoices", "_", "=_", "recent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "inv_", "in_", "recent_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "inv_", "._", "paid", "\\u", "at_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inv_", "._", "text", "\\u", "status_", "=_", "'", "PAI", "D", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "check", " ", "if", " ", "paid", "._", "\\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 ", " _", "d_", "=_", "get", "\\u", "ck", "\\u", "detail_", "(_", "inv_", "._", "ck", "\\u", "refn", "um_", ")_", "\\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_", "(_", "\"", "Fail", "ed", " ", "on", " ", "%", "s", "\"_", "%_", "inv_", "._", "ck", "\\u", "refn", "um_", ",_", "exc", "\\u", "info_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "inv_", "._", "details_", "=_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "d_", "._", "is", "\\u", "completed_", "or_", "d_", "._", "amo", "unt", "\\u", "so", "\\u", "far_", "._", "decimal_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "shou", "ld", " ", "expos", "e", " ", "total", " ", "paid", " ", "so", " ", "far", " ", "(", "for", " ", "tips", " ", "and", " ", "under", "pay", "ment", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "link", " ", "to", " ", "transaction", " ", "numbers", " ", "displaye", "d", " ", "at", " ", "block", "r", " ", "and", " ", "so", " ", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", "=_", "d_", "._", "events_", "[_", "0_", "]_", "._", "confirm", "ed", "\\u", "at_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "conf_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "inv_", "._", "paid", "\\u", "at_", "=_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inv_", "._", "text", "\\u", "status_", "=_", "'", "PAI", "D", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inv_", "._", "put", "\\u", "async_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "inv_", "._", "text", "\\u", "status_", "=_", "'", "pend", "ing", "'_", "\\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 ", " _", "inv_", "._", "text", "\\u", "status_", "=_", "'", "unpa", "id", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "response_", "._", "write_", "(_", "template_", "._", "render_", "(_", "ctx_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Make", "Handler_", "(_", "webapp2_", "._", "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_", "#", " ", "build", " ", "it", " ", "and", " ", "redirec", "t", " ", "to", " ", "somet", "hing", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "setti", "ng", " ", "in", " ", "app", ".", "yaml", " ", "protect", "s", " ", "this", " ", "for", " ", "admin", "-", "only", " ", "access", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "A", " ", "real", " ", "program", " ", "wou", "ld", " ", "have", " ", "validation", " ", "here_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "amount_", "=_", "Decimal_", "(_", "self_", "._", "request_", "._", "get_", "(_", "'", "amo", "unt", "'_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "amo", "unt", "\\u", "cct", "_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "amo", "unt", "\\u", "cct", "'_", ",_", "'", "BT", "C", "'_", ")_", "[_", "0_", ":_", "3_", "]_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pay", "able", "\\u", "cct", "_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "pay", "able", "\\u", "cct", "'_", ",_", "'", "BT", "C", "'_", ")_", "[_", "0_", ":_", "3_", "]_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "label", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "show", "\\u", "fia", "t_", "=_", "self_", "._", "request_", "._", "get_", "(_", "'", "show", "\\u", "fia", "t", "'_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "=_", "My", "Invoice", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "._", "amo", "unt", "\\u", "cct", "_", "=_", "amo", "unt", "\\u", "cct", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "._", "pay", "able", "\\u", "cct", "_", "=_", "pay", "able", "\\u", "cct", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "amo", "unt", "\\u", "cct", "_", "==_", "pay", "able", "\\u", "cct", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "n_", "._", "pay", "able_", "=_", "amount_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "._", "amount_", "=_", "amount_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "a", " ", "spot", " ", "quote", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "q_", "=_", "CK", "\\u", "API_", "._", "get_", "(_", "'/", "v1", "/", "spot", "\\u", "quote", "/", "%", "s", "/", "%", "s", "/", "%", "s", "'_", "%_", "(_", "pay", "able", "\\u", "cct", "_", ",_", "amo", "unt", "\\u", "cct", "_", ",_", "amount_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "._", "pay", "able_", "=_", "q_", "._", "result_", "._", "decimal_", "._", "quantize", "_", "(_", "Decimal_", "(_", "'", "0.0001", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "._", "amount_", "=_", "amount_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "n_", "._", "label_", "=_", "label_", "[_", "0_", ":_", "190_", "]_", "if_", "label_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "._", "show", "\\u", "fia", "t_", "=_", "bool_", "(_", "show", "\\u", "fia", "t_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "._", "token_", "=_", "b3", "2e", "ncode", "_", "(_", "os_", "._", "urandom_", "(_", "10_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", " ", "get", " ", "a", " ", "pubkey", " ", "for", " ", "the", " ", "request_", "\\u\\u\\uNL\\u\\u\\u_", "acct", "_", "=_", "ACCOUNT", "\\u", "MAP_", "[_", "pay", "able", "\\u", "cct", "_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "CK", "\\u", "API_", "._", "put_", "(_", "'/", "v1", "/", "new", "/", "receive", "'_", ",_", "account_", "=_", "acct", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "memo_", "=_", "'", "See", " ", "%", "s", "'_", "%_", "n_", "._", "get", "\\u", "url_", "(_", ")_", ",_", "amount_", "=_", "n_", "._", "pay", "able_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "req_", "=_", "r_", "._", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "._", "pubkey_", "=_", "req_", "._", "coin_", "._", "address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "n_", "._", "ck", "\\u", "refn", "um_", "=_", "req_", "._", "ref", "\\u", "number_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "save", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "n_", "._", "put_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bug", "fix", ":", " ", "not", " ", "see", "ing", " ", "the", " ", "new", " ", "entry", " ", "in", " ", "the", " ", "list", " ", "after", " ", "redirect_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", ":", " ", "this", " ", "doe", "sn", "'", "t", " ", "help", "!", " ", "need", " ", "a", " ", "fix", " ", "for", " ", "this", " ", "issue_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "import_", "ndb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ndb_", "._", "get", "\\u", "context_", "(_", ")_", "._", "clear", "\\u", "cache_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "redirec", "t", " ", "to", " ", "mak", "ing", " ", "page", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "redirect_", "(_", "'/", "make", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "inline", "\\u", "svg", "\\u", "qr_", "(_", "contents_", ",_", "boxs", "ize_", "=_", "10_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "provide", " ", "SV", "G", " ", "inline", ",", " ", "whi", "ch", " ", "is", " ", "a", " ", "SV", "G", " ", "image", " ", "of", " ", "QR", " ", "need", "ed", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "qr_", "=_", "qrc", "ode_", "._", "QR", "Code_", "(_", "error", "\\u", "correction_", "=_", "qrc", "ode_", "._", "ERROR", "\\u", "CORREC", "T", "\\u", "H_", ",_", "box", "\\u", "size_", "=_", "boxs", "ize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr_", "._", "add", "\\u", "data_", "(_", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr", "\\u", "img_", "=_", "qr_", "._", "make", "\\u", "image_", "(_", "image", "\\u", "factory_", "=_", "Svg", "Path", "Image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "body_", "=_", "String", "IO_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr", "\\u", "img_", "._", "save_", "(_", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "Markup_", "(_", "body_", "._", "getvalue_", "(_", ")_", ")_", "\\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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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 ]
Unreachable code
an0/Letterpress/code/markdown2/lib/markdown2.py
[ { "content": "#!/usr/bin/env python\n# Copyright (c) 2012 Trent Mick.\n# Copyright (c) 2007-2008 ActiveState Corp.\n# License: MIT (http://www.opensource.org/licenses/mit-license.php)\n\nfrom __future__ import generators\n\nr\"\"\"A fast and complete Python implementation of Markdown.\n\n[from http://daringfireball.net/projects/markdown/]\n> Markdown is a text-to-HTML filter; it translates an easy-to-read /\n> easy-to-write structured text format into HTML. Markdown's text\n> format is most similar to that of plain text email, and supports\n> features such as headers, *emphasis*, code blocks, blockquotes, and\n> links.\n>\n> Markdown's syntax is designed not as a generic markup language, but\n> specifically to serve as a front-end to (X)HTML. You can use span-level\n> HTML tags anywhere in a Markdown document, and you can use block level\n> HTML tags (like <div> and <table> as well).\n\nModule usage:\n\n >>> import markdown2\n >>> markdown2.markdown(\"*boo!*\") # or use `html = markdown_path(PATH)`\n u'<p><em>boo!</em></p>\\n'\n\n >>> markdowner = Markdown()\n >>> markdowner.convert(\"*boo!*\")\n u'<p><em>boo!</em></p>\\n'\n >>> markdowner.convert(\"**boom!**\")\n u'<p><strong>boom!</strong></p>\\n'\n\nThis implementation of Markdown implements the full \"core\" syntax plus a\nnumber of extras (e.g., code syntax coloring, footnotes) as described on\n<https://github.com/trentm/python-markdown2/wiki/Extras>.\n\"\"\"\n\ncmdln_desc = \"\"\"A fast and complete Python implementation of Markdown, a\ntext-to-HTML conversion tool for web writers.\n\nSupported extra syntax options (see -x|--extras option below and\nsee <https://github.com/trentm/python-markdown2/wiki/Extras> for details):\n\n* code-friendly: Disable _ and __ for em and strong.\n* cuddled-lists: Allow lists to be cuddled to the preceding paragraph.\n* fenced-code-blocks: Allows a code block to not have to be indented\n by fencing it with '```' on a line before and after. Based on\n <http://github.github.com/github-flavored-markdown/> with support for\n syntax highlighting.\n* footnotes: Support footnotes as in use on daringfireball.net and\n implemented in other Markdown processors (tho not in Markdown.pl v1.0.1).\n* header-ids: Adds \"id\" attributes to headers. The id value is a slug of\n the header text.\n* html-classes: Takes a dict mapping html tag names (lowercase) to a\n string to use for a \"class\" tag attribute. Currently only supports \"img\",\n \"table\", \"pre\" and \"code\" tags. Add an issue if you require this for other\n tags.\n* markdown-in-html: Allow the use of `markdown=\"1\"` in a block HTML tag to\n have markdown processing be done on its contents. Similar to\n <http://michelf.com/projects/php-markdown/extra/#markdown-attr> but with\n some limitations.\n* metadata: Extract metadata from a leading '---'-fenced block.\n See <https://github.com/trentm/python-markdown2/issues/77> for details.\n* nofollow: Add `rel=\"nofollow\"` to add `<a>` tags with an href. See\n <http://en.wikipedia.org/wiki/Nofollow>.\n* pyshell: Treats unindented Python interactive shell sessions as <code>\n blocks.\n* link-patterns: Auto-link given regex patterns in text (e.g. bug number\n references, revision number references).\n* smarty-pants: Replaces ' and \" with curly quotation marks or curly\n apostrophes. Replaces --, ---, ..., and . . . with en dashes, em dashes,\n and ellipses.\n* spoiler: A special kind of blockquote commonly hidden behind a\n click on SO. Syntax per <http://meta.stackexchange.com/a/72878>.\n* toc: The returned HTML string gets a new \"toc_html\" attribute which is\n a Table of Contents for the document. (experimental)\n* xml: Passes one-liner processing instructions and namespaced XML tags.\n* tables: Tables using the same format as GFM\n <https://help.github.com/articles/github-flavored-markdown#tables> and\n PHP-Markdown Extra <https://michelf.ca/projects/php-markdown/extra/#table>.\n* wiki-tables: Google Code Wiki-style tables. See\n <http://code.google.com/p/support/wiki/WikiSyntax#Tables>.\n\"\"\"\n\n# Dev Notes:\n# - Python's regex syntax doesn't have '\\z', so I'm using '\\Z'. I'm\n# not yet sure if there implications with this. Compare 'pydoc sre'\n# and 'perldoc perlre'.\n\n__version_info__ = (2, 3, 1)\n__version__ = '.'.join(map(str, __version_info__))\n__author__ = \"Trent Mick\"\n\nimport os\nimport sys\nfrom pprint import pprint, pformat\nimport re\nimport logging\ntry:\n from hashlib import md5\nexcept ImportError:\n from md5 import md5\nimport optparse\nfrom random import random, randint\nimport codecs\n\n\n#---- Python version compat\n\ntry:\n from urllib.parse import quote # python3\nexcept ImportError:\n from urllib import quote # python2\n\nif sys.version_info[:2] < (2,4):\n from sets import Set as set\n\n# Use `bytes` for byte strings and `unicode` for unicode strings (str in Py3).\nif sys.version_info[0] <= 2:\n py3 = False\n try:\n bytes\n except NameError:\n bytes = str\n base_string_type = basestring\nelif sys.version_info[0] >= 3:\n py3 = True\n unicode = str\n base_string_type = str\n\n\n\n#---- globals\n\nDEBUG = False\nlog = logging.getLogger(\"markdown\")\n\nDEFAULT_TAB_WIDTH = 4\n\n\nSECRET_SALT = bytes(randint(0, 1000000))\n\n# Table of hash values for escaped characters:\ng_escape_table = dict([(ch, _hash_text(ch))\n for ch in '\\\\`*_{}[]()>#+-.!'])\n\n\n\n#---- exceptions\n\n\n\n\n#---- public api\n\n\n\n\n\n\n\n#---- internal support functions\n\n\n## {{{ http://code.activestate.com/recipes/577257/ (r1)\n_slugify_strip_re = re.compile(r'[^\\w\\s-]')\n_slugify_hyphenate_re = re.compile(r'[-\\s]+')\n## end of http://code.activestate.com/recipes/577257/ }}}\n\n\n# From http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52549\n\n# Recipe: regex_from_encoded_pattern (1.0)\n\n# Recipe: dedent (0.1.2)\n\n\n\n\n\n_xml_oneliner_re_from_tab_width = _memoized(_xml_oneliner_re_from_tab_width)\n\n_hr_tag_re_from_tab_width = _memoized(_hr_tag_re_from_tab_width)\n\n\n\n\n\n\n\n#---- mainline\n\n\n\n\n\nif __name__ == \"__main__\":\n sys.exit( main(sys.argv) )\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def _dedentlines(lines, tabsize=8, skip_first_line=False):\n \"\"\"_dedentlines(lines, tabsize=8, skip_first_line=False) -> dedented lines\n\n \"lines\" is a list of lines to dedent.\n \"tabsize\" is the tab width to use for indent width calculations.\n \"skip_first_line\" is a boolean indicating if the first line should\n be skipped for calculating the indent width and for dedenting.\n This is sometimes useful for docstrings and similar.\n\n Same as dedent() except operates on a sequence of lines. Note: the\n lines list is modified **in-place**.\n \"\"\"\n DEBUG = False\n if DEBUG:\n print(\"dedent: dedent(..., tabsize=%d, skip_first_line=%r)\"\\\n % (tabsize, skip_first_line))\n indents = []\n margin = None\n for i, line in enumerate(lines):\n if i == 0 and skip_first_line: continue\n indent = 0\n for ch in line:\n if ch == ' ':\n indent += 1\n elif ch == '\\t':\n indent += tabsize - (indent % tabsize)\n elif ch in '\\r\\n':\n continue # skip all-whitespace lines\n else:\n break\n else:\n continue # skip all-whitespace lines\n if DEBUG: print(\"dedent: indent=%d: %r\" % (indent, line))\n if margin is None:\n margin = indent\n else:\n margin = min(margin, indent)\n if DEBUG: print(\"dedent: margin=%r\" % margin)\n\n if margin is not None and margin > 0:\n for i, line in enumerate(lines):\n if i == 0 and skip_first_line: continue\n removed = 0\n for j, ch in enumerate(line):\n if ch == ' ':\n removed += 1\n elif ch == '\\t':\n removed += tabsize - (removed % tabsize)\n elif ch in '\\r\\n':\n if DEBUG: print(\"dedent: %r: EOL -> strip up to EOL\" % line)\n lines[i] = lines[i][j:]\n break\n else:\n raise ValueError(\"unexpected non-whitespace char %r in \"\n \"line %r while removing %d-space margin\"\n % (ch, line, margin))\n if DEBUG:\n print(\"dedent: %r: %r -> removed %d/%d\"\\\n % (line, ch, removed, margin))\n if removed == margin:\n lines[i] = lines[i][j+1:]\n break\n elif removed > margin:\n lines[i] = ' '*(removed-margin) + lines[i][j+1:]\n break\n else:\n if removed:\n lines[i] = lines[i][removed:]\n return lines", "metadata": "root._dedentlines", "header": "['module', '___EOS___']", "index": 2194 } ]
[ { "span": "except NameError:", "start_line": 126, "start_column": 4, "end_line": 126, "end_column": 21 }, { "span": "print(\"dedent: dedent(..., tabsize=%d, skip_first_line=%r)\"\\\n % (tabsize, skip_first_line))", "start_line": 2208, "start_column": 8, "end_line": 2209, "end_column": 43 }, { "span": "print(\"dedent: indent=%d: %r\" % (indent, line))", "start_line": 2226, "start_column": 18, "end_line": 2226, "end_column": 65 }, { "span": "print(\"dedent: margin=%r\" % margin)", "start_line": 2231, "start_column": 14, "end_line": 2231, "end_column": 49 }, { "span": "print(\"dedent: %r: EOL -> strip up to EOL\" % line)", "start_line": 2243, "start_column": 30, "end_line": 2243, "end_column": 80 }, { "span": "print(\"dedent: %r: %r -> removed %d/%d\"\\\n % (line, ch, removed, margin))", "start_line": 2251, "start_column": 20, "end_line": 2252, "end_column": 56 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2012", " ", "Tren", "t", " ", "Mi", "ck", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2007", "-", "2008", " ", "Activ", "e", "State", " ", "Cor", "p", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", ":", " ", "MIT", " ", "(", "http", "://", "www", ".", "opens", "ource", ".", "org", "/", "license", "s", "/", "mit", "-", "license", ".", "php", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "generators_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "r", "\"\"\"", "A", " ", "fast", " ", "and", " ", "complete", " ", "Pyth", "on", " ", "implementation", " ", "of", " ", "Markdown", ".", "\\", "10", ";", "\\", "10", ";", "[", "from", " ", "http", "://", "dar", "ing", "fireba", "ll", ".", "net", "/", "project", "s", "/", "mark", "down", "/]", "\\", "10", ";", ">", " ", "Markdown", " ", "is", " ", "a", " ", "text", "-", "to", "-", "HTM", "L", " ", "filter", ";", " ", "it", " ", "translat", "es", " ", "an", " ", "easy", "-", "to", "-", "read", " ", "/", "\\", "10", ";", ">", " ", "easy", "-", "to", "-", "write", " ", "structure", "d", " ", "text", " ", "format", " ", "int", "o", " ", "HTM", "L", ".", " ", " ", "Markdown", "'", "s", " ", "text", "\\", "10", ";", ">", " ", "format", " ", "is", " ", "most", " ", "similar", " ", "to", " ", "tha", "t", " ", "of", " ", "plain", " ", "text", " ", "email", ",", " ", "and", " ", "support", "s", "\\", "10", ";", ">", " ", "features", " ", "suc", "h", " ", "as", " ", "header", "s", ",", " ", "*", "empha", "sis", "*", ",", " ", "code", " ", "blocks", ",", " ", "block", "quote", "s", ",", " ", "and", "\\", "10", ";", ">", " ", "link", "s", ".", "\\", "10", ";", ">", "\\", "10", ";", ">", " ", "Markdown", "'", "s", " ", "synta", "x", " ", "is", " ", "design", "ed", " ", "not", " ", "as", " ", "a", " ", "gener", "ic", " ", "markup", " ", "language", ",", " ", "but", "\\", "10", ";", ">", " ", "specifica", "ll", "y", " ", "to", " ", "serve", " ", "as", " ", "a", " ", "front", "-", "end", " ", "to", " ", "(", "X", ")", "HTM", "L", ".", " ", "You", " ", "can", " ", "use", " ", "span", "-", "level", "\\", "10", ";", ">", " ", "HTM", "L", " ", "tags", " ", "any", "where", " ", "in", " ", "a", " ", "Markdown", " ", "document", ",", " ", "and", " ", "you", " ", "can", " ", "use", " ", "block", " ", "level", "\\", "10", ";", ">", " ", "HTM", "L", " ", "tags", " ", "(", "like", " ", "<", "div", ">", " ", "and", " ", "<", "table", ">", " ", "as", " ", "well", ").", "\\", "10", ";", "\\", "10", ";", "Modul", "e", " ", "usage", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "import", " ", "mark", "down", "2", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "mark", "down", "2", ".", "mark", "down", "(\"", "*", "boo", "!*", "\")", " ", " ", "#", " ", "or", " ", "use", " ", "`", "html", " ", "=", " ", "mark", "down", "\\u", "path", "(", "PATH", ")`", "\\", "10", ";", " ", " ", " ", " ", "u", "'<", "p", "><", "em", ">", "boo", "!<", "/", "em", "><", "/", "p", ">\\\\", "n", "'", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "mark", "down", "er", " ", "=", " ", "Markdown", "()", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "mark", "down", "er", ".", "convert", "(\"", "*", "boo", "!*", "\")", "\\", "10", ";", " ", " ", " ", " ", "u", "'<", "p", "><", "em", ">", "boo", "!<", "/", "em", "><", "/", "p", ">\\\\", "n", "'", "\\", "10", ";", " ", " ", " ", " ", ">>>", " ", "mark", "down", "er", ".", "convert", "(\"", "**", "boo", "m", "!*", "*\"", ")", "\\", "10", ";", " ", " ", " ", " ", "u", "'<", "p", "><", "strong", ">", "boo", "m", "!<", "/", "strong", "><", "/", "p", ">\\\\", "n", "'", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "implementation", " ", "of", " ", "Markdown", " ", "implement", "s", " ", "the", " ", "full", " ", "\"", "core", "\"", " ", "synta", "x", " ", "plus", " ", "a", "\\", "10", ";", "number", " ", "of", " ", "extra", "s", " ", "(", "e", ".", "g", ".,", " ", "code", " ", "synta", "x", " ", "colori", "ng", ",", " ", "footnote", "s", ")", " ", "as", " ", "descri", "bed", " ", "on", "\\", "10", ";<", "https", "://", "git", "hub", ".", "com", "/", "tre", "nt", "m", "/", "python", "-", "mark", "down", "2", "/", "wiki", "/", "Extra", "s", ">.", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cmd", "ln", "\\u", "desc_", "=_", "\"\"\"", "A", " ", "fast", " ", "and", " ", "complete", " ", "Pyth", "on", " ", "implementation", " ", "of", " ", "Markdown", ",", " ", "a", "\\", "10", ";", "text", "-", "to", "-", "HTM", "L", " ", "conve", "rsi", "on", " ", "tool", " ", "for", " ", "web", " ", "writer", "s", ".", "\\", "10", ";", "\\", "10", ";", "Supp", "orte", "d", " ", "extra", " ", "synta", "x", " ", "options", " ", "(", "see", " ", "-", "x", "|--", "extra", "s", " ", "option", " ", "belo", "w", " ", "and", "\\", "10", ";", "see", " ", "<", "https", "://", "git", "hub", ".", "com", "/", "tre", "nt", "m", "/", "python", "-", "mark", "down", "2", "/", "wiki", "/", "Extra", "s", ">", " ", "for", " ", "deta", "il", "s", "):", "\\", "10", ";", "\\", "10", ";", "*", " ", "code", "-", "frie", "ndl", "y", ":", " ", "Disa", "ble", " ", "\\u", " ", "and", " ", "\\u\\u", " ", "for", " ", "em", " ", "and", " ", "strong", ".", "\\", "10", ";", "*", " ", "cud", "dle", "d", "-", "lists", ":", " ", "All", "ow", " ", "lists", " ", "to", " ", "be", " ", "cud", "dle", "d", " ", "to", " ", "the", " ", "preceding", " ", "paragraph", ".", "\\", "10", ";", "*", " ", "fence", "d", "-", "code", "-", "blocks", ":", " ", "All", "ow", "s", " ", "a", " ", "code", " ", "block", " ", "to", " ", "not", " ", "have", " ", "to", " ", "be", " ", "indented", "\\", "10", ";", " ", " ", "by", " ", "fen", "cing", " ", "it", " ", "with", " ", "'``", "`", "'", " ", "on", " ", "a", " ", "line", " ", "bef", "ore", " ", "and", " ", "after", ".", " ", "Base", "d", " ", "on", "\\", "10", ";", " ", " ", "<", "http", "://", "git", "hub", ".", "git", "hub", ".", "com", "/", "git", "hub", "-", "flavor", "ed", "-", "mark", "down", "/>", " ", "with", " ", "support", " ", "for", "\\", "10", ";", " ", " ", "synta", "x", " ", "highlight", "ing", ".", "\\", "10", ";", "*", " ", "footnote", "s", ":", " ", "Supp", "ort", " ", "footnote", "s", " ", "as", " ", "in", " ", "use", " ", "on", " ", "dar", "ing", "fireba", "ll", ".", "net", " ", "and", "\\", "10", ";", " ", " ", "implemented", " ", "in", " ", "other", " ", "Markdown", " ", "process", "ors", " ", "(", "tho", " ", "not", " ", "in", " ", "Markdown", ".", "pl", " ", "v1", ".0", ".1", ").", "\\", "10", ";", "*", " ", "header", "-", "ids", ":", " ", "Add", "s", " ", "\"", "id", "\"", " ", "attribute", "s", " ", "to", " ", "header", "s", ".", " ", "The", " ", "id", " ", "value", " ", "is", " ", "a", " ", "slug", " ", "of", "\\", "10", ";", " ", " ", "the", " ", "header", " ", "text", ".", "\\", "10", ";", "*", " ", "html", "-", "classe", "s", ":", " ", "Tak", "es", " ", "a", " ", "dict", " ", "mapping", " ", "html", " ", "tag", " ", "names", " ", "(", "lower", "case", ")", " ", "to", " ", "a", "\\", "10", ";", " ", " ", "string", " ", "to", " ", "use", " ", "for", " ", "a", " ", "\"", "class", "\"", " ", "tag", " ", "attribute", ".", " ", "Curr", "ent", "ly", " ", "only", " ", "support", "s", " ", "\"", "img", "\",", "\\", "10", ";", " ", " ", "\"", "table", "\",", " ", "\"", "pre", "\"", " ", "and", " ", "\"", "code", "\"", " ", "tags", ".", " ", "Add", " ", "an", " ", "issue", " ", "if", " ", "you", " ", "require", " ", "this", " ", "for", " ", "other", "\\", "10", ";", " ", " ", "tags", ".", "\\", "10", ";", "*", " ", "mark", "down", "-", "in", "-", "html", ":", " ", "All", "ow", " ", "the", " ", "use", " ", "of", " ", "`", "mark", "down", "=\"", "1", "\"`", " ", "in", " ", "a", " ", "block", " ", "HTM", "L", " ", "tag", " ", "to", "\\", "10", ";", " ", " ", "have", " ", "mark", "down", " ", "process", "ing", " ", "be", " ", "don", "e", " ", "on", " ", "its", " ", "content", "s", ".", " ", "Simil", "ar", " ", "to", "\\", "10", ";", " ", " ", "<", "http", "://", "mich", "elf", ".", "com", "/", "project", "s", "/", "php", "-", "mark", "down", "/", "extra", "/", "#", "mark", "down", "-", "attr", ">", " ", "but", " ", "with", "\\", "10", ";", " ", " ", "some", " ", "limit", "ation", "s", ".", "\\", "10", ";", "*", " ", "metadata", ":", " ", "Extract", " ", "metadata", " ", "from", " ", "a", " ", "lead", "ing", " ", "'---", "'-", "fence", "d", " ", "block", ".", "\\", "10", ";", " ", " ", "See", " ", "<", "https", "://", "git", "hub", ".", "com", "/", "tre", "nt", "m", "/", "python", "-", "mark", "down", "2", "/", "issue", "s", "/", "7", "7", ">", " ", "for", " ", "deta", "il", "s", ".", "\\", "10", ";", "*", " ", "nofo", "llow", ":", " ", "Add", " ", "`", "rel", "=\"", "nofo", "llow", "\"`", " ", "to", " ", "add", " ", "`", "<", "a", ">`", " ", "tags", " ", "with", " ", "an", " ", "href", ".", " ", "See", "\\", "10", ";", " ", " ", "<", "http", "://", "en", ".", "wikip", "edia", ".", "org", "/", "wiki", "/", "No", "follow", ">.", "\\", "10", ";", "*", " ", "pys", "hell", ":", " ", "Treat", "s", " ", "unin", "dent", "ed", " ", "Pyth", "on", " ", "interactive", " ", "shell", " ", "session", "s", " ", "as", " ", "<", "code", ">", "\\", "10", ";", " ", " ", "blocks", ".", "\\", "10", ";", "*", " ", "link", "-", "pattern", "s", ":", " ", "Auto", "-", "link", " ", "give", "n", " ", "regex", " ", "pattern", "s", " ", "in", " ", "text", " ", "(", "e", ".", "g", ".", " ", "bug", " ", "number", "\\", "10", ";", " ", " ", "reference", "s", ",", " ", "revis", "ion", " ", "number", " ", "reference", "s", ").", "\\", "10", ";", "*", " ", "smart", "y", "-", "pant", "s", ":", " ", "Replace", "s", " ", "'", " ", "and", " ", "\"", " ", "with", " ", "curl", "y", " ", "quotation", " ", "mark", "s", " ", "or", " ", "curl", "y", "\\", "10", ";", " ", " ", "apos", "trop", "hes", ".", " ", " ", "Replace", "s", " ", "--", ",", " ", "---", ",", " ", "...", ",", " ", "and", " ", ".", " ", ".", " ", ".", " ", "with", " ", "en", " ", "dashes", ",", " ", "em", " ", "dashes", ",", "\\", "10", ";", " ", " ", "and", " ", "ellips", "es", ".", "\\", "10", ";", "*", " ", "spo", "iler", ":", " ", "A", " ", "special", " ", "kind", " ", "of", " ", "block", "quote", " ", "common", "ly", " ", "hidden", " ", "beh", "ind", " ", "a", "\\", "10", ";", " ", " ", "click", " ", "on", " ", "SO", ".", " ", "Syntax", " ", "per", " ", "<", "http", "://", "meta", ".", "stack", "exchange", ".", "com", "/", "a", "/", "728", "7", "8", ">.", "\\", "10", ";", "*", " ", "toc", ":", " ", "The", " ", "return", "ed", " ", "HTM", "L", " ", "string", " ", "gets", " ", "a", " ", "new", " ", "\"", "toc", "\\u", "html", "\"", " ", "attribute", " ", "whi", "ch", " ", "is", "\\", "10", ";", " ", " ", "a", " ", "Table", " ", "of", " ", "Conten", "ts", " ", "for", " ", "the", " ", "document", ".", " ", "(", "experimental", ")", "\\", "10", ";", "*", " ", "xml", ":", " ", "Passe", "s", " ", "one", "-", "line", "r", " ", "process", "ing", " ", "instruct", "ion", "s", " ", "and", " ", "namespace", "d", " ", "XML", " ", "tags", ".", "\\", "10", ";", "*", " ", "tables", ":", " ", "Table", "s", " ", "usi", "ng", " ", "the", " ", "same", " ", "format", " ", "as", " ", "GF", "M", "\\", "10", ";", " ", " ", "<", "https", "://", "help", ".", "git", "hub", ".", "com", "/", "article", "s", "/", "git", "hub", "-", "flavor", "ed", "-", "mark", "down", "#", "tables", ">", " ", "and", "\\", "10", ";", " ", " ", "PH", "P", "-", "Markdown", " ", "Extra", " ", "<", "https", "://", "mich", "elf", ".", "ca", "/", "project", "s", "/", "php", "-", "mark", "down", "/", "extra", "/", "#", "table", ">.", "\\", "10", ";", "*", " ", "wiki", "-", "tables", ":", " ", "Goo", "gle", " ", "Code", " ", "Wiki", "-", "style", " ", "tables", ".", " ", "See", "\\", "10", ";", " ", " ", "<", "http", "://", "code", ".", "google", ".", "com", "/", "p", "/", "support", "/", "wiki", "/", "Wiki", "Syntax", "#", "Table", "s", ">.", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Dev", " ", "Not", "es", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "-", " ", "Pyth", "on", "'", "s", " ", "regex", " ", "synta", "x", " ", "doe", "sn", "'", "t", " ", "have", " ", "'\\\\", "z", "',", " ", "so", " ", "I", "'", "m", " ", "usi", "ng", " ", "'\\\\", "Z", "'.", " ", "I", "'", "m_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "not", " ", "ye", "t", " ", "sure", " ", "if", " ", "there", " ", "impli", "cations", " ", "with", " ", "this", ".", " ", "Compare", " ", "'", "pydo", "c", " ", "sre", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "and", " ", "'", "perl", "doc", " ", "perl", "re", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "version", "\\u", "info", "\\u\\u_", "=_", "(_", "2_", ",_", "3_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "'.'_", "._", "join_", "(_", "map_", "(_", "str_", ",_", "\\u\\u", "version", "\\u", "info", "\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "\"", "Tren", "t", " ", "Mi", "ck", "\"_", "\\u\\u\\uNEWLINE\\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_", "from_", "pprint_", "import_", "pprint_", ",_", "pformat_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "hashlib_", "import_", "md5_", "\\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_", "md5_", "import_", "md5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "import_", "optparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "random_", "import_", "random_", ",_", "randint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "codecs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "---", " ", "Pyth", "on", " ", "version", " ", "compat_", "\\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 ", " _", "from_", "urllib_", "._", "parse_", "import_", "quote_", "#", " ", "python", "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_", "urllib_", "import_", "quote_", "#", " ", "python", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "[_", ":_", "2_", "]_", "<_", "(_", "2_", ",_", "4_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "sets_", "import_", "Set_", "as_", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "`", "bytes", "`", " ", "for", " ", "byte", " ", "string", "s", " ", "and", " ", "`", "unicode", "`", " ", "for", " ", "unicode", " ", "string", "s", " ", "(", "str", " ", "in", " ", "Py", "3", ").", "_", "\\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_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", "<=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "py3", "_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bytes_", "\\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 ", " _", "bytes_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "base", "\\u", "string", "\\u", "type_", "=_", "basestring_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "sys_", "._", "version", "\\u", "info_", "[_", "0_", "]_", ">=_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "py3", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unicode_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "base", "\\u", "string", "\\u", "type_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "---", " ", "globals_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "DEBUG_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "\"", "mark", "down", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "TAB", "\\u", "WIDTH_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SEC", "RET", "\\u", "SAL", "T_", "=_", "bytes_", "(_", "randint_", "(_", "0_", ",_", "1000000_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Table", " ", "of", " ", "hash", " ", "values", " ", "for", " ", "escaped", " ", "character", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "g", "\\u", "escape", "\\u", "table_", "=_", "dict_", "(_", "[_", "(_", "ch_", ",_", "\\u", "hash", "\\u", "text_", "(_", "ch_", ")_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ch_", "in_", "'\\\\\\\\", "`", "*\\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_", "#-", "---", " ", "exceptions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#-", "---", " ", "public", " ", "api_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "---", " ", "internal", " ", "support", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "##", " ", "{{", "{", " ", "http", "://", "code", ".", "active", "state", ".", "com", "/", "recip", "es", "/", "577", "257", "/", " ", "(", "r1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "slug", "if", "y", "\\u", "strip", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "r", "'[", "^", "\\\\", "w", "\\\\", "s", "-]", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "slug", "if", "y", "\\u", "hyphen", "ate", "\\u", "re_", "=_", "re_", "._", "compile_", "(_", "r", "'[", "-\\\\", "s", "]+'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "##", " ", "end", " ", "of", " ", "http", "://", "code", ".", "active", "state", ".", "com", "/", "recip", "es", "/", "577", "257", "/", " ", "}}}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Fro", "m", " ", "http", "://", "asp", "n", ".", "active", "state", ".", "com", "/", "ASP", "N", "/", "Coo", "kb", "ook", "/", "Pyth", "on", "/", "Recip", "e", "/", "525", "49_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Recip", "e", ":", " ", "regex", "\\u", "from", "\\u", "encode", "d\\u", "pattern", " ", "(", "1.0", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Recip", "e", ":", " ", "ded", "ent", " ", "(", "0.", "1.2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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\\uDEDENT\\u\\u\\u_", "\\u", "xml", "\\u", "one", "line", "r", "\\u", "re", "\\u", "from", "\\u", "tab", "\\u", "width_", "=_", "\\u", "memoized", "_", "(_", "\\u", "xml", "\\u", "one", "line", "r", "\\u", "re", "\\u", "from", "\\u", "tab", "\\u", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "hr", "\\u", "tag", "\\u", "re", "\\u", "from", "\\u", "tab", "\\u", "width_", "=_", "\\u", "memoized", "_", "(_", "\\u", "hr", "\\u", "tag", "\\u", "re", "\\u", "from", "\\u", "tab", "\\u", "width_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "#-", "---", " ", "mainl", "ine_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "main_", "(_", "sys_", "._", "argv_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "ded", "ent", "lines_", "(_", "lines_", ",_", "tabs", "ize_", "=_", "8_", ",_", "skip", "\\u", "first", "\\u", "line_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\u", "ded", "ent", "lines", "(", "lines", ",", " ", "tabs", "ize", "=", "8", ",", " ", "skip", "\\u", "first", "\\u", "line", "=", "Fal", "se", ")", " ", "->", " ", "ded", "ente", "d", " ", "lines", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"", "lines", "\"", " ", "is", " ", "a", " ", "list", " ", "of", " ", "lines", " ", "to", " ", "ded", "ent", ".", "\\", "10", ";", " ", " ", " ", " ", "\"", "tabs", "ize", "\"", " ", "is", " ", "the", " ", "tab", " ", "widt", "h", " ", "to", " ", "use", " ", "for", " ", "indent", " ", "widt", "h", " ", "calculati", "ons", ".", "\\", "10", ";", " ", " ", " ", " ", "\"", "skip", "\\u", "first", "\\u", "line", "\"", " ", "is", " ", "a", " ", "boolean", " ", "indicati", "ng", " ", "if", " ", "the", " ", "first", " ", "line", " ", "shou", "ld", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "skip", "ped", " ", "for", " ", "calculati", "ng", " ", "the", " ", "indent", " ", "widt", "h", " ", "and", " ", "for", " ", "ded", "enti", "ng", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "somet", "imes", " ", "usef", "ul", " ", "for", " ", "docstrings", " ", "and", " ", "similar", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Sam", "e", " ", "as", " ", "ded", "ent", "()", " ", "except", " ", "operate", "s", " ", "on", " ", "a", " ", "sequence", " ", "of", " ", "lines", ".", " ", "Not", "e", ":", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "lines", " ", "list", " ", "is", " ", "modifi", "ed", " ", "**", "in", "-", "place", "**", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DEBUG_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "ded", "ent", ":", " ", "ded", "ent", "(.", "..", ",", " ", "tabs", "ize", "=", "%", "d", ",", " ", "skip", "\\u", "first", "\\u", "line", "=", "%", "r", ")\"_", "%_", "(_", "tabs", "ize_", ",_", "skip", "\\u", "first", "\\u", "line_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "indent", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "margin_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "0_", "and_", "skip", "\\u", "first", "\\u", "line_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "indent_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ch_", "in_", "line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ch_", "==_", "'", " ", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "indent_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ch_", "==_", "'\\\\", "t", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "indent_", "+=_", "tabs", "ize_", "-_", "(_", "indent_", "%_", "tabs", "ize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ch_", "in_", "'\\\\", "r", "\\\\", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "#", " ", "skip", " ", "all", "-", "whitespace", " ", "lines_", "\\u\\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_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "#", " ", "skip", " ", "all", "-", "whitespace", " ", "lines_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "DEBUG_", ":_", "print_", "(_", "\"", "ded", "ent", ":", " ", "indent", "=", "%", "d", ":", " ", "%", "r", "\"_", "%_", "(_", "indent_", ",_", "line_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "margin_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "margin_", "=_", "indent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "margin_", "=_", "min_", "(_", "margin_", ",_", "indent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "DEBUG_", ":_", "print_", "(_", "\"", "ded", "ent", ":", " ", "marg", "in", "=", "%", "r", "\"_", "%_", "margin_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "margin_", "is_", "not_", "None_", "and_", "margin_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "i_", ",_", "line_", "in_", "enumerate_", "(_", "lines_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "i_", "==_", "0_", "and_", "skip", "\\u", "first", "\\u", "line_", ":_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "removed_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "j_", ",_", "ch_", "in_", "enumerate_", "(_", "line_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ch_", "==_", "'", " ", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "removed_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ch_", "==_", "'\\\\", "t", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "removed_", "+=_", "tabs", "ize_", "-_", "(_", "removed_", "%_", "tabs", "ize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ch_", "in_", "'\\\\", "r", "\\\\", "n", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "DEBUG_", ":_", "print_", "(_", "\"", "ded", "ent", ":", " ", "%", "r", ":", " ", "EO", "L", " ", "->", " ", "strip", " ", "up", " ", "to", " ", "EO", "L", "\"_", "%_", "line_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "[_", "i_", "]_", "=_", "lines_", "[_", "i_", "]_", "[_", "j_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "\"", "unexpected", " ", "non", "-", "whitespace", " ", "char", " ", "%", "r", " ", "in", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "line", " ", "%", "r", " ", "whi", "le", " ", "remo", "ving", " ", "%", "d", "-", "space", " ", "marg", "in", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "ch_", ",_", "line_", ",_", "margin_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "DEBUG_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "print_", "(_", "\"", "ded", "ent", ":", " ", "%", "r", ":", " ", "%", "r", " ", "->", " ", "remove", "d", " ", "%", "d", "/", "%", "d", "\"_", "%_", "(_", "line_", ",_", "ch_", ",_", "removed_", ",_", "margin_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "removed_", "==_", "margin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "lines_", "[_", "i_", "]_", "=_", "lines_", "[_", "i_", "]_", "[_", "j_", "+_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "removed_", ">_", "margin_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "lines_", "[_", "i_", "]_", "=_", "'", " ", "'_", "*_", "(_", "removed_", "-_", "margin_", ")_", "+_", "lines_", "[_", "i_", "]_", "[_", "j_", "+_", "1_", ":_", "]_", "\\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 ", " _", "if_", "removed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "lines_", "[_", "i_", "]_", "=_", "lines_", "[_", "i_", "]_", "[_", "removed_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "lines_", "\\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, 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, 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 ]
Except block handles 'BaseException'
dnanexus/dx-toolkit/src/python/dxpy/utils/local_exec_utils.py
[ { "content": "def run_entry_points(run_spec):\n '''\n :param run_spec: run specification from the dxapp.json of the app\n :type run_spec: dict\n\n Runs all job entry points found in\n $DX_TEST_JOB_HOMEDIRS/job_queue.json in a first-in, first-out\n manner until it is an empty array (or an error occurs).\n '''\n job_queue_path = os.path.join(environ['DX_TEST_JOB_HOMEDIRS'], 'job_queue.json')\n all_job_outputs_path = os.path.join(environ['DX_TEST_JOB_HOMEDIRS'], 'job_outputs.json')\n\n while True:\n with open(job_queue_path, 'r') as fd:\n job_queue = json.load(fd)\n if len(job_queue) == 0:\n return\n\n with open(all_job_outputs_path, 'r') as fd:\n all_job_outputs = json.load(fd)\n\n entry_point_to_run = None\n for i, entry_point in enumerate(job_queue):\n runnable = True\n # See if its inputs are ready\n while has_local_job_refs(entry_point['input_hash']):\n try:\n resolve_job_references(entry_point['input_hash'], all_job_outputs)\n except:\n runnable = False\n break\n if runnable:\n entry_point_to_run = job_queue.pop(i)\n break\n\n if entry_point_to_run is None:\n # Just run the first entry point and let the runner throw\n # the appropriate error\n entry_point_to_run = job_queue.pop(0)\n\n with open(job_queue_path, 'wb') as fd:\n # Update job queue with updated inputs and after having\n # popped the entry point to be run\n json.dump(job_queue, fd)\n fd.write(b'\\n')\n\n run_one_entry_point(job_id=entry_point_to_run['id'],\n function=entry_point_to_run['function'],\n input_hash=entry_point_to_run['input_hash'],\n run_spec=run_spec,\n depends_on=entry_point_to_run.get('depends_on', []),\n name=entry_point_to_run.get('name'))", "metadata": "root.run_entry_points", "header": "['module', '___EOS___']", "index": 409 } ]
[ { "span": "except:", "start_line": 437, "start_column": 16, "end_line": 437, "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "run", "\\u", "entry", "\\u", "points_", "(_", "run", "\\u", "spec_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "run", "\\u", "spec", ":", " ", "run", " ", "specifica", "tion", " ", "from", " ", "the", " ", "dx", "app", ".", "json", " ", "of", " ", "the", " ", "app", "\\", "10", ";", " ", " ", " ", " ", ":", "type", " ", "run", "\\u", "spec", ":", " ", "dict", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Run", "s", " ", "all", " ", "job", " ", "entry", " ", "points", " ", "found", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "$", "DX", "\\u", "TEST", "\\u", "JOB", "\\u", "HOM", "EDI", "RS", "/", "job", "\\u", "queue", ".", "json", " ", "in", " ", "a", " ", "first", "-", "in", ",", " ", "first", "-", "out", "\\", "10", ";", " ", " ", " ", " ", "manner", " ", "unti", "l", " ", "it", " ", "is", " ", "an", " ", "empty", " ", "array", " ", "(", "or", " ", "an", " ", "error", " ", "occur", "s", ").", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "job", "\\u", "queue", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "environ_", "[_", "'", "DX", "\\u", "TEST", "\\u", "JOB", "\\u", "HOM", "EDI", "RS", "'_", "]_", ",_", "'", "job", "\\u", "queue", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "all", "\\u", "job", "\\u", "output", "s", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "environ_", "[_", "'", "DX", "\\u", "TEST", "\\u", "JOB", "\\u", "HOM", "EDI", "RS", "'_", "]_", ",_", "'", "job", "\\u", "output", "s", ".", "json", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "job", "\\u", "queue", "\\u", "path_", ",_", "'", "r", "'_", ")_", "as_", "fd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "job", "\\u", "queue_", "=_", "json_", "._", "load_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "job", "\\u", "queue_", ")_", "==_", "0_", ":_", "\\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_", "with_", "open_", "(_", "all", "\\u", "job", "\\u", "output", "s", "\\u", "path_", ",_", "'", "r", "'_", ")_", "as_", "fd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "all", "\\u", "job", "\\u", "outputs_", "=_", "json_", "._", "load_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "entry", "\\u", "point", "\\u", "to", "\\u", "run_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "entry", "\\u", "point_", "in_", "enumerate_", "(_", "job", "\\u", "queue_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "runnable", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "See", " ", "if", " ", "its", " ", "inputs", " ", "are", " ", "ready_", "\\u\\u\\uNL\\u\\u\\u_", "while_", "has", "\\u", "local", "\\u", "job", "\\u", "refs_", "(_", "entry", "\\u", "point_", "[_", "'", "input", "\\u", "hash", "'_", "]_", ")_", ":_", "\\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 ", " ", "_", "resolve", "\\u", "job", "\\u", "references_", "(_", "entry", "\\u", "point_", "[_", "'", "input", "\\u", "hash", "'_", "]_", ",_", "all", "\\u", "job", "\\u", "outputs_", ")_", "\\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 ", " ", "_", "runnable", "_", "=_", "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_", "if_", "runnable", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entry", "\\u", "point", "\\u", "to", "\\u", "run_", "=_", "job", "\\u", "queue_", "._", "pop_", "(_", "i_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "entry", "\\u", "point", "\\u", "to", "\\u", "run_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ju", "st", " ", "run", " ", "the", " ", "first", " ", "entry", " ", "point", " ", "and", " ", "let", " ", "the", " ", "runn", "er", " ", "throw_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "appropr", "iate", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entry", "\\u", "point", "\\u", "to", "\\u", "run_", "=_", "job", "\\u", "queue_", "._", "pop_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "with_", "open_", "(_", "job", "\\u", "queue", "\\u", "path_", ",_", "'", "wb", "'_", ")_", "as_", "fd_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Update", " ", "job", " ", "queue", " ", "with", " ", "update", "d", " ", "inputs", " ", "and", " ", "after", " ", "hav", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "popp", "ed", " ", "the", " ", "entry", " ", "point", " ", "to", " ", "be", " ", "run_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "json_", "._", "dump_", "(_", "job", "\\u", "queue_", ",_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", "._", "write_", "(_", "b", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "run", "\\u", "one", "\\u", "entry", "\\u", "point_", "(_", "job", "\\u", "id_", "=_", "entry", "\\u", "point", "\\u", "to", "\\u", "run_", "[_", "'", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "function_", "=_", "entry", "\\u", "point", "\\u", "to", "\\u", "run_", "[_", "'", "function", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "hash_", "=_", "entry", "\\u", "point", "\\u", "to", "\\u", "run_", "[_", "'", "input", "\\u", "hash", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "run", "\\u", "spec_", "=_", "run", "\\u", "spec_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "depend", "s", "\\u", "on_", "=_", "entry", "\\u", "point", "\\u", "to", "\\u", "run_", "._", "get_", "(_", "'", "depend", "s", "\\u", "on", "'_", ",_", "[_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "name_", "=_", "entry", "\\u", "point", "\\u", "to", "\\u", "run_", "._", "get_", "(_", "'", "name", "'_", ")_", ")_" ]
[ 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,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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 ]
Unused import
yajiemiao/pdnn/layers/conv_fast.py
[ { "content": "# Copyright 2013 Yajie Miao Carnegie Mellon University\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# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n# KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\n# WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\n# MERCHANTABLITY OR NON-INFRINGEMENT.\n# See the Apache 2 License for the specific language governing permissions and\n# limitations under the License.\n\nimport cPickle\nimport gzip\nimport os\nimport sys\nimport time\n\nimport numpy\n\nimport theano\nimport theano.tensor as T\nfrom theano.tensor.signal import downsample\nfrom theano.tensor.nnet import conv\n\nfrom theano.sandbox.cuda.basic_ops import gpu_contiguous\nfrom pylearn2.sandbox.cuda_convnet.filter_acts import FilterActs\nfrom pylearn2.sandbox.cuda_convnet.pool import MaxPool\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ConvLayer(object):\n \"\"\"Pool Layer of a convolutional network \"\"\"\n", "metadata": "root.ConvLayer", "header": "['module', '___EOS___']", "index": 32 }, { "content": " def __init__(self, numpy_rng=None, input = None, is_input_layer = False,\n input_shape=(1,28,28), filter_shape=(2, 1, 5, 5), \n poolsize=(1, 1), activation=T.tanh,\n flatten = False, border_mode = 'valid',\n\t\t non_maximum_erasing = False, W=None, b=None):\n\n \n assert input_shape[1] == filter_shape[1]\n if is_input_layer:\n self.input = input.reshape(input_shape).dimshuffle(1, 2, 3, 0)\n else:\n self.input = input \n # Now reconstruct the input_shape and filter_shape\n input_shape = (input_shape[1], input_shape[2], input_shape[3], input_shape[0])\n filter_shape = (filter_shape[1], filter_shape[2], filter_shape[3], filter_shape[0])\n\n self.input_shape = input_shape\n self.filter_shape = filter_shape\n self.poolsize = poolsize\n\n self.activation = activation\n self.flatten = flatten\n\n fan_in = numpy.prod(filter_shape[:3])\n fan_out = (filter_shape[3] * numpy.prod(filter_shape[1:3]) /\n numpy.prod(poolsize))\n # initialize weights with random weights\n\tif W is None:\n W_bound = numpy.sqrt(6. / (fan_in + fan_out))\n initial_W = numpy.asarray( numpy_rng.uniform(\n low=-W_bound, high=W_bound,\n size=filter_shape),\n dtype=theano.config.floatX)\n\n if activation == T.nnet.sigmoid:\n initial_W *= 4\n W = theano.shared(value = initial_W, name = 'W')\n\n self.W = W\n # the bias is a 1D tensor -- one bias per output feature map\n\tif b is None:\n b_values = numpy.zeros((filter_shape[3],), dtype=theano.config.floatX)\n b = theano.shared(value=b_values, name='b')\n\tself.b = b\n\n # for momentum\n\tself.delta_W = theano.shared(value = numpy.zeros(filter_shape,\n\t\t dtype=theano.config.floatX), name='delta_W')\n\n\tself.delta_b = theano.shared(value = numpy.zeros_like(self.b.get_value(borrow=True),\n\t dtype=theano.config.floatX), name='delta_b')\n\n # convolve input feature maps with filters\n conv_op = FilterActs()\n contiguous_input = gpu_contiguous(self.input)\n contiguous_filters = gpu_contiguous(self.W)\n conv_out = conv_op(contiguous_input, contiguous_filters)\n y_out = activation(conv_out + self.b.dimshuffle(0, 'x', 'x', 'x'))\n \n pool_op = MaxPool(ds=poolsize[0], stride=poolsize[0])\n pooled_out = pool_op(y_out)\n \n\tif non_maximum_erasing:\n\t ds = tuple(poolsize)\n\t po = pooled_out.repeat(ds[0], axis = 2).repeat(ds[1], axis = 3)\n\t self.output = T.eq(y_out, po) * y_out\n\telse:\n self.output = pooled_out\n\n if flatten:\n self.output = self.output.dimshuffle(3, 0, 1, 2) # c01b to bc01\n self.output = self.output.flatten(2)\n\n self.params = [self.W, self.b]\n self.delta_params = [self.delta_W, self.delta_b]", "metadata": "root.ConvLayer.__init__", "header": "['class', 'ConvLayer', '(', 'object', ')', ':', '___EOS___']", "index": 35 } ]
[ { "span": "import cPickle", "start_line": 15, "start_column": 0, "end_line": 15, "end_column": 14 }, { "span": "import gzip", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 11 }, { "span": "import os", "start_line": 17, "start_column": 0, "end_line": 17, "end_column": 9 }, { "span": "import sys", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 10 }, { "span": "import time", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 11 }, { "span": "from theano.tensor.signal import downsample", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 43 }, { "span": "from theano.tensor.nnet import conv", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 35 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2013", " ", " ", " ", " ", "Ya", "jie", " ", "Mi", "ao", " ", " ", " ", " ", "Car", "neg", "ie", " ", "Mel", "lon", " ", "Univers", "ity_", "\\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_", "#", " ", "THIS", " ", "CODE", " ", "IS", " ", "PROVI", "DED", " ", "*", "AS", " ", "IS", "*", " ", "BAS", "IS", ",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "KIND", ",", " ", "EI", "THER", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "WITH", "OUT", " ", "LIMIT", "ATION", " ", "ANY", " ", "IMPL", "IED", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "TIT", "LE", ",", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MER", "CHAN", "TAB", "LIT", "Y", " ", "OR", " ", "NON", "-", "INF", "RING", "EME", "NT", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "Ap", "ache", " ", "2", " ", "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_", "c", "Pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gzip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "theano_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "theano_", "._", "tensor_", "as_", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "theano_", "._", "tensor_", "._", "signal_", "import_", "downsample", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "theano_", "._", "tensor_", "._", "nnet", "_", "import_", "conv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "theano_", "._", "sandbox_", "._", "cuda_", "._", "basic", "\\u", "ops_", "import_", "gpu", "\\u", "contiguous", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "sandbox_", "._", "cud", "a", "\\u", "conv", "net_", "._", "filter", "\\u", "acts", "_", "import_", "Filter", "Act", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyl", "earn", "2_", "._", "sandbox_", "._", "cud", "a", "\\u", "conv", "net_", "._", "pool_", "import_", "Max", "Pool_", "\\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_", "Conv", "Layer_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Poo", "l", " ", "Layer", " ", "of", " ", "a", " ", "convolution", "al", " ", "network", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Conv", "Layer_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "nump", "y", "\\u", "rng_", "=_", "None_", ",_", "input_", "=_", "None_", ",_", "is", "\\u", "input", "\\u", "layer_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "input", "\\u", "shape_", "=_", "(_", "1_", ",_", "28_", ",_", "28_", ")_", ",_", "filter", "\\u", "shape_", "=_", "(_", "2_", ",_", "1_", ",_", "5_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pools", "ize_", "=_", "(_", "1_", ",_", "1_", ")_", ",_", "activation_", "=_", "T_", "._", "tanh_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "flatten_", "=_", "False_", ",_", "border", "\\u", "mode_", "=_", "'", "valid", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "non", "\\u", "maxim", "um", "\\u", "era", "sing", "_", "=_", "False_", ",_", "W_", "=_", "None_", ",_", "b_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "input", "\\u", "shape_", "[_", "1_", "]_", "==_", "filter", "\\u", "shape_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "is", "\\u", "input", "\\u", "layer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "input_", "=_", "input_", "._", "reshape_", "(_", "input", "\\u", "shape_", ")_", "._", "dims", "huff", "le_", "(_", "1_", ",_", "2_", ",_", "3_", ",_", "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_", "._", "input_", "=_", "input_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "reconstruct", " ", "the", " ", "input", "\\u", "shape", " ", "and", " ", "filter", "\\u", "shape_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "input", "\\u", "shape_", "=_", "(_", "input", "\\u", "shape_", "[_", "1_", "]_", ",_", "input", "\\u", "shape_", "[_", "2_", "]_", ",_", "input", "\\u", "shape_", "[_", "3_", "]_", ",_", "input", "\\u", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filter", "\\u", "shape_", "=_", "(_", "filter", "\\u", "shape_", "[_", "1_", "]_", ",_", "filter", "\\u", "shape_", "[_", "2_", "]_", ",_", "filter", "\\u", "shape_", "[_", "3_", "]_", ",_", "filter", "\\u", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "input", "\\u", "shape_", "=_", "input", "\\u", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "filter", "\\u", "shape_", "=_", "filter", "\\u", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pools", "ize_", "=_", "pools", "ize_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "activation_", "=_", "activation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "flatten_", "=_", "flatten_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fan", "\\u", "in_", "=_", "numpy_", "._", "prod_", "(_", "filter", "\\u", "shape_", "[_", ":_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fan", "\\u", "out_", "=_", "(_", "filter", "\\u", "shape_", "[_", "3_", "]_", "*_", "numpy_", "._", "prod_", "(_", "filter", "\\u", "shape_", "[_", "1_", ":_", "3_", "]_", ")_", "/_", "\\u\\u\\uNL\\u\\u\\u_", "numpy_", "._", "prod_", "(_", "pools", "ize_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "initialize", " ", "weight", "s", " ", "with", " ", "random", " ", "weights_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "W_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "W", "\\u", "bound_", "=_", "numpy_", "._", "sqrt_", "(_", "6._", "/_", "(_", "fan", "\\u", "in_", "+_", "fan", "\\u", "out_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "initial", "\\u", "W_", "=_", "numpy_", "._", "asarray_", "(_", "nump", "y", "\\u", "rng_", "._", "uniform_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "low_", "=_", "-_", "W", "\\u", "bound_", ",_", "high_", "=_", "W", "\\u", "bound_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "size_", "=_", "filter", "\\u", "shape_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "theano_", "._", "config_", "._", "float", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "activation_", "==_", "T_", "._", "nnet", "_", "._", "sigmoid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "initial", "\\u", "W_", "*=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "W_", "=_", "theano_", "._", "shared_", "(_", "value_", "=_", "initial", "\\u", "W_", ",_", "name_", "=_", "'", "W", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "W_", "=_", "W_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "the", " ", "bias", " ", "is", " ", "a", " ", "1", "D", " ", "tensor", " ", "--", " ", "one", " ", "bias", " ", "per", " ", "output", " ", "feature", " ", "map_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "b_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "b", "\\u", "values_", "=_", "numpy_", "._", "zeros_", "(_", "(_", "filter", "\\u", "shape_", "[_", "3_", "]_", ",_", ")_", ",_", "dtype_", "=_", "theano_", "._", "config_", "._", "float", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "theano_", "._", "shared_", "(_", "value_", "=_", "b", "\\u", "values_", ",_", "name_", "=_", "'", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "b_", "=_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "momentum_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "delta", "\\u", "W_", "=_", "theano_", "._", "shared_", "(_", "value_", "=_", "numpy_", "._", "zeros_", "(_", "filter", "\\u", "shape_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "theano_", "._", "config_", "._", "float", "X_", ")_", ",_", "name_", "=_", "'", "delta", "\\u", "W", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "delta", "\\u", "b_", "=_", "theano_", "._", "shared_", "(_", "value_", "=_", "numpy_", "._", "zero", "s", "\\u", "like_", "(_", "self_", "._", "b_", "._", "get", "\\u", "value_", "(_", "borrow", "_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dtype_", "=_", "theano_", "._", "config_", "._", "float", "X_", ")_", ",_", "name_", "=_", "'", "delta", "\\u", "b", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "convolve", " ", "input", " ", "feature", " ", "maps", " ", "with", " ", "filters_", "\\u\\u\\uNL\\u\\u\\u_", "conv", "\\u", "op_", "=_", "Filter", "Act", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contiguous", "\\u", "input_", "=_", "gpu", "\\u", "contiguous", "_", "(_", "self_", "._", "input_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "contiguous", "\\u", "filters_", "=_", "gpu", "\\u", "contiguous", "_", "(_", "self_", "._", "W_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conv", "\\u", "out_", "=_", "conv", "\\u", "op_", "(_", "contiguous", "\\u", "input_", ",_", "contiguous", "\\u", "filters_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y", "\\u", "out_", "=_", "activation_", "(_", "conv", "\\u", "out_", "+_", "self_", "._", "b_", "._", "dims", "huff", "le_", "(_", "0_", ",_", "'", "x", "'_", ",_", "'", "x", "'_", ",_", "'", "x", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "pool", "\\u", "op_", "=_", "Max", "Pool_", "(_", "ds_", "=_", "pools", "ize_", "[_", "0_", "]_", ",_", "stride_", "=_", "pools", "ize_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pooled", "\\u", "out_", "=_", "pool", "\\u", "op_", "(_", "y", "\\u", "out_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "non", "\\u", "maxim", "um", "\\u", "era", "sing", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", " _", "ds_", "=_", "tuple_", "(_", "pools", "ize_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "po_", "=_", "pooled", "\\u", "out_", "._", "repeat_", "(_", "ds_", "[_", "0_", "]_", ",_", "axis_", "=_", "2_", ")_", "._", "repeat_", "(_", "ds_", "[_", "1_", "]_", ",_", "axis_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "output_", "=_", "T_", "._", "eq_", "(_", "y", "\\u", "out_", ",_", "po_", ")_", "*_", "y", "\\u", "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 ", " _", "self_", "._", "output_", "=_", "pooled", "\\u", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "flatten_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "output_", "=_", "self_", "._", "output_", "._", "dims", "huff", "le_", "(_", "3_", ",_", "0_", ",_", "1_", ",_", "2_", ")_", "#", " ", "c0", "1b", " ", "to", " ", "bc", "01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "output_", "=_", "self_", "._", "output_", "._", "flatten_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "params_", "=_", "[_", "self_", "._", "W_", ",_", "self_", "._", "b_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "delta", "\\u", "params_", "=_", "[_", "self_", "._", "delta", "\\u", "W_", ",_", "self_", "._", "delta", "\\u", "b_", "]_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Flask app is run in debug mode
kylewm/flask-micropub/example.py
[ { "content": "from flask import Flask, request, url_for\nfrom flask.ext.micropub import MicropubClient\n\n\napp = Flask(__name__)\napp.config['SECRET_KEY'] = 'my super secret key'\nmicropub = MicropubClient(app)\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n app.run(debug=True)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "app.run(debug=True)", "start_line": 86, "start_column": 4, "end_line": 86, "end_column": 23 } ]
[]
1
false
[ "[CLS]_", "Flask_", "app_", "is_", "run_", "in_", "debug_", "mode_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "flask_", "import_", "Flask_", ",_", "request_", ",_", "url", "\\u", "for_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "flask_", "._", "ext_", "._", "microp", "ub_", "import_", "Micro", "pub", "Client_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "=_", "Flask_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "config_", "[_", "'", "SEC", "RET", "\\u", "KEY", "'_", "]_", "=_", "'", "my", " ", "super", " ", "secret", " ", "key", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "microp", "ub_", "=_", "Micro", "pub", "Client_", "(_", "app_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "'\\u", "\\u", "main", "\\u\\u'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app_", "._", "run_", "(_", "debug_", "=_", "True_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused local variable
ChrisBeaumont/brut/figures/mwp.py
[ { "content": "def main():\n fig = plt.figure(tight_layout=True, dpi=800)\n im1 = 'GLM_04393+0006_mosaic_I24M1.jpg'\n im2 = 'GLM_04130-0013_mosaic_I24M1.jpg'\n im1 = imread(im1)[::-1, ...]\n im2 = imread(im2)[::-1, ...]\n\n plt.subplot(211)\n plt.imshow(im1, interpolation='bicubic')\n\n plt.plot([.05 * 3600/3.375, .25 * 3600/3.375], [50, 50], 'white')\n plt.xlim(0, 800)\n plt.ylim(0, 400)\n\n plt.annotate(\"$\\ell=43.93^\\circ$ $b=0.06^\\circ$\",\n xy=(12, .9 * im1.shape[0]),\n color='white')\n plt.annotate(\"$0.2^\\circ$\", xy=(.15 * 3600 / 3.375, 80),\n color='white', ha='center')\n\n plt.xticks([])\n plt.yticks([])\n\n plt.subplot(212)\n plt.imshow(im2, interpolation='bicubic')\n plt.annotate(\"$\\ell=41.06^\\circ$ $b=0.17^\\circ$\",\n xy=(12, .9 * im1.shape[0]),\n color='white')\n plt.plot([.05 * 3600/6.75, .25 * 3600/6.75], [50, 50], 'white')\n plt.annotate(\"$0.2^\\circ$\", xy=(.15 * 3600 / 6.75, 80),\n color='white', ha='center')\n plt.xlim(0, 800)\n plt.ylim(0, 400)\n plt.xticks([])\n plt.yticks([])\n plt.savefig('mwp.eps')", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 5 } ]
[ { "span": "fig ", "start_line": 6, "start_column": 4, "end_line": 6, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "main_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fig_", "=_", "plt_", "._", "figure_", "(_", "tig", "ht", "\\u", "layout_", "=_", "True_", ",_", "dpi_", "=_", "800_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "1_", "=_", "'", "GL", "M", "\\u", "043", "9", "3", "+0", "006", "\\u", "mosaic", "\\u", "I2", "4", "M1", ".", "jp", "g", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im2", "_", "=_", "'", "GL", "M", "\\u", "041", "30", "-0", "013", "\\u", "mosaic", "\\u", "I2", "4", "M1", ".", "jp", "g", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im", "1_", "=_", "imread_", "(_", "im", "1_", ")_", "[_", ":_", ":_", "-_", "1_", ",_", "..._", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "im2", "_", "=_", "imread_", "(_", "im2", "_", ")_", "[_", ":_", ":_", "-_", "1_", ",_", "..._", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "subplot_", "(_", "211_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "imshow_", "(_", "im", "1_", ",_", "interpolation_", "=_", "'", "bic", "ubi", "c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "plot_", "(_", "[_", ".05_", "*_", "3600_", "/_", "3.3", "75_", ",_", ".25_", "*_", "3600_", "/_", "3.3", "75_", "]_", ",_", "[_", "50_", ",_", "50_", "]_", ",_", "'", "white", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xlim_", "(_", "0_", ",_", "800_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "ylim_", "(_", "0_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "annotate_", "(_", "\"$", "\\\\", "ell", "=", "43.", "9", "3", "^", "\\\\", "circ", "$", " ", " ", "$", "b", "=", "0.06", "^", "\\\\", "circ", "$\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xy_", "=_", "(_", "12_", ",_", ".9_", "*_", "im", "1_", "._", "shape_", "[_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "'", "white", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "annotate_", "(_", "\"$", "0.", "2", "^", "\\\\", "circ", "$\"_", ",_", "xy_", "=_", "(_", ".15_", "*_", "3600_", "/_", "3.3", "75_", ",_", "80_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "'", "white", "'_", ",_", "ha_", "=_", "'", "center", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "xticks_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "yticks_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "plt_", "._", "subplot_", "(_", "212_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "imshow_", "(_", "im2", "_", ",_", "interpolation_", "=_", "'", "bic", "ubi", "c", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "annotate_", "(_", "\"$", "\\\\", "ell", "=", "41.", "0", "6", "^", "\\\\", "circ", "$", " ", " ", "$", "b", "=", "0.17", "^", "\\\\", "circ", "$\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "xy_", "=_", "(_", "12_", ",_", ".9_", "*_", "im", "1_", "._", "shape_", "[_", "0_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "'", "white", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "plot_", "(_", "[_", ".05_", "*_", "3600_", "/_", "6.7", "5_", ",_", ".25_", "*_", "3600_", "/_", "6.7", "5_", "]_", ",_", "[_", "50_", ",_", "50_", "]_", ",_", "'", "white", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "annotate_", "(_", "\"$", "0.", "2", "^", "\\\\", "circ", "$\"_", ",_", "xy_", "=_", "(_", ".15_", "*_", "3600_", "/_", "6.7", "5_", ",_", "80_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "'", "white", "'_", ",_", "ha_", "=_", "'", "center", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xlim_", "(_", "0_", ",_", "800_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "ylim_", "(_", "0_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "xticks_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "yticks_", "(_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plt_", "._", "savefig_", "(_", "'", "mw", "p", ".", "eps", "'_", ")_", "\\u\\u\\uNEWL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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 ]
Unused local variable
rsgalloway/grit/grit/server/server.py
[ { "content": " def get_params(self, environ):\n kwargs = {}\n params = urlparse.parse_qs(environ.get('wsgi.input').read())\n action = params.get('action', ['read'])[0]\n xaction = params.get('xaction', ['read'])[0]\n try:\n del params['action']\n del params['xaction']\n except:\n pass\n\n for k,v in params.items():\n try:\n kwargs[k] = eval(params[k][0])\n except Exception, e:\n kwargs[k] = params[k][0]\n\n return action, kwargs", "metadata": "root.JSONServer.get_params", "header": "['class', 'JSONServer', '(', 'StaticWSGIServer', ')', ':', '___EOS___']", "index": 152 }, { "content": " def __call__(self, environ, start_response):\n\n selector_matches = (environ.get('wsgiorg.routing_args') or ([],{}))[1]\n if 'working_path' in selector_matches:\n path_info = selector_matches['working_path'].decode('utf8')\n else:\n path_info = environ.get('PATH_INFO', '').decode('utf8')\n\n scheme = environ.get('wsgi.url_scheme', 'http')\n host = environ.get('HTTP_HOST', 'localhost').decode('utf8')\n self.url = '%s://%s/%s' %(scheme, host, path_info)\n\n full_path = os.path.abspath(os.path.join(self.content_path, path_info.strip('/')))\n _pp = os.path.abspath(self.content_path)\n\n cmd, kwargs = self.get_params(environ)\n\n if not full_path.startswith(_pp):\n log.error('forbidden: %s' % full_path)\n return self.canned_handlers(environ, start_response, 'forbidden')\n\n if os.path.exists(full_path):\n mtime = os.stat(full_path).st_mtime\n etag, last_modified = str(mtime), email.utils.formatdate(mtime)\n else:\n mtime, etag, last_modified = (None, None, None)\n\n headers = [\n ('Content-type', 'text/plain'),\n ('Date', email.utils.formatdate(time.time())),\n ('Last-Modified', last_modified),\n ('ETag', etag)\n ]\n\n fmap = {\n 'read': handle_read,\n 'new': handle_branch,\n 'branch': handle_branch,\n 'repos': handle_repos,\n 'items': handle_items,\n 'versions': handle_versions,\n 'submodules': handle_submodules,\n 'addSubmodule': handle_addSubmodule,\n 'addVersion': handle_addVersion,\n 'parent': handle_parent,\n 'upload': handle_upload,\n }\n\n repo = get_repo_parent(full_path)\n if repo is None:\n repo = full_path\n item_path = full_path.split(str(repo))[-1][1:]\n\n #HACK: get the item, swap with repo\n if item_path and cmd != 'submodules':\n log.debug('full_path: %s, item_path: %s' % (full_path, item_path))\n items = repo.items(path=item_path)\n if items:\n repo = item = items[0]\n\n if cmd == 'data':\n data = repo.file()\n return self.package_response(data, environ, start_response)\n\n else:\n func = fmap.get(cmd, None)\n if func:\n response = func(repo, **kwargs)\n else:\n response = getattr(repo, cmd)(**kwargs)\n return self.json_response(response, environ, start_response)", "metadata": "root.JSONServer.__call__", "header": "['class', 'JSONServer', '(', 'StaticWSGIServer', ')', ':', '___EOS___']", "index": 171 }, { "content": " def __call__(self, environ, start_response):\n path_info = environ.get('PATH_INFO', '').decode('utf8')\n self.content_path = os.path.join(os.path.dirname(__file__), '..', '..')\n return super(StaticServer, self).__call__(environ, start_response)", "metadata": "root.StaticServer.__call__", "header": "['class', 'StaticServer', '(', 'StaticWSGIServer', ')', ':', '___EOS___']", "index": 247 } ]
[ { "span": "xaction ", "start_line": 156, "start_column": 8, "end_line": 156, "end_column": 15 }, { "span": "headers ", "start_line": 198, "start_column": 8, "end_line": 198, "end_column": 15 }, { "span": "item ", "start_line": 229, "start_column": 23, "end_line": 229, "end_column": 27 }, { "span": "path_info ", "start_line": 248, "start_column": 8, "end_line": 248, "end_column": 17 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "JSO", "NS", "erver_", "(_", "Static", "WS", "GI", "Server_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "params_", "(_", "self_", ",_", "environ_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "urlparse_", "._", "parse", "\\u", "qs_", "(_", "environ_", "._", "get_", "(_", "'", "wsgi", ".", "input", "'_", ")_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "action_", "=_", "params_", "._", "get_", "(_", "'", "action", "'_", ",_", "[_", "'", "read", "'_", "]_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "xac", "tion_", "=_", "params_", "._", "get_", "(_", "'", "xac", "tion", "'_", ",_", "[_", "'", "read", "'_", "]_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "del_", "params_", "[_", "'", "action", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "params_", "[_", "'", "xac", "tion", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "params_", "._", "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 ", " _", "kwargs_", "[_", "k_", "]_", "=_", "eval_", "(_", "params_", "[_", "k_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "[_", "k_", "]_", "=_", "params_", "[_", "k_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "action_", ",_", "kwargs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "JSO", "NS", "erver_", "(_", "Static", "WS", "GI", "Server_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "environ_", ",_", "start", "\\u", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "select", "or", "\\u", "matches_", "=_", "(_", "environ_", "._", "get_", "(_", "'", "wsgi", "org", ".", "routin", "g", "\\u", "args", "'_", ")_", "or_", "(_", "[_", "]_", ",_", "{_", "}_", ")_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "working", "\\u", "path", "'_", "in_", "select", "or", "\\u", "matches_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path", "\\u", "info_", "=_", "select", "or", "\\u", "matches_", "[_", "'", "working", "\\u", "path", "'_", "]_", "._", "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 ", " _", "path", "\\u", "info_", "=_", "environ_", "._", "get_", "(_", "'", "PATH", "\\u", "INFO", "'_", ",_", "''_", ")_", "._", "decode_", "(_", "'", "utf", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "scheme_", "=_", "environ_", "._", "get_", "(_", "'", "wsgi", ".", "url", "\\u", "sche", "me", "'_", ",_", "'", "http", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "environ_", "._", "get_", "(_", "'", "HTTP", "\\u", "HOST", "'_", ",_", "'", "local", "host", "'_", ")_", "._", "decode_", "(_", "'", "utf", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "url_", "=_", "'%", "s", "://", "%", "s", "/", "%", "s", "'_", "%_", "(_", "scheme_", ",_", "host_", ",_", "path", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "full", "\\u", "path_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "self_", "._", "content", "\\u", "path_", ",_", "path", "\\u", "info_", "._", "strip_", "(_", "'/'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "pp_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "self_", "._", "content", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cmd_", ",_", "kwargs_", "=_", "self_", "._", "get", "\\u", "params_", "(_", "environ_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "full", "\\u", "path_", "._", "startswith_", "(_", "\\u", "pp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "error_", "(_", "'", "forbidden", ":", " ", "%", "s", "'_", "%_", "full", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "cann", "ed", "\\u", "handlers_", "(_", "environ_", ",_", "start", "\\u", "response_", ",_", "'", "forbidden", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "exists_", "(_", "full", "\\u", "path_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mtime_", "=_", "os_", "._", "stat_", "(_", "full", "\\u", "path_", ")_", "._", "st", "\\u", "mtime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "etag_", ",_", "last", "\\u", "modified_", "=_", "str_", "(_", "mtime_", ")_", ",_", "email_", "._", "utils_", "._", "format", "date_", "(_", "mtime_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mtime_", ",_", "etag_", ",_", "last", "\\u", "modified_", "=_", "(_", "None_", ",_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "headers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Conten", "t", "-", "type", "'_", ",_", "'", "text", "/", "plain", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Date", "'_", ",_", "email_", "._", "utils_", "._", "format", "date_", "(_", "time_", "._", "time_", "(_", ")_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "Las", "t", "-", "Modifie", "d", "'_", ",_", "last", "\\u", "modified_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "'", "ET", "ag", "'_", ",_", "etag_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fma", "p_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "read", "'_", ":_", "handle", "\\u", "read_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "new", "'_", ":_", "handle", "\\u", "branch_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "branch", "'_", ":_", "handle", "\\u", "branch_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "repos", "'_", ":_", "handle", "\\u", "repos_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "items", "'_", ":_", "handle", "\\u", "items_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "s", "'_", ":_", "handle", "\\u", "versions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "submodules", "'_", ":_", "handle", "\\u", "submodules", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "add", "Subm", "odule", "'_", ":_", "handle", "\\u", "add", "Subm", "odule_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "add", "Version", "'_", ":_", "handle", "\\u", "add", "Version_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parent", "'_", ":_", "handle", "\\u", "parent_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "upload", "'_", ":_", "handle", "\\u", "upload_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "repo_", "=_", "get", "\\u", "repo", "\\u", "parent_", "(_", "full", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "repo_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repo_", "=_", "full", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "item", "\\u", "path_", "=_", "full", "\\u", "path_", "._", "split_", "(_", "str_", "(_", "repo_", ")_", ")_", "[_", "-_", "1_", "]_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "HA", "CK", ":", " ", "get", " ", "the", " ", "item", ",", " ", "swap", " ", "with", " ", "repo_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "item", "\\u", "path_", "and_", "cmd_", "!=_", "'", "submodules", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "'", "full", "\\u", "path", ":", " ", "%", "s", ",", " ", "item", "\\u", "path", ":", " ", "%", "s", "'_", "%_", "(_", "full", "\\u", "path_", ",_", "item", "\\u", "path_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "items_", "=_", "repo_", "._", "items_", "(_", "path_", "=_", "item", "\\u", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "items_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "repo_", "=_", "item_", "=_", "items_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "cmd_", "==_", "'", "data", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "repo_", "._", "file_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "package", "\\u", "response_", "(_", "data_", ",_", "environ_", ",_", "start", "\\u", "response_", ")_", "\\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 ", " _", "func_", "=_", "fma", "p_", "._", "get_", "(_", "cmd_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "func_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "func_", "(_", "repo_", ",_", "**_", "kwargs_", ")_", "\\u\\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_", "=_", "getattr_", "(_", "repo_", ",_", "cmd_", ")_", "(_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "json", "\\u", "response_", "(_", "response_", ",_", "environ_", ",_", "start", "\\u", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Static", "Server_", "(_", "Static", "WS", "GI", "Server_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "call\\u\\u_", "(_", "self_", ",_", "environ_", ",_", "start", "\\u", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path", "\\u", "info_", "=_", "environ_", "._", "get_", "(_", "'", "PATH", "\\u", "INFO", "'_", ",_", "''_", ")_", "._", "decode_", "(_", "'", "utf", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "content", "\\u", "path_", "=_", "os_", "._", "path_", "._", "join_", "(_", "os_", "._", "path_", "._", "dirname_", "(_", "\\u\\u", "file\\u\\u_", ")_", ",_", "'..'_", ",_", "'..'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "super_", "(_", "Static", "Server_", ",_", "self_", ")_", "._", "\\u\\u", "call\\u\\u_", "(_", "environ_", ",_", "start", "\\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, 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,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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, 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, 4, 2, 2, 2, 2, 2, 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 ]
Imprecise assert
runabove/python-runabove/runabove/tests/ssh_key.py
[ { "content": " def test_list(self):\n self.mock_wrapper.get.return_value = json.loads(self.answer_list)\n ssh_key_list = self.ssh_keys.list()\n self.mock_wrapper.get.assert_called_once_with(\n self.ssh_keys.basepath\n )\n self.assertIsInstance(ssh_key_list, list)\n self.assertTrue(len(ssh_key_list) > 0)", "metadata": "root.TestSshKey.test_list", "header": "['class', 'TestSshKey', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 70 }, { "content": " def test_list_by_region(self):\n region_name = 'BHS-1'\n self.mock_wrapper.get.return_value = json.loads(self.answer_list)\n ssh_key_list = self.ssh_keys.list_by_region(region_name)\n self.mock_wrapper.get.assert_called_once_with(\n self.ssh_keys.basepath,\n {'region': region_name}\n )\n self.assertIsInstance(ssh_key_list, list)\n self.assertTrue(len(ssh_key_list) > 0)\n for ssh_key in ssh_key_list:\n self.assertIsInstance(ssh_key, runabove.ssh_key.SSHKey)\n self.assertEqual(ssh_key.region.name, region_name)", "metadata": "root.TestSshKey.test_list_by_region", "header": "['class', 'TestSshKey', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 79 } ]
[ { "span": "self.assertTrue(len(ssh_key_list) > 0)", "start_line": 77, "start_column": 8, "end_line": 77, "end_column": 46 }, { "span": "self.assertTrue(len(ssh_key_list) > 0)", "start_line": 88, "start_column": 8, "end_line": 88, "end_column": 46 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Test", "Ss", "h", "Key_", "(_", "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_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mock", "\\u", "wrapper_", "._", "get_", "._", "return", "\\u", "value_", "=_", "json_", "._", "loads_", "(_", "self_", "._", "answer", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssh", "\\u", "key", "\\u", "list_", "=_", "self_", "._", "ssh", "\\u", "keys_", "._", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mock", "\\u", "wrapper_", "._", "get_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ssh", "\\u", "keys_", "._", "basepath_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "ssh", "\\u", "key", "\\u", "list_", ",_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "ssh", "\\u", "key", "\\u", "list_", ")_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Ss", "h", "Key_", "(_", "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", "\\u", "by", "\\u", "region_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "region", "\\u", "name_", "=_", "'", "BH", "S", "-1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mock", "\\u", "wrapper_", "._", "get_", "._", "return", "\\u", "value_", "=_", "json_", "._", "loads_", "(_", "self_", "._", "answer", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssh", "\\u", "key", "\\u", "list_", "=_", "self_", "._", "ssh", "\\u", "keys_", "._", "list", "\\u", "by", "\\u", "region_", "(_", "region", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mock", "\\u", "wrapper_", "._", "get_", "._", "assert", "\\u", "call", "ed", "\\u", "onc", "e\\u", "with_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "ssh", "\\u", "keys_", "._", "basepath_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "region", "'_", ":_", "region", "\\u", "name_", "}_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Is", "Instance_", "(_", "ssh", "\\u", "key", "\\u", "list_", ",_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "len_", "(_", "ssh", "\\u", "key", "\\u", "list_", ")_", ">_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "ssh", "\\u", "key_", "in_", "ssh", "\\u", "key", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Is", "Instance_", "(_", "ssh", "\\u", "key_", ",_", "runa", "bo", "ve_", "._", "ssh", "\\u", "key_", "._", "SSH", "Key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "ssh", "\\u", "key_", "._", "region_", "._", "name_", ",_", "region", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
SheffieldML/GPy/GPy/util/pca.py
[ { "content": "'''\nCreated on 10 Sep 2012\n\n@author: Max Zwiessele\n@copyright: Max Zwiessele 2012\n'''\nimport numpy\ntry:\n import pylab\n import matplotlib\nexcept:\n pass\nfrom numpy.linalg.linalg import LinAlgError\nfrom operator import setitem\nimport itertools\nfrom functools import reduce\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class PCA(object):\n \"\"\"\n PCA module with automatic primal/dual determination.\n \"\"\"\n\n\n\n\n\n", "metadata": "root.PCA", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def __init__(self, X):\n self.mu = None\n self.sigma = None\n\n X = self.center(X)\n\n # self.X = input\n if X.shape[0] >= X.shape[1]:\n # print \"N >= D: using primal\"\n self.eigvals, self.eigvectors = self._primal_eig(X)\n else:\n # print \"N < D: using dual\"\n self.eigvals, self.eigvectors = self._dual_eig(X)\n self.sort = numpy.argsort(self.eigvals)[::-1]\n self.eigvals = self.eigvals[self.sort]\n self.eigvectors = self.eigvectors[:, self.sort]\n self.fracs = self.eigvals / self.eigvals.sum()\n self.Q = self.eigvals.shape[0]", "metadata": "root.PCA.__init__", "header": "['class', 'PCA', '(', 'object', ')', ':', '___EOS___']", "index": 21 }, { "content": " def center(self, X):\n \"\"\"\n Center `X` in PCA space.\n \"\"\"\n X = X.copy()\n inan = numpy.isnan(X)\n if self.mu is None:\n X_ = numpy.ma.masked_array(X, inan)\n self.mu = X_.mean(0).base\n self.sigma = X_.std(0).base\n reduce(lambda y,x: setitem(x[0], x[1], x[2]), zip(X.T, inan.T, self.mu), None)\n X = X - self.mu\n X = X / numpy.where(self.sigma == 0, 1e-30, self.sigma)\n return X", "metadata": "root.PCA.center", "header": "['class', 'PCA', '(', 'object', ')', ':', '___EOS___']", "index": 40 }, { "content": " def _primal_eig(self, X):\n return numpy.linalg.eigh(numpy.einsum('ji,jk->ik',X,X))", "metadata": "root.PCA._primal_eig", "header": "['class', 'PCA', '(', 'object', ')', ':', '___EOS___']", "index": 55 }, { "content": " def _dual_eig(self, X):\n dual_eigvals, dual_eigvects = numpy.linalg.eigh(numpy.einsum('ij,kj->ik',X,X))\n relevant_dimensions = numpy.argsort(numpy.abs(dual_eigvals))[-X.shape[1]:]\n eigvals = dual_eigvals[relevant_dimensions]\n eigvects = dual_eigvects[:, relevant_dimensions]\n eigvects = (1. / numpy.sqrt(X.shape[0] * numpy.abs(eigvals))) * X.T.dot(eigvects)\n eigvects /= numpy.sqrt(numpy.diag(eigvects.T.dot(eigvects)))\n return eigvals, eigvects", "metadata": "root.PCA._dual_eig", "header": "['class', 'PCA', '(', 'object', ')', ':', '___EOS___']", "index": 58 }, { "content": " def project(self, X, Q=None):\n \"\"\"\n Project X into PCA space, defined by the Q highest eigenvalues.\n Y = X dot V\n \"\"\"\n if Q is None:\n Q = self.Q\n if Q > X.shape[1]:\n raise IndexError(\"requested dimension larger then input dimension\")\n X = self.center(X)\n return X.dot(self.eigvectors[:, :Q])", "metadata": "root.PCA.project", "header": "['class', 'PCA', '(', 'object', ')', ':', '___EOS___']", "index": 67 }, { "content": " def plot_fracs(self, Q=None, ax=None, fignum=None):\n \"\"\"\n Plot fractions of Eigenvalues sorted in descending order.\n \"\"\"\n from ..plotting import Tango\n Tango.reset()\n col = Tango.nextMedium()\n if ax is None:\n fig = pylab.figure(fignum)\n ax = fig.add_subplot(111)\n if Q is None:\n Q = self.Q\n ticks = numpy.arange(Q)\n bar = ax.bar(ticks - .4, self.fracs[:Q], color=col)\n ax.set_xticks(ticks, map(lambda x: r\"${}$\".format(x), ticks + 1))\n ax.set_ylabel(\"Eigenvalue fraction\")\n ax.set_xlabel(\"PC\")\n ax.set_ylim(0, ax.get_ylim()[1])\n ax.set_xlim(ticks.min() - .5, ticks.max() + .5)\n try:\n pylab.tight_layout()\n except:\n pass\n return bar", "metadata": "root.PCA.plot_fracs", "header": "['class', 'PCA', '(', 'object', ')', ':', '___EOS___']", "index": 79 }, { "content": " def plot_2d(self, X, labels=None, s=20, marker='o',\n dimensions=(0, 1), ax=None, colors=None,\n fignum=None, cmap=None, # @UndefinedVariable\n ** kwargs):\n \"\"\"\n Plot dimensions `dimensions` with given labels against each other in\n PC space. Labels can be any sequence of labels of dimensions X.shape[0].\n Labels can be drawn with a subsequent call to legend()\n \"\"\"\n if cmap is None:\n cmap = matplotlib.cm.jet\n if ax is None:\n fig = pylab.figure(fignum)\n ax = fig.add_subplot(111)\n if labels is None:\n labels = numpy.zeros(X.shape[0])\n ulabels = []\n for lab in labels:\n if not lab in ulabels:\n ulabels.append(lab)\n nlabels = len(ulabels)\n if colors is None:\n colors = iter([cmap(float(i) / nlabels) for i in range(nlabels)])\n else:\n colors = iter(colors)\n X_ = self.project(X, self.Q)[:,dimensions]\n kwargs.update(dict(s=s))\n plots = list()\n for i, l in enumerate(ulabels):\n kwargs.update(dict(color=colors.next(), marker=marker[i % len(marker)]))\n plots.append(ax.scatter(*X_[labels == l, :].T, label=str(l), **kwargs))\n ax.set_xlabel(r\"PC$_1$\")\n ax.set_ylabel(r\"PC$_2$\")\n try:\n pylab.tight_layout()\n except:\n pass\n return plots", "metadata": "root.PCA.plot_2d", "header": "['class', 'PCA', '(', 'object', ')', ':', '___EOS___']", "index": 104 } ]
[ { "span": "from numpy.linalg.linalg import LinAlgError", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 43 }, { "span": "import itertools", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 16 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "Creat", "ed", " ", "on", " ", "10", " ", "Se", "p", " ", "2012", "\\", "10", ";", "\\", "10", ";", "@", "author", ":", " ", "Max", " ", "Zw", "ies", "sele", "\\", "10", ";", "@", "copyr", "ight", ":", " ", "Max", " ", "Zw", "ies", "sele", " ", "2012", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pylab_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "matplotlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "numpy_", "._", "linalg_", "._", "linalg_", "import_", "Lin", "Alg", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "operator_", "import_", "setitem", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "itertools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "functools_", "import_", "reduce_", "\\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_", "PCA", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "PCA", " ", "module", " ", "with", " ", "automati", "c", " ", "prima", "l", "/", "dual", " ", "determina", "tion", ".", "\\", "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_", "PCA", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "X_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "mu_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sigma_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "X_", "=_", "self_", "._", "center_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "self", ".", "X", " ", "=", " ", "input_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "X_", "._", "shape_", "[_", "0_", "]_", ">=_", "X_", "._", "shape_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "\"", "N", " ", ">=", " ", "D", ":", " ", "usi", "ng", " ", "prima", "l", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "eigv", "als_", ",_", "self_", "._", "eigv", "ector", "s_", "=_", "self_", "._", "\\u", "prima", "l\\u", "eig_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "print", " ", "\"", "N", " ", "<", " ", "D", ":", " ", "usi", "ng", " ", "dual", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "eigv", "als_", ",_", "self_", "._", "eigv", "ector", "s_", "=_", "self_", "._", "\\u", "dual", "\\u", "eig_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sort_", "=_", "numpy_", "._", "argsort_", "(_", "self_", "._", "eigv", "als_", ")_", "[_", ":_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "eigv", "als_", "=_", "self_", "._", "eigv", "als_", "[_", "self_", "._", "sort_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "eigv", "ector", "s_", "=_", "self_", "._", "eigv", "ector", "s_", "[_", ":_", ",_", "self_", "._", "sort_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "frac", "s_", "=_", "self_", "._", "eigv", "als_", "/_", "self_", "._", "eigv", "als_", "._", "sum_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Q_", "=_", "self_", "._", "eigv", "als_", "._", "shape_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PCA", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "center_", "(_", "self_", ",_", "X_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Center", " ", "`", "X", "`", " ", "in", " ", "PCA", " ", "space", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "X_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ina", "n_", "=_", "numpy_", "._", "isnan_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "mu_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "X", "\\u_", "=_", "numpy_", "._", "ma_", "._", "mask", "ed", "\\u", "array_", "(_", "X_", ",_", "ina", "n_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "mu_", "=_", "X", "\\u_", "._", "mean_", "(_", "0_", ")_", "._", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sigma_", "=_", "X", "\\u_", "._", "std_", "(_", "0_", ")_", "._", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "reduce_", "(_", "lambda_", "y_", ",_", "x_", ":_", "setitem", "_", "(_", "x_", "[_", "0_", "]_", ",_", "x_", "[_", "1_", "]_", ",_", "x_", "[_", "2_", "]_", ")_", ",_", "zip_", "(_", "X_", "._", "T_", ",_", "ina", "n_", "._", "T_", ",_", "self_", "._", "mu_", ")_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "X_", "-_", "self_", "._", "mu_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "X_", "=_", "X_", "/_", "numpy_", "._", "where_", "(_", "self_", "._", "sigma_", "==_", "0_", ",_", "1e-", "30_", ",_", "self_", "._", "sigma_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "X_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PCA", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "prima", "l\\u", "eig_", "(_", "self_", ",_", "X_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "numpy_", "._", "linalg_", "._", "eig", "h_", "(_", "numpy_", "._", "einsum_", "(_", "'", "ji", ",", "jk", "->", "ik", "'_", ",_", "X_", ",_", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PCA", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "dual", "\\u", "eig_", "(_", "self_", ",_", "X_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dual", "\\u", "eigv", "als_", ",_", "dual", "\\u", "eigv", "ects_", "=_", "numpy_", "._", "linalg_", "._", "eig", "h_", "(_", "numpy_", "._", "einsum_", "(_", "'", "ij", ",", "kj", "->", "ik", "'_", ",_", "X_", ",_", "X_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rele", "van", "t", "\\u", "dimensions_", "=_", "numpy_", "._", "argsort_", "(_", "numpy_", "._", "abs_", "(_", "dual", "\\u", "eigv", "als_", ")_", ")_", "[_", "-_", "X_", "._", "shape_", "[_", "1_", "]_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eigv", "als_", "=_", "dual", "\\u", "eigv", "als_", "[_", "rele", "van", "t", "\\u", "dimensions_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eigv", "ects_", "=_", "dual", "\\u", "eigv", "ects_", "[_", ":_", ",_", "rele", "van", "t", "\\u", "dimensions_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eigv", "ects_", "=_", "(_", "1._", "/_", "numpy_", "._", "sqrt_", "(_", "X_", "._", "shape_", "[_", "0_", "]_", "*_", "numpy_", "._", "abs_", "(_", "eigv", "als_", ")_", ")_", ")_", "*_", "X_", "._", "T_", "._", "dot_", "(_", "eigv", "ects_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "eigv", "ects_", "/=_", "numpy_", "._", "sqrt_", "(_", "numpy_", "._", "diag_", "(_", "eigv", "ects_", "._", "T_", "._", "dot_", "(_", "eigv", "ects_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "eigv", "als_", ",_", "eigv", "ects_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PCA", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "project_", "(_", "self_", ",_", "X_", ",_", "Q_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Project", " ", "X", " ", "int", "o", " ", "PCA", " ", "space", ",", " ", "defin", "ed", " ", "by", " ", "the", " ", "Q", " ", "high", "est", " ", "eigenvalues", ".", "\\", "10", ";", " ", " ", " ", " ", "Y", " ", "=", " ", "X", " ", "dot", " ", "V", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "Q_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Q_", "=_", "self_", "._", "Q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Q_", ">_", "X_", "._", "shape_", "[_", "1_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Index", "Error_", "(_", "\"", "request", "ed", " ", "dimension", " ", "large", "r", " ", "then", " ", "input", " ", "dimension", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "X_", "=_", "self_", "._", "center_", "(_", "X_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "X_", "._", "dot_", "(_", "self_", "._", "eigv", "ector", "s_", "[_", ":_", ",_", ":_", "Q_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PCA", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plot", "\\u", "frac", "s_", "(_", "self_", ",_", "Q_", "=_", "None_", ",_", "ax_", "=_", "None_", ",_", "fign", "um_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Plot", " ", "fract", "ion", "s", " ", "of", " ", "Eigen", "values", " ", "sorte", "d", " ", "in", " ", "descend", "ing", " ", "order", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "._", "plotting_", "import_", "Tang", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Tang", "o_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "col_", "=_", "Tang", "o_", "._", "next", "Medi", "um_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ax_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fig_", "=_", "pylab_", "._", "figure_", "(_", "fign", "um_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "111_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "Q_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "Q_", "=_", "self_", "._", "Q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ticks_", "=_", "numpy_", "._", "arange_", "(_", "Q_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bar_", "=_", "ax_", "._", "bar_", "(_", "ticks_", "-_", ".4_", ",_", "self_", "._", "frac", "s_", "[_", ":_", "Q_", "]_", ",_", "color_", "=_", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "xticks_", "(_", "ticks_", ",_", "map_", "(_", "lambda_", "x_", ":_", "r", "\"$", "{}", "$\"_", "._", "format_", "(_", "x_", ")_", ",_", "ticks_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "ylabel_", "(_", "\"", "Eigen", "value", " ", "fract", "ion", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "xlabel_", "(_", "\"", "PC", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "ylim_", "(_", "0_", ",_", "ax_", "._", "get", "\\u", "ylim_", "(_", ")_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "xlim_", "(_", "ticks_", "._", "min_", "(_", ")_", "-_", ".5_", ",_", "ticks_", "._", "max_", "(_", ")_", "+_", ".5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pylab_", "._", "tig", "ht", "\\u", "layout_", "(_", ")_", "\\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_", "return_", "bar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "PCA", "_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "plot", "\\u", "2d_", "(_", "self_", ",_", "X_", ",_", "labels_", "=_", "None_", ",_", "s_", "=_", "20_", ",_", "marker_", "=_", "'", "o", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dimensions_", "=_", "(_", "0_", ",_", "1_", ")_", ",_", "ax_", "=_", "None_", ",_", "colors_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fign", "um_", "=_", "None_", ",_", "cmap_", "=_", "None_", ",_", "#", " ", "@", "Unde", "fined", "Variable_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Plot", " ", "dimension", "s", " ", "`", "dimension", "s", "`", " ", "with", " ", "give", "n", " ", "labels", " ", "against", " ", "each", " ", "other", " ", "in", "\\", "10", ";", " ", " ", " ", " ", "PC", " ", "space", ".", " ", "Label", "s", " ", "can", " ", "be", " ", "any", " ", "sequence", " ", "of", " ", "labels", " ", "of", " ", "dimension", "s", " ", "X", ".", "shape", "[", "0", "].", "\\", "10", ";", " ", " ", " ", " ", "Label", "s", " ", "can", " ", "be", " ", "draw", "n", " ", "with", " ", "a", " ", "subsequen", "t", " ", "call", " ", "to", " ", "legend", "()", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cmap_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cmap_", "=_", "matplotlib_", "._", "cm_", "._", "jet", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ax_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fig_", "=_", "pylab_", "._", "figure_", "(_", "fign", "um_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "=_", "fig_", "._", "add", "\\u", "subplot_", "(_", "111_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "labels_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "labels_", "=_", "numpy_", "._", "zeros_", "(_", "X_", "._", "shape_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ula", "bels", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "lab_", "in_", "labels_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "lab_", "in_", "ula", "bels", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ula", "bels", "_", "._", "append_", "(_", "lab_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nla", "bels", "_", "=_", "len_", "(_", "ula", "bels", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "colors_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colors_", "=_", "iter_", "(_", "[_", "cmap_", "(_", "float_", "(_", "i_", ")_", "/_", "nla", "bels", "_", ")_", "for_", "i_", "in_", "range_", "(_", "nla", "bels", "_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "colors_", "=_", "iter_", "(_", "colors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "X", "\\u_", "=_", "self_", "._", "project_", "(_", "X_", ",_", "self_", "._", "Q_", ")_", "[_", ":_", ",_", "dimensions_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "kwargs_", "._", "update_", "(_", "dict_", "(_", "s_", "=_", "s_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plots_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "l_", "in_", "enumerate_", "(_", "ula", "bels", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "kwargs_", "._", "update_", "(_", "dict_", "(_", "color_", "=_", "colors_", "._", "next_", "(_", ")_", ",_", "marker_", "=_", "marker_", "[_", "i_", "%_", "len_", "(_", "marker_", ")_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "plots_", "._", "append_", "(_", "ax_", "._", "scatter_", "(_", "*_", "X", "\\u_", "[_", "labels_", "==_", "l_", ",_", ":_", "]_", "._", "T_", ",_", "label_", "=_", "str_", "(_", "l_", ")_", ",_", "**_", "kwargs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ax_", "._", "set\\u", "xlabel_", "(_", "r", "\"", "PC", "$\\u", "1", "$\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "ylabel_", "(_", "r", "\"", "PC", "$\\u", "2", "$\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pylab_", "._", "tig", "ht", "\\u", "layout_", "(_", ")_", "\\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_", "return_", "plots_" ]
[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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 ]
Unused local variable
dcramer/sentry-old/tests/test_events.py
[ { "content": " def test_context_processors(self):\n try:\n username = 'random_user'\n password = 'secret42'\n raise ValueError('foo bar')\n except:\n exc_info = sys.exc_info()\n\n # We raise a second event to ensure we actually reference\n # the first event\n try:\n raise SyntaxError('baz')\n except:\n pass\n\n # Exception pulls in sys.exc_info()\n # by default\n event_id = capture('Exception')\n\n event = Event.objects.get(event_id)\n self.assertTrue('sentry.interfaces.Stacktrace' in event.data)\n event_data = event.data['sentry.interfaces.Stacktrace']\n frame = event_data['frames'][0]\n self.assertEquals(frame['vars']['password'], '****************')", "metadata": "root.SentryTest.test_context_processors", "header": "['class', 'SentryTest', '(', 'BaseTest', ')', ':', '___NEWLINE___', '# Some quick ugly high level tests to get shit working fast', '___NL___', '___EOS___']", "index": 304 } ]
[ { "span": "username ", "start_line": 306, "start_column": 12, "end_line": 306, "end_column": 20 }, { "span": "password ", "start_line": 307, "start_column": 12, "end_line": 307, "end_column": 20 }, { "span": "exc_info ", "start_line": 310, "start_column": 12, "end_line": 310, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Sent", "ry", "Test_", "(_", "Base", "Test_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Some", " ", "quick", " ", "ug", "ly", " ", "high", " ", "level", " ", "tests", " ", "to", " ", "get", " ", "shi", "t", " ", "working", " ", "fast_", "\\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", "context", "\\u", "processors_", "(_", "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 ", " _", "username_", "=_", "'", "random", "\\u", "user", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "password_", "=_", "'", "secret", "4", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Value", "Error_", "(_", "'", "foo", " ", "bar", "'_", ")_", "\\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 ", " _", "exc", "\\u", "info_", "=_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "raise", " ", "a", " ", "second", " ", "event", " ", "to", " ", "ensure", " ", "we", " ", "actual", "ly", " ", "reference_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "first", " ", "event_", "\\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 ", " _", "raise_", "Syntax", "Error_", "(_", "'", "ba", "z", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Except", "ion", " ", "pull", "s", " ", "in", " ", "sys", ".", "exc", "\\u", "info", "()", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "by", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "event", "\\u", "id_", "=_", "capture_", "(_", "'", "Except", "ion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "event_", "=_", "Event_", "._", "objects_", "._", "get_", "(_", "event", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "sentry", ".", "interface", "s", ".", "Stack", "trace", "'_", "in_", "event_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "event", "\\u", "data_", "=_", "event_", "._", "data_", "[_", "'", "sentry", ".", "interface", "s", ".", "Stack", "trace", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "frame_", "=_", "event", "\\u", "data_", "[_", "'", "frames", "'_", "]_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equals_", "(_", "frame_", "[_", "'", "vars", "'_", "]_", "[_", "'", "password", "'_", "]_", ",_", "'*******", "********", "*'_", ")_" ]
[ 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, 0, 2, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
spulec/pep8ify/tests/fixtures/indentation/indentation7_in.py
[ { "content": " def get_new_broks(self):\n # Get the good links tab for looping..\n links = rechts", "metadata": "root.X.get_new_broks", "header": "['class', 'X', ':', '___NEWLINE___', '# We get new broks from schedulers', '___NL___', '# REF: doc/broker-modules.png (2)', '___NL___', '___EOS___']", "index": 5 } ]
[ { "span": "links ", "start_line": 7, "start_column": 9, "end_line": 7, "end_column": 14 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "X_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "get", " ", "new", " ", "bro", "ks", " ", "from", " ", "schedule", "rs_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "REF", ":", " ", "doc", "/", "broker", "-", "module", "s", ".", "png", " ", "(", "2", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get", "\\u", "new", "\\u", "bro", "ks_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "good", " ", "link", "s", " ", "tab", " ", "for", " ", "looping", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "links_", "=_", "rech", "ts_" ]
[ 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 ]
Unused local variable
jcberquist/sublimetext-cfml/src/fw1/fw1.py
[ { "content": "def get_script_completions(view, prefix, position, info):\n\tif not get_setting(view, \"fw1_enabled\"):\n\t\treturn None\n\n\tif extends_fw1(view):\n\t\tif view.match_selector(position, \"meta.class.body.cfml -meta.function.body -meta.struct-literal\"):\n\t\t\treturn CompletionList(fw1[\"methods\"][\"definitions\"], 1, False)\n\n\t\tkey = get_struct_var_assignment(view, position)\n\t\tcompletions = []\n\t\tif key and key in fw1[\"settings\"]:\n\t\t\treturn CompletionList(fw1[\"settings\"][key], 1, False)\n\n\t\treturn CompletionList(fw1[\"methods\"][\"calls\"], 1, False)\n\n\tif get_file_type(view) in [\"view\",\"layout\"]:\n\t\treturn CompletionList(fw1[\"methods\"][\"calls\"], 1, False)\n\n\treturn None", "metadata": "root.get_script_completions", "header": "['module', '___EOS___']", "index": 80 } ]
[ { "span": "completions ", "start_line": 89, "start_column": 2, "end_line": 89, "end_column": 13 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "script", "\\u", "completions_", "(_", "view_", ",_", "prefix_", ",_", "position_", ",_", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "_", "if_", "not_", "get", "\\u", "setting_", "(_", "view_", ",_", "\"", "fw", "1", "\\u", "enable", "d", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "extend", "s", "\\u", "fw", "1_", "(_", "view_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "if_", "view_", "._", "match", "\\u", "selector_", "(_", "position_", ",_", "\"", "meta", ".", "class", ".", "body", ".", "cfm", "l", " ", "-", "meta", ".", "function", ".", "body", " ", "-", "meta", ".", "struct", "-", "literal", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "Completi", "on", "List_", "(_", "fw", "1_", "[_", "\"", "method", "s", "\"_", "]_", "[_", "\"", "definit", "ion", "s", "\"_", "]_", ",_", "1_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key_", "=_", "get", "\\u", "struct", "\\u", "var", "\\u", "assignment_", "(_", "view_", ",_", "position_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "completions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "key_", "and_", "key_", "in_", "fw", "1_", "[_", "\"", "settings", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t\t_", "return_", "Completi", "on", "List_", "(_", "fw", "1_", "[_", "\"", "settings", "\"_", "]_", "[_", "key_", "]_", ",_", "1_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "Completi", "on", "List_", "(_", "fw", "1_", "[_", "\"", "method", "s", "\"_", "]_", "[_", "\"", "calls", "\"_", "]_", ",_", "1_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "get", "\\u", "file", "\\u", "type_", "(_", "view_", ")_", "in_", "[_", "\"", "view", "\"_", ",_", "\"", "layout", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u\t", "\t_", "return_", "Completi", "on", "List_", "(_", "fw", "1_", "[_", "\"", "method", "s", "\"_", "]_", "[_", "\"", "calls", "\"_", "]_", ",_", "1_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
ronnix/fabtools/fabtools/require/system.py
[ { "content": "\"\"\"\nSystem settings\n===============\n\"\"\"\n\nfrom re import escape\n\nfrom fabric.api import settings, warn\nfrom fabric.contrib.files import append, uncomment\n\nfrom fabtools.files import is_file, watch\nfrom fabtools.system import (\n UnsupportedFamily,\n distrib_family, distrib_id,\n get_hostname, set_hostname,\n get_sysctl, set_sysctl,\n supported_locales,\n)\nfrom fabtools.utils import run_as_root\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class UnsupportedLocales(Exception):\n", "metadata": "root.UnsupportedLocales", "header": "['module', '___EOS___']", "index": 21 }, { "content": " def __init__(self, locales):\n self.locales = sorted(locales)\n msg = \"Unsupported locales: %s\" % ', '.join(self.locales)\n super(UnsupportedLocales, self).__init__(msg)", "metadata": "root.UnsupportedLocales.__init__", "header": "['class', 'UnsupportedLocales', '(', 'Exception', ')', ':', '___EOS___']", "index": 23 }, { "content": "def sysctl(key, value, persist=True):\n \"\"\"\n Require a kernel parameter to have a specific value.\n \"\"\"\n if get_sysctl(key) != value:\n set_sysctl(key, value)\n\n if persist:\n\n from fabtools.require import file as require_file\n\n filename = '/etc/sysctl.d/60-%s.conf' % key\n with watch(filename, use_sudo=True) as config:\n require_file(filename,\n contents='%(key)s = %(value)s\\n' % locals(),\n use_sudo=True)\n if config.changed:\n if distrib_family() == 'debian':\n with settings(warn_only=True):\n run_as_root('service procps start')", "metadata": "root.sysctl", "header": "['module', '___EOS___']", "index": 29 }, { "content": "def hostname(name):\n \"\"\"\n Require the hostname to have a specific value.\n \"\"\"\n if get_hostname() != name:\n set_hostname(name)", "metadata": "root.hostname", "header": "['module', '___EOS___']", "index": 51 }, { "content": "def locales(names):\n \"\"\"\n Require the list of locales to be available.\n\n Raises UnsupportedLocales if some of the required locales\n are not supported.\n \"\"\"\n\n family = distrib_family()\n if family == 'debian':\n command = 'dpkg-reconfigure --frontend=noninteractive locales'\n if distrib_id() == 'Ubuntu':\n config_file = '/var/lib/locales/supported.d/local'\n if not is_file(config_file):\n run_as_root('touch %s' % config_file)\n else:\n config_file = '/etc/locale.gen'\n _locales_generic(names, config_file=config_file, command=command)\n elif family in ['arch', 'gentoo']:\n _locales_generic(names, config_file='/etc/locale.gen', command='locale-gen')\n elif distrib_family() == 'redhat':\n _locales_redhat(names)\n else:\n raise UnsupportedFamily(supported=['debian', 'arch', 'gentoo', 'redhat'])", "metadata": "root.locales", "header": "['module', '___EOS___']", "index": 59 }, { "content": "def _locales_generic(names, config_file, command):\n\n supported = supported_locales()\n _check_for_unsupported_locales(names, supported)\n\n # Regenerate locales if config file changes\n with watch(config_file, use_sudo=True) as config:\n\n # Add valid locale names to the config file\n charset_from_name = dict(supported)\n for name in names:\n charset = charset_from_name[name]\n locale = \"%s %s\" % (name, charset)\n uncomment(config_file, escape(locale), use_sudo=True, shell=True)\n append(config_file, locale, use_sudo=True, partial=True, shell=True)\n\n if config.changed:\n run_as_root(command)", "metadata": "root._locales_generic", "header": "['module', '___EOS___']", "index": 85 }, { "content": "def _locales_redhat(names):\n supported = supported_locales()\n _check_for_unsupported_locales(names, supported)", "metadata": "root._locales_redhat", "header": "['module', '___EOS___']", "index": 105 }, { "content": "def _check_for_unsupported_locales(names, supported):\n missing = set(names) - set([name for name, _ in supported])\n if missing:\n raise UnsupportedLocales(missing)", "metadata": "root._check_for_unsupported_locales", "header": "['module', '___EOS___']", "index": 110 }, { "content": "def locale(name):\n \"\"\"\n Require the locale to be available.\n\n Raises UnsupportedLocales if the required locale is not supported.\n \"\"\"\n locales([name])", "metadata": "root.locale", "header": "['module', '___EOS___']", "index": 116 }, { "content": "def default_locale(name):\n \"\"\"\n Require the locale to be the default.\n \"\"\"\n from fabtools.require import file as require_file\n\n # Ensure the locale is available\n locale(name)\n\n # Make it the default\n contents = 'LANG=\"%s\"\\n' % name\n if distrib_family() == 'arch':\n config_file = '/etc/locale.conf'\n else:\n config_file = '/etc/default/locale'\n require_file(config_file, contents, use_sudo=True)", "metadata": "root.default_locale", "header": "['module', '___EOS___']", "index": 125 } ]
[ { "span": "from fabric.api import settings, warn", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 37 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "System", " ", "settings", "\\", "10", ";", "==============", "=", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "re_", "import_", "escape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "fabric_", "._", "api_", "import_", "settings_", ",_", "warn_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fabric_", "._", "contrib_", "._", "files_", "import_", "append_", ",_", "uncomm", "ent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "fab", "tools_", "._", "files_", "import_", "is", "\\u", "file_", ",_", "watch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fab", "tools_", "._", "system_", "import_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Unsu", "ppo", "rted", "Family_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "distri", "b", "\\u", "family_", ",_", "distri", "b", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "hostname_", ",_", "set\\u", "hostname_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "sysc", "tl_", ",_", "set\\u", "sysc", "tl_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "support", "ed", "\\u", "locales_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fab", "tools_", "._", "utils_", "import_", "run", "\\u", "as", "\\u", "root_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Unsu", "ppo", "rted", "Local", "es_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Unsu", "ppo", "rted", "Local", "es_", "(_", "Exception_", ")_", ":_", "\\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_", ",_", "locales_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "locales_", "=_", "sorted_", "(_", "locales_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "\"", "Unsu", "ppo", "rted", " ", "locale", "s", ":", " ", "%", "s", "\"_", "%_", "',", " ", "'_", "._", "join_", "(_", "self_", "._", "locales_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Unsu", "ppo", "rted", "Local", "es_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sysc", "tl_", "(_", "key_", ",_", "value_", ",_", "persist_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Requ", "ire", " ", "a", " ", "kernel", " ", "parameter", " ", "to", " ", "have", " ", "a", " ", "specific", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "get", "\\u", "sysc", "tl_", "(_", "key_", ")_", "!=_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "sysc", "tl_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "persist_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "fab", "tools_", "._", "require_", "import_", "file_", "as_", "require", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "'/", "etc", "/", "sysc", "tl", ".", "d", "/", "60", "-%", "s", ".", "conf", "'_", "%_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "watch_", "(_", "filename_", ",_", "use", "\\u", "sudo_", "=_", "True_", ")_", "as_", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "require", "\\u", "file_", "(_", "filename_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "contents_", "=_", "'%", "(", "key", ")", "s", " ", "=", " ", "%", "(", "value", ")", "s", "\\\\", "n", "'_", "%_", "locals_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "sudo_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "config_", "._", "changed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "distri", "b", "\\u", "family_", "(_", ")_", "==_", "'", "debi", "an", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "settings_", "(_", "warn", "\\u", "only_", "=_", "True_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "run", "\\u", "as", "\\u", "root_", "(_", "'", "service", " ", "proc", "ps", " ", "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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "hostname_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Requ", "ire", " ", "the", " ", "host", "name", " ", "to", " ", "have", " ", "a", " ", "specific", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "get", "\\u", "hostname_", "(_", ")_", "!=_", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "set\\u", "hostname_", "(_", "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_", "locales_", "(_", "names_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Requ", "ire", " ", "the", " ", "list", " ", "of", " ", "locale", "s", " ", "to", " ", "be", " ", "avail", "able", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", " ", "Unsu", "ppo", "rted", "Local", "es", " ", "if", " ", "some", " ", "of", " ", "the", " ", "require", "d", " ", "locale", "s", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "not", " ", "support", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "family_", "=_", "distri", "b", "\\u", "family_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "family_", "==_", "'", "debi", "an", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "command_", "=_", "'", "dpkg", "-", "reconfigur", "e", " ", "--", "front", "end", "=", "non", "interactive", " ", "locale", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "distri", "b", "\\u", "id_", "(_", ")_", "==_", "'", "Ub", "unt", "u", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "file_", "=_", "'/", "var", "/", "lib", "/", "locale", "s", "/", "support", "ed", ".", "d", "/", "local", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "is", "\\u", "file_", "(_", "config", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run", "\\u", "as", "\\u", "root_", "(_", "'", "touch", " ", "%", "s", "'_", "%_", "config", "\\u", "file_", ")_", "\\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 ", " _", "config", "\\u", "file_", "=_", "'/", "etc", "/", "locale", ".", "gen", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "locale", "s", "\\u", "generic_", "(_", "names_", ",_", "config", "\\u", "file_", "=_", "config", "\\u", "file_", ",_", "command_", "=_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "family_", "in_", "[_", "'", "arch", "'_", ",_", "'", "gent", "oo", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "locale", "s", "\\u", "generic_", "(_", "names_", ",_", "config", "\\u", "file_", "=_", "'/", "etc", "/", "locale", ".", "gen", "'_", ",_", "command_", "=_", "'", "locale", "-", "gen", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "distri", "b", "\\u", "family_", "(_", ")_", "==_", "'", "red", "hat", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "locale", "s", "\\u", "red", "hat_", "(_", "names_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Unsu", "ppo", "rted", "Family_", "(_", "supported_", "=_", "[_", "'", "debi", "an", "'_", ",_", "'", "arch", "'_", ",_", "'", "gent", "oo", "'_", ",_", "'", "red", "hat", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "locale", "s", "\\u", "generic_", "(_", "names_", ",_", "config", "\\u", "file_", ",_", "command_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "supported_", "=_", "support", "ed", "\\u", "locales_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "check", "\\u", "for", "\\u", "unsup", "porte", "d\\u", "locales_", "(_", "names_", ",_", "supported_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Rege", "nera", "te", " ", "locale", "s", " ", "if", " ", "config", " ", "file", " ", "changes_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "watch_", "(_", "config", "\\u", "file_", ",_", "use", "\\u", "sudo_", "=_", "True_", ")_", "as_", "config_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "valid", " ", "locale", " ", "names", " ", "to", " ", "the", " ", "config", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "charset", "\\u", "from", "\\u", "name_", "=_", "dict_", "(_", "supported_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "name_", "in_", "names_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "charset_", "=_", "charset", "\\u", "from", "\\u", "name_", "[_", "name_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "locale_", "=_", "\"%", "s", " ", "%", "s", "\"_", "%_", "(_", "name_", ",_", "charset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "uncomm", "ent_", "(_", "config", "\\u", "file_", ",_", "escape_", "(_", "locale_", ")_", ",_", "use", "\\u", "sudo_", "=_", "True_", ",_", "shell_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "append_", "(_", "config", "\\u", "file_", ",_", "locale_", ",_", "use", "\\u", "sudo_", "=_", "True_", ",_", "partial_", "=_", "True_", ",_", "shell_", "=_", "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_", "config_", "._", "changed_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "run", "\\u", "as", "\\u", "root_", "(_", "command_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "locale", "s", "\\u", "red", "hat_", "(_", "names_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "supported_", "=_", "support", "ed", "\\u", "locales_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "check", "\\u", "for", "\\u", "unsup", "porte", "d\\u", "locales_", "(_", "names_", ",_", "supported_", ")_", "\\u\\u\\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", "check", "\\u", "for", "\\u", "unsup", "porte", "d\\u", "locales_", "(_", "names_", ",_", "supported_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "missing_", "=_", "set_", "(_", "names_", ")_", "-_", "set_", "(_", "[_", "name_", "for_", "name_", ",_", "\\u_", "in_", "supported_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "missing_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Unsu", "ppo", "rted", "Local", "es_", "(_", "missing_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "locale_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Requ", "ire", " ", "the", " ", "locale", " ", "to", " ", "be", " ", "avail", "able", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", " ", "Unsu", "ppo", "rted", "Local", "es", " ", "if", " ", "the", " ", "require", "d", " ", "locale", " ", "is", " ", "not", " ", "support", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "locales_", "(_", "[_", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "default", "\\u", "locale_", "(_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Requ", "ire", " ", "the", " ", "locale", " ", "to", " ", "be", " ", "the", " ", "default", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "fab", "tools_", "._", "require_", "import_", "file_", "as_", "require", "\\u", "file_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ensur", "e", " ", "the", " ", "locale", " ", "is", " ", "available_", "\\u\\u\\uNL\\u\\u\\u_", "locale_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "it", " ", "the", " ", "default_", "\\u\\u\\uNL\\u\\u\\u_", "contents_", "=_", "'", "LANG", "=\"", "%", "s", "\"\\\\", "n", "'_", "%_", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "distri", "b", "\\u", "family_", "(_", ")_", "==_", "'", "arch", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "file_", "=_", "'/", "etc", "/", "locale", ".", "conf", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "file_", "=_", "'/", "etc", "/", "default", "/", "locale", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "require", "\\u", "file_", "(_", "config", "\\u", "file_", ",_", "contents_", ",_", "use", "\\u", "sudo_", "=_", "True_", ")_" ]
[ 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 ]
Unused import
karesansui/karesansui/karesansui/gadget/hostby1log.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\n\"\"\"\n@authors: Hiroki Takayasu <[email protected]>\n\"\"\"\nimport os\nimport web\nimport socket\n\nfrom karesansui.lib.rest import Rest, auth\nfrom karesansui.lib.log.config import LogViewConfigParam\nfrom karesansui.lib.const import LOG_VIEW_XML_FILE\n\n\nurls = ('/host/(\\d+)/log?(\\.part)$', HostBy1Log,)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class HostBy1Log(Rest):", "metadata": "root.HostBy1Log", "header": "['module', '___EOS___']", "index": 36 }, { "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 self.view.host_id = host_id\n\n config = LogViewConfigParam(LOG_VIEW_XML_FILE)\n config.load_xml_config()\n self.view.apps = config.get_applications()\n return True", "metadata": "root.HostBy1Log._GET", "header": "['class', 'HostBy1Log', '(', 'Rest', ')', ':', '___EOS___']", "index": 37 } ]
[ { "span": "import os", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 9 }, { "span": "import socket", "start_line": 30, "start_column": 0, "end_line": 30, "end_column": 13 } ]
[]
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_", "\"\"\"", "\\", "10", ";", "@", "author", "s", ":", " ", "Hi", "rok", "i", " ", "Tak", "aya", "su", " ", "<", "hir", "oki", "@", "kar", "esa", "nsu", "i", "-", "project", ".", "info", ">", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "web_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\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_", "._", "lib_", "._", "log_", "._", "config_", "import_", "Log", "View", "Config", "Param_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "kar", "esa", "nsu", "i_", "._", "lib_", "._", "const_", "import_", "LOG", "\\u", "VIEW", "\\u", "XML", "\\u", "FILE_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "urls_", "=_", "(_", "'/", "host", "/(", "\\\\", "d", "+)", "/", "log", "?(", "\\\\.", "part", ")$'_", ",_", "Host", "By", "1", "Log_", ",_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Host", "By", "1", "Log_", "(_", "Rest", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Host", "By", "1", "Log_", "(_", "Rest", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\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_", "self_", "._", "view_", "._", "host", "\\u", "id_", "=_", "host", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "=_", "Log", "View", "Config", "Param_", "(_", "LOG", "\\u", "VIEW", "\\u", "XML", "\\u", "FILE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config_", "._", "load", "\\u", "xml", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "view_", "._", "apps_", "=_", "config_", "._", "get", "\\u", "applications_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\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, 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'BaseException'
blixt/py-starbound/starbound/helpers.py
[ { "content": "import binascii\nimport hashlib\nimport io\nimport os\nimport re\nimport struct\nimport zlib\n\nfrom . import btreedb4\nfrom . import sbvj01\nfrom . import sbon\n\ntry:\n import builtins\nexcept:\n import __builtin__ as builtins\n\n# Override range with xrange when running Python 2.x.\ntry:\n range = xrange\nexcept:\n pass\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nEXTENSION_TO_CLASS = dict(\n chunks=CelestialChunks,\n clientcontext=sbvj01.FileSBVJ01,\n dat=sbvj01.FileSBVJ01,\n db=VariantDatabase,\n fail=FailedWorld,\n modpak=Package,\n pak=Package,\n player=Player,\n shipworld=World,\n world=World,\n)\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def get_metadata(self):\n try:\n stream = io.BytesIO(self.get_raw(World.METADATA_KEY))\n except:\n stream = btreedb4.LeafReader.last_buffer\n stream.seek(0)\n\n # Not sure what these values mean.\n unknown_1, unknown_2 = struct.unpack('>ii', stream.read(8))\n\n name, version, data = sbon.read_document(stream, True)\n assert name == 'WorldMetadata', 'Invalid world data'\n\n self._metadata = data\n self._metadata_version = version\n\n return data, version", "metadata": "root.FailedWorld.get_metadata", "header": "['class', 'FailedWorld', '(', 'World', ')', ':', '___EOS___']", "index": 181 } ]
[ { "span": "except:", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 7 }, { "span": "except:", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 7 }, { "span": "except:", "start_line": 184, "start_column": 8, "end_line": 184, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "binascii_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "io_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "import_", "bt", "ree", "db", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "sb", "vj", "01_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "sbo", "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 ", " _", "import_", "builtins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "\\u\\u", "builtin\\u\\u_", "as_", "builtins_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Override", " ", "range", " ", "with", " ", "xran", "ge", " ", "whe", "n", " ", "runn", "ing", " ", "Pyth", "on", " ", "2", ".", "x", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "range_", "=_", "xrange_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "EXTENSION", "\\u", "TO", "\\u", "CLASS_", "=_", "dict_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "chunks_", "=_", "Cel", "esti", "al", "Chunk", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "client", "context_", "=_", "sb", "vj", "01_", "._", "File", "SB", "VJ", "01_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dat_", "=_", "sb", "vj", "01_", "._", "File", "SB", "VJ", "01_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db_", "=_", "Varia", "nt", "Database_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fail_", "=_", "Fail", "ed", "World_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "modp", "ak_", "=_", "Package_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "pak", "_", "=_", "Package_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "player_", "=_", "Player_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ship", "world_", "=_", "World_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "world_", "=_", "World_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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]_", "class_", "Fail", "ed", "World_", "(_", "World_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "metadata_", "(_", "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 ", " _", "stream_", "=_", "io_", "._", "Byte", "s", "IO_", "(_", "self_", "._", "get", "\\u", "raw_", "(_", "World_", "._", "METAD", "ATA", "\\u", "KEY_", ")_", ")_", "\\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 ", " _", "stream_", "=_", "bt", "ree", "db", "4_", "._", "Lea", "f", "Reader_", "._", "last", "\\u", "buffer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stream_", "._", "seek_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", " ", "sure", " ", "what", " ", "these", " ", "values", " ", "mean", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "unknown", "\\u", "1_", ",_", "unknown", "\\u", "2_", "=_", "struct_", "._", "unpack_", "(_", "'>", "ii", "'_", ",_", "stream_", "._", "read_", "(_", "8_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "name_", ",_", "version_", ",_", "data_", "=_", "sbo", "n_", "._", "read", "\\u", "document_", "(_", "stream_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "name_", "==_", "'", "Wor", "ld", "Meta", "data", "'_", ",_", "'", "Inva", "lid", " ", "world", " ", "data", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "metadata_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "metadata", "\\u", "version_", "=_", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "data_", ",_", "version_", "\\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, 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
elistevens/solari/ajax/solariajax/testing/test_pyApi.py
[ { "content": "# Copyright (c) 2010 Eli Stevens\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\n# stdlib\nimport copy\nimport datetime\nimport doctest\nimport gc\nimport random\nimport re\nimport sys\nimport time\nimport unittest\n\n# 3rd party packages\n#import couchdb\n\n# in-house\nimport solariajax\n\n\n\n# eof\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestPyApi(unittest.TestCase):\n\n\n\n\n", "metadata": "root.TestPyApi", "header": "['module', '___EOS___']", "index": 39 }, { "content": " def setUp(self):\n pass", "metadata": "root.TestPyApi.setUp", "header": "['class', 'TestPyApi', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 41 }, { "content": " def tearDown(self):\n pass", "metadata": "root.TestPyApi.tearDown", "header": "['class', 'TestPyApi', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 44 }, { "content": " def test_docs(self):\n # doctest returns a tuple of (failed, attempted)\n self.assertEqual(doctest.testmod(solariajax.core,\n optionflags=(doctest.REPORT_CDIFF | doctest.NORMALIZE_WHITESPACE | doctest.ELLIPSIS))[0], 0)", "metadata": "root.TestPyApi.test_docs", "header": "['class', 'TestPyApi', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 47 }, { "content": " def test_simple(self):\n pass", "metadata": "root.TestPyApi.test_simple", "header": "['class', 'TestPyApi', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 53 } ]
[ { "span": "import copy", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 11 }, { "span": "import datetime", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 15 }, { "span": "import gc", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 9 }, { "span": "import random", "start_line": 26, "start_column": 0, "end_line": 26, "end_column": 13 }, { "span": "import re", "start_line": 27, "start_column": 0, "end_line": 27, "end_column": 9 }, { "span": "import sys", "start_line": 28, "start_column": 0, "end_line": 28, "end_column": 10 }, { "span": "import time", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 11 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2010", " ", "Eli", " ", "Ste", "ven", "s_", "\\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_", "#", " ", "stdlib", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "doctest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "3", "rd", " ", "part", "y", " ", "packages_", "\\u\\u\\uNL\\u\\u\\u_", "#", "import", " ", "couchdb", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", "-", "house_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "solar", "ia", "jax_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "eof_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Test", "Py", "Api_", "(_", "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\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Test", "Py", "Api_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Py", "Api_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "tear", "Down_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Py", "Api_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "docs_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "docte", "st", " ", "return", "s", " ", "a", " ", "tuple", " ", "of", " ", "(", "fail", "ed", ",", " ", "atte", "mpte", "d", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Equal_", "(_", "doctest_", "._", "testmod_", "(_", "solar", "ia", "jax_", "._", "core_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "option", "flags_", "=_", "(_", "doctest_", "._", "REPORT", "\\u", "CD", "IF", "F_", "|_", "doctest_", "._", "NORMALIZ", "E", "\\u", "WHITESPACE", "_", "|_", "doctest_", "._", "ELLIPS", "IS_", ")_", ")_", "[_", "0_", "]_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Py", "Api_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "simple_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Nested loops with same variable
spotify/python-graphwalker/graphwalker/gml.py
[ { "content": "def deserialize(d, **kw):\n commented = re.sub(\"\\n\\\\s*#[^\\n]*\", \"\\n\", d)\n tokenized = [mo[0] or mo[1] for mo in re.findall(token_pattern, commented)]\n empty, tree = parse(tokenized)\n serial = iter(xrange(0, 2 ** 62)).next\n verts, edges = [], []\n\n for key, node in tree:\n if key.lower() == 'graph':\n for key, val in node:\n if key.lower() == 'node':\n verts.append(build_vert(val))\n elif key.lower() == 'edge':\n edges.append(build_edge(val, serial()))\n\n return verts, edges\n else:\n assert False, \"Could not find graph in file.\"", "metadata": "root.deserialize", "header": "['module', '___EOS___']", "index": 87 } ]
[ { "span": "for key, val in node:", "start_line": 96, "start_column": 12, "end_line": 96, "end_column": 33 } ]
[ { "span": "for key, node in tree:", "start_line": 94, "start_column": 4, "end_line": 94, "end_column": 26 } ]
1
true
[ "[CLS]_", "Nest", "ed_", "loops_", "with_", "same_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "deserialize_", "(_", "d_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "commente", "d_", "=_", "re_", "._", "sub_", "(_", "\"\\\\", "n", "\\\\\\\\", "s", "*#", "[", "^", "\\\\", "n", "]*", "\"_", ",_", "\"\\\\", "n", "\"_", ",_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tokenized", "_", "=_", "[_", "mo_", "[_", "0_", "]_", "or_", "mo_", "[_", "1_", "]_", "for_", "mo_", "in_", "re_", "._", "findall_", "(_", "token", "\\u", "pattern_", ",_", "commente", "d_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "empty_", ",_", "tree_", "=_", "parse_", "(_", "tokenized", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "serial_", "=_", "iter_", "(_", "xrange_", "(_", "0_", ",_", "2_", "**_", "62_", ")_", ")_", "._", "next_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "verts_", ",_", "edges_", "=_", "[_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "node_", "in_", "tree_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "._", "lower_", "(_", ")_", "==_", "'", "graph", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "key_", ",_", "val_", "in_", "node_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "._", "lower_", "(_", ")_", "==_", "'", "node", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "verts_", "._", "append_", "(_", "build", "\\u", "vert_", "(_", "val_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "key_", "._", "lower_", "(_", ")_", "==_", "'", "edge", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "edges_", "._", "append_", "(_", "build", "\\u", "edge_", "(_", "val_", ",_", "serial_", "(_", ")_", ")_", ")_", "\\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_", "verts_", ",_", "edges_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "False_", ",_", "\"", "Cou", "ld", " ", "not", " ", "find", " ", "graph", " ", "in", " ", "file", ".\"_" ]
[ 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, 3, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 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 ]
Variable defined multiple times
openstack/compass-core/compass/tests/api/test_api.py
[ { "content": " def test_add_switch_machines(self):\n # batch switch machines\n url = '/switches'\n return_value = self.get(url)\n\n url = '/switches/machines'\n data = [{\n \"switch_ip\": \"0.0.0.0\",\n \"mac\": \"1a:2b:3c:4d:5e:6f\",\n \"port\": \"100\"\n }, {\n \"switch_ip\": \"0.0.0.0\",\n \"mac\": \"a1:b2:c3:d4:e5:f6\",\n \"port\": \"101\"\n }, {\n \"switch_ip\": \"0.0.0.0\",\n \"mac\": \"a1:b2:c3:d4:e5:f6\",\n \"port\": \"101\"\n }, {\n \"switch_ip\": \"0.0.0.0\",\n \"mac\": \"a1:b2:c3:d4:e5:f6\",\n \"port\": \"102\"\n }, {\n \"switch_ip\": \"10.10.10.1\",\n \"mac\": \"b1:b2:c3:d4:e5:f6\",\n \"port\": \"200\"\n }, {\n \"switch_ip\": \"127.0.0.2\",\n \"mac\": \"a1:b2:f3:d4:e5:f6\",\n \"port\": \"100\"\n }]\n return_value = self.post(url, data)\n expected = [{\n 'switch_ip': '0.0.0.0',\n 'port': '100',\n 'mac': '1a:2b:3c:4d:5e:6f'\n }, {\n 'switch_ip': '0.0.0.0',\n 'port': '101',\n 'mac': 'a1:b2:c3:d4:e5:f6'\n }, {\n 'switch_ip': '10.10.10.1',\n 'port': '200',\n 'mac': 'b1:b2:c3:d4:e5:f6'\n }]\n expect_duplicate = [{'mac': 'a1:b2:c3:d4:e5:f6', 'port': '101'}]\n expect_failed = [\n {'mac': 'a1:b2:f3:d4:e5:f6', 'port': '100'},\n {'mac': 'a1:b2:c3:d4:e5:f6', 'port': '102'}\n ]\n resp = json.loads(return_value.get_data())\n res = []\n res_du = []\n res_fail = []\n for k, v in resp.items():\n if k == 'switches_machines':\n for item in v:\n res.append(item)\n if k == 'duplicate_switches_machines':\n for item in v:\n res_du.append(item)\n if k == 'fail_switches_machines':\n for item in v:\n res_fail.append(item)\n self.assertEqual(len(res), len(expected))\n for i, v in enumerate(res):\n self.assertDictContainsSubset(\n expected[i], res[i]\n )\n self.assertEqual(len(res_fail), len(expect_failed))\n for i, v in enumerate(res_fail):\n self.assertDictContainsSubset(\n expect_failed[i], res_fail[i]\n )\n self.assertEqual(len(res_du), len(expect_duplicate))\n for i, v in enumerate(res_du):\n self.assertDictContainsSubset(\n expect_duplicate[i], res_du[i]\n )", "metadata": "root.TestSwitchMachines.test_add_switch_machines", "header": "['class', 'TestSwitchMachines', '(', 'ApiTestCase', ')', ':', '___EOS___']", "index": 1002 } ]
[ { "span": "return_value ", "start_line": 1005, "start_column": 8, "end_line": 1005, "end_column": 20 } ]
[ { "span": "return_value ", "start_line": 1033, "start_column": 8, "end_line": 1033, "end_column": 20 } ]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "class_", "Test", "Switch", "Machine", "s_", "(_", "Ap", "i", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "add", "\\u", "switch", "\\u", "machines_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "batch", " ", "switch", " ", "machines_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "url_", "=_", "'/", "switche", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "\\u", "value_", "=_", "self_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "url_", "=_", "'/", "switche", "s", "/", "machine", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "switch", "\\u", "ip", "\"_", ":_", "\"", "0.", "0.", "0.", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mac", "\"_", ":_", "\"", "1a", ":", "2b", ":", "3c", ":", "4d", ":", "5e", ":", "6f", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "port", "\"_", ":_", "\"", "100", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "switch", "\\u", "ip", "\"_", ":_", "\"", "0.", "0.", "0.", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mac", "\"_", ":_", "\"", "a1", ":", "b2", ":", "c3", ":", "d4", ":", "e5", ":", "f6", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "port", "\"_", ":_", "\"", "101", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "switch", "\\u", "ip", "\"_", ":_", "\"", "0.", "0.", "0.", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mac", "\"_", ":_", "\"", "a1", ":", "b2", ":", "c3", ":", "d4", ":", "e5", ":", "f6", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "port", "\"_", ":_", "\"", "101", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "switch", "\\u", "ip", "\"_", ":_", "\"", "0.", "0.", "0.", "0", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mac", "\"_", ":_", "\"", "a1", ":", "b2", ":", "c3", ":", "d4", ":", "e5", ":", "f6", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "port", "\"_", ":_", "\"", "102", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "switch", "\\u", "ip", "\"_", ":_", "\"", "10.1", "0.10", ".1", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mac", "\"_", ":_", "\"", "b1", ":", "b2", ":", "c3", ":", "d4", ":", "e5", ":", "f6", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "port", "\"_", ":_", "\"", "200", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "switch", "\\u", "ip", "\"_", ":_", "\"", "127", ".0", ".0", ".2", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "mac", "\"_", ":_", "\"", "a1", ":", "b2", ":", "f3", ":", "d4", ":", "e5", ":", "f6", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "port", "\"_", ":_", "\"", "100", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return", "\\u", "value_", "=_", "self_", "._", "post_", "(_", "url_", ",_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected_", "=_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "switch", "\\u", "ip", "'_", ":_", "'", "0.", "0.", "0.", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "'", "100", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mac", "'_", ":_", "'", "1a", ":", "2b", ":", "3c", ":", "4d", ":", "5e", ":", "6f", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "switch", "\\u", "ip", "'_", ":_", "'", "0.", "0.", "0.", "0", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "'", "101", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mac", "'_", ":_", "'", "a1", ":", "b2", ":", "c3", ":", "d4", ":", "e5", ":", "f6", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "switch", "\\u", "ip", "'_", ":_", "'", "10.1", "0.10", ".1", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "port", "'_", ":_", "'", "200", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mac", "'_", ":_", "'", "b1", ":", "b2", ":", "c3", ":", "d4", ":", "e5", ":", "f6", "'_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect", "\\u", "duplicate_", "=_", "[_", "{_", "'", "mac", "'_", ":_", "'", "a1", ":", "b2", ":", "c3", ":", "d4", ":", "e5", ":", "f6", "'_", ",_", "'", "port", "'_", ":_", "'", "101", "'_", "}_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expect", "\\u", "failed_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "mac", "'_", ":_", "'", "a1", ":", "b2", ":", "f3", ":", "d4", ":", "e5", ":", "f6", "'_", ",_", "'", "port", "'_", ":_", "'", "100", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "mac", "'_", ":_", "'", "a1", ":", "b2", ":", "c3", ":", "d4", ":", "e5", ":", "f6", "'_", ",_", "'", "port", "'_", ":_", "'", "102", "'_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resp_", "=_", "json_", "._", "loads_", "(_", "return", "\\u", "value_", "._", "get", "\\u", "data_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "du_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res", "\\u", "fail_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", ",_", "v_", "in_", "resp_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "k_", "==_", "'", "switche", "s", "\\u", "machine", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "item_", "in_", "v_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "res_", "._", "append_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "k_", "==_", "'", "duplicat", "e\\u", "switche", "s", "\\u", "machine", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "item_", "in_", "v_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "res", "\\u", "du_", "._", "append_", "(_", "item_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "k_", "==_", "'", "fail", "\\u", "switche", "s", "\\u", "machine", "s", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "item_", "in_", "v_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "res", "\\u", "fail_", "._", "append_", "(_", "item_", ")_", "\\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_", "._", "assert", "Equal_", "(_", "len_", "(_", "res_", ")_", ",_", "len_", "(_", "expected_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "v_", "in_", "enumerate_", "(_", "res_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Dict", "Contain", "s", "Subset", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "expected_", "[_", "i_", "]_", ",_", "res_", "[_", "i_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res", "\\u", "fail_", ")_", ",_", "len_", "(_", "expect", "\\u", "failed_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "v_", "in_", "enumerate_", "(_", "res", "\\u", "fail_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Dict", "Contain", "s", "Subset", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "expect", "\\u", "failed_", "[_", "i_", "]_", ",_", "res", "\\u", "fail_", "[_", "i_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "len_", "(_", "res", "\\u", "du_", ")_", ",_", "len_", "(_", "expect", "\\u", "duplicate_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "v_", "in_", "enumerate_", "(_", "res", "\\u", "du_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "assert", "Dict", "Contain", "s", "Subset", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "expect", "\\u", "duplicate_", "[_", "i_", "]_", ",_", "res", "\\u", "du_", "[_", "i_", "]_", "\\u\\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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
tanghaibao/jcvi/graphics/grabseeds.py
[ { "content": "def seeds(args):\n \"\"\"\n %prog seeds [pngfile|jpgfile]\n\n Extract seed metrics from [pngfile|jpgfile]. Use --rows and --cols to crop image.\n \"\"\"\n p = OptionParser(seeds.__doc__)\n p.set_outfile()\n opts, args, iopts = add_seeds_options(p, args)\n\n if len(args) != 1:\n sys.exit(not p.print_help())\n\n pngfile, = args\n pf = opts.prefix or op.basename(pngfile).rsplit(\".\", 1)[0]\n sigma, kernel = opts.sigma, opts.kernel\n rows, cols = opts.rows, opts.cols\n labelrows, labelcols = opts.labelrows, opts.labelcols\n ff = opts.filter\n calib = opts.calibrate\n outdir = opts.outdir\n if outdir != '.':\n mkdir(outdir)\n if calib:\n calib = json.load(must_open(calib))\n pixel_cm_ratio, tr = calib[\"PixelCMratio\"], calib[\"RGBtransform\"]\n tr = np.array(tr)\n\n resizefile, mainfile, labelfile, exif = \\\n convert_image(pngfile, pf, outdir=outdir,\n rotate=opts.rotate,\n rows=rows, cols=cols,\n labelrows=labelrows, labelcols=labelcols)\n\n oimg = load_image(resizefile)\n img = load_image(mainfile)\n\n fig, (ax1, ax2, ax3, ax4) = plt.subplots(ncols=4, nrows=1,\n figsize=(iopts.w, iopts.h))\n\n # Edge detection\n img_gray = rgb2gray(img)\n logging.debug(\"Running {0} edge detection ...\".format(ff))\n if ff == \"canny\":\n edges = canny(img_gray, sigma=opts.sigma)\n elif ff == \"roberts\":\n edges = roberts(img_gray)\n elif ff == \"sobel\":\n edges = sobel(img_gray)\n edges = clear_border(edges, buffer_size=opts.border)\n selem = disk(kernel)\n closed = closing(edges, selem) if kernel else edges\n filled = binary_fill_holes(closed)\n\n # Watershed algorithm\n if opts.watershed:\n distance = distance_transform_edt(filled)\n local_maxi = peak_local_max(distance, threshold_rel=.05, indices=False)\n coordinates = peak_local_max(distance, threshold_rel=.05)\n markers, nmarkers = label(local_maxi, return_num=True)\n logging.debug(\"Identified {0} watershed markers\".format(nmarkers))\n labels = watershed(closed, markers, mask=filled)\n else:\n labels = label(filled)\n\n # Object size filtering\n w, h = img_gray.shape\n canvas_size = w * h\n min_size = int(round(canvas_size * opts.minsize / 100))\n max_size = int(round(canvas_size * opts.maxsize / 100))\n logging.debug(\"Find objects with pixels between {0} ({1}%) and {2} ({3}%)\"\\\n .format(min_size, opts.minsize, max_size, opts.maxsize))\n\n # Plotting\n ax1.set_title('Original picture')\n ax1.imshow(oimg)\n\n params = \"{0}, $\\sigma$={1}, $k$={2}\".format(ff, sigma, kernel)\n if opts.watershed:\n params += \", watershed\"\n ax2.set_title('Edge detection\\n({0})'.format(params))\n closed = gray2rgb(closed)\n ax2_img = labels\n if opts.edges:\n ax2_img = closed\n elif opts.watershed:\n ax2.plot(coordinates[:, 1], coordinates[:, 0], 'g.')\n ax2.imshow(ax2_img, cmap=iopts.cmap)\n\n ax3.set_title('Object detection')\n ax3.imshow(img)\n\n filename = op.basename(pngfile)\n if labelfile:\n accession = extract_label(labelfile)\n else:\n accession = pf\n\n # Calculate region properties\n rp = regionprops(labels)\n rp = [x for x in rp if min_size <= x.area <= max_size]\n nb_labels = len(rp)\n logging.debug(\"A total of {0} objects identified.\".format(nb_labels))\n objects = []\n for i, props in enumerate(rp):\n i += 1\n if i > opts.count:\n break\n\n y0, x0 = props.centroid\n orientation = props.orientation\n major, minor = props.major_axis_length, props.minor_axis_length\n major_dx = cos(orientation) * major / 2\n major_dy = sin(orientation) * major / 2\n minor_dx = sin(orientation) * minor / 2\n minor_dy = cos(orientation) * minor / 2\n ax2.plot((x0 - major_dx, x0 + major_dx),\n (y0 + major_dy, y0 - major_dy), 'r-')\n ax2.plot((x0 - minor_dx, x0 + minor_dx),\n (y0 - minor_dy, y0 + minor_dy), 'r-')\n\n npixels = int(props.area)\n # Sample the center of the blob for color\n d = min(int(round(minor / 2 * .35)) + 1, 50)\n square = img[(y0 - d):(y0 + d), (x0 - d):(x0 + d)]\n pixels = []\n for row in square:\n pixels.extend(row)\n logging.debug(\"Seed #{0}: {1} pixels ({2} sampled) - {3:.2f}%\".\\\n format(i, npixels, len(pixels), 100. * npixels / canvas_size))\n\n rgb = pixel_stats(pixels)\n objects.append(Seed(filename, accession, i, rgb, props, exif))\n minr, minc, maxr, maxc = props.bbox\n rect = Rectangle((minc, minr), maxc - minc, maxr - minr,\n fill=False, ec='w', lw=1)\n ax3.add_patch(rect)\n mc, mr = (minc + maxc) / 2, (minr + maxr) / 2\n ax3.text(mc, mr, \"{0}\".format(i), color='w',\n ha=\"center\", va=\"center\", size=6)\n\n for ax in (ax2, ax3):\n ax.set_xlim(0, h)\n ax.set_ylim(w, 0)\n\n # Output identified seed stats\n ax4.text(.1, .92, \"File: {0}\".format(latex(filename)), color='g')\n ax4.text(.1, .86, \"Label: {0}\".format(latex(accession)), color='m')\n yy = .8\n fw = must_open(opts.outfile, \"w\")\n if not opts.noheader:\n print >> fw, Seed.header(calibrate=calib)\n for o in objects:\n if calib:\n o.calibrate(pixel_cm_ratio, tr)\n print >> fw, o\n i = o.seedno\n if i > 7:\n continue\n ax4.text(.01, yy, str(i), va=\"center\", bbox=dict(fc='none', ec='k'))\n ax4.text(.1, yy, o.pixeltag, va=\"center\")\n yy -= .04\n ax4.add_patch(Rectangle((.1, yy - .025), .12, .05, lw=0,\n fc=rgb_to_hex(o.rgb)))\n ax4.text(.27, yy, o.hashtag, va=\"center\")\n yy -= .06\n ax4.text(.1 , yy, \"(A total of {0} objects displayed)\".format(nb_labels),\n color=\"darkslategrey\")\n normalize_axes(ax4)\n\n for ax in (ax1, ax2, ax3):\n xticklabels = [int(x) for x in ax.get_xticks()]\n yticklabels = [int(x) for x in ax.get_yticks()]\n ax.set_xticklabels(xticklabels, family='Helvetica', size=8)\n ax.set_yticklabels(yticklabels, family='Helvetica', size=8)\n\n image_name = op.join(outdir, pf + \".\" + iopts.format)\n savefig(image_name, dpi=iopts.dpi, iopts=iopts)\n return objects", "metadata": "root.seeds", "header": "['module', '___EOS___']", "index": 403 } ]
[ { "span": "fig,", "start_line": 440, "start_column": 4, "end_line": 440, "end_column": 7 } ]
[]
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_", "seeds_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "%", "prog", " ", "seeds", " ", "[", "png", "file", "|", "jp", "gf", "ile", "]", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Extract", " ", "seed", " ", "metric", "s", " ", "from", " ", "[", "png", "file", "|", "jp", "gf", "ile", "].", " ", "Us", "e", " ", "--", "rows", " ", "and", " ", "--", "cols", " ", "to", " ", "crop", " ", "image", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "Optio", "n", "Parser_", "(_", "seeds_", "._", "\\u\\u", "doc\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "set\\u", "outfile_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "opts_", ",_", "args_", ",_", "iop", "ts_", "=_", "add", "\\u", "seeds", "\\u", "options_", "(_", "p_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "not_", "p_", "._", "print", "\\u", "help_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "png", "file_", ",_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pf_", "=_", "opts_", "._", "prefix_", "or_", "op_", "._", "basename_", "(_", "png", "file_", ")_", "._", "rsplit_", "(_", "\".\"_", ",_", "1_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sigma_", ",_", "kernel_", "=_", "opts_", "._", "sigma_", ",_", "opts_", "._", "kernel_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rows_", ",_", "cols_", "=_", "opts_", "._", "rows_", ",_", "opts_", "._", "cols_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "label", "rows_", ",_", "label", "cols_", "=_", "opts_", "._", "label", "rows_", ",_", "opts_", "._", "label", "cols_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ff_", "=_", "opts_", "._", "filter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "calib", "_", "=_", "opts_", "._", "calibrate", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "outdir_", "=_", "opts_", "._", "outdir_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "outdir_", "!=_", "'.'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mkdir_", "(_", "outdir_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "calib", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "calib", "_", "=_", "json_", "._", "load_", "(_", "must", "\\u", "open_", "(_", "calib", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pixel", "\\u", "cm", "\\u", "ratio_", ",_", "tr_", "=_", "calib", "_", "[_", "\"", "Pix", "el", "CM", "ratio", "\"_", "]_", ",_", "calib", "_", "[_", "\"", "RGB", "transform", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tr_", "=_", "np_", "._", "array_", "(_", "tr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "resiz", "efi", "le_", ",_", "main", "file_", ",_", "label", "file_", ",_", "exif", "_", "=_", "convert", "\\u", "image_", "(_", "png", "file_", ",_", "pf_", ",_", "outdir_", "=_", "outdir_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rotate_", "=_", "opts_", "._", "rotate_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rows_", "=_", "rows_", ",_", "cols_", "=_", "cols_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label", "rows_", "=_", "label", "rows_", ",_", "label", "cols_", "=_", "label", "cols_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "oi", "mg_", "=_", "load", "\\u", "image_", "(_", "resiz", "efi", "le_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "img_", "=_", "load", "\\u", "image_", "(_", "main", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fig_", ",_", "(_", "ax1_", ",_", "ax2_", ",_", "ax3_", ",_", "ax4", "_", ")_", "=_", "plt_", "._", "subplots_", "(_", "ncols_", "=_", "4_", ",_", "nrows_", "=_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "figsize_", "=_", "(_", "iop", "ts_", "._", "w_", ",_", "iop", "ts_", "._", "h_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ed", "ge", " ", "detection_", "\\u\\u\\uNL\\u\\u\\u_", "img", "\\u", "gray_", "=_", "rgb", "2g", "ray_", "(_", "img_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "debug_", "(_", "\"", "Run", "ning", " ", "{", "0", "}", " ", "edge", " ", "detect", "ion", " ", "...\"_", "._", "format_", "(_", "ff_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ff_", "==_", "\"", "cann", "y", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edges_", "=_", "cann", "y_", "(_", "img", "\\u", "gray_", ",_", "sigma_", "=_", "opts_", "._", "sigma_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ff_", "==_", "\"", "robe", "rts", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edges_", "=_", "robe", "rts_", "(_", "img", "\\u", "gray_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ff_", "==_", "\"", "sob", "el", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "edges_", "=_", "sob", "el_", "(_", "img", "\\u", "gray_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "edges_", "=_", "clear", "\\u", "border_", "(_", "edges_", ",_", "buffer", "\\u", "size_", "=_", "opts_", "._", "border_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sele", "m_", "=_", "disk_", "(_", "kernel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "closed_", "=_", "closing_", "(_", "edges_", ",_", "sele", "m_", ")_", "if_", "kernel_", "else_", "edges_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filled_", "=_", "binar", "y", "\\u", "fill", "\\u", "holes_", "(_", "closed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Water", "shed", " ", "algorithm_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "opts_", "._", "waters", "hed", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "distance_", "=_", "distance", "\\u", "transform", "\\u", "edt", "_", "(_", "filled_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "local", "\\u", "maxi", "_", "=_", "peak", "\\u", "local", "\\u", "max_", "(_", "distance_", ",_", "threshol", "d\\u", "rel_", "=_", ".05_", ",_", "indices_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "coordinates_", "=_", "peak", "\\u", "local", "\\u", "max_", "(_", "distance_", ",_", "threshol", "d\\u", "rel_", "=_", ".05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "markers_", ",_", "nma", "rke", "rs_", "=_", "label_", "(_", "local", "\\u", "maxi", "_", ",_", "return", "\\u", "num_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "debug_", "(_", "\"", "Identifie", "d", " ", "{", "0", "}", " ", "waters", "hed", " ", "marker", "s", "\"_", "._", "format_", "(_", "nma", "rke", "rs_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "labels_", "=_", "waters", "hed", "_", "(_", "closed_", ",_", "markers_", ",_", "mask_", "=_", "filled_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "labels_", "=_", "label_", "(_", "filled_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Object", " ", "size", " ", "filtering", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "w_", ",_", "h_", "=_", "img", "\\u", "gray_", "._", "shape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "canv", "as", "\\u", "size_", "=_", "w_", "*_", "h_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "size_", "=_", "int_", "(_", "round_", "(_", "canv", "as", "\\u", "size_", "*_", "opts_", "._", "minsize", "_", "/_", "100_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "size_", "=_", "int_", "(_", "round_", "(_", "canv", "as", "\\u", "size_", "*_", "opts_", "._", "maxsize_", "/_", "100_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "debug_", "(_", "\"", "Fin", "d", " ", "object", "s", " ", "with", " ", "pixel", "s", " ", "bet", "ween", " ", "{", "0", "}", " ", "({", "1", "}%", ")", " ", "and", " ", "{", "2", "}", " ", "({", "3", "}%", ")\"_", "._", "format_", "(_", "min", "\\u", "size_", ",_", "opts_", "._", "minsize", "_", ",_", "max", "\\u", "size_", ",_", "opts_", "._", "maxsize_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Plott", "ing_", "\\u\\u\\uNL\\u\\u\\u_", "ax1_", "._", "set\\u", "title_", "(_", "'", "Origina", "l", " ", "pic", "ture", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax1_", "._", "imshow_", "(_", "oi", "mg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "params_", "=_", "\"{", "0", "},", " ", "$", "\\\\", "sigma", "$", "={", "1", "},", " ", "$", "k", "$", "={", "2", "}\"_", "._", "format_", "(_", "ff_", ",_", "sigma_", ",_", "kernel_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "opts_", "._", "waters", "hed", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "params_", "+=_", "\",", " ", "waters", "hed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ax2_", "._", "set\\u", "title_", "(_", "'", "Ed", "ge", " ", "detect", "ion", "\\\\", "n", "({", "0", "})'_", "._", "format_", "(_", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "closed_", "=_", "gray", "2r", "gb_", "(_", "closed_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax", "2", "\\u", "img_", "=_", "labels_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "opts_", "._", "edges_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ax", "2", "\\u", "img_", "=_", "closed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "opts_", "._", "waters", "hed", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ax2_", "._", "plot_", "(_", "coordinates_", "[_", ":_", ",_", "1_", "]_", ",_", "coordinates_", "[_", ":_", ",_", "0_", "]_", ",_", "'", "g", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ax2_", "._", "imshow_", "(_", "ax", "2", "\\u", "img_", ",_", "cmap_", "=_", "iop", "ts_", "._", "cmap_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ax3_", "._", "set\\u", "title_", "(_", "'", "Object", " ", "detect", "ion", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax3_", "._", "imshow_", "(_", "img_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "op_", "._", "basename_", "(_", "png", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "label", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "accession_", "=_", "extract", "\\u", "label_", "(_", "label", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "accession_", "=_", "pf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Calculat", "e", " ", "region", " ", "properties_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rp_", "=_", "region", "props_", "(_", "labels_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rp_", "=_", "[_", "x_", "for_", "x_", "in_", "rp_", "if_", "min", "\\u", "size_", "<=_", "x_", "._", "area_", "<=_", "max", "\\u", "size_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nb", "\\u", "labels_", "=_", "len_", "(_", "rp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "debug_", "(_", "\"", "A", " ", "total", " ", "of", " ", "{", "0", "}", " ", "object", "s", " ", "identifi", "ed", ".\"_", "._", "format_", "(_", "nb", "\\u", "labels_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objects_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", ",_", "props_", "in_", "enumerate_", "(_", "rp_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", ">_", "opts_", "._", "count_", ":_", "\\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_", "y0_", ",_", "x0_", "=_", "props_", "._", "centroid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "orientation_", "=_", "props_", "._", "orientation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "major_", ",_", "minor_", "=_", "props_", "._", "major", "\\u", "axis", "\\u", "length_", ",_", "props_", "._", "mino", "r", "\\u", "axis", "\\u", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "major", "\\u", "dx_", "=_", "cos_", "(_", "orientation_", ")_", "*_", "major_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "major", "\\u", "dy_", "=_", "sin_", "(_", "orientation_", ")_", "*_", "major_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mino", "r", "\\u", "dx_", "=_", "sin_", "(_", "orientation_", ")_", "*_", "minor_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mino", "r", "\\u", "dy_", "=_", "cos_", "(_", "orientation_", ")_", "*_", "minor_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax2_", "._", "plot_", "(_", "(_", "x0_", "-_", "major", "\\u", "dx_", ",_", "x0_", "+_", "major", "\\u", "dx_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "y0_", "+_", "major", "\\u", "dy_", ",_", "y0_", "-_", "major", "\\u", "dy_", ")_", ",_", "'", "r", "-'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax2_", "._", "plot_", "(_", "(_", "x0_", "-_", "mino", "r", "\\u", "dx_", ",_", "x0_", "+_", "mino", "r", "\\u", "dx_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "y0_", "-_", "mino", "r", "\\u", "dy_", ",_", "y0_", "+_", "mino", "r", "\\u", "dy_", ")_", ",_", "'", "r", "-'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "npix", "els_", "=_", "int_", "(_", "props_", "._", "area_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Sampl", "e", " ", "the", " ", "center", " ", "of", " ", "the", " ", "blob", " ", "for", " ", "color_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "min_", "(_", "int_", "(_", "round_", "(_", "minor_", "/_", "2_", "*_", ".3", "5_", ")_", ")_", "+_", "1_", ",_", "50_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "square_", "=_", "img_", "[_", "(_", "y0_", "-_", "d_", ")_", ":_", "(_", "y0_", "+_", "d_", ")_", ",_", "(_", "x0_", "-_", "d_", ")_", ":_", "(_", "x0_", "+_", "d_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pixels_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "row_", "in_", "square_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pixels_", "._", "extend_", "(_", "row_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "debug_", "(_", "\"", "See", "d", " ", "#{", "0", "}:", " ", "{", "1", "}", " ", "pixel", "s", " ", "({", "2", "}", " ", "sample", "d", ")", " ", "-", " ", "{", "3", ":.", "2f", "}%", "\"_", "._", "format_", "(_", "i_", ",_", "npix", "els_", ",_", "len_", "(_", "pixels_", ")_", ",_", "100._", "*_", "npix", "els_", "/_", "canv", "as", "\\u", "size_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "rgb_", "=_", "pixel", "\\u", "stats_", "(_", "pixels_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "objects_", "._", "append_", "(_", "Seed_", "(_", "filename_", ",_", "accession_", ",_", "i_", ",_", "rgb_", ",_", "props_", ",_", "exif", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "r_", ",_", "min", "c_", ",_", "maxr", "_", ",_", "maxc", "_", "=_", "props_", "._", "bbox_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rect_", "=_", "Rectangle_", "(_", "(_", "min", "c_", ",_", "min", "r_", ")_", ",_", "maxc", "_", "-_", "min", "c_", ",_", "maxr", "_", "-_", "min", "r_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fill_", "=_", "False_", ",_", "ec_", "=_", "'", "w", "'_", ",_", "lw_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax3_", "._", "add", "\\u", "patch_", "(_", "rect_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mc_", ",_", "mr_", "=_", "(_", "min", "c_", "+_", "maxc", "_", ")_", "/_", "2_", ",_", "(_", "min", "r_", "+_", "maxr", "_", ")_", "/_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax3_", "._", "text_", "(_", "mc_", ",_", "mr_", ",_", "\"{", "0", "}\"_", "._", "format_", "(_", "i_", ")_", ",_", "color_", "=_", "'", "w", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "ha_", "=_", "\"", "center", "\"_", ",_", "va_", "=_", "\"", "center", "\"_", ",_", "size_", "=_", "6_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "ax_", "in_", "(_", "ax2_", ",_", "ax3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ax_", "._", "set\\u", "xlim_", "(_", "0_", ",_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "ylim_", "(_", "w_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Output", " ", "identifi", "ed", " ", "seed", " ", "stats_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ax4", "_", "._", "text_", "(_", ".1_", ",_", ".92", "_", ",_", "\"", "File", ":", " ", "{", "0", "}\"_", "._", "format_", "(_", "latex_", "(_", "filename_", ")_", ")_", ",_", "color_", "=_", "'", "g", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax4", "_", "._", "text_", "(_", ".1_", ",_", ".8", "6_", ",_", "\"", "Label", ":", " ", "{", "0", "}\"_", "._", "format_", "(_", "latex_", "(_", "accession_", ")_", ")_", ",_", "color_", "=_", "'", "m", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yy_", "=_", ".8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fw_", "=_", "must", "\\u", "open_", "(_", "opts_", "._", "outfile_", ",_", "\"", "w", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "opts_", "._", "noh", "eader", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", ">>_", "fw_", ",_", "Seed_", "._", "header_", "(_", "calibrate", "_", "=_", "calib", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "o_", "in_", "objects_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "calib", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "o_", "._", "calibrate", "_", "(_", "pixel", "\\u", "cm", "\\u", "ratio_", ",_", "tr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", ">>_", "fw_", ",_", "o_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i_", "=_", "o_", "._", "seed", "no_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", ">_", "7_", ":_", "\\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_", "ax4", "_", "._", "text_", "(_", ".01_", ",_", "yy_", ",_", "str_", "(_", "i_", ")_", ",_", "va_", "=_", "\"", "center", "\"_", ",_", "bbox_", "=_", "dict_", "(_", "fc_", "=_", "'", "none", "'_", ",_", "ec_", "=_", "'", "k", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax4", "_", "._", "text_", "(_", ".1_", ",_", "yy_", ",_", "o_", "._", "pixel", "tag_", ",_", "va_", "=_", "\"", "center", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yy_", "-=_", ".04", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax4", "_", "._", "add", "\\u", "patch_", "(_", "Rectangle_", "(_", "(_", ".1_", ",_", "yy_", "-_", ".02", "5_", ")_", ",_", ".12", "_", ",_", ".05_", ",_", "lw_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fc_", "=_", "rgb", "\\u", "to", "\\u", "hex_", "(_", "o_", "._", "rgb_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax4", "_", "._", "text_", "(_", ".2", "7_", ",_", "yy_", ",_", "o_", "._", "hashtag", "_", ",_", "va_", "=_", "\"", "center", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yy_", "-=_", ".0", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "ax4", "_", "._", "text_", "(_", ".1_", ",_", "yy_", ",_", "\"(", "A", " ", "total", " ", "of", " ", "{", "0", "}", " ", "object", "s", " ", "displaye", "d", ")\"_", "._", "format_", "(_", "nb", "\\u", "labels_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "color_", "=_", "\"", "dark", "slate", "grey", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "normali", "ze", "\\u", "axes_", "(_", "ax4", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ax_", "in_", "(_", "ax1_", ",_", "ax2_", ",_", "ax3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "xticklabels_", "=_", "[_", "int_", "(_", "x_", ")_", "for_", "x_", "in_", "ax_", "._", "get", "\\u", "xticks_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "yticklabels_", "=_", "[_", "int_", "(_", "x_", ")_", "for_", "x_", "in_", "ax_", "._", "get", "\\u", "yticks_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "xticklabels_", "(_", "xticklabels_", ",_", "family_", "=_", "'", "Hel", "vet", "ica", "'_", ",_", "size_", "=_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ax_", "._", "set\\u", "yticklabels_", "(_", "yticklabels_", ",_", "family_", "=_", "'", "Hel", "vet", "ica", "'_", ",_", "size_", "=_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "image", "\\u", "name_", "=_", "op_", "._", "join_", "(_", "outdir_", ",_", "pf_", "+_", "\".\"_", "+_", "iop", "ts_", "._", "format_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "savefig_", "(_", "image", "\\u", "name_", ",_", "dpi_", "=_", "iop", "ts_", "._", "dpi_", ",_", "iop", "ts_", "=_", "iop", "ts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "objects_", "\\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,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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 ]
Unused import
nii-cloud/dodai-compute/nova/compute/manager.py
[ { "content": "# vim: tabstop=4 shiftwidth=4 softtabstop=4\n\n# Copyright 2010 United States Government as represented by the\n# Administrator of the National Aeronautics and Space Administration.\n# Copyright 2011 Justin Santa Barbara\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\n\"\"\"Handles all processes relating to instances (guest vms).\n\nThe :py:class:`ComputeManager` class is a :py:class:`nova.manager.Manager` that\nhandles RPC calls relating to creating instances. It is responsible for\nbuilding a disk image, launching it via the underlying virtualization driver,\nresponding to calls to check its state, attaching persistent storage, and\nterminating it.\n\n**Related Flags**\n\n:instances_path: Where instances are kept on disk\n:compute_driver: Name of class that is used to handle virtualization, loaded\n by :func:`nova.utils.import_object`\n:volume_manager: Name of class that handles persistent storage, loaded by\n :func:`nova.utils.import_object`\n\n\"\"\"\n\nimport os\nimport socket\nimport sys\nimport tempfile\nimport time\nimport functools\n\nfrom eventlet import greenthread\n\nimport nova.context\nfrom nova import block_device\nfrom nova import exception\nfrom nova import flags\nimport nova.image\nfrom nova import log as logging\nfrom nova import manager\nfrom nova import network\nfrom nova import rpc\nfrom nova import utils\nfrom nova import volume\nfrom nova import db\nfrom nova.compute import power_state\nfrom nova.compute import task_states\nfrom nova.compute import vm_states\nfrom nova.notifier import api as notifier\nfrom nova.compute.utils import terminate_volumes\nfrom nova.virt import driver\n\nFLAGS = flags.FLAGS\nflags.DEFINE_string('instances_path', '$state_path/instances',\n 'where instances are stored on disk')\nflags.DEFINE_string('compute_driver', 'nova.virt.connection.get_connection',\n 'Driver to use for controlling virtualization')\nflags.DEFINE_string('stub_network', False,\n 'Stub network related code')\nflags.DEFINE_integer('password_length', 12,\n 'Length of generated admin passwords')\nflags.DEFINE_string('console_host', socket.gethostname(),\n 'Console proxy host to use to connect to instances on'\n 'this host.')\nflags.DEFINE_integer('live_migration_retry_count', 30,\n \"Retry count needed in live_migration.\"\n \" sleep 1 sec for each count\")\nflags.DEFINE_integer(\"rescue_timeout\", 0,\n \"Automatically unrescue an instance after N seconds.\"\n \" Set to 0 to disable.\")\nflags.DEFINE_integer('host_state_interval', 120,\n 'Interval in seconds for querying the host status')\n\nLOG = logging.getLogger('nova.compute.manager')\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def publisher_id(host=None):\n return notifier.publisher_id(\"compute\", host)", "metadata": "root.publisher_id", "header": "['module', '___EOS___']", "index": 89 }, { "content": "def checks_instance_lock(function):\n \"\"\"Decorator to prevent action against locked instances for non-admins.\"\"\"\n @functools.wraps(function)\n def decorated_function(self, context, instance_id, *args, **kwargs):\n #TODO(anyone): this being called instance_id is forcing a slightly\n # confusing convention of pushing instance_uuids\n # through an \"instance_id\" key in the queue args dict when\n # casting through the compute API\n LOG.info(_(\"check_instance_lock: decorating: |%s|\"), function,\n context=context)\n LOG.info(_(\"check_instance_lock: arguments: |%(self)s| |%(context)s|\"\n \" |%(instance_id)s|\") % locals(), context=context)\n locked = self.get_lock(context, instance_id)\n admin = context.is_admin\n LOG.info(_(\"check_instance_lock: locked: |%s|\"), locked,\n context=context)\n LOG.info(_(\"check_instance_lock: admin: |%s|\"), admin,\n context=context)\n\n # if admin or unlocked call function otherwise log error\n if admin or not locked:\n LOG.info(_(\"check_instance_lock: executing: |%s|\"), function,\n context=context)\n function(self, context, instance_id, *args, **kwargs)\n else:\n LOG.error(_(\"check_instance_lock: not executing |%s|\"),\n function, context=context)\n return False\n\n return decorated_function", "metadata": "root.checks_instance_lock", "header": "['module', '___EOS___']", "index": 93 }, { "content": "class ComputeManager(manager.SchedulerDependentManager):\n \"\"\"Manages the running instances from creation to destruction.\"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\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.ComputeManager", "header": "['module', '___EOS___']", "index": 125 }, { "content": " def __init__(self, compute_driver=None, *args, **kwargs):\n \"\"\"Load configuration options and connect to the hypervisor.\"\"\"\n # TODO(vish): sync driver creation logic with the rest of the system\n # and redocument the module docstring\n if not compute_driver:\n compute_driver = FLAGS.compute_driver\n\n try:\n self.driver = utils.check_isinstance(\n utils.import_object(compute_driver),\n driver.ComputeDriver)\n except ImportError as e:\n LOG.error(_(\"Unable to load the virtualization driver: %s\") % (e))\n sys.exit(1)\n\n self.network_api = network.API()\n self.network_manager = utils.import_object(FLAGS.network_manager)\n self.volume_manager = utils.import_object(FLAGS.volume_manager)\n self._last_host_check = 0\n super(ComputeManager, self).__init__(service_name=\"compute\",\n *args, **kwargs)", "metadata": "root.ComputeManager.__init__", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 128 }, { "content": " def _instance_update(self, context, instance_id, **kwargs):\n \"\"\"Update an instance in the database using kwargs as value.\"\"\"\n return self.db.instance_update(context, instance_id, kwargs)", "metadata": "root.ComputeManager._instance_update", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 150 }, { "content": " def init_host(self):\n \"\"\"Initialization for a standalone compute service.\"\"\"\n self.driver.init_host(host=self.host)\n context = nova.context.get_admin_context()\n instances = self.db.instance_get_all_by_host(context, self.host)\n for instance in instances:\n inst_name = instance['name']\n db_state = instance['power_state']\n drv_state = self._get_power_state(context, instance)\n\n expect_running = db_state == power_state.RUNNING \\\n and drv_state != db_state\n\n LOG.debug(_('Current state of %(inst_name)s is %(drv_state)s, '\n 'state in DB is %(db_state)s.'), locals())\n\n if (expect_running and FLAGS.resume_guests_state_on_host_boot)\\\n or FLAGS.start_guests_on_host_boot:\n LOG.info(_('Rebooting instance %(inst_name)s after '\n 'nova-compute restart.'), locals())\n self.reboot_instance(context, instance['id'])\n elif drv_state == power_state.RUNNING:\n # Hyper-V and VMWareAPI drivers will raise and exception\n try:\n net_info = self._get_instance_nw_info(context, instance)\n self.driver.ensure_filtering_rules_for_instance(instance,\n net_info)\n except NotImplementedError:\n LOG.warning(_('Hypervisor driver does not '\n 'support firewall rules'))", "metadata": "root.ComputeManager.init_host", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 154 }, { "content": " def _get_power_state(self, context, instance):\n \"\"\"Retrieve the power state for the given instance.\"\"\"\n LOG.debug(_('Checking state of %s'), instance['name'])\n try:\n return self.driver.get_info(instance['name'])[\"state\"]\n except exception.NotFound:\n return power_state.FAILED", "metadata": "root.ComputeManager._get_power_state", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 185 }, { "content": " def get_console_topic(self, context, **kwargs):\n \"\"\"Retrieves the console host for a project on this host.\n\n Currently this is just set in the flags for each compute host.\n\n \"\"\"\n #TODO(mdragon): perhaps make this variable by console_type?\n return self.db.queue_get_for(context,\n FLAGS.console_topic,\n FLAGS.console_host)", "metadata": "root.ComputeManager.get_console_topic", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 193 }, { "content": " def get_console_pool_info(self, context, console_type):\n return self.driver.get_console_pool_info(console_type)", "metadata": "root.ComputeManager.get_console_pool_info", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 204 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n def refresh_security_group_rules(self, context, security_group_id,\n **kwargs):\n \"\"\"Tell the virtualization driver to refresh security group rules.\n\n Passes straight through to the virtualization driver.\n\n \"\"\"\n return self.driver.refresh_security_group_rules(security_group_id)", "metadata": "root.ComputeManager.refresh_security_group_rules", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 207 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n def refresh_security_group_members(self, context,\n security_group_id, **kwargs):\n \"\"\"Tell the virtualization driver to refresh security group members.\n\n Passes straight through to the virtualization driver.\n\n \"\"\"\n return self.driver.refresh_security_group_members(security_group_id)", "metadata": "root.ComputeManager.refresh_security_group_members", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 217 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n def refresh_provider_fw_rules(self, context, **_kwargs):\n \"\"\"This call passes straight through to the virtualization driver.\"\"\"\n return self.driver.refresh_provider_fw_rules()", "metadata": "root.ComputeManager.refresh_provider_fw_rules", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 227 }, { "content": " def _get_instance_nw_info(self, context, instance):\n \"\"\"Get a list of dictionaries of network data of an instance.\n Returns an empty list if stub_network flag is set.\"\"\"\n network_info = []\n if not FLAGS.stub_network:\n network_info = self.network_api.get_instance_nw_info(context,\n instance)\n return network_info", "metadata": "root.ComputeManager._get_instance_nw_info", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 232 }, { "content": " def _setup_block_device_mapping(self, context, instance_id):\n \"\"\"setup volumes for block device mapping\"\"\"\n volume_api = volume.API()\n block_device_mapping = []\n swap = None\n ephemerals = []\n for bdm in self.db.block_device_mapping_get_all_by_instance(\n context, instance_id):\n LOG.debug(_(\"setting up bdm %s\"), bdm)\n\n if bdm['no_device']:\n continue\n if bdm['virtual_name']:\n virtual_name = bdm['virtual_name']\n device_name = bdm['device_name']\n assert block_device.is_swap_or_ephemeral(virtual_name)\n if virtual_name == 'swap':\n swap = {'device_name': device_name,\n 'swap_size': bdm['volume_size']}\n elif block_device.is_ephemeral(virtual_name):\n eph = {'num': block_device.ephemeral_num(virtual_name),\n 'virtual_name': virtual_name,\n 'device_name': device_name,\n 'size': bdm['volume_size']}\n ephemerals.append(eph)\n continue\n\n if ((bdm['snapshot_id'] is not None) and\n (bdm['volume_id'] is None)):\n # TODO(yamahata): default name and description\n vol = volume_api.create(context, bdm['volume_size'],\n bdm['snapshot_id'], '', '')\n # TODO(yamahata): creating volume simultaneously\n # reduces creation time?\n volume_api.wait_creation(context, vol['id'])\n self.db.block_device_mapping_update(\n context, bdm['id'], {'volume_id': vol['id']})\n bdm['volume_id'] = vol['id']\n\n if not ((bdm['snapshot_id'] is None) or\n (bdm['volume_id'] is not None)):\n LOG.error(_('corrupted state of block device mapping '\n 'id: %(id)s '\n 'snapshot: %(snapshot_id) volume: %(vollume_id)') %\n {'id': bdm['id'],\n 'snapshot_id': bdm['snapshot'],\n 'volume_id': bdm['volume_id']})\n raise exception.ApiError(_('broken block device mapping %d') %\n bdm['id'])\n\n if bdm['volume_id'] is not None:\n volume_api.check_attach(context,\n volume_id=bdm['volume_id'])\n dev_path = self._attach_volume_boot(context, instance_id,\n bdm['volume_id'],\n bdm['device_name'])\n block_device_mapping.append({'device_path': dev_path,\n 'mount_device':\n bdm['device_name']})\n\n return (swap, ephemerals, block_device_mapping)", "metadata": "root.ComputeManager._setup_block_device_mapping", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 241 }, { "content": " def _run_instance(self, context, instance_id, **kwargs):\n \"\"\"Launch a new instance with specified options.\"\"\"\n def _check_image_size():\n \"\"\"Ensure image is smaller than the maximum size allowed by the\n instance_type.\n\n The image stored in Glance is potentially compressed, so we use two\n checks to ensure that the size isn't exceeded:\n\n 1) This one - checks compressed size, this a quick check to\n eliminate any images which are obviously too large\n\n 2) Check uncompressed size in nova.virt.xenapi.vm_utils. This\n is a slower check since it requires uncompressing the entire\n image, but is accurate because it reflects the image's\n actual size.\n \"\"\"\n # NOTE(jk0): image_ref is defined in the DB model, image_href is\n # used by the image service. This should be refactored to be\n # consistent.\n image_href = instance['image_ref']\n image_service, image_id = nova.image.get_image_service(context,\n image_href)\n image_meta = image_service.show(context, image_id)\n\n try:\n size_bytes = image_meta['size']\n except KeyError:\n # Size is not a required field in the image service (yet), so\n # we are unable to rely on it being there even though it's in\n # glance.\n\n # TODO(jk0): Should size be required in the image service?\n return\n\n instance_type_id = instance['instance_type_id']\n instance_type = self.db.instance_type_get(context,\n instance_type_id)\n allowed_size_gb = instance_type['local_gb']\n\n # NOTE(jk0): Since libvirt uses local_gb as a secondary drive, we\n # need to handle potential situations where local_gb is 0. This is\n # the default for m1.tiny.\n if allowed_size_gb == 0:\n return\n\n allowed_size_bytes = allowed_size_gb * 1024 * 1024 * 1024\n\n LOG.debug(_(\"image_id=%(image_id)d, image_size_bytes=\"\n \"%(size_bytes)d, allowed_size_bytes=\"\n \"%(allowed_size_bytes)d\") % locals())\n\n if size_bytes > allowed_size_bytes:\n LOG.info(_(\"Image '%(image_id)d' size %(size_bytes)d exceeded\"\n \" instance_type allowed size \"\n \"%(allowed_size_bytes)d\")\n % locals())\n raise exception.ImageTooLarge()\n\n def _make_network_info():\n if FLAGS.stub_network:\n # TODO(tr3buchet) not really sure how this should be handled.\n # virt requires network_info to be passed in but stub_network\n # is enabled. Setting to [] for now will cause virt to skip\n # all vif creation and network injection, maybe this is correct\n network_info = []\n else:\n # NOTE(vish): This could be a cast because we don't do\n # anything with the address currently, but I'm leaving it as a\n # call to ensure that network setup completes. We will\n # eventually also need to save the address here.\n network_info = self.network_api.allocate_for_instance(context,\n instance, vpn=is_vpn,\n requested_networks=requested_networks)\n LOG.debug(_(\"instance network_info: |%s|\"), network_info)\n return network_info\n\n def _make_block_device_info():\n (swap, ephemerals,\n block_device_mapping) = self._setup_block_device_mapping(\n context, instance_id)\n block_device_info = {\n 'root_device_name': instance['root_device_name'],\n 'swap': swap,\n 'ephemerals': ephemerals,\n 'block_device_mapping': block_device_mapping}\n return block_device_info\n\n def _deallocate_network():\n if not FLAGS.stub_network:\n LOG.debug(_(\"deallocating network for instance: %s\"),\n instance['id'])\n self.network_api.deallocate_for_instance(context,\n instance)\n\n context = context.elevated()\n instance = self.db.instance_get(context, instance_id)\n\n requested_networks = kwargs.get('requested_networks', None)\n\n if instance['name'] in self.driver.list_instances():\n raise exception.Error(_(\"Instance has already been created\"))\n\n _check_image_size()\n\n LOG.audit(_(\"instance %s: starting...\"), instance_id,\n context=context)\n updates = {}\n updates['host'] = self.host\n updates['launched_on'] = self.host\n updates['vm_state'] = vm_states.BUILDING\n updates['task_state'] = task_states.NETWORKING\n instance = self.db.instance_update(context, instance_id, updates)\n instance['injected_files'] = kwargs.get('injected_files', [])\n instance['admin_pass'] = kwargs.get('admin_password', None)\n\n is_vpn = instance['image_ref'] == str(FLAGS.vpn_image_id)\n network_info = _make_network_info()\n\n def _inner_run_instance():\n try:\n self._instance_update(context,\n instance_id,\n vm_state=vm_states.BUILDING,\n task_state=task_states.BLOCK_DEVICE_MAPPING)\n \n block_device_info = _make_block_device_info()\n \n self._instance_update(context,\n instance_id,\n vm_state=vm_states.BUILDING,\n task_state=task_states.SPAWNING)\n \n # TODO(vish) check to make sure the availability zone matches\n try:\n self.driver.spawn(context, instance,\n network_info, block_device_info)\n except Exception as ex: # pylint: disable=W0702\n msg = _(\"Instance '%(instance_id)s' failed to spawn. Is \"\n \"virtualization enabled in the BIOS? Details: \"\n \"%(ex)s\") % locals()\n LOG.exception(msg)\n _deallocate_network()\n return\n \n current_power_state = self._get_power_state(context, instance)\n self._instance_update(context,\n instance_id,\n power_state=current_power_state,\n vm_state=vm_states.ACTIVE,\n task_state=None,\n launched_at=utils.utcnow())\n \n usage_info = utils.usage_from_instance(instance)\n notifier.notify('compute.%s' % self.host,\n 'compute.instance.create',\n notifier.INFO, usage_info)\n \n except exception.InstanceNotFound:\n # FIXME(wwolf): We are just ignoring InstanceNotFound\n # exceptions here in case the instance was immediately\n # deleted before it actually got created. This should\n # be fixed once we have no-db-messaging\n pass\n except:\n with utils.save_and_reraise_exception():\n _deallocate_network()\n\n greenthread.spawn(_inner_run_instance)", "metadata": "root.ComputeManager._run_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 303 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n def run_instance(self, context, instance_id, **kwargs):\n self._run_instance(context, instance_id, **kwargs)", "metadata": "root.ComputeManager.run_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 473 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n #@checks_instance_lock\n def start_instance(self, context, instance_id):\n \"\"\"Starting an instance on this host.\"\"\"\n def _inner_start_instance():\n instance = self.db.instance_get(context, instance_id) \n self.driver.start(context, instance)\n self._instance_update(context,\n instance_id,\n vm_state=vm_states.ACTIVE,\n task_state=None)\n greenthread.spawn(_inner_start_instance)", "metadata": "root.ComputeManager.start_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 477 }, { "content": " def _shutdown_instance(self, context, instance_id, action_str):\n \"\"\"Shutdown an instance on this host.\"\"\"\n context = context.elevated()\n instance = self.db.instance_get(context, instance_id)\n LOG.audit(_(\"%(action_str)s instance %(instance_id)s\") %\n {'action_str': action_str, 'instance_id': instance_id},\n context=context)\n\n network_info = self._get_instance_nw_info(context, instance)\n if not FLAGS.stub_network:\n self.network_api.deallocate_for_instance(context, instance)\n\n #volumes = instance.get('volumes') or []\n #for volume in volumes:\n # self._detach_volume(context, instance_id, volume['id'], False)\n\n #if instance['power_state'] == power_state.SHUTOFF:\n # self.db.instance_destroy(context, instance_id)\n # raise exception.Error(_('trying to destroy already destroyed'\n # ' instance: %s') % instance_id)\n\n return self.driver.destroy(context, instance, network_info)\n\n #if action_str == 'Terminating':\n # terminate_volumes(self.db, context, instance_id)", "metadata": "root.ComputeManager._shutdown_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 490 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def terminate_instance(self, context, instance_id):\n \"\"\"Terminate an instance on this host.\"\"\"\n def _inner_terminate_instance():\n try:\n self._instance_update(context,\n instance_id,\n vm_state=vm_states.DELETED,\n task_state=None,\n terminated_at=utils.utcnow())\n \n bmm = self._shutdown_instance(context, instance_id, 'Terminating')\n instance = self.db.instance_get(context.elevated(), instance_id)\n instance_new = db.instance_create(context, \n {\"availability_zone\": \"resource_pool\",\n \"user_id\": instance[\"user_id\"],\n \"project_id\": instance[\"project_id\"],\n \"kernel_id\": instance[\"kernel_id\"],\n \"host\": instance[\"host\"],\n \"display_name\": instance[\"display_name\"],\n \"instance_type_id\": instance[\"instance_type_id\"],\n \"vcpus\": instance[\"vcpus\"],\n \"vm_state\": vm_states.BUILDING,\n \"image_ref\": FLAGS.dodai_default_image})\n \n self.db.instance_destroy(context, instance_id)\n \n usage_info = utils.usage_from_instance(instance)\n notifier.notify('compute.%s' % self.host,\n 'compute.instance.delete',\n notifier.INFO, usage_info)\n \n self.driver.add_to_resource_pool(context, instance_new, bmm)\n except Exception as ex:\n LOG.exception(ex)\n\n greenthread.spawn(_inner_terminate_instance)", "metadata": "root.ComputeManager.terminate_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 516 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n #@checks_instance_lock\n def stop_instance(self, context, instance_id):\n \"\"\"Stopping an instance on this host.\"\"\"\n\n def _inner_stop_instance():\n #self._shutdown_instance(context, instance_id, 'Stopping')\n\n instance = self.db.instance_get(context, instance_id)\n self._instance_update(context,\n instance_id,\n vm_state=vm_states.STOPPED,\n task_state=None)\n self.driver.stop(context, instance)\n greenthread.spawn(_inner_stop_instance)", "metadata": "root.ComputeManager.stop_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 555 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def rebuild_instance(self, context, instance_id, **kwargs):\n \"\"\"Destroy and re-make this instance.\n\n A 'rebuild' effectively purges all existing data from the system and\n remakes the VM with given 'metadata' and 'personalities'.\n\n :param context: `nova.RequestContext` object\n :param instance_id: Instance identifier (integer)\n :param injected_files: Files to inject\n :param new_pass: password to set on rebuilt instance\n \"\"\"\n context = context.elevated()\n\n instance_ref = self.db.instance_get(context, instance_id)\n LOG.audit(_(\"Rebuilding instance %s\"), instance_id, context=context)\n\n current_power_state = self._get_power_state(context, instance_ref)\n self._instance_update(context,\n instance_id,\n power_state=current_power_state,\n vm_state=vm_states.REBUILDING,\n task_state=None)\n\n network_info = self._get_instance_nw_info(context, instance_ref)\n self.driver.destroy(instance_ref, network_info)\n\n self._instance_update(context,\n instance_id,\n vm_state=vm_states.REBUILDING,\n task_state=task_states.BLOCK_DEVICE_MAPPING)\n\n instance_ref.injected_files = kwargs.get('injected_files', [])\n network_info = self.network_api.get_instance_nw_info(context,\n instance_ref)\n bd_mapping = self._setup_block_device_mapping(context, instance_id)\n\n self._instance_update(context,\n instance_id,\n vm_state=vm_states.REBUILDING,\n task_state=task_states.SPAWNING)\n\n # pull in new password here since the original password isn't in the db\n instance_ref.admin_pass = kwargs.get('new_pass',\n utils.generate_password(FLAGS.password_length))\n\n self.driver.spawn(context, instance_ref, network_info, bd_mapping)\n\n current_power_state = self._get_power_state(context, instance_ref)\n self._instance_update(context,\n instance_id,\n power_state=current_power_state,\n vm_state=vm_states.ACTIVE,\n task_state=None,\n launched_at=utils.utcnow())\n\n usage_info = utils.usage_from_instance(instance_ref)\n notifier.notify('compute.%s' % self.host,\n 'compute.instance.rebuild',\n notifier.INFO,\n usage_info)", "metadata": "root.ComputeManager.rebuild_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 571 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def reboot_instance(self, context, instance_id):\n \"\"\"Reboot an instance on this host.\"\"\"\n LOG.audit(_(\"Rebooting instance %s\"), instance_id, context=context)\n context = context.elevated()\n instance_ref = self.db.instance_get(context, instance_id)\n\n current_power_state = self._get_power_state(context, instance_ref)\n self._instance_update(context,\n instance_id,\n power_state=current_power_state,\n vm_state=vm_states.ACTIVE,\n task_state=task_states.REBOOTING)\n\n if instance_ref['power_state'] != power_state.RUNNING:\n state = instance_ref['power_state']\n running = power_state.RUNNING\n LOG.warn(_('trying to reboot a non-running '\n 'instance: %(instance_id)s (state: %(state)s '\n 'expected: %(running)s)') % locals(),\n context=context)\n\n network_info = self._get_instance_nw_info(context, instance_ref)\n self.driver.reboot(instance_ref, network_info)\n\n current_power_state = self._get_power_state(context, instance_ref)\n self._instance_update(context,\n instance_id,\n power_state=current_power_state,\n vm_state=vm_states.ACTIVE,\n task_state=None)", "metadata": "root.ComputeManager.reboot_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 634 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n def snapshot_instance(self, context, instance_id, image_id,\n image_type='snapshot', backup_type=None,\n rotation=None):\n \"\"\"Snapshot an instance on this host.\n\n :param context: security context\n :param instance_id: nova.db.sqlalchemy.models.Instance.Id\n :param image_id: glance.db.sqlalchemy.models.Image.Id\n :param image_type: snapshot | backup\n :param backup_type: daily | weekly\n :param rotation: int representing how many backups to keep around;\n None if rotation shouldn't be used (as in the case of snapshots)\n \"\"\"\n if image_type == \"snapshot\":\n task_state = task_states.IMAGE_SNAPSHOT\n elif image_type == \"backup\":\n task_state = task_states.IMAGE_BACKUP\n else:\n raise Exception(_('Image type not recognized %s') % image_type)\n\n context = context.elevated()\n instance_ref = self.db.instance_get(context, instance_id)\n\n current_power_state = self._get_power_state(context, instance_ref)\n self._instance_update(context,\n instance_id,\n power_state=current_power_state,\n vm_state=vm_states.ACTIVE,\n task_state=task_state)\n\n LOG.audit(_('instance %s: snapshotting'), instance_id,\n context=context)\n\n if instance_ref['power_state'] != power_state.RUNNING:\n state = instance_ref['power_state']\n running = power_state.RUNNING\n LOG.warn(_('trying to snapshot a non-running '\n 'instance: %(instance_id)s (state: %(state)s '\n 'expected: %(running)s)') % locals())\n\n self.driver.snapshot(context, instance_ref, image_id)\n self._instance_update(context, instance_id, task_state=None)\n\n if image_type == 'snapshot' and rotation:\n raise exception.ImageRotationNotAllowed()\n\n elif image_type == 'backup' and rotation:\n instance_uuid = instance_ref['uuid']\n self.rotate_backups(context, instance_uuid, backup_type, rotation)\n\n elif image_type == 'backup':\n raise exception.RotationRequiredForBackup()", "metadata": "root.ComputeManager.snapshot_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 667 }, { "content": " def rotate_backups(self, context, instance_uuid, backup_type, rotation):\n \"\"\"Delete excess backups associated to an instance.\n\n Instances are allowed a fixed number of backups (the rotation number);\n this method deletes the oldest backups that exceed the rotation\n threshold.\n\n :param context: security context\n :param instance_uuid: string representing uuid of instance\n :param backup_type: daily | weekly\n :param rotation: int representing how many backups to keep around;\n None if rotation shouldn't be used (as in the case of snapshots)\n \"\"\"\n # NOTE(jk0): Eventually extract this out to the ImageService?\n def fetch_images():\n images = []\n marker = None\n while True:\n batch = image_service.detail(context, filters=filters,\n marker=marker, sort_key='created_at', sort_dir='desc')\n if not batch:\n break\n images += batch\n marker = batch[-1]['id']\n return images\n\n image_service = nova.image.get_default_image_service()\n filters = {'property-image_type': 'backup',\n 'property-backup_type': backup_type,\n 'property-instance_uuid': instance_uuid}\n\n images = fetch_images()\n num_images = len(images)\n LOG.debug(_(\"Found %(num_images)d images (rotation: %(rotation)d)\"\n % locals()))\n if num_images > rotation:\n # NOTE(sirp): this deletes all backups that exceed the rotation\n # limit\n excess = len(images) - rotation\n LOG.debug(_(\"Rotating out %d backups\" % excess))\n for i in xrange(excess):\n image = images.pop()\n image_id = image['id']\n LOG.debug(_(\"Deleting image %d\" % image_id))\n image_service.delete(context, image_id)", "metadata": "root.ComputeManager.rotate_backups", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 721 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def set_admin_password(self, context, instance_id, new_pass=None):\n \"\"\"Set the root/admin password for an instance on this host.\n\n This is generally only called by API password resets after an\n image has been built.\n \"\"\"\n\n context = context.elevated()\n\n if new_pass is None:\n # Generate a random password\n new_pass = utils.generate_password(FLAGS.password_length)\n\n max_tries = 10\n\n for i in xrange(max_tries):\n instance_ref = self.db.instance_get(context, instance_id)\n instance_id = instance_ref[\"id\"]\n instance_state = instance_ref[\"power_state\"]\n expected_state = power_state.RUNNING\n\n if instance_state != expected_state:\n raise exception.Error(_('Instance is not running'))\n else:\n try:\n self.driver.set_admin_password(instance_ref, new_pass)\n LOG.audit(_(\"Instance %s: Root password set\"),\n instance_ref[\"name\"])\n break\n except NotImplementedError:\n # NOTE(dprince): if the driver doesn't implement\n # set_admin_password we break to avoid a loop\n LOG.warn(_('set_admin_password is not implemented '\n 'by this driver.'))\n break\n except Exception, e:\n # Catch all here because this could be anything.\n LOG.exception(e)\n if i == max_tries - 1:\n # At some point this exception may make it back\n # to the API caller, and we don't want to reveal\n # too much. The real exception is logged above\n raise exception.Error(_('Internal error'))\n time.sleep(1)\n continue", "metadata": "root.ComputeManager.set_admin_password", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 767 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def inject_file(self, context, instance_id, path, file_contents):\n \"\"\"Write a file to the specified path in an instance on this host.\"\"\"\n context = context.elevated()\n instance_ref = self.db.instance_get(context, instance_id)\n instance_id = instance_ref['id']\n instance_state = instance_ref['power_state']\n expected_state = power_state.RUNNING\n if instance_state != expected_state:\n LOG.warn(_('trying to inject a file into a non-running '\n 'instance: %(instance_id)s (state: %(instance_state)s '\n 'expected: %(expected_state)s)') % locals())\n nm = instance_ref['name']\n msg = _('instance %(nm)s: injecting file to %(path)s') % locals()\n LOG.audit(msg)\n self.driver.inject_file(instance_ref, path, file_contents)", "metadata": "root.ComputeManager.inject_file", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 815 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def agent_update(self, context, instance_id, url, md5hash):\n \"\"\"Update agent running on an instance on this host.\"\"\"\n context = context.elevated()\n instance_ref = self.db.instance_get(context, instance_id)\n instance_id = instance_ref['id']\n instance_state = instance_ref['power_state']\n expected_state = power_state.RUNNING\n if instance_state != expected_state:\n LOG.warn(_('trying to update agent on a non-running '\n 'instance: %(instance_id)s (state: %(instance_state)s '\n 'expected: %(expected_state)s)') % locals())\n nm = instance_ref['name']\n msg = _('instance %(nm)s: updating agent to %(url)s') % locals()\n LOG.audit(msg)\n self.driver.agent_update(instance_ref, url, md5hash)", "metadata": "root.ComputeManager.agent_update", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 833 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def rescue_instance(self, context, instance_id):\n \"\"\"Rescue an instance on this host.\"\"\"\n LOG.audit(_('instance %s: rescuing'), instance_id, context=context)\n context = context.elevated()\n\n instance_ref = self.db.instance_get(context, instance_id)\n network_info = self._get_instance_nw_info(context, instance_ref)\n\n # NOTE(blamar): None of the virt drivers use the 'callback' param\n self.driver.rescue(context, instance_ref, None, network_info)\n\n current_power_state = self._get_power_state(context, instance_ref)\n self._instance_update(context,\n instance_id,\n vm_state=vm_states.RESCUED,\n task_state=None,\n power_state=current_power_state)", "metadata": "root.ComputeManager.rescue_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 851 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def unrescue_instance(self, context, instance_id):\n \"\"\"Rescue an instance on this host.\"\"\"\n LOG.audit(_('instance %s: unrescuing'), instance_id, context=context)\n context = context.elevated()\n\n instance_ref = self.db.instance_get(context, instance_id)\n network_info = self._get_instance_nw_info(context, instance_ref)\n\n # NOTE(blamar): None of the virt drivers use the 'callback' param\n self.driver.unrescue(instance_ref, None, network_info)\n\n current_power_state = self._get_power_state(context, instance_ref)\n self._instance_update(context,\n instance_id,\n vm_state=vm_states.ACTIVE,\n task_state=None,\n power_state=current_power_state)", "metadata": "root.ComputeManager.unrescue_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 871 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def confirm_resize(self, context, instance_id, migration_id):\n \"\"\"Destroys the source instance.\"\"\"\n migration_ref = self.db.migration_get(context, migration_id)\n instance_ref = self.db.instance_get_by_uuid(context,\n migration_ref.instance_uuid)\n\n network_info = self._get_instance_nw_info(context, instance_ref)\n self.driver.destroy(instance_ref, network_info)\n usage_info = utils.usage_from_instance(instance_ref)\n notifier.notify('compute.%s' % self.host,\n 'compute.instance.resize.confirm',\n notifier.INFO,\n usage_info)", "metadata": "root.ComputeManager.confirm_resize", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 891 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def revert_resize(self, context, instance_id, migration_id):\n \"\"\"Destroys the new instance on the destination machine.\n\n Reverts the model changes, and powers on the old instance on the\n source machine.\n\n \"\"\"\n migration_ref = self.db.migration_get(context, migration_id)\n instance_ref = self.db.instance_get_by_uuid(context,\n migration_ref.instance_uuid)\n\n network_info = self._get_instance_nw_info(context, instance_ref)\n self.driver.destroy(instance_ref, network_info)\n topic = self.db.queue_get_for(context, FLAGS.compute_topic,\n instance_ref['host'])\n rpc.cast(context, topic,\n {'method': 'finish_revert_resize',\n 'args': {'instance_id': instance_ref['uuid'],\n 'migration_id': migration_ref['id']},\n })", "metadata": "root.ComputeManager.revert_resize", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 907 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def finish_revert_resize(self, context, instance_id, migration_id):\n \"\"\"Finishes the second half of reverting a resize.\n\n Power back on the source instance and revert the resized attributes\n in the database.\n\n \"\"\"\n migration_ref = self.db.migration_get(context, migration_id)\n instance_ref = self.db.instance_get_by_uuid(context,\n migration_ref.instance_uuid)\n\n instance_type = self.db.instance_type_get(context,\n migration_ref['old_instance_type_id'])\n\n # Just roll back the record. There's no need to resize down since\n # the 'old' VM already has the preferred attributes\n self._instance_update(context,\n instance_ref[\"uuid\"],\n memory_mb=instance_type['memory_mb'],\n vcpus=instance_type['vcpus'],\n local_gb=instance_type['local_gb'],\n instance_type_id=instance_type['id'])\n\n self.driver.revert_migration(instance_ref)\n self.db.migration_update(context, migration_id,\n {'status': 'reverted'})\n usage_info = utils.usage_from_instance(instance_ref)\n notifier.notify('compute.%s' % self.host,\n 'compute.instance.resize.revert',\n notifier.INFO,\n usage_info)", "metadata": "root.ComputeManager.finish_revert_resize", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 930 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def prep_resize(self, context, instance_id, instance_type_id):\n \"\"\"Initiates the process of moving a running instance to another host.\n\n Possibly changes the RAM and disk size in the process.\n\n \"\"\"\n context = context.elevated()\n\n # Because of checks_instance_lock, this must currently be called\n # instance_id. However, the compute API is always passing the UUID\n # of the instance down\n instance_ref = self.db.instance_get_by_uuid(context, instance_id)\n\n if instance_ref['host'] == FLAGS.host:\n self._instance_update(context,\n instance_id,\n vm_state=vm_states.ERROR)\n msg = _('Migration error: destination same as source!')\n raise exception.Error(msg)\n\n old_instance_type = self.db.instance_type_get(context,\n instance_ref['instance_type_id'])\n new_instance_type = self.db.instance_type_get(context,\n instance_type_id)\n\n migration_ref = self.db.migration_create(context,\n {'instance_uuid': instance_ref['uuid'],\n 'source_compute': instance_ref['host'],\n 'dest_compute': FLAGS.host,\n 'dest_host': self.driver.get_host_ip_addr(),\n 'old_instance_type_id': old_instance_type['id'],\n 'new_instance_type_id': instance_type_id,\n 'status': 'pre-migrating'})\n\n LOG.audit(_('instance %s: migrating'), instance_ref['uuid'],\n context=context)\n topic = self.db.queue_get_for(context, FLAGS.compute_topic,\n instance_ref['host'])\n rpc.cast(context, topic,\n {'method': 'resize_instance',\n 'args': {'instance_id': instance_ref['uuid'],\n 'migration_id': migration_ref['id']}})\n\n usage_info = utils.usage_from_instance(instance_ref,\n new_instance_type=new_instance_type['name'],\n new_instance_type_id=new_instance_type['id'])\n notifier.notify('compute.%s' % self.host,\n 'compute.instance.resize.prep',\n notifier.INFO,\n usage_info)", "metadata": "root.ComputeManager.prep_resize", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 964 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def resize_instance(self, context, instance_id, migration_id):\n \"\"\"Starts the migration of a running instance to another host.\"\"\"\n migration_ref = self.db.migration_get(context, migration_id)\n instance_ref = self.db.instance_get_by_uuid(context,\n migration_ref.instance_uuid)\n\n self.db.migration_update(context,\n migration_id,\n {'status': 'migrating'})\n\n disk_info = self.driver.migrate_disk_and_power_off(\n instance_ref, migration_ref['dest_host'])\n self.db.migration_update(context,\n migration_id,\n {'status': 'post-migrating'})\n\n service = self.db.service_get_by_host_and_topic(\n context, migration_ref['dest_compute'], FLAGS.compute_topic)\n topic = self.db.queue_get_for(context,\n FLAGS.compute_topic,\n migration_ref['dest_compute'])\n params = {'migration_id': migration_id,\n 'disk_info': disk_info,\n 'instance_id': instance_ref['uuid']}\n rpc.cast(context, topic, {'method': 'finish_resize',\n 'args': params})", "metadata": "root.ComputeManager.resize_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1017 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def finish_resize(self, context, instance_id, migration_id, disk_info):\n \"\"\"Completes the migration process.\n\n Sets up the newly transferred disk and turns on the instance at its\n new host machine.\n\n \"\"\"\n migration_ref = self.db.migration_get(context, migration_id)\n\n resize_instance = False\n instance_ref = self.db.instance_get_by_uuid(context,\n migration_ref.instance_uuid)\n if migration_ref['old_instance_type_id'] != \\\n migration_ref['new_instance_type_id']:\n instance_type = self.db.instance_type_get(context,\n migration_ref['new_instance_type_id'])\n self.db.instance_update(context, instance_ref.uuid,\n dict(instance_type_id=instance_type['id'],\n memory_mb=instance_type['memory_mb'],\n vcpus=instance_type['vcpus'],\n local_gb=instance_type['local_gb']))\n resize_instance = True\n\n instance_ref = self.db.instance_get_by_uuid(context,\n instance_ref.uuid)\n\n network_info = self._get_instance_nw_info(context, instance_ref)\n self.driver.finish_migration(context, instance_ref, disk_info,\n network_info, resize_instance)\n\n self._instance_update(context,\n instance_id,\n vm_state=vm_states.ACTIVE,\n task_state=task_states.RESIZE_VERIFY)\n\n self.db.migration_update(context, migration_id,\n {'status': 'finished', })", "metadata": "root.ComputeManager.finish_resize", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1046 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def add_fixed_ip_to_instance(self, context, instance_id, network_id):\n \"\"\"Calls network_api to add new fixed_ip to instance\n then injects the new network info and resets instance networking.\n\n \"\"\"\n self.network_api.add_fixed_ip_to_instance(context, instance_id,\n self.host, network_id)\n self.inject_network_info(context, instance_id)\n self.reset_network(context, instance_id)", "metadata": "root.ComputeManager.add_fixed_ip_to_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1086 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def remove_fixed_ip_from_instance(self, context, instance_id, address):\n \"\"\"Calls network_api to remove existing fixed_ip from instance\n by injecting the altered network info and resetting\n instance networking.\n \"\"\"\n self.network_api.remove_fixed_ip_from_instance(context, instance_id,\n address)\n self.inject_network_info(context, instance_id)\n self.reset_network(context, instance_id)", "metadata": "root.ComputeManager.remove_fixed_ip_from_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1098 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def pause_instance(self, context, instance_id):\n \"\"\"Pause an instance on this host.\"\"\"\n LOG.audit(_('instance %s: pausing'), instance_id, context=context)\n context = context.elevated()\n\n instance_ref = self.db.instance_get(context, instance_id)\n self.driver.pause(instance_ref, lambda result: None)\n\n current_power_state = self._get_power_state(context, instance_ref)\n self._instance_update(context,\n instance_id,\n power_state=current_power_state,\n vm_state=vm_states.PAUSED,\n task_state=None)", "metadata": "root.ComputeManager.pause_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1110 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def unpause_instance(self, context, instance_id):\n \"\"\"Unpause a paused instance on this host.\"\"\"\n LOG.audit(_('instance %s: unpausing'), instance_id, context=context)\n context = context.elevated()\n\n instance_ref = self.db.instance_get(context, instance_id)\n self.driver.unpause(instance_ref, lambda result: None)\n\n current_power_state = self._get_power_state(context, instance_ref)\n self._instance_update(context,\n instance_id,\n power_state=current_power_state,\n vm_state=vm_states.ACTIVE,\n task_state=None)", "metadata": "root.ComputeManager.unpause_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1127 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n def host_power_action(self, context, host=None, action=None):\n \"\"\"Reboots, shuts down or powers up the host.\"\"\"\n return self.driver.host_power_action(host, action)", "metadata": "root.ComputeManager.host_power_action", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1144 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n def set_host_enabled(self, context, host=None, enabled=None):\n \"\"\"Sets the specified host's ability to accept new instances.\"\"\"\n return self.driver.set_host_enabled(host, enabled)", "metadata": "root.ComputeManager.set_host_enabled", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1149 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n def get_diagnostics(self, context, instance_id):\n \"\"\"Retrieve diagnostics for an instance on this host.\"\"\"\n instance_ref = self.db.instance_get(context, instance_id)\n if instance_ref[\"power_state\"] == power_state.RUNNING:\n LOG.audit(_(\"instance %s: retrieving diagnostics\"), instance_id,\n context=context)\n return self.driver.get_diagnostics(instance_ref)", "metadata": "root.ComputeManager.get_diagnostics", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1154 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def suspend_instance(self, context, instance_id):\n \"\"\"Suspend the given instance.\"\"\"\n LOG.audit(_('instance %s: suspending'), instance_id, context=context)\n context = context.elevated()\n\n instance_ref = self.db.instance_get(context, instance_id)\n self.driver.suspend(instance_ref, lambda result: None)\n\n current_power_state = self._get_power_state(context, instance_ref)\n self._instance_update(context,\n instance_id,\n power_state=current_power_state,\n vm_state=vm_states.SUSPENDED,\n task_state=None)", "metadata": "root.ComputeManager.suspend_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1163 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def resume_instance(self, context, instance_id):\n \"\"\"Resume the given suspended instance.\"\"\"\n LOG.audit(_('instance %s: resuming'), instance_id, context=context)\n context = context.elevated()\n\n instance_ref = self.db.instance_get(context, instance_id)\n self.driver.resume(instance_ref, lambda result: None)\n\n current_power_state = self._get_power_state(context, instance_ref)\n self._instance_update(context,\n instance_id,\n power_state=current_power_state,\n vm_state=vm_states.ACTIVE,\n task_state=None)", "metadata": "root.ComputeManager.resume_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1180 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n def lock_instance(self, context, instance_id):\n \"\"\"Lock the given instance.\"\"\"\n context = context.elevated()\n\n LOG.debug(_('instance %s: locking'), instance_id, context=context)\n self.db.instance_update(context, instance_id, {'locked': True})", "metadata": "root.ComputeManager.lock_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1197 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n def unlock_instance(self, context, instance_id):\n \"\"\"Unlock the given instance.\"\"\"\n context = context.elevated()\n\n LOG.debug(_('instance %s: unlocking'), instance_id, context=context)\n self.db.instance_update(context, instance_id, {'locked': False})", "metadata": "root.ComputeManager.unlock_instance", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1205 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n def get_lock(self, context, instance_id):\n \"\"\"Return the boolean state of the given instance's lock.\"\"\"\n context = context.elevated()\n LOG.debug(_('instance %s: getting locked state'), instance_id,\n context=context)\n if utils.is_uuid_like(instance_id):\n uuid = instance_id\n instance_ref = self.db.instance_get_by_uuid(context, uuid)\n else:\n instance_ref = self.db.instance_get(context, instance_id)\n return instance_ref['locked']", "metadata": "root.ComputeManager.get_lock", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1213 }, { "content": " @checks_instance_lock\n def reset_network(self, context, instance_id):\n \"\"\"Reset networking on the given instance.\"\"\"\n instance = self.db.instance_get(context, instance_id)\n LOG.debug(_('instance %s: reset network'), instance_id,\n context=context)\n self.driver.reset_network(instance)", "metadata": "root.ComputeManager.reset_network", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1226 }, { "content": " @checks_instance_lock\n def inject_network_info(self, context, instance_id):\n \"\"\"Inject network info for the given instance.\"\"\"\n LOG.debug(_('instance %s: inject network info'), instance_id,\n context=context)\n instance = self.db.instance_get(context, instance_id)\n network_info = self._get_instance_nw_info(context, instance)\n LOG.debug(_(\"network_info to inject: |%s|\"), network_info)\n\n self.driver.inject_network_info(instance, network_info)", "metadata": "root.ComputeManager.inject_network_info", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1234 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n def get_console_output(self, context, instance_id):\n \"\"\"Send the console output for the given instance.\"\"\"\n context = context.elevated()\n instance_ref = self.db.instance_get(context, instance_id)\n LOG.audit(_(\"Get console output for instance %s\"), instance_id,\n context=context)\n output = self.driver.get_console_output(instance_ref)\n return output.decode('utf-8', 'replace').encode('ascii', 'replace')", "metadata": "root.ComputeManager.get_console_output", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1245 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n def get_ajax_console(self, context, instance_id):\n \"\"\"Return connection information for an ajax console.\"\"\"\n context = context.elevated()\n LOG.debug(_(\"instance %s: getting ajax console\"), instance_id)\n instance_ref = self.db.instance_get(context, instance_id)\n return self.driver.get_ajax_console(instance_ref)", "metadata": "root.ComputeManager.get_ajax_console", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1255 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n def get_vnc_console(self, context, instance_id):\n \"\"\"Return connection information for a vnc console.\"\"\"\n context = context.elevated()\n LOG.debug(_(\"instance %s: getting vnc console\"), instance_id)\n instance_ref = self.db.instance_get(context, instance_id)\n return self.driver.get_vnc_console(instance_ref)", "metadata": "root.ComputeManager.get_vnc_console", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1263 }, { "content": " def _attach_volume_boot(self, context, instance_id, volume_id, mountpoint):\n \"\"\"Attach a volume to an instance at boot time. So actual attach\n is done by instance creation\"\"\"\n\n # TODO(yamahata):\n # should move check_attach to volume manager?\n volume.API().check_attach(context, volume_id)\n\n context = context.elevated()\n LOG.audit(_(\"instance %(instance_id)s: booting with \"\n \"volume %(volume_id)s at %(mountpoint)s\") %\n locals(), context=context)\n dev_path = self.volume_manager.setup_compute_volume(context, volume_id)\n self.db.volume_attached(context, volume_id, instance_id, mountpoint)\n return dev_path", "metadata": "root.ComputeManager._attach_volume_boot", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1271 }, { "content": " @checks_instance_lock\n def attach_volume(self, context, instance_id, volume_id, mountpoint):\n \"\"\"Attach a volume to an instance.\"\"\"\n context = context.elevated()\n instance_ref = self.db.instance_get(context, instance_id)\n LOG.audit(_(\"instance %(instance_id)s: attaching volume %(volume_id)s\"\n \" to %(mountpoint)s\") % locals(), context=context)\n dev_path = self.volume_manager.setup_compute_volume(context,\n volume_id)\n try:\n self.driver.attach_volume(instance_ref['name'],\n dev_path,\n mountpoint)\n self.db.volume_attached(context,\n volume_id,\n instance_id,\n mountpoint)\n values = {\n 'instance_id': instance_id,\n 'device_name': mountpoint,\n 'delete_on_termination': False,\n 'virtual_name': None,\n 'snapshot_id': None,\n 'volume_id': volume_id,\n 'volume_size': None,\n 'no_device': None}\n self.db.block_device_mapping_create(context, values)\n except Exception as exc: # pylint: disable=W0702\n # NOTE(vish): The inline callback eats the exception info so we\n # log the traceback here and reraise the same\n # ecxception below.\n LOG.exception(_(\"instance %(instance_id)s: attach failed\"\n \" %(mountpoint)s, removing\") % locals(), context=context)\n self.volume_manager.remove_compute_volume(context,\n volume_id)\n raise exc\n\n return True", "metadata": "root.ComputeManager.attach_volume", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1287 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n @checks_instance_lock\n def _detach_volume(self, context, instance_id, volume_id, destroy_bdm):\n \"\"\"Detach a volume from an instance.\"\"\"\n context = context.elevated()\n instance_ref = self.db.instance_get(context, instance_id)\n volume_ref = self.db.volume_get(context, volume_id)\n mp = volume_ref['mountpoint']\n LOG.audit(_(\"Detach volume %(volume_id)s from mountpoint %(mp)s\"\n \" on instance %(instance_id)s\") % locals(), context=context)\n if instance_ref['name'] not in self.driver.list_instances():\n LOG.warn(_(\"Detaching volume from unknown instance %s\"),\n instance_id, context=context)\n else:\n self.driver.detach_volume(instance_ref['name'],\n volume_ref['mountpoint'])\n self.volume_manager.remove_compute_volume(context, volume_id)\n self.db.volume_detached(context, volume_id)\n if destroy_bdm:\n self.db.block_device_mapping_destroy_by_instance_and_volume(\n context, instance_id, volume_id)\n return True", "metadata": "root.ComputeManager._detach_volume", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1326 }, { "content": " def detach_volume(self, context, instance_id, volume_id):\n \"\"\"Detach a volume from an instance.\"\"\"\n return self._detach_volume(context, instance_id, volume_id, True)", "metadata": "root.ComputeManager.detach_volume", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1349 }, { "content": " def remove_volume(self, context, volume_id):\n \"\"\"Remove volume on compute host.\n\n :param context: security context\n :param volume_id: volume ID\n \"\"\"\n self.volume_manager.remove_compute_volume(context, volume_id)", "metadata": "root.ComputeManager.remove_volume", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1353 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n def compare_cpu(self, context, cpu_info):\n \"\"\"Checks that the host cpu is compatible with a cpu given by xml.\n\n :param context: security context\n :param cpu_info: json string obtained from virConnect.getCapabilities\n :returns: See driver.compare_cpu\n\n \"\"\"\n return self.driver.compare_cpu(cpu_info)", "metadata": "root.ComputeManager.compare_cpu", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1361 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n def create_shared_storage_test_file(self, context):\n \"\"\"Makes tmpfile under FLAGS.instance_path.\n\n This method enables compute nodes to recognize that they mounts\n same shared storage. (create|check|creanup)_shared_storage_test_file()\n is a pair.\n\n :param context: security context\n :returns: tmpfile name(basename)\n\n \"\"\"\n dirpath = FLAGS.instances_path\n fd, tmp_file = tempfile.mkstemp(dir=dirpath)\n LOG.debug(_(\"Creating tmpfile %s to notify to other \"\n \"compute nodes that they should mount \"\n \"the same storage.\") % tmp_file)\n os.close(fd)\n return os.path.basename(tmp_file)", "metadata": "root.ComputeManager.create_shared_storage_test_file", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1372 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n def check_shared_storage_test_file(self, context, filename):\n \"\"\"Confirms existence of the tmpfile under FLAGS.instances_path.\n Cannot confirm tmpfile return False.\n\n :param context: security context\n :param filename: confirm existence of FLAGS.instances_path/thisfile\n\n \"\"\"\n tmp_file = os.path.join(FLAGS.instances_path, filename)\n if not os.path.exists(tmp_file):\n return False\n else:\n return True", "metadata": "root.ComputeManager.check_shared_storage_test_file", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1392 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n def cleanup_shared_storage_test_file(self, context, filename):\n \"\"\"Removes existence of the tmpfile under FLAGS.instances_path.\n\n :param context: security context\n :param filename: remove existence of FLAGS.instances_path/thisfile\n\n \"\"\"\n tmp_file = os.path.join(FLAGS.instances_path, filename)\n os.remove(tmp_file)", "metadata": "root.ComputeManager.cleanup_shared_storage_test_file", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1407 }, { "content": " @exception.wrap_exception(notifier=notifier, publisher_id=publisher_id())\n def update_available_resource(self, context):\n \"\"\"See comments update_resource_info.\n\n :param context: security context\n :returns: See driver.update_available_resource()\n\n \"\"\"\n return self.driver.update_available_resource(context, self.host)", "metadata": "root.ComputeManager.update_available_resource", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1418 }, { "content": " def pre_live_migration(self, context, instance_id, time=None,\n block_migration=False, disk=None):\n \"\"\"Preparations for live migration at dest host.\n\n :param context: security context\n :param instance_id: nova.db.sqlalchemy.models.Instance.Id\n :param block_migration: if true, prepare for block migration\n\n \"\"\"\n if not time:\n time = greenthread\n\n # Getting instance info\n instance_ref = self.db.instance_get(context, instance_id)\n hostname = instance_ref['hostname']\n\n # Getting fixed ips\n fixed_ips = self.db.instance_get_fixed_addresses(context, instance_id)\n if not fixed_ips:\n raise exception.FixedIpNotFoundForInstance(instance_id=instance_id)\n\n # If any volume is mounted, prepare here.\n if not instance_ref['volumes']:\n LOG.info(_(\"%s has no volume.\"), hostname)\n else:\n for v in instance_ref['volumes']:\n self.volume_manager.setup_compute_volume(context, v['id'])\n\n # Bridge settings.\n # Call this method prior to ensure_filtering_rules_for_instance,\n # since bridge is not set up, ensure_filtering_rules_for instance\n # fails.\n #\n # Retry operation is necessary because continuously request comes,\n # concorrent request occurs to iptables, then it complains.\n network_info = self._get_instance_nw_info(context, instance_ref)\n max_retry = FLAGS.live_migration_retry_count\n for cnt in range(max_retry):\n try:\n self.driver.plug_vifs(instance_ref, network_info)\n break\n except exception.ProcessExecutionError:\n if cnt == max_retry - 1:\n raise\n else:\n LOG.warn(_(\"plug_vifs() failed %(cnt)d.\"\n \"Retry up to %(max_retry)d for %(hostname)s.\")\n % locals())\n time.sleep(1)\n\n # Creating filters to hypervisors and firewalls.\n # An example is that nova-instance-instance-xxx,\n # which is written to libvirt.xml(Check \"virsh nwfilter-list\")\n # This nwfilter is necessary on the destination host.\n # In addition, this method is creating filtering rule\n # onto destination host.\n self.driver.ensure_filtering_rules_for_instance(instance_ref,\n network_info)\n\n # Preparation for block migration\n if block_migration:\n self.driver.pre_block_migration(context,\n instance_ref,\n disk)", "metadata": "root.ComputeManager.pre_live_migration", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1428 }, { "content": " def live_migration(self, context, instance_id,\n dest, block_migration=False):\n \"\"\"Executing live migration.\n\n :param context: security context\n :param instance_id: nova.db.sqlalchemy.models.Instance.Id\n :param dest: destination host\n :param block_migration: if true, do block migration\n\n \"\"\"\n # Get instance for error handling.\n instance_ref = self.db.instance_get(context, instance_id)\n\n try:\n # Checking volume node is working correctly when any volumes\n # are attached to instances.\n if instance_ref['volumes']:\n rpc.call(context,\n FLAGS.volume_topic,\n {\"method\": \"check_for_export\",\n \"args\": {'instance_id': instance_id}})\n\n if block_migration:\n disk = self.driver.get_instance_disk_info(context,\n instance_ref)\n else:\n disk = None\n\n rpc.call(context,\n self.db.queue_get_for(context, FLAGS.compute_topic, dest),\n {\"method\": \"pre_live_migration\",\n \"args\": {'instance_id': instance_id,\n 'block_migration': block_migration,\n 'disk': disk}})\n\n except Exception:\n i_name = instance_ref.name\n msg = _(\"Pre live migration for %(i_name)s failed at %(dest)s\")\n LOG.error(msg % locals())\n self.rollback_live_migration(context, instance_ref,\n dest, block_migration)\n raise\n\n # Executing live migration\n # live_migration might raises exceptions, but\n # nothing must be recovered in this version.\n self.driver.live_migration(context, instance_ref, dest,\n self.post_live_migration,\n self.rollback_live_migration,\n block_migration)", "metadata": "root.ComputeManager.live_migration", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1493 }, { "content": " def post_live_migration(self, ctxt, instance_ref,\n dest, block_migration=False):\n \"\"\"Post operations for live migration.\n\n This method is called from live_migration\n and mainly updating database record.\n\n :param ctxt: security context\n :param instance_id: nova.db.sqlalchemy.models.Instance.Id\n :param dest: destination host\n :param block_migration: if true, do block migration\n\n \"\"\"\n\n LOG.info(_('post_live_migration() is started..'))\n instance_id = instance_ref['id']\n\n # Detaching volumes.\n try:\n for vol in self.db.volume_get_all_by_instance(ctxt, instance_id):\n self.volume_manager.remove_compute_volume(ctxt, vol['id'])\n except exception.NotFound:\n pass\n\n # Releasing vlan.\n # (not necessary in current implementation?)\n\n network_info = self._get_instance_nw_info(ctxt, instance_ref)\n # Releasing security group ingress rule.\n self.driver.unfilter_instance(instance_ref, network_info)\n\n # Database updating.\n i_name = instance_ref.name\n try:\n # Not return if floating_ip is not found, otherwise,\n # instance never be accessible..\n floating_ip = self.db.instance_get_floating_address(ctxt,\n instance_id)\n if not floating_ip:\n LOG.info(_('No floating_ip is found for %s.'), i_name)\n else:\n floating_ip_ref = self.db.floating_ip_get_by_address(ctxt,\n floating_ip)\n self.db.floating_ip_update(ctxt,\n floating_ip_ref['address'],\n {'host': dest})\n except exception.NotFound:\n LOG.info(_('No floating_ip is found for %s.'), i_name)\n except Exception, e:\n LOG.error(_(\"Live migration: Unexpected error: \"\n \"%(i_name)s cannot inherit floating \"\n \"ip.\\n%(e)s\") % (locals()))\n\n # Define domain at destination host, without doing it,\n # pause/suspend/terminate do not work.\n rpc.call(ctxt,\n self.db.queue_get_for(ctxt, FLAGS.compute_topic, dest),\n {\"method\": \"post_live_migration_at_destination\",\n \"args\": {'instance_id': instance_ref.id,\n 'block_migration': block_migration}})\n\n # Restore instance state\n current_power_state = self._get_power_state(ctxt, instance_ref)\n self._instance_update(ctxt,\n instance_ref[\"id\"],\n host=dest,\n power_state=current_power_state,\n vm_state=vm_states.ACTIVE,\n task_state=None)\n\n # Restore volume state\n for volume_ref in instance_ref['volumes']:\n volume_id = volume_ref['id']\n self.db.volume_update(ctxt, volume_id, {'status': 'in-use'})\n\n # No instance booting at source host, but instance dir\n # must be deleted for preparing next block migration\n if block_migration:\n self.driver.destroy(instance_ref, network_info)\n\n LOG.info(_('Migrating %(i_name)s to %(dest)s finished successfully.')\n % locals())\n LOG.info(_(\"You may see the error \\\"libvirt: QEMU error: \"\n \"Domain not found: no domain with matching name.\\\" \"\n \"This error can be safely ignored.\"))", "metadata": "root.ComputeManager.post_live_migration", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1544 }, { "content": " def post_live_migration_at_destination(self, context,\n instance_id, block_migration=False):\n \"\"\"Post operations for live migration .\n\n :param context: security context\n :param instance_id: nova.db.sqlalchemy.models.Instance.Id\n :param block_migration: block_migration\n\n \"\"\"\n instance_ref = self.db.instance_get(context, instance_id)\n LOG.info(_('Post operation of migraton started for %s .')\n % instance_ref.name)\n network_info = self._get_instance_nw_info(context, instance_ref)\n self.driver.post_live_migration_at_destination(context,\n instance_ref,\n network_info,\n block_migration)", "metadata": "root.ComputeManager.post_live_migration_at_destination", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1630 }, { "content": " def rollback_live_migration(self, context, instance_ref,\n dest, block_migration):\n \"\"\"Recovers Instance/volume state from migrating -> running.\n\n :param context: security context\n :param instance_id: nova.db.sqlalchemy.models.Instance.Id\n :param dest:\n This method is called from live migration src host.\n This param specifies destination host.\n \"\"\"\n host = instance_ref['host']\n self._instance_update(context,\n instance_ref['id'],\n host=host,\n vm_state=vm_states.ACTIVE,\n task_state=None)\n\n for volume_ref in instance_ref['volumes']:\n volume_id = volume_ref['id']\n self.db.volume_update(context, volume_id, {'status': 'in-use'})\n volume.API().remove_from_compute(context, volume_id, dest)\n\n # Block migration needs empty image at destination host\n # before migration starts, so if any failure occurs,\n # any empty images has to be deleted.\n if block_migration:\n rpc.cast(context,\n self.db.queue_get_for(context, FLAGS.compute_topic, dest),\n {\"method\": \"rollback_live_migration_at_destination\",\n \"args\": {'instance_id': instance_ref['id']}})", "metadata": "root.ComputeManager.rollback_live_migration", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1648 }, { "content": " def rollback_live_migration_at_destination(self, context, instance_id):\n \"\"\" Cleaning up image directory that is created pre_live_migration.\n\n :param context: security context\n :param instance_id: nova.db.sqlalchemy.models.Instance.Id\n \"\"\"\n instances_ref = self.db.instance_get(context, instance_id)\n network_info = self._get_instance_nw_info(context, instances_ref)\n self.driver.destroy(instances_ref, network_info)", "metadata": "root.ComputeManager.rollback_live_migration_at_destination", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1679 }, { "content": " def periodic_tasks(self, context=None):\n \"\"\"Tasks to be run at a periodic interval.\"\"\"\n error_list = super(ComputeManager, self).periodic_tasks(context)\n if error_list is None:\n error_list = []\n\n try:\n if FLAGS.rescue_timeout > 0:\n self.driver.poll_rescued_instances(FLAGS.rescue_timeout)\n except Exception as ex:\n LOG.warning(_(\"Error during poll_rescued_instances: %s\"),\n unicode(ex))\n error_list.append(ex)\n\n try:\n self._report_driver_status()\n except Exception as ex:\n LOG.warning(_(\"Error during report_driver_status(): %s\"),\n unicode(ex))\n error_list.append(ex)\n\n try:\n self._sync_power_states(context)\n except Exception as ex:\n LOG.warning(_(\"Error during power_state sync: %s\"), unicode(ex))\n error_list.append(ex)\n\n return error_list", "metadata": "root.ComputeManager.periodic_tasks", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1689 }, { "content": " def _report_driver_status(self):\n curr_time = time.time()\n if curr_time - self._last_host_check > FLAGS.host_state_interval:\n self._last_host_check = curr_time\n LOG.info(_(\"Updating host status\"))\n # This will grab info about the host and queue it\n # to be sent to the Schedulers.\n self.update_service_capabilities(\n self.driver.get_host_stats(refresh=True))", "metadata": "root.ComputeManager._report_driver_status", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1718 }, { "content": " def _sync_power_states(self, context):\n \"\"\"Align power states between the database and the hypervisor.\n\n The hypervisor is authoritative for the power_state data, so we\n simply loop over all known instances for this host and update the\n power_state according to the hypervisor. If the instance is not found\n then it will be set to power_state.NOSTATE, because it doesn't exist\n on the hypervisor.\n\n \"\"\"\n vm_instances = self.driver.list_instances_detail(context)\n vm_instances = dict((vm.name, vm) for vm in vm_instances)\n db_instances = self.db.instance_get_all_by_host(context, self.host)\n\n num_vm_instances = len(vm_instances)\n num_db_instances = len(db_instances)\n\n if num_vm_instances != num_db_instances:\n LOG.info(_(\"Found %(num_db_instances)s in the database and \"\n \"%(num_vm_instances)s on the hypervisor.\") % locals())\n\n for db_instance in db_instances:\n name = db_instance[\"name\"]\n db_power_state = db_instance['power_state']\n vm_instance = vm_instances.get(name)\n\n if vm_instance is None:\n vm_power_state = power_state.NOSTATE\n else:\n vm_power_state = vm_instance.state\n\n if vm_power_state == db_power_state:\n continue\n\n self._instance_update(context,\n db_instance[\"id\"],\n power_state=vm_power_state)", "metadata": "root.ComputeManager._sync_power_states", "header": "['class', 'ComputeManager', '(', 'manager', '.', 'SchedulerDependentManager', ')', ':', '___EOS___']", "index": 1728 } ]
[ { "span": "from nova.compute.utils import terminate_volumes", "start_line": 62, "start_column": 0, "end_line": 62, "end_column": 48 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "vim", ":", " ", "tabs", "top", "=", "4", " ", "shift", "widt", "h", "=", "4", " ", "soft", "tabs", "top", "=", "4_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2010", " ", "Unit", "ed", " ", "State", "s", " ", "Gov", "ern", "ment", " ", "as", " ", "represent", "ed", " ", "by", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Administra", "tor", " ", "of", " ", "the", " ", "Nat", "ional", " ", "Aer", "ona", "uti", "cs", " ", "and", " ", "Spac", "e", " ", "Administrati", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2011", " ", "Justi", "n", " ", "Santa", " ", "Bar", "bar", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "Rig", "hts", " ", "Reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", " ", "you", " ", "may", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", ".", " ", "You", " ", "may", " ", "obtain", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",", " ", "WITH", "OUT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or", " ", "impli", "ed", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and", " ", "limit", "ations_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "Handle", "s", " ", "all", " ", "process", "es", " ", "relati", "ng", " ", "to", " ", "instance", "s", " ", "(", "guest", " ", "vms", ").", "\\", "10", ";", "\\", "10", ";", "The", " ", ":", "py", ":", "class", ":`", "Compute", "Manager", "`", " ", "class", " ", "is", " ", "a", " ", ":", "py", ":", "class", ":`", "nova", ".", "manage", "r", ".", "Manager", "`", " ", "tha", "t", "\\", "10", ";", "handle", "s", " ", "RP", "C", " ", "calls", " ", "relati", "ng", " ", "to", " ", "creati", "ng", " ", "instance", "s", ".", " ", " ", "It", " ", "is", " ", "responsib", "le", " ", "for", "\\", "10", ";", "buildi", "ng", " ", "a", " ", "disk", " ", "image", ",", " ", "launch", "ing", " ", "it", " ", "via", " ", "the", " ", "underl", "ying", " ", "virtual", "izatio", "n", " ", "driver", ",", "\\", "10", ";", "respond", "ing", " ", "to", " ", "calls", " ", "to", " ", "check", " ", "its", " ", "state", ",", " ", "attach", "ing", " ", "persiste", "nt", " ", "storage", ",", " ", "and", "\\", "10", ";", "termina", "ting", " ", "it", ".", "\\", "10", ";", "\\", "10", ";", "**", "Rela", "ted", " ", "Fla", "gs", "**", "\\", "10", ";", "\\", "10", ";", ":", "instance", "s", "\\u", "path", ":", " ", " ", "Whe", "re", " ", "instance", "s", " ", "are", " ", "kep", "t", " ", "on", " ", "disk", "\\", "10", ";", ":", "compute", "\\u", "driver", ":", " ", " ", "Name", " ", "of", " ", "class", " ", "tha", "t", " ", "is", " ", "used", " ", "to", " ", "handle", " ", "virtual", "izatio", "n", ",", " ", "load", "ed", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "by", " ", ":", "func", ":`", "nova", ".", "util", "s", ".", "import", "\\u", "object", "`", "\\", "10", ";", ":", "volume", "\\u", "manage", "r", ":", " ", " ", "Name", " ", "of", " ", "class", " ", "tha", "t", " ", "handle", "s", " ", "persiste", "nt", " ", "storage", ",", " ", "load", "ed", " ", "by", "\\", "10", ";", " ", " ", " ", " ", " ", " ", ":", "func", ":`", "nova", ".", "util", "s", ".", "import", "\\u", "object", "`", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "functools_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "eventlet_", "import_", "green", "thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "nova_", "._", "context_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "block", "\\u", "device_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "flags_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "nova_", "._", "image_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "log_", "as_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "manager_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "network_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "rpc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "volume_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "import_", "db_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "compute_", "import_", "power", "\\u", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "compute_", "import_", "task", "\\u", "states_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "compute_", "import_", "vm", "\\u", "states_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "notifier_", "import_", "api_", "as_", "notifier_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "compute_", "._", "utils_", "import_", "terminate", "\\u", "volumes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nova_", "._", "virt_", "import_", "driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "FLAGS_", "=_", "flags_", "._", "FLAGS_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "._", "DEFINE", "\\u", "string_", "(_", "'", "instance", "s", "\\u", "path", "'_", ",_", "'$", "state", "\\u", "path", "/", "instance", "s", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "where", " ", "instance", "s", " ", "are", " ", "store", "d", " ", "on", " ", "disk", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "._", "DEFINE", "\\u", "string_", "(_", "'", "compute", "\\u", "driver", "'_", ",_", "'", "nova", ".", "virt", ".", "connecti", "on", ".", "get", "\\u", "connecti", "on", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Drive", "r", " ", "to", " ", "use", " ", "for", " ", "controll", "ing", " ", "virtual", "izatio", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "._", "DEFINE", "\\u", "string_", "(_", "'", "stub", "\\u", "network", "'_", ",_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Stu", "b", " ", "network", " ", "relate", "d", " ", "code", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "._", "DEFINE", "\\u", "integer_", "(_", "'", "password", "\\u", "length", "'_", ",_", "12_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Length", " ", "of", " ", "generat", "ed", " ", "admin", " ", "passwords", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "._", "DEFINE", "\\u", "string_", "(_", "'", "console", "\\u", "host", "'_", ",_", "socket_", "._", "gethostname_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Cons", "ole", " ", "proxy", " ", "host", " ", "to", " ", "use", " ", "to", " ", "connect", " ", "to", " ", "instance", "s", " ", "on", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "this", " ", "host", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "._", "DEFINE", "\\u", "integer_", "(_", "'", "live", "\\u", "migrati", "on", "\\u", "retr", "y", "\\u", "count", "'_", ",_", "30_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Retr", "y", " ", "count", " ", "need", "ed", " ", "in", " ", "live", "\\u", "migrati", "on", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "sleep", " ", "1", " ", "sec", " ", "for", " ", "each", " ", "count", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "._", "DEFINE", "\\u", "integer_", "(_", "\"", "rescue", "\\u", "timeo", "ut", "\"_", ",_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Automat", "ical", "ly", " ", "unres", "cue", " ", "an", " ", "instance", " ", "after", " ", "N", " ", "second", "s", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "Set", " ", "to", " ", "0", " ", "to", " ", "disable", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "flags_", "._", "DEFINE", "\\u", "integer_", "(_", "'", "host", "\\u", "state", "\\u", "interval", "'_", ",_", "120_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Interv", "al", " ", "in", " ", "second", "s", " ", "for", " ", "query", "ing", " ", "the", " ", "host", " ", "status", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "=_", "logging_", "._", "get", "Logger_", "(_", "'", "nova", ".", "compute", ".", "manage", "r", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "publi", "sher", "\\u", "id_", "(_", "host_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "notifier_", "._", "publi", "sher", "\\u", "id_", "(_", "\"", "compute", "\"_", ",_", "host_", ")_", "\\u\\u\\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_", "checks", "\\u", "instance", "\\u", "lock_", "(_", "function_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Decorat", "or", " ", "to", " ", "prevent", " ", "action", " ", "against", " ", "lock", "ed", " ", "instance", "s", " ", "for", " ", "non", "-", "admin", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "functools_", "._", "wraps_", "(_", "function_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "decorated", "\\u", "function_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", "(", "any", "one", "):", " ", "this", " ", "bei", "ng", " ", "call", "ed", " ", "instance", "\\u", "id", " ", "is", " ", "forcing", " ", "a", " ", "slight", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "conf", "usi", "ng", " ", "convention", " ", "of", " ", "push", "ing", " ", "instance", "\\u", "uuids_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "through", " ", "an", " ", "\"", "instance", "\\u", "id", "\"", " ", "key", " ", "in", " ", "the", " ", "queue", " ", "args", " ", "dict", " ", "when_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "casting", " ", "through", " ", "the", " ", "compute", " ", "API_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "info_", "(_", "\\u_", "(_", "\"", "check", "\\u", "instance", "\\u", "lock", ":", " ", "decorat", "ing", ":", " ", "|", "%", "s", "|\"_", ")_", ",_", "function_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "info_", "(_", "\\u_", "(_", "\"", "check", "\\u", "instance", "\\u", "lock", ":", " ", "argu", "ment", "s", ":", " ", "|", "%", "(", "self", ")", "s", "|", " ", "|", "%", "(", "context", ")", "s", "|\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "|", "%", "(", "instance", "\\u", "id", ")", "s", "|\"_", ")_", "%_", "locals_", "(_", ")_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "locked_", "=_", "self_", "._", "get", "\\u", "lock_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "admin_", "=_", "context_", "._", "is", "\\u", "admin_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "info_", "(_", "\\u_", "(_", "\"", "check", "\\u", "instance", "\\u", "lock", ":", " ", "lock", "ed", ":", " ", "|", "%", "s", "|\"_", ")_", ",_", "locked_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "info_", "(_", "\\u_", "(_", "\"", "check", "\\u", "instance", "\\u", "lock", ":", " ", "admin", ":", " ", "|", "%", "s", "|\"_", ")_", ",_", "admin_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "admin", " ", "or", " ", "unlocked", " ", "call", " ", "function", " ", "other", "wis", "e", " ", "log", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "admin_", "or_", "not_", "locked_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "info_", "(_", "\\u_", "(_", "\"", "check", "\\u", "instance", "\\u", "lock", ":", " ", "executi", "ng", ":", " ", "|", "%", "s", "|\"_", ")_", ",_", "function_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "function_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\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_", "._", "error_", "(_", "\\u_", "(_", "\"", "check", "\\u", "instance", "\\u", "lock", ":", " ", "not", " ", "executi", "ng", " ", "|", "%", "s", "|\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "function_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "decorated", "\\u", "function_", "\\u\\u\\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_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Manage", "s", " ", "the", " ", "runn", "ing", " ", "instance", "s", " ", "from", " ", "creati", "on", " ", "to", " ", "destruct", "ion", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u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u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "compute", "\\u", "driver_", "=_", "None_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Load", " ", "configura", "tion", " ", "options", " ", "and", " ", "connect", " ", "to", " ", "the", " ", "hypervisor", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", "(", "vis", "h", "):", " ", "sync", " ", "driver", " ", "creati", "on", " ", "logic", " ", "with", " ", "the", " ", "rest", " ", "of", " ", "the", " ", "system_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "and", " ", "redo", "cum", "ent", " ", "the", " ", "module", " ", "docstring_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "compute", "\\u", "driver_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "compute", "\\u", "driver_", "=_", "FLAGS_", "._", "compute", "\\u", "driver_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "driver_", "=_", "utils_", "._", "check", "\\u", "isinstance_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "utils_", "._", "import", "\\u", "object_", "(_", "compute", "\\u", "driver_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "driver_", "._", "Compute", "Driver_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "error_", "(_", "\\u_", "(_", "\"", "Una", "ble", " ", "to", " ", "load", " ", "the", " ", "virtual", "izatio", "n", " ", "driver", ":", " ", "%", "s", "\"_", ")_", "%_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "network", "\\u", "api_", "=_", "network_", "._", "API_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "network", "\\u", "manager_", "=_", "utils_", "._", "import", "\\u", "object_", "(_", "FLAGS_", "._", "network", "\\u", "manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "volume", "\\u", "manager_", "=_", "utils_", "._", "import", "\\u", "object_", "(_", "FLAGS_", "._", "volume", "\\u", "manager_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "last", "\\u", "host", "\\u", "check_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Compute", "Manager_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "service", "\\u", "name_", "=_", "\"", "compute", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "instance", "\\u", "update_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", " ", "an", " ", "instance", " ", "in", " ", "the", " ", "databa", "se", " ", "usi", "ng", " ", "kwarg", "s", " ", "as", " ", "value", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "db_", "._", "instance", "\\u", "update_", "(_", "context_", ",_", "instance", "\\u", "id_", ",_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "init", "\\u", "host_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initializ", "ation", " ", "for", " ", "a", " ", "standalone", " ", "compute", " ", "service", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "init", "\\u", "host_", "(_", "host_", "=_", "self_", "._", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "nova_", "._", "context_", "._", "get", "\\u", "admin", "\\u", "context_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instances_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get", "\\u", "all", "\\u", "by", "\\u", "host_", "(_", "context_", ",_", "self_", "._", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "instance_", "in_", "instances_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "inst", "\\u", "name_", "=_", "instance_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "\\u", "state_", "=_", "instance_", "[_", "'", "power", "\\u", "state", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "drv", "\\u", "state_", "=_", "self_", "._", "\\u", "get", "\\u", "power", "\\u", "state_", "(_", "context_", ",_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "expect", "\\u", "running_", "=_", "db", "\\u", "state_", "==_", "power", "\\u", "state_", "._", "RUNNING_", "and_", "drv", "\\u", "state_", "!=_", "db", "\\u", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "._", "debug_", "(_", "\\u_", "(_", "'", "Curr", "ent", " ", "state", " ", "of", " ", "%", "(", "inst", "\\u", "name", ")", "s", " ", "is", " ", "%", "(", "drv", "\\u", "state", ")", "s", ",", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "state", " ", "in", " ", "DB", " ", "is", " ", "%", "(", "db", "\\u", "state", ")", "s", ".'_", ")_", ",_", "locals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "expect", "\\u", "running_", "and_", "FLAGS_", "._", "resum", "e\\u", "guest", "s", "\\u", "state", "\\u", "on", "\\u", "host", "\\u", "boot_", ")_", "or_", "FLAGS_", "._", "start", "\\u", "guest", "s", "\\u", "on", "\\u", "host", "\\u", "boot_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "info_", "(_", "\\u_", "(_", "'", "Reboot", "ing", " ", "instance", " ", "%", "(", "inst", "\\u", "name", ")", "s", " ", "after", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nova", "-", "compute", " ", "restart", ".'_", ")_", ",_", "locals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rebo", "ot", "\\u", "instance_", "(_", "context_", ",_", "instance_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "drv", "\\u", "state_", "==_", "power", "\\u", "state_", "._", "RUNNING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Hyper", "-", "V", " ", "and", " ", "VM", "War", "e", "API", " ", "driver", "s", " ", "will", " ", "raise", " ", "and", " ", "exception_", "\\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 ", " ", "_", "net", "\\u", "info_", "=_", "self_", "._", "\\u", "get", "\\u", "instance", "\\u", "nw", "\\u", "info_", "(_", "context_", ",_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "ensure", "\\u", "filtering", "\\u", "rule", "s", "\\u", "for", "\\u", "instance_", "(_", "instance_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "net", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Not", "Impl", "ement", "ed", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "LOG_", "._", "warning_", "(_", "\\u_", "(_", "'", "Hyper", "visor", " ", "driver", " ", "doe", "s", " ", "not", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "support", " ", "firew", "all", " ", "rule", "s", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "power", "\\u", "state_", "(_", "self_", ",_", "context_", ",_", "instance_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", " ", "the", " ", "power", " ", "state", " ", "for", " ", "the", " ", "give", "n", " ", "instance", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "debug_", "(_", "\\u_", "(_", "'", "Check", "ing", " ", "state", " ", "of", " ", "%", "s", "'_", ")_", ",_", "instance_", "[_", "'", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "driver_", "._", "get", "\\u", "info_", "(_", "instance_", "[_", "'", "name", "'_", "]_", ")_", "[_", "\"", "state", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exception_", "._", "Not", "Found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "power", "\\u", "state_", "._", "FAILED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\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", "console", "\\u", "topic_", "(_", "self_", ",_", "context_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", "s", " ", "the", " ", "console", " ", "host", " ", "for", " ", "a", " ", "project", " ", "on", " ", "this", " ", "host", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Curr", "ent", "ly", " ", "this", " ", "is", " ", "just", " ", "set", " ", "in", " ", "the", " ", "flags", " ", "for", " ", "each", " ", "compute", " ", "host", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "TOD", "O", "(", "md", "rag", "on", "):", " ", "per", "hap", "s", " ", "make", " ", "this", " ", "variab", "le", " ", "by", " ", "console", "\\u", "type", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "db_", "._", "queue", "\\u", "get", "\\u", "for_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "FLAGS_", "._", "console", "\\u", "topic_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "FLAGS_", "._", "console", "\\u", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "console", "\\u", "pool", "\\u", "info_", "(_", "self_", ",_", "context_", ",_", "console", "\\u", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "driver_", "._", "get", "\\u", "console", "\\u", "pool", "\\u", "info_", "(_", "console", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "refre", "sh", "\\u", "security", "\\u", "group", "\\u", "rules_", "(_", "self_", ",_", "context_", ",_", "security", "\\u", "group", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Tell", " ", "the", " ", "virtual", "izatio", "n", " ", "driver", " ", "to", " ", "refre", "sh", " ", "security", " ", "group", " ", "rule", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Passe", "s", " ", "straight", " ", "through", " ", "to", " ", "the", " ", "virtual", "izatio", "n", " ", "driver", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "driver_", "._", "refre", "sh", "\\u", "security", "\\u", "group", "\\u", "rules_", "(_", "security", "\\u", "group", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "refre", "sh", "\\u", "security", "\\u", "group", "\\u", "members_", "(_", "self_", ",_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "security", "\\u", "group", "\\u", "id_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Tell", " ", "the", " ", "virtual", "izatio", "n", " ", "driver", " ", "to", " ", "refre", "sh", " ", "security", " ", "group", " ", "member", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Passe", "s", " ", "straight", " ", "through", " ", "to", " ", "the", " ", "virtual", "izatio", "n", " ", "driver", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "driver_", "._", "refre", "sh", "\\u", "security", "\\u", "group", "\\u", "members_", "(_", "security", "\\u", "group", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "refre", "sh", "\\u", "provide", "r", "\\u", "fw", "\\u", "rules_", "(_", "self_", ",_", "context_", ",_", "**_", "\\u", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Thi", "s", " ", "call", " ", "pass", "es", " ", "straight", " ", "through", " ", "to", " ", "the", " ", "virtual", "izatio", "n", " ", "driver", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "driver_", "._", "refre", "sh", "\\u", "provide", "r", "\\u", "fw", "\\u", "rules_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "get", "\\u", "instance", "\\u", "nw", "\\u", "info_", "(_", "self_", ",_", "context_", ",_", "instance_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Get", " ", "a", " ", "list", " ", "of", " ", "dictionar", "ies", " ", "of", " ", "network", " ", "data", " ", "of", " ", "an", " ", "instance", ".", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "an", " ", "empty", " ", "list", " ", "if", " ", "stub", "\\u", "network", " ", "flag", " ", "is", " ", "set", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "\\u", "info_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "FLAGS_", "._", "stub", "\\u", "network_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network", "\\u", "info_", "=_", "self_", "._", "network", "\\u", "api_", "._", "get", "\\u", "instance", "\\u", "nw", "\\u", "info_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "network", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "setup", "\\u", "block", "\\u", "device", "\\u", "mapping_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "setup", " ", "volume", "s", " ", "for", " ", "block", " ", "device", " ", "mapping", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "volume", "\\u", "api_", "=_", "volume_", "._", "API_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block", "\\u", "device", "\\u", "mapping_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "swap_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ephemeral", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "bdm_", "in_", "self_", "._", "db_", "._", "block", "\\u", "device", "\\u", "mapping", "\\u", "get", "\\u", "all", "\\u", "by", "\\u", "instance_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "debug_", "(_", "\\u_", "(_", "\"", "setti", "ng", " ", "up", " ", "bdm", " ", "%", "s", "\"_", ")_", ",_", "bdm_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "bdm_", "[_", "'", "no", "\\u", "device", "'_", "]_", ":_", "\\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_", "bdm_", "[_", "'", "virtual", "\\u", "name", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "virtual", "\\u", "name_", "=_", "bdm_", "[_", "'", "virtual", "\\u", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "device", "\\u", "name_", "=_", "bdm_", "[_", "'", "device", "\\u", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "block", "\\u", "device_", "._", "is", "\\u", "swap", "\\u", "or", "\\u", "ephemeral", "_", "(_", "virtual", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "virtual", "\\u", "name_", "==_", "'", "swap", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "swap_", "=_", "{_", "'", "device", "\\u", "name", "'_", ":_", "device", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "swap", "\\u", "size", "'_", ":_", "bdm_", "[_", "'", "volume", "\\u", "size", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "block", "\\u", "device_", "._", "is", "\\u", "ephemeral", "_", "(_", "virtual", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "eph", "_", "=_", "{_", "'", "num", "'_", ":_", "block", "\\u", "device_", "._", "ephemeral", "\\u", "num_", "(_", "virtual", "\\u", "name_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "virtual", "\\u", "name", "'_", ":_", "virtual", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "device", "\\u", "name", "'_", ":_", "device", "\\u", "name_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "size", "'_", ":_", "bdm_", "[_", "'", "volume", "\\u", "size", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ephemeral", "s_", "._", "append_", "(_", "eph", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "(_", "bdm_", "[_", "'", "snapshot", "\\u", "id", "'_", "]_", "is_", "not_", "None_", ")_", "and_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "bdm_", "[_", "'", "volume", "\\u", "id", "'_", "]_", "is_", "None_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", "(", "ya", "mah", "ata", "):", " ", "default", " ", "name", " ", "and", " ", "description_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vol_", "=_", "volume", "\\u", "api_", "._", "create_", "(_", "context_", ",_", "bdm_", "[_", "'", "volume", "\\u", "size", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bdm_", "[_", "'", "snapshot", "\\u", "id", "'_", "]_", ",_", "''_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", "(", "ya", "mah", "ata", "):", " ", "creati", "ng", " ", "volume", " ", "simultaneous", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "reduce", "s", " ", "creati", "on", " ", "time", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "volume", "\\u", "api_", "._", "wait", "\\u", "creation_", "(_", "context_", ",_", "vol_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "block", "\\u", "device", "\\u", "mapping", "\\u", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "context_", ",_", "bdm_", "[_", "'", "id", "'_", "]_", ",_", "{_", "'", "volume", "\\u", "id", "'_", ":_", "vol_", "[_", "'", "id", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bdm_", "[_", "'", "volume", "\\u", "id", "'_", "]_", "=_", "vol_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "(_", "(_", "bdm_", "[_", "'", "snapshot", "\\u", "id", "'_", "]_", "is_", "None_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "bdm_", "[_", "'", "volume", "\\u", "id", "'_", "]_", "is_", "not_", "None_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "error_", "(_", "\\u_", "(_", "'", "corrupted", " ", "state", " ", "of", " ", "block", " ", "device", " ", "mapping", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", ":", " ", "%", "(", "id", ")", "s", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "snapshot", ":", " ", "%", "(", "snapshot", "\\u", "id", ")", " ", "volume", ":", " ", "%", "(", "vol", "lum", "e\\u", "id", ")'_", ")_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "id", "'_", ":_", "bdm_", "[_", "'", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "snapshot", "\\u", "id", "'_", ":_", "bdm_", "[_", "'", "snapshot", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "volume", "\\u", "id", "'_", ":_", "bdm_", "[_", "'", "volume", "\\u", "id", "'_", "]_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exception_", "._", "Ap", "i", "Error_", "(_", "\\u_", "(_", "'", "broken", " ", "block", " ", "device", " ", "mapping", " ", "%", "d", "'_", ")_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "bdm_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "bdm_", "[_", "'", "volume", "\\u", "id", "'_", "]_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "volume", "\\u", "api_", "._", "check", "\\u", "attach_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "volume", "\\u", "id_", "=_", "bdm_", "[_", "'", "volume", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dev", "\\u", "path_", "=_", "self_", "._", "\\u", "attach", "\\u", "volume", "\\u", "boot_", "(_", "context_", ",_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bdm_", "[_", "'", "volume", "\\u", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "bdm_", "[_", "'", "device", "\\u", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block", "\\u", "device", "\\u", "mapping_", "._", "append_", "(_", "{_", "'", "device", "\\u", "path", "'_", ":_", "dev", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mount", "\\u", "device", "'_", ":_", "\\u\\u\\uNL\\u\\u\\u_", "bdm_", "[_", "'", "device", "\\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_", "return_", "(_", "swap_", ",_", "ephemeral", "s_", ",_", "block", "\\u", "device", "\\u", "mapping_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "run", "\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Launch", " ", "a", " ", "new", " ", "instance", " ", "with", " ", "specified", " ", "options", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "check", "\\u", "image", "\\u", "size_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Ensur", "e", " ", "image", " ", "is", " ", "small", "er", " ", "than", " ", "the", " ", "maxim", "um", " ", "size", " ", "allow", "ed", " ", "by", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "instance", "\\u", "type", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "image", " ", "store", "d", " ", "in", " ", "Glance", " ", "is", " ", "potenti", "ally", " ", "compress", "ed", ",", " ", "so", " ", "we", " ", "use", " ", "two", "\\", "10", ";", " ", " ", " ", " ", "checks", " ", "to", " ", "ensure", " ", "tha", "t", " ", "the", " ", "size", " ", "isn", "'", "t", " ", "exceed", "ed", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "1", ")", " ", "Thi", "s", " ", "one", " ", "-", " ", "checks", " ", "compress", "ed", " ", "size", ",", " ", "this", " ", "a", " ", "quick", " ", "check", " ", "to", "\\", "10", ";", " ", "eliminat", "e", " ", "any", " ", "images", " ", "whi", "ch", " ", "are", " ", "ob", "vio", "usl", "y", " ", "too", " ", "large", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "2", ")", " ", "Check", " ", "uncompressed", " ", "size", " ", "in", " ", "nova", ".", "virt", ".", "xenapi", ".", "vm", "\\u", "util", "s", ".", " ", "Thi", "s", "\\", "10", ";", " ", "is", " ", "a", " ", "slowe", "r", " ", "check", " ", "sinc", "e", " ", "it", " ", "require", "s", " ", "uncom", "press", "ing", " ", "the", " ", "entire", "\\", "10", ";", " ", "image", ",", " ", "but", " ", "is", " ", "accurate", " ", "bec", "aus", "e", " ", "it", " ", "reflect", "s", " ", "the", " ", "image", "'", "s", "\\", "10", ";", " ", "actual", " ", "size", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "jk", "0", "):", " ", "image", "\\u", "ref", " ", "is", " ", "defin", "ed", " ", "in", " ", "the", " ", "DB", " ", "model", ",", " ", "image", "\\u", "href", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "used", " ", "by", " ", "the", " ", "image", " ", "service", ".", " ", "Thi", "s", " ", "shou", "ld", " ", "be", " ", "refactor", "ed", " ", "to", " ", "be_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "consistent", "._", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "href_", "=_", "instance_", "[_", "'", "image", "\\u", "ref", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "service_", ",_", "image", "\\u", "id_", "=_", "nova_", "._", "image_", "._", "get", "\\u", "image", "\\u", "service_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "href_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "meta_", "=_", "image", "\\u", "service_", "._", "show_", "(_", "context_", ",_", "image", "\\u", "id_", ")_", "\\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 ", " _", "size", "\\u", "bytes_", "=_", "image", "\\u", "meta_", "[_", "'", "size", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Key", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Size", " ", "is", " ", "not", " ", "a", " ", "require", "d", " ", "field", " ", "in", " ", "the", " ", "image", " ", "service", " ", "(", "ye", "t", "),", " ", "so_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "we", " ", "are", " ", "una", "ble", " ", "to", " ", "rely", " ", "on", " ", "it", " ", "bei", "ng", " ", "there", " ", "even", " ", "tho", "ugh", " ", "it", "'", "s", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "gla", "nce", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", "(", "jk", "0", "):", " ", "Sho", "ul", "d", " ", "size", " ", "be", " ", "require", "d", " ", "in", " ", "the", " ", "image", " ", "service", "?", "_", "\\u\\u\\uNL\\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_", "instance", "\\u", "type", "\\u", "id_", "=_", "instance_", "[_", "'", "instance", "\\u", "type", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "type_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "type", "\\u", "get_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "type", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "allow", "ed", "\\u", "size", "\\u", "gb_", "=_", "instance", "\\u", "type_", "[_", "'", "local", "\\u", "gb", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", "(", "jk", "0", "):", " ", "Sin", "ce", " ", "libvi", "rt", " ", "use", "s", " ", "local", "\\u", "gb", " ", "as", " ", "a", " ", "second", "ary", " ", "drive", ",", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "need", " ", "to", " ", "handle", " ", "potenti", "al", " ", "situation", "s", " ", "where", " ", "local", "\\u", "gb", " ", "is", " ", "0.", " ", "Thi", "s", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "default", " ", "for", " ", "m1", ".", "tiny", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "allow", "ed", "\\u", "size", "\\u", "gb_", "==_", "0_", ":_", "\\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_", "allow", "ed", "\\u", "size", "\\u", "bytes_", "=_", "allow", "ed", "\\u", "size", "\\u", "gb_", "*_", "1024_", "*_", "1024_", "*_", "1024_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "._", "debug_", "(_", "\\u_", "(_", "\"", "image", "\\u", "id", "=", "%", "(", "image", "\\u", "id", ")", "d", ",", " ", "image", "\\u", "size", "\\u", "bytes", "=\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "(", "size", "\\u", "bytes", ")", "d", ",", " ", "allow", "ed", "\\u", "size", "\\u", "bytes", "=\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "(", "allow", "ed", "\\u", "size", "\\u", "bytes", ")", "d", "\"_", ")_", "%_", "locals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "size", "\\u", "bytes_", ">_", "allow", "ed", "\\u", "size", "\\u", "bytes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "info_", "(_", "\\u_", "(_", "\"", "Image", " ", "'%", "(", "image", "\\u", "id", ")", "d", "'", " ", "size", " ", "%", "(", "size", "\\u", "bytes", ")", "d", " ", "exceed", "ed", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "instance", "\\u", "type", " ", "allow", "ed", " ", "size", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "(", "allow", "ed", "\\u", "size", "\\u", "bytes", ")", "d", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "locals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exception_", "._", "Image", "Too", "Large", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "make", "\\u", "network", "\\u", "info_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "FLAGS_", "._", "stub", "\\u", "network_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "TOD", "O", "(", "tr", "3b", "uche", "t", ")", " ", "not", " ", "reall", "y", " ", "sure", " ", "how", " ", "this", " ", "shou", "ld", " ", "be", " ", "handle", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "virt", " ", "require", "s", " ", "network", "\\u", "info", " ", "to", " ", "be", " ", "pass", "ed", " ", "in", " ", "but", " ", "stub", "\\u", "network_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "is", " ", "enable", "d", ".", " ", "Sett", "ing", " ", "to", " ", "[]", " ", "for", " ", "now", " ", "will", " ", "caus", "e", " ", "virt", " ", "to", " ", "skip_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "all", " ", "vi", "f", " ", "creati", "on", " ", "and", " ", "network", " ", "injection", ",", " ", "may", "be", " ", "this", " ", "is", " ", "correct_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network", "\\u", "info_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "vis", "h", "):", " ", "Thi", "s", " ", "coul", "d", " ", "be", " ", "a", " ", "cast", " ", "bec", "aus", "e", " ", "we", " ", "don", "'", "t", " ", "do_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "anyt", "hing", " ", "with", " ", "the", " ", "address", " ", "currentl", "y", ",", " ", "but", " ", "I", "'", "m", " ", "leaving", " ", "it", " ", "as", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "call", " ", "to", " ", "ensure", " ", "tha", "t", " ", "network", " ", "setup", " ", "complete", "s", ".", " ", " ", "We", " ", "will", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "eventual", "ly", " ", "als", "o", " ", "need", " ", "to", " ", "save", " ", "the", " ", "address", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "network", "\\u", "info_", "=_", "self_", "._", "network", "\\u", "api_", "._", "allocate", "\\u", "for", "\\u", "instance_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance_", ",_", "vpn_", "=_", "is", "\\u", "vpn_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "request", "ed", "\\u", "networks_", "=_", "request", "ed", "\\u", "networks_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "debug_", "(_", "\\u_", "(_", "\"", "instance", " ", "network", "\\u", "info", ":", " ", "|", "%", "s", "|\"_", ")_", ",_", "network", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "network", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "make", "\\u", "block", "\\u", "device", "\\u", "info_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "swap_", ",_", "ephemeral", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "block", "\\u", "device", "\\u", "mapping_", ")_", "=_", "self_", "._", "\\u", "setup", "\\u", "block", "\\u", "device", "\\u", "mapping_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block", "\\u", "device", "\\u", "info_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "root", "\\u", "device", "\\u", "name", "'_", ":_", "instance_", "[_", "'", "root", "\\u", "device", "\\u", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "swap", "'_", ":_", "swap_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ephemeral", "s", "'_", ":_", "ephemeral", "s_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "block", "\\u", "device", "\\u", "mapping", "'_", ":_", "block", "\\u", "device", "\\u", "mapping_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "block", "\\u", "device", "\\u", "info_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "deal", "locat", "e\\u", "network_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "FLAGS_", "._", "stub", "\\u", "network_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "debug_", "(_", "\\u_", "(_", "\"", "deal", "locat", "ing", " ", "network", " ", "for", " ", "instance", ":", " ", "%", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "network", "\\u", "api_", "._", "deal", "locat", "e\\u", "for", "\\u", "instance_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "request", "ed", "\\u", "networks_", "=_", "kwargs_", "._", "get_", "(_", "'", "request", "ed", "\\u", "network", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "instance_", "[_", "'", "name", "'_", "]_", "in_", "self_", "._", "driver_", "._", "list", "\\u", "instances_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Error_", "(_", "\\u_", "(_", "\"", "Insta", "nce", " ", "has", " ", "alr", "ead", "y", " ", "bee", "n", " ", "created", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "check", "\\u", "image", "\\u", "size_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "\\u_", "(_", "\"", "instance", " ", "%", "s", ":", " ", "startin", "g", "...\"_", ")_", ",_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "updates_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "updates_", "[_", "'", "host", "'_", "]_", "=_", "self_", "._", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "updates_", "[_", "'", "launched", "\\u", "on", "'_", "]_", "=_", "self_", "._", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "updates_", "[_", "'", "vm", "\\u", "state", "'_", "]_", "=_", "vm", "\\u", "states_", "._", "BUILD", "ING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "updates_", "[_", "'", "task", "\\u", "state", "'_", "]_", "=_", "task", "\\u", "states_", "._", "NET", "WORK", "ING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "update_", "(_", "context_", ",_", "instance", "\\u", "id_", ",_", "updates_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "[_", "'", "injected", "\\u", "files", "'_", "]_", "=_", "kwargs_", "._", "get_", "(_", "'", "injected", "\\u", "files", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "[_", "'", "admin", "\\u", "pass", "'_", "]_", "=_", "kwargs_", "._", "get_", "(_", "'", "admin", "\\u", "password", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "is", "\\u", "vpn_", "=_", "instance_", "[_", "'", "image", "\\u", "ref", "'_", "]_", "==_", "str_", "(_", "FLAGS_", "._", "vpn", "\\u", "image", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "\\u", "info_", "=_", "\\u", "make", "\\u", "network", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "inner", "\\u", "run", "\\u", "instance_", "(_", ")_", ":_", "\\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", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "BUILD", "ING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "task", "\\u", "states_", "._", "BLOCK", "\\u", "DEV", "ICE", "\\u", "MAPPING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "block", "\\u", "device", "\\u", "info_", "=_", "\\u", "make", "\\u", "block", "\\u", "device", "\\u", "info_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "BUILD", "ING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "task", "\\u", "states_", "._", "SPA", "WN", "ING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", "(", "vis", "h", ")", " ", "check", " ", "to", " ", "make", " ", "sure", " ", "the", " ", "avail", "abilit", "y", " ", "zone", " ", "matches_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "driver_", "._", "spawn_", "(_", "context_", ",_", "instance_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "info_", ",_", "block", "\\u", "device", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "ex_", ":_", "#", " ", "pylint", ":", " ", "disable", "=", "W", "070", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "msg_", "=_", "\\u_", "(_", "\"", "Insta", "nce", " ", "'%", "(", "instance", "\\u", "id", ")", "s", "'", " ", "fail", "ed", " ", "to", " ", "spawn", ".", " ", "Is", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "virtual", "izatio", "n", " ", "enable", "d", " ", "in", " ", "the", " ", "BIOS", "?", " ", "Det", "ail", "s", ":", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "(", "ex", ")", "s", "\"_", ")_", "%_", "locals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "exception_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "deal", "locat", "e\\u", "network_", "(_", ")_", "\\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_", "current", "\\u", "power", "\\u", "state_", "=_", "self_", "._", "\\u", "get", "\\u", "power", "\\u", "state_", "(_", "context_", ",_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "state_", "=_", "current", "\\u", "power", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "ACTIVE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "launched", "\\u", "at_", "=_", "utils_", "._", "utcnow_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "usage", "\\u", "info_", "=_", "utils_", "._", "usage", "\\u", "from", "\\u", "instance_", "(_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "notifier_", "._", "notify_", "(_", "'", "compute", ".", "%", "s", "'_", "%_", "self_", "._", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "compute", ".", "instance", ".", "create", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "notifier_", "._", "INFO_", ",_", "usage", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exception_", "._", "Insta", "nce", "Not", "Found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "FIX", "ME", "(", "ww", "ol", "f", "):", " ", "We", " ", "are", " ", "just", " ", "ign", "orin", "g", " ", "Insta", "nce", "Not", "Found_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "exception", "s", " ", "here", " ", "in", " ", "case", " ", "the", " ", "instance", " ", "was", " ", "immediate", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "delete", "d", " ", "bef", "ore", " ", "it", " ", "actual", "ly", " ", "got", " ", "created", ".", " ", " ", "Thi", "s", " ", "should_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "be", " ", "fixed", " ", "onc", "e", " ", "we", " ", "have", " ", "no", "-", "db", "-", "messaging_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "utils_", "._", "save", "\\u", "and", "\\u", "reraise", "\\u", "exception_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "\\u", "deal", "locat", "e\\u", "network_", "(_", ")_", "\\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_", "green", "thread_", "._", "spawn_", "(_", "\\u", "inner", "\\u", "run", "\\u", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "run", "\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "run", "\\u", "instance_", "(_", "context_", ",_", "instance", "\\u", "id_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#@", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "start", "\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Start", "ing", " ", "an", " ", "instance", " ", "on", " ", "this", " ", "host", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "inner", "\\u", "start", "\\u", "instance_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instance_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "start_", "(_", "context_", ",_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "ACTIVE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "green", "thread_", "._", "spawn_", "(_", "\\u", "inner", "\\u", "start", "\\u", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "shut", "down", "\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "action", "\\u", "str_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Shut", "down", " ", "an", " ", "instance", " ", "on", " ", "this", " ", "host", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "\\u_", "(_", "\"%", "(", "action", "\\u", "str", ")", "s", " ", "instance", " ", "%", "(", "instance", "\\u", "id", ")", "s", "\"_", ")_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "action", "\\u", "str", "'_", ":_", "action", "\\u", "str_", ",_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "info_", "=_", "self_", "._", "\\u", "get", "\\u", "instance", "\\u", "nw", "\\u", "info_", "(_", "context_", ",_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "FLAGS_", "._", "stub", "\\u", "network_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "network", "\\u", "api_", "._", "deal", "locat", "e\\u", "for", "\\u", "instance_", "(_", "context_", ",_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "volume", "s", " ", "=", " ", "instance", ".", "get", "('", "volume", "s", "')", " ", "or", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "for", " ", "volume", " ", "in", " ", "volume", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".\\u", "deta", "ch", "\\u", "volume", "(", "context", ",", " ", "instance", "\\u", "id", ",", " ", "volume", "['", "id", "']", ",", " ", "Fal", "se", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "instance", "['", "power", "\\u", "state", "']", " ", "==", " ", "power", "\\u", "state", ".", "SHU", "TO", "FF", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "self", ".", "db", ".", "instance", "\\u", "destroy", "(", "context", ",", " ", "instance", "\\u", "id", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "raise", " ", "exception", ".", "Error", "(\\u", "('", "try", "ing", " ", "to", " ", "destroy", " ", "alr", "ead", "y", " ", "destroy", "ed", "'_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", " ", "'", " ", "instance", ":", " ", "%", "s", "')", " ", "%", " ", "instance", "\\u", "id", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "driver_", "._", "destroy_", "(_", "context_", ",_", "instance_", ",_", "network", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "if", " ", "action", "\\u", "str", " ", "==", " ", "'", "Terminati", "ng", "':", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "terminate", "\\u", "volume", "s", "(", "self", ".", "db", ",", " ", "context", ",", " ", "instance", "\\u", "id", ")_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "terminate", "\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Terminate", " ", "an", " ", "instance", " ", "on", " ", "this", " ", "host", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "inner", "\\u", "terminate", "\\u", "instance_", "(_", ")_", ":_", "\\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", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "DELETED", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "terminate", "d\\u", "at_", "=_", "utils_", "._", "utcnow_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "bm", "m_", "=_", "self_", "._", "\\u", "shut", "down", "\\u", "instance_", "(_", "context_", ",_", "instance", "\\u", "id_", ",_", "'", "Terminati", "ng", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", "._", "elevat", "ed_", "(_", ")_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "new_", "=_", "db_", "._", "instance", "\\u", "create_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "avail", "abilit", "y", "\\u", "zone", "\"_", ":_", "\"", "resource", "\\u", "pool", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "user", "\\u", "id", "\"_", ":_", "instance_", "[_", "\"", "user", "\\u", "id", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "project", "\\u", "id", "\"_", ":_", "instance_", "[_", "\"", "project", "\\u", "id", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "kernel", "\\u", "id", "\"_", ":_", "instance_", "[_", "\"", "kernel", "\\u", "id", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "host", "\"_", ":_", "instance_", "[_", "\"", "host", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "display", "\\u", "name", "\"_", ":_", "instance_", "[_", "\"", "display", "\\u", "name", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "instance", "\\u", "type", "\\u", "id", "\"_", ":_", "instance_", "[_", "\"", "instance", "\\u", "type", "\\u", "id", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vcpu", "s", "\"_", ":_", "instance_", "[_", "\"", "vcpu", "s", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "vm", "\\u", "state", "\"_", ":_", "vm", "\\u", "states_", "._", "BUILD", "ING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "image", "\\u", "ref", "\"_", ":_", "FLAGS_", "._", "dod", "ai", "\\u", "default", "\\u", "image_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "db_", "._", "instance", "\\u", "destroy_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "usage", "\\u", "info_", "=_", "utils_", "._", "usage", "\\u", "from", "\\u", "instance_", "(_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "notifier_", "._", "notify_", "(_", "'", "compute", ".", "%", "s", "'_", "%_", "self_", "._", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "compute", ".", "instance", ".", "delete", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "notifier_", "._", "INFO_", ",_", "usage", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "driver_", "._", "add", "\\u", "to", "\\u", "resource", "\\u", "pool_", "(_", "context_", ",_", "instance", "\\u", "new_", ",_", "bm", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "exception_", "(_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "green", "thread_", "._", "spawn_", "(_", "\\u", "inner", "\\u", "terminate", "\\u", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#@", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "stop", "\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Stopp", "ing", " ", "an", " ", "instance", " ", "on", " ", "this", " ", "host", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u", "inner", "\\u", "stop", "\\u", "instance_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "self", ".\\u", "shut", "down", "\\u", "instance", "(", "context", ",", " ", "instance", "\\u", "id", ",", " ", "'", "Stopp", "ing", "')", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instance_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "STOPPED", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "stop_", "(_", "context_", ",_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "green", "thread_", "._", "spawn_", "(_", "\\u", "inner", "\\u", "stop", "\\u", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "rebu", "ild", "\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Destr", "oy", " ", "and", " ", "re", "-", "make", " ", "this", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "'", "rebu", "ild", "'", " ", "effective", "ly", " ", "pur", "ges", " ", "all", " ", "exist", "ing", " ", "data", " ", "from", " ", "the", " ", "system", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "rema", "kes", " ", "the", " ", "VM", " ", "with", " ", "give", "n", " ", "'", "metadata", "'", " ", "and", " ", "'", "personali", "ties", "'.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "context", ":", " ", "`", "nova", ".", "Request", "Context", "`", " ", "object", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "instance", "\\u", "id", ":", " ", "Insta", "nce", " ", "identifi", "er", " ", "(", "integ", "er", ")", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "injected", "\\u", "files", ":", " ", "Files", " ", "to", " ", "inject", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "new", "\\u", "pass", ":", " ", "password", " ", "to", " ", "set", " ", "on", " ", "rebu", "ilt", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "\\u_", "(_", "\"", "Reb", "uild", "ing", " ", "instance", " ", "%", "s", "\"_", ")_", ",_", "instance", "\\u", "id_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "power", "\\u", "state_", "=_", "self_", "._", "\\u", "get", "\\u", "power", "\\u", "state_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "state_", "=_", "current", "\\u", "power", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "REB", "UI", "LD", "ING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "info_", "=_", "self_", "._", "\\u", "get", "\\u", "instance", "\\u", "nw", "\\u", "info_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "destroy_", "(_", "instance", "\\u", "ref_", ",_", "network", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "REB", "UI", "LD", "ING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "task", "\\u", "states_", "._", "BLOCK", "\\u", "DEV", "ICE", "\\u", "MAPPING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", "._", "injected", "\\u", "files_", "=_", "kwargs_", "._", "get_", "(_", "'", "injected", "\\u", "files", "'_", ",_", "[_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "\\u", "info_", "=_", "self_", "._", "network", "\\u", "api_", "._", "get", "\\u", "instance", "\\u", "nw", "\\u", "info_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bd", "\\u", "mapping_", "=_", "self_", "._", "\\u", "setup", "\\u", "block", "\\u", "device", "\\u", "mapping_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "REB", "UI", "LD", "ING_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "task", "\\u", "states_", "._", "SPA", "WN", "ING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "pull", " ", "in", " ", "new", " ", "password", " ", "here", " ", "sinc", "e", " ", "the", " ", "original", " ", "password", " ", "isn", "'", "t", " ", "in", " ", "the", " ", "db_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", "._", "admin", "\\u", "pass_", "=_", "kwargs_", "._", "get_", "(_", "'", "new", "\\u", "pass", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "utils_", "._", "generat", "e\\u", "password_", "(_", "FLAGS_", "._", "password", "\\u", "length_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "driver_", "._", "spawn_", "(_", "context_", ",_", "instance", "\\u", "ref_", ",_", "network", "\\u", "info_", ",_", "bd", "\\u", "mapping_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "power", "\\u", "state_", "=_", "self_", "._", "\\u", "get", "\\u", "power", "\\u", "state_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "state_", "=_", "current", "\\u", "power", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "ACTIVE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "launched", "\\u", "at_", "=_", "utils_", "._", "utcnow_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "usage", "\\u", "info_", "=_", "utils_", "._", "usage", "\\u", "from", "\\u", "instance_", "(_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "notifier_", "._", "notify_", "(_", "'", "compute", ".", "%", "s", "'_", "%_", "self_", "._", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "compute", ".", "instance", ".", "rebu", "ild", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "notifier_", "._", "INFO_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "usage", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "rebo", "ot", "\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Reboot", " ", "an", " ", "instance", " ", "on", " ", "this", " ", "host", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "\\u_", "(_", "\"", "Reboot", "ing", " ", "instance", " ", "%", "s", "\"_", ")_", ",_", "instance", "\\u", "id_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "power", "\\u", "state_", "=_", "self_", "._", "\\u", "get", "\\u", "power", "\\u", "state_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "state_", "=_", "current", "\\u", "power", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "ACTIVE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "task", "\\u", "states_", "._", "REB", "OOT", "ING_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "instance", "\\u", "ref_", "[_", "'", "power", "\\u", "state", "'_", "]_", "!=_", "power", "\\u", "state_", "._", "RUNNING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "=_", "instance", "\\u", "ref_", "[_", "'", "power", "\\u", "state", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "running_", "=_", "power", "\\u", "state_", "._", "RUNNING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "warn_", "(_", "\\u_", "(_", "'", "try", "ing", " ", "to", " ", "rebo", "ot", " ", "a", " ", "non", "-", "runn", "ing", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", ":", " ", "%", "(", "instance", "\\u", "id", ")", "s", " ", "(", "state", ":", " ", "%", "(", "state", ")", "s", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "expected", ":", " ", "%", "(", "runn", "ing", ")", "s", ")'_", ")_", "%_", "locals_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "network", "\\u", "info_", "=_", "self_", "._", "\\u", "get", "\\u", "instance", "\\u", "nw", "\\u", "info_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "reboot_", "(_", "instance", "\\u", "ref_", ",_", "network", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "power", "\\u", "state_", "=_", "self_", "._", "\\u", "get", "\\u", "power", "\\u", "state_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "state_", "=_", "current", "\\u", "power", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "ACTIVE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "snapshot", "\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "image", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "image", "\\u", "type_", "=_", "'", "snapshot", "'_", ",_", "backup", "\\u", "type_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rotation_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Snapshot", " ", "an", " ", "instance", " ", "on", " ", "this", " ", "host", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "context", ":", " ", "security", " ", "context", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "instance", "\\u", "id", ":", " ", "nova", ".", "db", ".", "sqla", "lche", "my", ".", "model", "s", ".", "Insta", "nce", ".", "Id", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "image", "\\u", "id", ":", " ", "gla", "nce", ".", "db", ".", "sqla", "lche", "my", ".", "model", "s", ".", "Image", ".", "Id", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "image", "\\u", "type", ":", " ", "snapshot", " ", "|", " ", "backup", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "backup", "\\u", "type", ":", " ", "daily", " ", "|", " ", "week", "ly", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "rotati", "on", ":", " ", "int", " ", "represent", "ing", " ", "how", " ", "many", " ", "backup", "s", " ", "to", " ", "keep", " ", "aro", "und", ";", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", " ", "if", " ", "rotati", "on", " ", "shou", "ld", "n", "'", "t", " ", "be", " ", "used", " ", "(", "as", " ", "in", " ", "the", " ", "case", " ", "of", " ", "snapshot", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "image", "\\u", "type_", "==_", "\"", "snapshot", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "\\u", "state_", "=_", "task", "\\u", "states_", "._", "IMA", "GE", "\\u", "SNAPSHOT", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "image", "\\u", "type_", "==_", "\"", "backup", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "task", "\\u", "state_", "=_", "task", "\\u", "states_", "._", "IMA", "GE", "\\u", "BACKUP", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "\\u_", "(_", "'", "Image", " ", "type", " ", "not", " ", "recognize", "d", " ", "%", "s", "'_", ")_", "%_", "image", "\\u", "type_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "power", "\\u", "state_", "=_", "self_", "._", "\\u", "get", "\\u", "power", "\\u", "state_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "state_", "=_", "current", "\\u", "power", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "ACTIVE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "task", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "\\u_", "(_", "'", "instance", " ", "%", "s", ":", " ", "snapshot", "ting", "'_", ")_", ",_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "instance", "\\u", "ref_", "[_", "'", "power", "\\u", "state", "'_", "]_", "!=_", "power", "\\u", "state_", "._", "RUNNING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "=_", "instance", "\\u", "ref_", "[_", "'", "power", "\\u", "state", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "running_", "=_", "power", "\\u", "state_", "._", "RUNNING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "warn_", "(_", "\\u_", "(_", "'", "try", "ing", " ", "to", " ", "snapshot", " ", "a", " ", "non", "-", "runn", "ing", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", ":", " ", "%", "(", "instance", "\\u", "id", ")", "s", " ", "(", "state", ":", " ", "%", "(", "state", ")", "s", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "expected", ":", " ", "%", "(", "runn", "ing", ")", "s", ")'_", ")_", "%_", "locals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "driver_", "._", "snapshot_", "(_", "context_", ",_", "instance", "\\u", "ref_", ",_", "image", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "instance", "\\u", "id_", ",_", "task", "\\u", "state_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "image", "\\u", "type_", "==_", "'", "snapshot", "'_", "and_", "rotation_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Image", "Rot", "ation", "Not", "Allowed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "image", "\\u", "type_", "==_", "'", "backup", "'_", "and_", "rotation_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instance", "\\u", "uuid_", "=_", "instance", "\\u", "ref_", "[_", "'", "uuid", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rota", "te", "\\u", "backups_", "(_", "context_", ",_", "instance", "\\u", "uuid_", ",_", "backup", "\\u", "type_", ",_", "rotation_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "image", "\\u", "type_", "==_", "'", "backup", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Rot", "ation", "Requ", "ired", "For", "Backup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\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_", "rota", "te", "\\u", "backups_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "uuid_", ",_", "backup", "\\u", "type_", ",_", "rotation_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Delete", " ", "excess", " ", "backup", "s", " ", "associate", "d", " ", "to", " ", "an", " ", "instance", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Insta", "nce", "s", " ", "are", " ", "allow", "ed", " ", "a", " ", "fixed", " ", "number", " ", "of", " ", "backup", "s", " ", "(", "the", " ", "rotati", "on", " ", "number", ");", "\\", "10", ";", " ", " ", " ", " ", "this", " ", "method", " ", "delete", "s", " ", "the", " ", "oldest", " ", "backup", "s", " ", "tha", "t", " ", "exceed", " ", "the", " ", "rotati", "on", "\\", "10", ";", " ", " ", " ", " ", "threshol", "d", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "context", ":", " ", "security", " ", "context", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "instance", "\\u", "uuid", ":", " ", "string", " ", "represent", "ing", " ", "uuid", " ", "of", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "backup", "\\u", "type", ":", " ", "daily", " ", "|", " ", "week", "ly", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "rotati", "on", ":", " ", "int", " ", "represent", "ing", " ", "how", " ", "many", " ", "backup", "s", " ", "to", " ", "keep", " ", "aro", "und", ";", "\\", "10", ";", " ", " ", " ", " ", "Non", "e", " ", "if", " ", "rotati", "on", " ", "shou", "ld", "n", "'", "t", " ", "be", " ", "used", " ", "(", "as", " ", "in", " ", "the", " ", "case", " ", "of", " ", "snapshot", "s", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "jk", "0", "):", " ", "Event", "ual", "ly", " ", "extract", " ", "this", " ", "out", " ", "to", " ", "the", " ", "Image", "Service", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "fetch", "\\u", "images_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "images_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "marker_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "batch_", "=_", "image", "\\u", "service_", "._", "detail_", "(_", "context_", ",_", "filters_", "=_", "filters_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "marker_", "=_", "marker_", ",_", "sort", "\\u", "key_", "=_", "'", "created", "\\u", "at", "'_", ",_", "sort", "\\u", "dir_", "=_", "'", "desc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "batch_", ":_", "\\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_", "images_", "+=_", "batch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "marker_", "=_", "batch_", "[_", "-_", "1_", "]_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "images_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "image", "\\u", "service_", "=_", "nova_", "._", "image_", "._", "get", "\\u", "default", "\\u", "image", "\\u", "service_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filters_", "=_", "{_", "'", "property", "-", "image", "\\u", "type", "'_", ":_", "'", "backup", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "property", "-", "backup", "\\u", "type", "'_", ":_", "backup", "\\u", "type_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "property", "-", "instance", "\\u", "uuid", "'_", ":_", "instance", "\\u", "uuid_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "images_", "=_", "fetch", "\\u", "images_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "images_", "=_", "len_", "(_", "images_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "debug_", "(_", "\\u_", "(_", "\"", "Foun", "d", " ", "%", "(", "num", "\\u", "images", ")", "d", " ", "images", " ", "(", "rotati", "on", ":", " ", "%", "(", "rotati", "on", ")", "d", ")\"_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "locals_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "num", "\\u", "images_", ">_", "rotation_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "sir", "p", "):", " ", "this", " ", "delete", "s", " ", "all", " ", "backup", "s", " ", "tha", "t", " ", "exceed", " ", "the", " ", "rotation_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "excess", "_", "=_", "len_", "(_", "images_", ")_", "-_", "rotation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "debug_", "(_", "\\u_", "(_", "\"", "Rot", "ati", "ng", " ", "out", " ", "%", "d", " ", "backup", "s", "\"_", "%_", "excess", "_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "excess", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "image_", "=_", "images_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "id_", "=_", "image_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "debug_", "(_", "\\u_", "(_", "\"", "Del", "eti", "ng", " ", "image", " ", "%", "d", "\"_", "%_", "image", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "image", "\\u", "service_", "._", "delete_", "(_", "context_", ",_", "image", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\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_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set\\u", "admin", "\\u", "password_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "new", "\\u", "pass_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", " ", "the", " ", "root", "/", "admin", " ", "password", " ", "for", " ", "an", " ", "instance", " ", "on", " ", "this", " ", "host", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "genera", "ll", "y", " ", "only", " ", "call", "ed", " ", "by", " ", "API", " ", "password", " ", "reset", "s", " ", "after", " ", "an", "\\", "10", ";", " ", " ", " ", " ", "image", " ", "has", " ", "bee", "n", " ", "bui", "lt", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "new", "\\u", "pass_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Generate", " ", "a", " ", "random", " ", "password_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "pass_", "=_", "utils_", "._", "generat", "e\\u", "password_", "(_", "FLAGS_", "._", "password", "\\u", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "max", "\\u", "tries_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "max", "\\u", "tries_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "id_", "=_", "instance", "\\u", "ref_", "[_", "\"", "id", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "state_", "=_", "instance", "\\u", "ref_", "[_", "\"", "power", "\\u", "state", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "state_", "=_", "power", "\\u", "state_", "._", "RUNNING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "instance", "\\u", "state_", "!=_", "expected", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Error_", "(_", "\\u_", "(_", "'", "Insta", "nce", " ", "is", " ", "not", " ", "runn", "ing", "'_", ")_", ")_", "\\u\\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 ", " ", "_", "self_", "._", "driver_", "._", "set\\u", "admin", "\\u", "password_", "(_", "instance", "\\u", "ref_", ",_", "new", "\\u", "pass_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "\\u_", "(_", "\"", "Insta", "nce", " ", "%", "s", ":", " ", "Roo", "t", " ", "password", " ", "set", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", "[_", "\"", "name", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Not", "Impl", "ement", "ed", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "dpr", "inc", "e", "):", " ", "if", " ", "the", " ", "driver", " ", "doe", "sn", "'", "t", " ", "implement", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "set\\u", "admin", "\\u", "password", " ", "we", " ", "break", " ", "to", " ", "avoid", " ", "a", " ", "loop_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "LOG_", "._", "warn_", "(_", "\\u_", "(_", "'", "set\\u", "admin", "\\u", "password", " ", "is", " ", "not", " ", "implemented", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "by", " ", "this", " ", "driver", ".'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Catch", " ", "all", " ", "here", " ", "bec", "aus", "e", " ", "this", " ", "coul", "d", " ", "be", " ", "anyt", "hing", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "LOG_", "._", "exception_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "i_", "==_", "max", "\\u", "tries_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "At", " ", "some", " ", "point", " ", "this", " ", "exception", " ", "may", " ", "make", " ", "it", " ", "back_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "the", " ", "API", " ", "caller", ",", " ", "and", " ", "we", " ", "don", "'", "t", " ", "want", " ", "to", " ", "reveal", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "too", " ", "muc", "h", ".", " ", " ", "The", " ", "real", " ", "exception", " ", "is", " ", "logged", " ", "above_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "raise_", "exception_", "._", "Error_", "(_", "\\u_", "(_", "'", "Intern", "al", " ", "error", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "time_", "._", "sleep_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\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_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "inject", "\\u", "file_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "path_", ",_", "file", "\\u", "contents_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Write", " ", "a", " ", "file", " ", "to", " ", "the", " ", "specified", " ", "path", " ", "in", " ", "an", " ", "instance", " ", "on", " ", "this", " ", "host", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "id_", "=_", "instance", "\\u", "ref_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "state_", "=_", "instance", "\\u", "ref_", "[_", "'", "power", "\\u", "state", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "state_", "=_", "power", "\\u", "state_", "._", "RUNNING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "instance", "\\u", "state_", "!=_", "expected", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "warn_", "(_", "\\u_", "(_", "'", "try", "ing", " ", "to", " ", "inject", " ", "a", " ", "file", " ", "int", "o", " ", "a", " ", "non", "-", "runn", "ing", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", ":", " ", "%", "(", "instance", "\\u", "id", ")", "s", " ", "(", "state", ":", " ", "%", "(", "instance", "\\u", "state", ")", "s", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "expected", ":", " ", "%", "(", "expected", "\\u", "state", ")", "s", ")'_", ")_", "%_", "locals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nm_", "=_", "instance", "\\u", "ref_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "\\u_", "(_", "'", "instance", " ", "%", "(", "nm", ")", "s", ":", " ", "inject", "ing", " ", "file", " ", "to", " ", "%", "(", "path", ")", "s", "'_", ")_", "%_", "locals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "inject", "\\u", "file_", "(_", "instance", "\\u", "ref_", ",_", "path_", ",_", "file", "\\u", "contents_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "agent", "\\u", "update_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "url_", ",_", "md5", "hash_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Update", " ", "agent", " ", "runn", "ing", " ", "on", " ", "an", " ", "instance", " ", "on", " ", "this", " ", "host", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "id_", "=_", "instance", "\\u", "ref_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "state_", "=_", "instance", "\\u", "ref_", "[_", "'", "power", "\\u", "state", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expected", "\\u", "state_", "=_", "power", "\\u", "state_", "._", "RUNNING_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "instance", "\\u", "state_", "!=_", "expected", "\\u", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "warn_", "(_", "\\u_", "(_", "'", "try", "ing", " ", "to", " ", "update", " ", "agent", " ", "on", " ", "a", " ", "non", "-", "runn", "ing", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", ":", " ", "%", "(", "instance", "\\u", "id", ")", "s", " ", "(", "state", ":", " ", "%", "(", "instance", "\\u", "state", ")", "s", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'", "expected", ":", " ", "%", "(", "expected", "\\u", "state", ")", "s", ")'_", ")_", "%_", "locals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "nm_", "=_", "instance", "\\u", "ref_", "[_", "'", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "\\u_", "(_", "'", "instance", " ", "%", "(", "nm", ")", "s", ":", " ", "updat", "ing", " ", "agent", " ", "to", " ", "%", "(", "url", ")", "s", "'_", ")_", "%_", "locals_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "agent", "\\u", "update_", "(_", "instance", "\\u", "ref_", ",_", "url_", ",_", "md5", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "rescue", "\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Resc", "ue", " ", "an", " ", "instance", " ", "on", " ", "this", " ", "host", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "\\u_", "(_", "'", "instance", " ", "%", "s", ":", " ", "resc", "uin", "g", "'_", ")_", ",_", "instance", "\\u", "id_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "\\u", "info_", "=_", "self_", "._", "\\u", "get", "\\u", "instance", "\\u", "nw", "\\u", "info_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", "(", "bla", "mar", "):", " ", "Non", "e", " ", "of", " ", "the", " ", "virt", " ", "driver", "s", " ", "use", " ", "the", " ", "'", "callback", "'", " ", "param_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "driver_", "._", "rescue", "_", "(_", "context_", ",_", "instance", "\\u", "ref_", ",_", "None_", ",_", "network", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "power", "\\u", "state_", "=_", "self_", "._", "\\u", "get", "\\u", "power", "\\u", "state_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "RES", "CU", "ED_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "state_", "=_", "current", "\\u", "power", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "unres", "cue", "\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Resc", "ue", " ", "an", " ", "instance", " ", "on", " ", "this", " ", "host", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "\\u_", "(_", "'", "instance", " ", "%", "s", ":", " ", "unres", "cui", "ng", "'_", ")_", ",_", "instance", "\\u", "id_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "\\u", "info_", "=_", "self_", "._", "\\u", "get", "\\u", "instance", "\\u", "nw", "\\u", "info_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", "(", "bla", "mar", "):", " ", "Non", "e", " ", "of", " ", "the", " ", "virt", " ", "driver", "s", " ", "use", " ", "the", " ", "'", "callback", "'", " ", "param_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "driver_", "._", "unres", "cue", "_", "(_", "instance", "\\u", "ref_", ",_", "None_", ",_", "network", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "power", "\\u", "state_", "=_", "self_", "._", "\\u", "get", "\\u", "power", "\\u", "state_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "ACTIVE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "state_", "=_", "current", "\\u", "power", "\\u", "state_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "confirm", "\\u", "resize_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "migrati", "on", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Destr", "oy", "s", " ", "the", " ", "source", " ", "instance", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "migrati", "on", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "migrati", "on", "\\u", "get_", "(_", "context_", ",_", "migrati", "on", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get", "\\u", "by", "\\u", "uuid_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrati", "on", "\\u", "ref_", "._", "instance", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "info_", "=_", "self_", "._", "\\u", "get", "\\u", "instance", "\\u", "nw", "\\u", "info_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "destroy_", "(_", "instance", "\\u", "ref_", ",_", "network", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "usage", "\\u", "info_", "=_", "utils_", "._", "usage", "\\u", "from", "\\u", "instance_", "(_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "notifier_", "._", "notify_", "(_", "'", "compute", ".", "%", "s", "'_", "%_", "self_", "._", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "compute", ".", "instance", ".", "resiz", "e", ".", "confirm", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "notifier_", "._", "INFO_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "usage", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "revert", "\\u", "resize_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "migrati", "on", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Destr", "oy", "s", " ", "the", " ", "new", " ", "instance", " ", "on", " ", "the", " ", "destinat", "ion", " ", "machine", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Rever", "ts", " ", "the", " ", "model", " ", "change", "s", ",", " ", "and", " ", "powers", " ", "on", " ", "the", " ", "old", " ", "instance", " ", "on", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "source", " ", "machine", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "migrati", "on", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "migrati", "on", "\\u", "get_", "(_", "context_", ",_", "migrati", "on", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get", "\\u", "by", "\\u", "uuid_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrati", "on", "\\u", "ref_", "._", "instance", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "info_", "=_", "self_", "._", "\\u", "get", "\\u", "instance", "\\u", "nw", "\\u", "info_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "destroy_", "(_", "instance", "\\u", "ref_", ",_", "network", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topic_", "=_", "self_", "._", "db_", "._", "queue", "\\u", "get", "\\u", "for_", "(_", "context_", ",_", "FLAGS_", "._", "compute", "\\u", "topic_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", "[_", "'", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rpc_", "._", "cast_", "(_", "context_", ",_", "topic_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "method", "'_", ":_", "'", "finish", "\\u", "revert", "\\u", "resiz", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "args", "'_", ":_", "{_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "ref_", "[_", "'", "uuid", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "migrati", "on", "\\u", "id", "'_", ":_", "migrati", "on", "\\u", "ref_", "[_", "'", "id", "'_", "]_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "finish", "\\u", "revert", "\\u", "resize_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "migrati", "on", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Finish", "es", " ", "the", " ", "second", " ", "half", " ", "of", " ", "revert", "ing", " ", "a", " ", "resiz", "e", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Power", " ", "back", " ", "on", " ", "the", " ", "source", " ", "instance", " ", "and", " ", "revert", " ", "the", " ", "resized", " ", "attribute", "s", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "the", " ", "databa", "se", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "migrati", "on", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "migrati", "on", "\\u", "get_", "(_", "context_", ",_", "migrati", "on", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get", "\\u", "by", "\\u", "uuid_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrati", "on", "\\u", "ref_", "._", "instance", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "type_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "type", "\\u", "get_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrati", "on", "\\u", "ref_", "[_", "'", "old", "\\u", "instance", "\\u", "type", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Ju", "st", " ", "roll", " ", "back", " ", "the", " ", "record", ".", " ", "There", "'", "s", " ", "no", " ", "need", " ", "to", " ", "resiz", "e", " ", "down", " ", "since_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "'", "old", "'", " ", "VM", " ", "alr", "ead", "y", " ", "has", " ", "the", " ", "prefer", "red", " ", "attributes_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", "[_", "\"", "uuid", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "memory", "\\u", "mb_", "=_", "instance", "\\u", "type_", "[_", "'", "memory", "\\u", "mb", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vcpu", "s_", "=_", "instance", "\\u", "type_", "[_", "'", "vcpu", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "local", "\\u", "gb_", "=_", "instance", "\\u", "type_", "[_", "'", "local", "\\u", "gb", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "type", "\\u", "id_", "=_", "instance", "\\u", "type_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "driver_", "._", "revert", "\\u", "migration_", "(_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "migrati", "on", "\\u", "update_", "(_", "context_", ",_", "migrati", "on", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "status", "'_", ":_", "'", "revert", "ed", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "usage", "\\u", "info_", "=_", "utils_", "._", "usage", "\\u", "from", "\\u", "instance_", "(_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "notifier_", "._", "notify_", "(_", "'", "compute", ".", "%", "s", "'_", "%_", "self_", "._", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "compute", ".", "instance", ".", "resiz", "e", ".", "revert", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "notifier_", "._", "INFO_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "usage", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "prep", "\\u", "resize_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "instance", "\\u", "type", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Initiat", "es", " ", "the", " ", "process", " ", "of", " ", "movin", "g", " ", "a", " ", "runn", "ing", " ", "instance", " ", "to", " ", "anot", "her", " ", "host", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Poss", "ibl", "y", " ", "change", "s", " ", "the", " ", "RAM", " ", "and", " ", "disk", " ", "size", " ", "in", " ", "the", " ", "process", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Be", "caus", "e", " ", "of", " ", "checks", "\\u", "instance", "\\u", "lock", ",", " ", "this", " ", "must", " ", "currentl", "y", " ", "be", " ", "called_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "instance", "\\u", "id", ".", " ", "Ho", "we", "ver", ",", " ", "the", " ", "compute", " ", "API", " ", "is", " ", "alw", "ay", "s", " ", "passi", "ng", " ", "the", " ", "UUID_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "instance", " ", "down_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get", "\\u", "by", "\\u", "uuid_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "instance", "\\u", "ref_", "[_", "'", "host", "'_", "]_", "==_", "FLAGS_", "._", "host_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "ERROR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "\\u_", "(_", "'", "Migrat", "ion", " ", "error", ":", " ", "destinat", "ion", " ", "same", " ", "as", " ", "source", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exception_", "._", "Error_", "(_", "msg_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "old", "\\u", "instance", "\\u", "type_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "type", "\\u", "get_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", "[_", "'", "instance", "\\u", "type", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "instance", "\\u", "type_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "type", "\\u", "get_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "type", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "migrati", "on", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "migrati", "on", "\\u", "create_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "instance", "\\u", "uuid", "'_", ":_", "instance", "\\u", "ref_", "[_", "'", "uuid", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "source", "\\u", "compute", "'_", ":_", "instance", "\\u", "ref_", "[_", "'", "host", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dest", "\\u", "compute", "'_", ":_", "FLAGS_", "._", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dest", "\\u", "host", "'_", ":_", "self_", "._", "driver_", "._", "get", "\\u", "host", "\\u", "ip", "\\u", "addr_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "old", "\\u", "instance", "\\u", "type", "\\u", "id", "'_", ":_", "old", "\\u", "instance", "\\u", "type_", "[_", "'", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "new", "\\u", "instance", "\\u", "type", "\\u", "id", "'_", ":_", "instance", "\\u", "type", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "status", "'_", ":_", "'", "pre", "-", "migrati", "ng", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "\\u_", "(_", "'", "instance", " ", "%", "s", ":", " ", "migrati", "ng", "'_", ")_", ",_", "instance", "\\u", "ref_", "[_", "'", "uuid", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topic_", "=_", "self_", "._", "db_", "._", "queue", "\\u", "get", "\\u", "for_", "(_", "context_", ",_", "FLAGS_", "._", "compute", "\\u", "topic_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", "[_", "'", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rpc_", "._", "cast_", "(_", "context_", ",_", "topic_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "method", "'_", ":_", "'", "resiz", "e\\u", "instance", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "args", "'_", ":_", "{_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "ref_", "[_", "'", "uuid", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "migrati", "on", "\\u", "id", "'_", ":_", "migrati", "on", "\\u", "ref_", "[_", "'", "id", "'_", "]_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "usage", "\\u", "info_", "=_", "utils_", "._", "usage", "\\u", "from", "\\u", "instance_", "(_", "instance", "\\u", "ref_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "instance", "\\u", "type_", "=_", "new", "\\u", "instance", "\\u", "type_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "instance", "\\u", "type", "\\u", "id_", "=_", "new", "\\u", "instance", "\\u", "type_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "notifier_", "._", "notify_", "(_", "'", "compute", ".", "%", "s", "'_", "%_", "self_", "._", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "compute", ".", "instance", ".", "resiz", "e", ".", "prep", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "notifier_", "._", "INFO_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "usage", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "resiz", "e\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "migrati", "on", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Start", "s", " ", "the", " ", "migrati", "on", " ", "of", " ", "a", " ", "runn", "ing", " ", "instance", " ", "to", " ", "anot", "her", " ", "host", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "migrati", "on", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "migrati", "on", "\\u", "get_", "(_", "context_", ",_", "migrati", "on", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get", "\\u", "by", "\\u", "uuid_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrati", "on", "\\u", "ref_", "._", "instance", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "db_", "._", "migrati", "on", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrati", "on", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "status", "'_", ":_", "'", "migrati", "ng", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "disk", "\\u", "info_", "=_", "self_", "._", "driver_", "._", "migr", "ate", "\\u", "disk", "\\u", "and", "\\u", "power", "\\u", "off_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", ",_", "migrati", "on", "\\u", "ref_", "[_", "'", "dest", "\\u", "host", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "migrati", "on", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrati", "on", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "status", "'_", ":_", "'", "post", "-", "migrati", "ng", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "service_", "=_", "self_", "._", "db_", "._", "service", "\\u", "get", "\\u", "by", "\\u", "host", "\\u", "and", "\\u", "topic_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "context_", ",_", "migrati", "on", "\\u", "ref_", "[_", "'", "dest", "\\u", "compute", "'_", "]_", ",_", "FLAGS_", "._", "compute", "\\u", "topic_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "topic_", "=_", "self_", "._", "db_", "._", "queue", "\\u", "get", "\\u", "for_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "FLAGS_", "._", "compute", "\\u", "topic_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrati", "on", "\\u", "ref_", "[_", "'", "dest", "\\u", "compute", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "'", "migrati", "on", "\\u", "id", "'_", ":_", "migrati", "on", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "disk", "\\u", "info", "'_", ":_", "disk", "\\u", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "ref_", "[_", "'", "uuid", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rpc_", "._", "cast_", "(_", "context_", ",_", "topic_", ",_", "{_", "'", "method", "'_", ":_", "'", "finish", "\\u", "resiz", "e", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "args", "'_", ":_", "params_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "finish", "\\u", "resize_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "migrati", "on", "\\u", "id_", ",_", "disk", "\\u", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Complete", "s", " ", "the", " ", "migrati", "on", " ", "process", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Set", "s", " ", "up", " ", "the", " ", "newl", "y", " ", "transferred", " ", "disk", " ", "and", " ", "turns", " ", "on", " ", "the", " ", "instance", " ", "at", " ", "its", "\\", "10", ";", " ", " ", " ", " ", "new", " ", "host", " ", "machine", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "migrati", "on", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "migrati", "on", "\\u", "get_", "(_", "context_", ",_", "migrati", "on", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resiz", "e\\u", "instance_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get", "\\u", "by", "\\u", "uuid_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrati", "on", "\\u", "ref_", "._", "instance", "\\u", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "migrati", "on", "\\u", "ref_", "[_", "'", "old", "\\u", "instance", "\\u", "type", "\\u", "id", "'_", "]_", "!=_", "migrati", "on", "\\u", "ref_", "[_", "'", "new", "\\u", "instance", "\\u", "type", "\\u", "id", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instance", "\\u", "type_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "type", "\\u", "get_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "migrati", "on", "\\u", "ref_", "[_", "'", "new", "\\u", "instance", "\\u", "type", "\\u", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "instance", "\\u", "update_", "(_", "context_", ",_", "instance", "\\u", "ref_", "._", "uuid_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dict_", "(_", "instance", "\\u", "type", "\\u", "id_", "=_", "instance", "\\u", "type_", "[_", "'", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "memory", "\\u", "mb_", "=_", "instance", "\\u", "type_", "[_", "'", "memory", "\\u", "mb", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vcpu", "s_", "=_", "instance", "\\u", "type_", "[_", "'", "vcpu", "s", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "local", "\\u", "gb_", "=_", "instance", "\\u", "type_", "[_", "'", "local", "\\u", "gb", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "resiz", "e\\u", "instance_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get", "\\u", "by", "\\u", "uuid_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", "._", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "info_", "=_", "self_", "._", "\\u", "get", "\\u", "instance", "\\u", "nw", "\\u", "info_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "finish", "\\u", "migration_", "(_", "context_", ",_", "instance", "\\u", "ref_", ",_", "disk", "\\u", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "info_", ",_", "resiz", "e\\u", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "ACTIVE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "task", "\\u", "states_", "._", "RESIZE", "\\u", "VERIFY", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "db_", "._", "migrati", "on", "\\u", "update_", "(_", "context_", ",_", "migrati", "on", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "status", "'_", ":_", "'", "finish", "ed", "'_", ",_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "add", "\\u", "fixed", "\\u", "ip", "\\u", "to", "\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "network", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Calls", " ", "network", "\\u", "api", " ", "to", " ", "add", " ", "new", " ", "fixed", "\\u", "ip", " ", "to", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "then", " ", "inject", "s", " ", "the", " ", "new", " ", "network", " ", "info", " ", "and", " ", "reset", "s", " ", "instance", " ", "networking", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "network", "\\u", "api_", "._", "add", "\\u", "fixed", "\\u", "ip", "\\u", "to", "\\u", "instance_", "(_", "context_", ",_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "host_", ",_", "network", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "inject", "\\u", "network", "\\u", "info_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reset", "\\u", "network_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "remove", "\\u", "fixed", "\\u", "ip", "\\u", "from", "\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "address_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Calls", " ", "network", "\\u", "api", " ", "to", " ", "remove", " ", "exist", "ing", " ", "fixed", "\\u", "ip", " ", "from", " ", "instance", "\\", "10", ";", " ", " ", " ", " ", "by", " ", "inject", "ing", " ", "the", " ", "alter", "ed", " ", "network", " ", "info", " ", "and", " ", "reset", "ting", "\\", "10", ";", " ", " ", " ", " ", "instance", " ", "networking", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "network", "\\u", "api_", "._", "remove", "\\u", "fixed", "\\u", "ip", "\\u", "from", "\\u", "instance_", "(_", "context_", ",_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "inject", "\\u", "network", "\\u", "info_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "reset", "\\u", "network_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "paus", "e\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Pause", " ", "an", " ", "instance", " ", "on", " ", "this", " ", "host", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "\\u_", "(_", "'", "instance", " ", "%", "s", ":", " ", "paus", "ing", "'_", ")_", ",_", "instance", "\\u", "id_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "pause_", "(_", "instance", "\\u", "ref_", ",_", "lambda_", "result_", ":_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "power", "\\u", "state_", "=_", "self_", "._", "\\u", "get", "\\u", "power", "\\u", "state_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "state_", "=_", "current", "\\u", "power", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "PAUSE", "D_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "unpa", "use", "\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Unp", "aus", "e", " ", "a", " ", "paus", "ed", " ", "instance", " ", "on", " ", "this", " ", "host", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "\\u_", "(_", "'", "instance", " ", "%", "s", ":", " ", "unpa", "usi", "ng", "'_", ")_", ",_", "instance", "\\u", "id_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "unpa", "use_", "(_", "instance", "\\u", "ref_", ",_", "lambda_", "result_", ":_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "power", "\\u", "state_", "=_", "self_", "._", "\\u", "get", "\\u", "power", "\\u", "state_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "state_", "=_", "current", "\\u", "power", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "ACTIVE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "host", "\\u", "power", "\\u", "action_", "(_", "self_", ",_", "context_", ",_", "host_", "=_", "None_", ",_", "action_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Reboot", "s", ",", " ", "shut", "s", " ", "down", " ", "or", " ", "powers", " ", "up", " ", "the", " ", "host", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "driver_", "._", "host", "\\u", "power", "\\u", "action_", "(_", "host_", ",_", "action_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "set\\u", "host", "\\u", "enabled_", "(_", "self_", ",_", "context_", ",_", "host_", "=_", "None_", ",_", "enabled_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Set", "s", " ", "the", " ", "specified", " ", "host", "'", "s", " ", "abilit", "y", " ", "to", " ", "accept", " ", "new", " ", "instance", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "driver_", "._", "set\\u", "host", "\\u", "enabled_", "(_", "host_", ",_", "enabled_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "diagnostics", "_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Retrieve", " ", "diagnostics", " ", "for", " ", "an", " ", "instance", " ", "on", " ", "this", " ", "host", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "instance", "\\u", "ref_", "[_", "\"", "power", "\\u", "state", "\"_", "]_", "==_", "power", "\\u", "state_", "._", "RUNNING_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "audit_", "(_", "\\u_", "(_", "\"", "instance", " ", "%", "s", ":", " ", "retrie", "ving", " ", "diagnostics", "\"_", ")_", ",_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "driver_", "._", "get", "\\u", "diagnostics", "_", "(_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "suspend", "\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Suspend", " ", "the", " ", "give", "n", " ", "instance", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "\\u_", "(_", "'", "instance", " ", "%", "s", ":", " ", "suspend", "ing", "'_", ")_", ",_", "instance", "\\u", "id_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "suspend", "_", "(_", "instance", "\\u", "ref_", ",_", "lambda_", "result_", ":_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "power", "\\u", "state_", "=_", "self_", "._", "\\u", "get", "\\u", "power", "\\u", "state_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "state_", "=_", "current", "\\u", "power", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "SUS", "PEND", "ED_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "resum", "e\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Resu", "me", " ", "the", " ", "give", "n", " ", "suspended", " ", "instance", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "\\u_", "(_", "'", "instance", " ", "%", "s", ":", " ", "resum", "ing", "'_", ")_", ",_", "instance", "\\u", "id_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "resume_", "(_", "instance", "\\u", "ref_", ",_", "lambda_", "result_", ":_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "power", "\\u", "state_", "=_", "self_", "._", "\\u", "get", "\\u", "power", "\\u", "state_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "state_", "=_", "current", "\\u", "power", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "ACTIVE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "lock", "\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Lock", " ", "the", " ", "give", "n", " ", "instance", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "._", "debug_", "(_", "\\u_", "(_", "'", "instance", " ", "%", "s", ":", " ", "locking", "'_", ")_", ",_", "instance", "\\u", "id_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "instance", "\\u", "update_", "(_", "context_", ",_", "instance", "\\u", "id_", ",_", "{_", "'", "lock", "ed", "'_", ":_", "True_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "unlock", "\\u", "instance_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Unlock", " ", "the", " ", "give", "n", " ", "instance", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "._", "debug_", "(_", "\\u_", "(_", "'", "instance", " ", "%", "s", ":", " ", "unlock", "ing", "'_", ")_", ",_", "instance", "\\u", "id_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "instance", "\\u", "update_", "(_", "context_", ",_", "instance", "\\u", "id_", ",_", "{_", "'", "lock", "ed", "'_", ":_", "False_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "lock_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "the", " ", "boolean", " ", "state", " ", "of", " ", "the", " ", "give", "n", " ", "instance", "'", "s", " ", "lock", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "debug_", "(_", "\\u_", "(_", "'", "instance", " ", "%", "s", ":", " ", "getti", "ng", " ", "lock", "ed", " ", "state", "'_", ")_", ",_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "utils_", "._", "is", "\\u", "uuid", "\\u", "like_", "(_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uuid_", "=_", "instance", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get", "\\u", "by", "\\u", "uuid_", "(_", "context_", ",_", "uuid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "instance", "\\u", "ref_", "[_", "'", "lock", "ed", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "reset", "\\u", "network_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Reset", " ", "networking", " ", "on", " ", "the", " ", "give", "n", " ", "instance", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "debug_", "(_", "\\u_", "(_", "'", "instance", " ", "%", "s", ":", " ", "reset", " ", "network", "'_", ")_", ",_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "reset", "\\u", "network_", "(_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "inject", "\\u", "network", "\\u", "info_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Inject", " ", "network", " ", "info", " ", "for", " ", "the", " ", "give", "n", " ", "instance", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "debug_", "(_", "\\u_", "(_", "'", "instance", " ", "%", "s", ":", " ", "inject", " ", "network", " ", "info", "'_", ")_", ",_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "\\u", "info_", "=_", "self_", "._", "\\u", "get", "\\u", "instance", "\\u", "nw", "\\u", "info_", "(_", "context_", ",_", "instance_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "debug_", "(_", "\\u_", "(_", "\"", "network", "\\u", "info", " ", "to", " ", "inject", ":", " ", "|", "%", "s", "|\"_", ")_", ",_", "network", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "driver_", "._", "inject", "\\u", "network", "\\u", "info_", "(_", "instance_", ",_", "network", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "console", "\\u", "output_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sen", "d", " ", "the", " ", "console", " ", "output", " ", "for", " ", "the", " ", "give", "n", " ", "instance", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "\\u_", "(_", "\"", "Get", " ", "console", " ", "output", " ", "for", " ", "instance", " ", "%", "s", "\"_", ")_", ",_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output_", "=_", "self_", "._", "driver_", "._", "get", "\\u", "console", "\\u", "output_", "(_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "output_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ",_", "'", "replace", "'_", ")_", "._", "encode_", "(_", "'", "ascii", "'_", ",_", "'", "replace", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "aja", "x", "\\u", "console_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "connecti", "on", " ", "informati", "on", " ", "for", " ", "an", " ", "aja", "x", " ", "console", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "debug_", "(_", "\\u_", "(_", "\"", "instance", " ", "%", "s", ":", " ", "getti", "ng", " ", "aja", "x", " ", "console", "\"_", ")_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "driver_", "._", "get", "\\u", "aja", "x", "\\u", "console_", "(_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get", "\\u", "vnc", "\\u", "console_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Return", " ", "connecti", "on", " ", "informati", "on", " ", "for", " ", "a", " ", "vnc", " ", "console", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "debug_", "(_", "\\u_", "(_", "\"", "instance", " ", "%", "s", ":", " ", "getti", "ng", " ", "vnc", " ", "console", "\"_", ")_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "driver_", "._", "get", "\\u", "vnc", "\\u", "console_", "(_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "attach", "\\u", "volume", "\\u", "boot_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "volume", "\\u", "id_", ",_", "mountpoint_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Attach", " ", "a", " ", "volume", " ", "to", " ", "an", " ", "instance", " ", "at", " ", "boot", " ", "time", ".", " ", "So", " ", "actual", " ", "attach", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "don", "e", " ", "by", " ", "instance", " ", "creati", "on", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "TOD", "O", "(", "ya", "mah", "ata", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", " ", "move", " ", "check", "\\u", "attach", " ", "to", " ", "volume", " ", "manage", "r", "?", "_", "\\u\\u\\uNL\\u\\u\\u_", "volume_", "._", "API_", "(_", ")_", "._", "check", "\\u", "attach_", "(_", "context_", ",_", "volume", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "\\u_", "(_", "\"", "instance", " ", "%", "(", "instance", "\\u", "id", ")", "s", ":", " ", "boot", "ing", " ", "with", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "volume", " ", "%", "(", "volume", "\\u", "id", ")", "s", " ", "at", " ", "%", "(", "mountpoint", ")", "s", "\"_", ")_", "%_", "\\u\\u\\uNL\\u\\u\\u_", "locals_", "(_", ")_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dev", "\\u", "path_", "=_", "self_", "._", "volume", "\\u", "manager_", "._", "setup", "\\u", "compute", "\\u", "volume_", "(_", "context_", ",_", "volume", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "volume", "\\u", "attache", "d_", "(_", "context_", ",_", "volume", "\\u", "id_", ",_", "instance", "\\u", "id_", ",_", "mountpoint_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "dev", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "attach", "\\u", "volume_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "volume", "\\u", "id_", ",_", "mountpoint_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Attach", " ", "a", " ", "volume", " ", "to", " ", "an", " ", "instance", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "\\u_", "(_", "\"", "instance", " ", "%", "(", "instance", "\\u", "id", ")", "s", ":", " ", "attach", "ing", " ", "volume", " ", "%", "(", "volume", "\\u", "id", ")", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "to", " ", "%", "(", "mountpoint", ")", "s", "\"_", ")_", "%_", "locals_", "(_", ")_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dev", "\\u", "path_", "=_", "self_", "._", "volume", "\\u", "manager_", "._", "setup", "\\u", "compute", "\\u", "volume_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "volume", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "driver_", "._", "attach", "\\u", "volume_", "(_", "instance", "\\u", "ref_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dev", "\\u", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mountpoint_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "volume", "\\u", "attache", "d_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "volume", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "mountpoint_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "values_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "device", "\\u", "name", "'_", ":_", "mountpoint_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "delete", "\\u", "on", "\\u", "termination", "'_", ":_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "virtual", "\\u", "name", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "snapshot", "\\u", "id", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "volume", "\\u", "id", "'_", ":_", "volume", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "volume", "\\u", "size", "'_", ":_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "no", "\\u", "device", "'_", ":_", "None_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "block", "\\u", "device", "\\u", "mapping", "\\u", "create_", "(_", "context_", ",_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "exc_", ":_", "#", " ", "pylint", ":", " ", "disable", "=", "W", "070", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "NOTE", "(", "vis", "h", "):", " ", "The", " ", "inline", " ", "callback", " ", "eat", "s", " ", "the", " ", "exception", " ", "info", " ", "so", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "log", " ", "the", " ", "traceback", " ", "here", " ", "and", " ", "reraise", " ", "the", " ", "same_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "ec", "xcept", "ion", " ", "belo", "w", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "exception_", "(_", "\\u_", "(_", "\"", "instance", " ", "%", "(", "instance", "\\u", "id", ")", "s", ":", " ", "attach", " ", "fail", "ed", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "%", "(", "mountpoint", ")", "s", ",", " ", "remo", "ving", "\"_", ")_", "%_", "locals_", "(_", ")_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "volume", "\\u", "manager_", "._", "remove", "\\u", "compute", "\\u", "volume_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "volume", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "exc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "checks", "\\u", "instance", "\\u", "lock_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u", "deta", "ch", "\\u", "volume_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "volume", "\\u", "id_", ",_", "destroy", "\\u", "bdm_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Detach", " ", "a", " ", "volume", " ", "from", " ", "an", " ", "instance", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "context_", "=_", "context_", "._", "elevat", "ed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "volume", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "volume", "\\u", "get_", "(_", "context_", ",_", "volume", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mp_", "=_", "volume", "\\u", "ref_", "[_", "'", "mountpoint", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "audit_", "(_", "\\u_", "(_", "\"", "Detach", " ", "volume", " ", "%", "(", "volume", "\\u", "id", ")", "s", " ", "from", " ", "mountpoint", " ", "%", "(", "mp", ")", "s", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "on", " ", "instance", " ", "%", "(", "instance", "\\u", "id", ")", "s", "\"_", ")_", "%_", "locals_", "(_", ")_", ",_", "context_", "=_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "instance", "\\u", "ref_", "[_", "'", "name", "'_", "]_", "not_", "in_", "self_", "._", "driver_", "._", "list", "\\u", "instances_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "warn_", "(_", "\\u_", "(_", "\"", "Detach", "ing", " ", "volume", " ", "from", " ", "unknown", " ", "instance", " ", "%", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "context_", "=_", "context_", ")_", "\\u\\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_", "._", "driver_", "._", "deta", "ch", "\\u", "volume_", "(_", "instance", "\\u", "ref_", "[_", "'", "name", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "volume", "\\u", "ref_", "[_", "'", "mountpoint", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "volume", "\\u", "manager_", "._", "remove", "\\u", "compute", "\\u", "volume_", "(_", "context_", ",_", "volume", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "volume", "\\u", "detached", "_", "(_", "context_", ",_", "volume", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "destroy", "\\u", "bdm_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "db_", "._", "block", "\\u", "device", "\\u", "mapping", "\\u", "destroy", "\\u", "by", "\\u", "instance", "\\u", "and", "\\u", "volume_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "context_", ",_", "instance", "\\u", "id_", ",_", "volume", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "deta", "ch", "\\u", "volume_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "volume", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Detach", " ", "a", " ", "volume", " ", "from", " ", "an", " ", "instance", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "deta", "ch", "\\u", "volume_", "(_", "context_", ",_", "instance", "\\u", "id_", ",_", "volume", "\\u", "id_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "\\u", "volume_", "(_", "self_", ",_", "context_", ",_", "volume", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Remove", " ", "volume", " ", "on", " ", "compute", " ", "host", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "context", ":", " ", "security", " ", "context", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "volume", "\\u", "id", ":", " ", "volume", " ", "ID", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "volume", "\\u", "manager_", "._", "remove", "\\u", "compute", "\\u", "volume_", "(_", "context_", ",_", "volume", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "compare", "\\u", "cpu_", "(_", "self_", ",_", "context_", ",_", "cpu", "\\u", "info_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Check", "s", " ", "tha", "t", " ", "the", " ", "host", " ", "cpu", " ", "is", " ", "compatible", " ", "with", " ", "a", " ", "cpu", " ", "give", "n", " ", "by", " ", "xml", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "context", ":", " ", "security", " ", "context", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "cpu", "\\u", "info", ":", " ", "json", " ", "string", " ", "obtain", "ed", " ", "from", " ", "vir", "Connect", ".", "get", "Capabilities", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "See", " ", "driver", ".", "compare", "\\u", "cpu", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "driver_", "._", "compare", "\\u", "cpu_", "(_", "cpu", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "create", "\\u", "shared", "\\u", "storage", "\\u", "test\\u", "file_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Make", "s", " ", "tmpfile", " ", "under", " ", "FLAG", "S", ".", "instance", "\\u", "path", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "enable", "s", " ", "compute", " ", "nodes", " ", "to", " ", "recognize", " ", "tha", "t", " ", "the", "y", " ", "mount", "s", "\\", "10", ";", " ", " ", " ", " ", "same", " ", "shared", " ", "storage", ".", " ", "(", "create", "|", "check", "|", "crea", "nup", ")\\u", "shared", "\\u", "storage", "\\u", "test\\u", "file", "()", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "a", " ", "pair", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "context", ":", " ", "security", " ", "context", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "tmpfile", " ", "name", "(", "basen", "ame", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "dirpath_", "=_", "FLAGS_", "._", "instance", "s", "\\u", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fd_", ",_", "tmp", "\\u", "file_", "=_", "tempfile_", "._", "mkstemp_", "(_", "dir_", "=_", "dirpath_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "debug_", "(_", "\\u_", "(_", "\"", "Creat", "ing", " ", "tmpfile", " ", "%", "s", " ", "to", " ", "notif", "y", " ", "to", " ", "other", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "compute", " ", "nodes", " ", "tha", "t", " ", "the", "y", " ", "shou", "ld", " ", "mount", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "the", " ", "same", " ", "storage", ".\"_", ")_", "%_", "tmp", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "close_", "(_", "fd_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "os_", "._", "path_", "._", "basename_", "(_", "tmp", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "check", "\\u", "shared", "\\u", "storage", "\\u", "test\\u", "file_", "(_", "self_", ",_", "context_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Confirm", "s", " ", "existence", " ", "of", " ", "the", " ", "tmpfile", " ", "under", " ", "FLAG", "S", ".", "instance", "s", "\\u", "path", ".", "\\", "10", ";", " ", " ", " ", "Cann", "ot", " ", "confirm", " ", "tmpfile", " ", "return", " ", "Fal", "se", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "context", ":", " ", "security", " ", "context", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "filename", ":", " ", "confirm", " ", "existence", " ", "of", " ", "FLAG", "S", ".", "instance", "s", "\\u", "path", "/", "this", "file", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "\\u", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "FLAGS_", "._", "instance", "s", "\\u", "path_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "os_", "._", "path_", "._", "exists_", "(_", "tmp", "\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "clean", "up", "\\u", "shared", "\\u", "storage", "\\u", "test\\u", "file_", "(_", "self_", ",_", "context_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Remove", "s", " ", "existence", " ", "of", " ", "the", " ", "tmpfile", " ", "under", " ", "FLAG", "S", ".", "instance", "s", "\\u", "path", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "context", ":", " ", "security", " ", "context", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "filename", ":", " ", "remove", " ", "existence", " ", "of", " ", "FLAG", "S", ".", "instance", "s", "\\u", "path", "/", "this", "file", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "\\u", "file_", "=_", "os_", "._", "path_", "._", "join_", "(_", "FLAGS_", "._", "instance", "s", "\\u", "path_", ",_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "os_", "._", "remove_", "(_", "tmp", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "exception_", "._", "wrap", "\\u", "exception_", "(_", "notifier_", "=_", "notifier_", ",_", "publi", "sher", "\\u", "id_", "=_", "publi", "sher", "\\u", "id_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "update", "\\u", "avail", "able", "\\u", "resource_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "See", " ", "comment", "s", " ", "update", "\\u", "resource", "\\u", "info", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "context", ":", " ", "security", " ", "context", "\\", "10", ";", " ", " ", " ", " ", ":", "return", "s", ":", " ", "See", " ", "driver", ".", "update", "\\u", "avail", "able", "\\u", "resource", "()", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "driver_", "._", "update", "\\u", "avail", "able", "\\u", "resource_", "(_", "context_", ",_", "self_", "._", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "pre", "\\u", "live", "\\u", "migration_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "time_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "block", "\\u", "migration_", "=_", "False_", ",_", "disk_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Prepar", "ation", "s", " ", "for", " ", "live", " ", "migrati", "on", " ", "at", " ", "dest", " ", "host", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "context", ":", " ", "security", " ", "context", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "instance", "\\u", "id", ":", " ", "nova", ".", "db", ".", "sqla", "lche", "my", ".", "model", "s", ".", "Insta", "nce", ".", "Id", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "block", "\\u", "migrati", "on", ":", " ", "if", " ", "true", ",", " ", "prepar", "e", " ", "for", " ", "block", " ", "migrati", "on", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "=_", "green", "thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", "ting", " ", "instance", " ", "info_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hostname_", "=_", "instance", "\\u", "ref_", "[_", "'", "host", "name", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", "ting", " ", "fixed", " ", "ips_", "\\u\\u\\uNL\\u\\u\\u_", "fixed", "\\u", "ips_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get", "\\u", "fixed", "\\u", "addresses_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "fixed", "\\u", "ips_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "exception_", "._", "Fix", "ed", "Ip", "Not", "Foun", "d", "For", "Instance_", "(_", "instance", "\\u", "id_", "=_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "any", " ", "volume", " ", "is", " ", "mounte", "d", ",", " ", "prepar", "e", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "instance", "\\u", "ref_", "[_", "'", "volume", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "info_", "(_", "\\u_", "(_", "\"%", "s", " ", "has", " ", "no", " ", "volume", ".\"_", ")_", ",_", "hostname_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "v_", "in_", "instance", "\\u", "ref_", "[_", "'", "volume", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "volume", "\\u", "manager_", "._", "setup", "\\u", "compute", "\\u", "volume_", "(_", "context_", ",_", "v_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bridge", " ", "settings", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Call", " ", "this", " ", "method", " ", "prior", " ", "to", " ", "ensure", "\\u", "filtering", "\\u", "rule", "s", "\\u", "for", "\\u", "instance", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sinc", "e", " ", "bridge", " ", "is", " ", "not", " ", "set", " ", "up", ",", " ", "ensure", "\\u", "filtering", "\\u", "rule", "s", "\\u", "for", " ", "instance_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fail", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Retr", "y", " ", "operati", "on", " ", "is", " ", "necessar", "y", " ", "bec", "aus", "e", " ", "continuous", "ly", " ", "request", " ", "come", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "conc", "orr", "ent", " ", "request", " ", "occur", "s", " ", "to", " ", "iptables", ",", " ", "then", " ", "it", " ", "compl", "ain", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "network", "\\u", "info_", "=_", "self_", "._", "\\u", "get", "\\u", "instance", "\\u", "nw", "\\u", "info_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "retry_", "=_", "FLAGS_", "._", "live", "\\u", "migrati", "on", "\\u", "retr", "y", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "cnt_", "in_", "range_", "(_", "max", "\\u", "retry_", ")_", ":_", "\\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_", "._", "driver_", "._", "plug", "\\u", "vi", "fs_", "(_", "instance", "\\u", "ref_", ",_", "network", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exception_", "._", "Process", "Execut", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cnt_", "==_", "max", "\\u", "retry_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "LOG_", "._", "warn_", "(_", "\\u_", "(_", "\"", "plug", "\\u", "vi", "fs", "()", " ", "fail", "ed", " ", "%", "(", "cnt", ")", "d", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Retr", "y", " ", "up", " ", "to", " ", "%", "(", "max", "\\u", "retr", "y", ")", "d", " ", "for", " ", "%", "(", "host", "name", ")", "s", ".\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "locals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "ing", " ", "filter", "s", " ", "to", " ", "hypervisor", "s", " ", "and", " ", "firew", "alls", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "An", " ", "example", " ", "is", " ", "tha", "t", " ", "nova", "-", "instance", "-", "instance", "-", "xxx", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "whi", "ch", " ", "is", " ", "writt", "en", " ", "to", " ", "libvi", "rt", ".", "xml", "(", "Check", " ", "\"", "virsh", " ", "nw", "filter", "-", "list", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "nw", "filter", " ", "is", " ", "necessar", "y", " ", "on", " ", "the", " ", "destinat", "ion", " ", "host", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "In", " ", "addition", ",", " ", "this", " ", "method", " ", "is", " ", "creati", "ng", " ", "filtering", " ", "rule_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "onto", " ", "destinat", "ion", " ", "host", "._", "\\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_", "._", "driver_", "._", "ensure", "\\u", "filtering", "\\u", "rule", "s", "\\u", "for", "\\u", "instance_", "(_", "instance", "\\u", "ref_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Prepar", "ation", " ", "for", " ", "block", " ", "migration_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "block", "\\u", "migration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "driver_", "._", "pre", "\\u", "block", "\\u", "migration_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "disk_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\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_", "live", "\\u", "migration_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", ",_", "block", "\\u", "migration_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Execut", "ing", " ", "live", " ", "migrati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "context", ":", " ", "security", " ", "context", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "instance", "\\u", "id", ":", " ", "nova", ".", "db", ".", "sqla", "lche", "my", ".", "model", "s", ".", "Insta", "nce", ".", "Id", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "dest", ":", " ", "destinat", "ion", " ", "host", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "block", "\\u", "migrati", "on", ":", " ", "if", " ", "true", ",", " ", "do", " ", "block", " ", "migrati", "on", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "instance", " ", "for", " ", "error", " ", "handling", "._", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", "ing", " ", "volume", " ", "node", " ", "is", " ", "working", " ", "correct", "ly", " ", "whe", "n", " ", "any", " ", "volumes_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "are", " ", "attache", "d", " ", "to", " ", "instance", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "instance", "\\u", "ref_", "[_", "'", "volume", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rpc_", "._", "call_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "FLAGS_", "._", "volume", "\\u", "topic_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "method", "\"_", ":_", "\"", "check", "\\u", "for", "\\u", "export", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "block", "\\u", "migration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "disk_", "=_", "self_", "._", "driver_", "._", "get", "\\u", "instance", "\\u", "disk", "\\u", "info_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "disk_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rpc_", "._", "call_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "db_", "._", "queue", "\\u", "get", "\\u", "for_", "(_", "context_", ",_", "FLAGS_", "._", "compute", "\\u", "topic_", ",_", "dest_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "method", "\"_", ":_", "\"", "pre", "\\u", "live", "\\u", "migrati", "on", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "block", "\\u", "migrati", "on", "'_", ":_", "block", "\\u", "migration_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "disk", "'_", ":_", "disk_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "i", "\\u", "name_", "=_", "instance", "\\u", "ref_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "\\u_", "(_", "\"", "Pre", " ", "live", " ", "migrati", "on", " ", "for", " ", "%", "(", "i", "\\u", "name", ")", "s", " ", "fail", "ed", " ", "at", " ", "%", "(", "dest", ")", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "error_", "(_", "msg_", "%_", "locals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rollback", "\\u", "live", "\\u", "migration_", "(_", "context_", ",_", "instance", "\\u", "ref_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", ",_", "block", "\\u", "migration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Execut", "ing", " ", "live", " ", "migration_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "live", "\\u", "migrati", "on", " ", "mig", "ht", " ", "raise", "s", " ", "exception", "s", ",", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", "hing", " ", "must", " ", "be", " ", "recovered", " ", "in", " ", "this", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "driver_", "._", "live", "\\u", "migration_", "(_", "context_", ",_", "instance", "\\u", "ref_", ",_", "dest_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "post", "\\u", "live", "\\u", "migration_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "rollback", "\\u", "live", "\\u", "migration_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "block", "\\u", "migration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post", "\\u", "live", "\\u", "migration_", "(_", "self_", ",_", "ctxt_", ",_", "instance", "\\u", "ref_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", ",_", "block", "\\u", "migration_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Post", " ", "operati", "ons", " ", "for", " ", "live", " ", "migrati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "call", "ed", " ", "from", " ", "live", "\\u", "migrati", "on", "\\", "10", ";", " ", " ", " ", " ", "and", " ", "mainl", "y", " ", "updat", "ing", " ", "databa", "se", " ", "record", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "ctx", "t", ":", " ", "security", " ", "context", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "instance", "\\u", "id", ":", " ", "nova", ".", "db", ".", "sqla", "lche", "my", ".", "model", "s", ".", "Insta", "nce", ".", "Id", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "dest", ":", " ", "destinat", "ion", " ", "host", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "block", "\\u", "migrati", "on", ":", " ", "if", " ", "true", ",", " ", "do", " ", "block", " ", "migrati", "on", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "._", "info_", "(_", "\\u_", "(_", "'", "post", "\\u", "live", "\\u", "migrati", "on", "()", " ", "is", " ", "start", "ed", "..'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "id_", "=_", "instance", "\\u", "ref_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Detach", "ing", " ", "volume", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "vol_", "in_", "self_", "._", "db_", "._", "volume", "\\u", "get", "\\u", "all", "\\u", "by", "\\u", "instance_", "(_", "ctxt_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "volume", "\\u", "manager_", "._", "remove", "\\u", "compute", "\\u", "volume_", "(_", "ctxt_", ",_", "vol_", "[_", "'", "id", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exception_", "._", "Not", "Found_", ":_", "\\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_", "#", " ", "Rel", "easi", "ng", " ", "vlan", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "not", " ", "necessar", "y", " ", "in", " ", "current", " ", "implementation", "?)", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "network", "\\u", "info_", "=_", "self_", "._", "\\u", "get", "\\u", "instance", "\\u", "nw", "\\u", "info_", "(_", "ctxt_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Rel", "easi", "ng", " ", "security", " ", "group", " ", "ingress", " ", "rule", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "driver_", "._", "unfi", "lter", "\\u", "instance_", "(_", "instance", "\\u", "ref_", ",_", "network", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Databa", "se", " ", "updat", "ing", "._", "\\u\\u\\uNL\\u\\u\\u_", "i", "\\u", "name_", "=_", "instance", "\\u", "ref_", "._", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Not", " ", "return", " ", "if", " ", "float", "ing", "\\u", "ip", " ", "is", " ", "not", " ", "found", ",", " ", "other", "wis", "e", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "instance", " ", "neve", "r", " ", "be", " ", "accessible", "..", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "float", "ing", "\\u", "ip_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get", "\\u", "float", "ing", "\\u", "address_", "(_", "ctxt_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "float", "ing", "\\u", "ip_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "info_", "(_", "\\u_", "(_", "'", "No", " ", "float", "ing", "\\u", "ip", " ", "is", " ", "found", " ", "for", " ", "%", "s", ".'_", ")_", ",_", "i", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "float", "ing", "\\u", "ip", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "float", "ing", "\\u", "ip", "\\u", "get", "\\u", "by", "\\u", "address_", "(_", "ctxt_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "float", "ing", "\\u", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "float", "ing", "\\u", "ip", "\\u", "update_", "(_", "ctxt_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "float", "ing", "\\u", "ip", "\\u", "ref_", "[_", "'", "address", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "host", "'_", ":_", "dest_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "exception_", "._", "Not", "Found_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "info_", "(_", "\\u_", "(_", "'", "No", " ", "float", "ing", "\\u", "ip", " ", "is", " ", "found", " ", "for", " ", "%", "s", ".'_", ")_", ",_", "i", "\\u", "name_", ")_", "\\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 ", " _", "LOG_", "._", "error_", "(_", "\\u_", "(_", "\"", "Live", " ", "migrati", "on", ":", " ", "Une", "xpe", "cte", "d", " ", "error", ":", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "(", "i", "\\u", "name", ")", "s", " ", "cann", "ot", " ", "inherit", " ", "float", "ing", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ip", ".\\\\", "n", "%", "(", "e", ")", "s", "\"_", ")_", "%_", "(_", "locals_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Define", " ", "domain", " ", "at", " ", "destinat", "ion", " ", "host", ",", " ", "with", "out", " ", "doi", "ng", " ", "it", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "paus", "e", "/", "suspend", "/", "terminate", " ", "do", " ", "not", " ", "work", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "rpc_", "._", "call_", "(_", "ctxt_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "db_", "._", "queue", "\\u", "get", "\\u", "for_", "(_", "ctxt_", ",_", "FLAGS_", "._", "compute", "\\u", "topic_", ",_", "dest_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "method", "\"_", ":_", "\"", "post", "\\u", "live", "\\u", "migrati", "on", "\\u", "at", "\\u", "destinat", "ion", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "ref_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "block", "\\u", "migrati", "on", "'_", ":_", "block", "\\u", "migration_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Restor", "e", " ", "instance", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "current", "\\u", "power", "\\u", "state_", "=_", "self_", "._", "\\u", "get", "\\u", "power", "\\u", "state_", "(_", "ctxt_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "ctxt_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", "[_", "\"", "id", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "=_", "dest_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "state_", "=_", "current", "\\u", "power", "\\u", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "ACTIVE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Restor", "e", " ", "volume", " ", "state_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "volume", "\\u", "ref_", "in_", "instance", "\\u", "ref_", "[_", "'", "volume", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "volume", "\\u", "id_", "=_", "volume", "\\u", "ref_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "volume", "\\u", "update_", "(_", "ctxt_", ",_", "volume", "\\u", "id_", ",_", "{_", "'", "status", "'_", ":_", "'", "in", "-", "use", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", " ", "instance", " ", "boot", "ing", " ", "at", " ", "source", " ", "host", ",", " ", "but", " ", "instance", " ", "dir_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "must", " ", "be", " ", "delete", "d", " ", "for", " ", "prepar", "ing", " ", "next", " ", "block", " ", "migration_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "block", "\\u", "migration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "driver_", "._", "destroy_", "(_", "instance", "\\u", "ref_", ",_", "network", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "LOG_", "._", "info_", "(_", "\\u_", "(_", "'", "Migrat", "ing", " ", "%", "(", "i", "\\u", "name", ")", "s", " ", "to", " ", "%", "(", "dest", ")", "s", " ", "finish", "ed", " ", "success", "full", "y", ".'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "locals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "info_", "(_", "\\u_", "(_", "\"", "You", " ", "may", " ", "see", " ", "the", " ", "error", " ", "\\\\\"", "libvi", "rt", ":", " ", "QE", "MU", " ", "error", ":", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Doma", "in", " ", "not", " ", "found", ":", " ", "no", " ", "domain", " ", "with", " ", "matchi", "ng", " ", "name", ".\\\\", "\"", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Thi", "s", " ", "error", " ", "can", " ", "be", " ", "safe", "ly", " ", "ignore", "d", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "post", "\\u", "live", "\\u", "migrati", "on", "\\u", "at", "\\u", "destination_", "(_", "self_", ",_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "id_", ",_", "block", "\\u", "migration_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Post", " ", "operati", "ons", " ", "for", " ", "live", " ", "migrati", "on", " ", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "context", ":", " ", "security", " ", "context", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "instance", "\\u", "id", ":", " ", "nova", ".", "db", ".", "sqla", "lche", "my", ".", "model", "s", ".", "Insta", "nce", ".", "Id", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "block", "\\u", "migrati", "on", ":", " ", "block", "\\u", "migrati", "on", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "info_", "(_", "\\u_", "(_", "'", "Post", " ", "operati", "on", " ", "of", " ", "migr", "ato", "n", " ", "start", "ed", " ", "for", " ", "%", "s", " ", ".'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "instance", "\\u", "ref_", "._", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "\\u", "info_", "=_", "self_", "._", "\\u", "get", "\\u", "instance", "\\u", "nw", "\\u", "info_", "(_", "context_", ",_", "instance", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "post", "\\u", "live", "\\u", "migrati", "on", "\\u", "at", "\\u", "destination_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "network", "\\u", "info_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "block", "\\u", "migration_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "rollback", "\\u", "live", "\\u", "migration_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "ref_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "dest_", ",_", "block", "\\u", "migration_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Recover", "s", " ", "Insta", "nce", "/", "volume", " ", "state", " ", "from", " ", "migrati", "ng", " ", "->", " ", "runn", "ing", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "context", ":", " ", "security", " ", "context", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "instance", "\\u", "id", ":", " ", "nova", ".", "db", ".", "sqla", "lche", "my", ".", "model", "s", ".", "Insta", "nce", ".", "Id", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "dest", ":", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "is", " ", "call", "ed", " ", "from", " ", "live", " ", "migrati", "on", " ", "src", " ", "host", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "param", " ", "speci", "fie", "s", " ", "destinat", "ion", " ", "host", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "host_", "=_", "instance", "\\u", "ref_", "[_", "'", "host", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "instance", "\\u", "ref_", "[_", "'", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "host_", "=_", "host_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "vm", "\\u", "state_", "=_", "vm", "\\u", "states_", "._", "ACTIVE_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "task", "\\u", "state_", "=_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "volume", "\\u", "ref_", "in_", "instance", "\\u", "ref_", "[_", "'", "volume", "s", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "volume", "\\u", "id_", "=_", "volume", "\\u", "ref_", "[_", "'", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "volume", "\\u", "update_", "(_", "context_", ",_", "volume", "\\u", "id_", ",_", "{_", "'", "status", "'_", ":_", "'", "in", "-", "use", "'_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "volume_", "._", "API_", "(_", ")_", "._", "remove", "\\u", "from", "\\u", "compute_", "(_", "context_", ",_", "volume", "\\u", "id_", ",_", "dest_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Block", " ", "migrati", "on", " ", "need", "s", " ", "empty", " ", "image", " ", "at", " ", "destinat", "ion", " ", "host_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "bef", "ore", " ", "migrati", "on", " ", "starts", ",", " ", "so", " ", "if", " ", "any", " ", "fail", "ure", " ", "occur", "s", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "any", " ", "empty", " ", "images", " ", "has", " ", "to", " ", "be", " ", "delete", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "block", "\\u", "migration_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "rpc_", "._", "cast_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "db_", "._", "queue", "\\u", "get", "\\u", "for_", "(_", "context_", ",_", "FLAGS_", "._", "compute", "\\u", "topic_", ",_", "dest_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "method", "\"_", ":_", "\"", "rollback", "\\u", "live", "\\u", "migrati", "on", "\\u", "at", "\\u", "destinat", "ion", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "args", "\"_", ":_", "{_", "'", "instance", "\\u", "id", "'_", ":_", "instance", "\\u", "ref_", "[_", "'", "id", "'_", "]_", "}_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\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_", "rollback", "\\u", "live", "\\u", "migrati", "on", "\\u", "at", "\\u", "destination_", "(_", "self_", ",_", "context_", ",_", "instance", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Clean", "ing", " ", "up", " ", "image", " ", "director", "y", " ", "tha", "t", " ", "is", " ", "created", " ", "pre", "\\u", "live", "\\u", "migrati", "on", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "context", ":", " ", "security", " ", "context", "\\", "10", ";", " ", " ", " ", " ", ":", "param", " ", "instance", "\\u", "id", ":", " ", "nova", ".", "db", ".", "sqla", "lche", "my", ".", "model", "s", ".", "Insta", "nce", ".", "Id", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "s", "\\u", "ref_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get_", "(_", "context_", ",_", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "network", "\\u", "info_", "=_", "self_", "._", "\\u", "get", "\\u", "instance", "\\u", "nw", "\\u", "info_", "(_", "context_", ",_", "instance", "s", "\\u", "ref_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "driver_", "._", "destroy_", "(_", "instance", "s", "\\u", "ref_", ",_", "network", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "periodic", "\\u", "tasks_", "(_", "self_", ",_", "context_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Task", "s", " ", "to", " ", "be", " ", "run", " ", "at", " ", "a", " ", "periodic", " ", "interval", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "list_", "=_", "super_", "(_", "Compute", "Manager_", ",_", "self_", ")_", "._", "periodic", "\\u", "tasks_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "error", "\\u", "list_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "\\u", "list_", "=_", "[_", "]_", "\\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 ", " _", "if_", "FLAGS_", "._", "rescue", "\\u", "timeout_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "driver_", "._", "poll", "\\u", "rescue", "d\\u", "instances_", "(_", "FLAGS_", "._", "rescue", "\\u", "timeout_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "warning_", "(_", "\\u_", "(_", "\"", "Error", " ", "dur", "ing", " ", "poll", "\\u", "rescue", "d\\u", "instance", "s", ":", " ", "%", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unicode_", "(_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "list_", "._", "append_", "(_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "report", "\\u", "driver", "\\u", "status_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "warning_", "(_", "\\u_", "(_", "\"", "Error", " ", "dur", "ing", " ", "report", "\\u", "driver", "\\u", "status", "():", " ", "%", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "unicode_", "(_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "list_", "._", "append_", "(_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "sync", "\\u", "power", "\\u", "states_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", "as_", "ex_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "warning_", "(_", "\\u_", "(_", "\"", "Error", " ", "dur", "ing", " ", "power", "\\u", "state", " ", "sync", ":", " ", "%", "s", "\"_", ")_", ",_", "unicode_", "(_", "ex_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "error", "\\u", "list_", "._", "append_", "(_", "ex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "error", "\\u", "list_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "report", "\\u", "driver", "\\u", "status_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "curr", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "curr", "\\u", "time_", "-_", "self_", "._", "\\u", "last", "\\u", "host", "\\u", "check_", ">_", "FLAGS_", "._", "host", "\\u", "state", "\\u", "interval_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "last", "\\u", "host", "\\u", "check_", "=_", "curr", "\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "LOG_", "._", "info_", "(_", "\\u_", "(_", "\"", "Up", "dati", "ng", " ", "host", " ", "status", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "will", " ", "gra", "b", " ", "info", " ", "abo", "ut", " ", "the", " ", "host", " ", "and", " ", "queue", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "be", " ", "sent", " ", "to", " ", "the", " ", "Schedule", "rs", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "update", "\\u", "service", "\\u", "capabilities_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "driver_", "._", "get", "\\u", "host", "\\u", "stats_", "(_", "refresh_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Compute", "Manager_", "(_", "manager_", "._", "Schedule", "r", "Dependent", "Manager_", ")_", ":_", "\\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", "sync", "\\u", "power", "\\u", "states_", "(_", "self_", ",_", "context_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Align", " ", "power", " ", "state", "s", " ", "bet", "ween", " ", "the", " ", "databa", "se", " ", "and", " ", "the", " ", "hypervisor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "hypervisor", " ", "is", " ", "authori", "tative", " ", "for", " ", "the", " ", "power", "\\u", "state", " ", "data", ",", " ", "so", " ", "we", "\\", "10", ";", " ", " ", " ", " ", "simp", "ly", " ", "loop", " ", "over", " ", "all", " ", "know", "n", " ", "instance", "s", " ", "for", " ", "this", " ", "host", " ", "and", " ", "update", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "power", "\\u", "state", " ", "according", " ", "to", " ", "the", " ", "hypervisor", ".", " ", "If", " ", "the", " ", "instance", " ", "is", " ", "not", " ", "found", "\\", "10", ";", " ", " ", " ", " ", "then", " ", "it", " ", "will", " ", "be", " ", "set", " ", "to", " ", "power", "\\u", "state", ".", "NOS", "TAT", "E", ",", " ", "bec", "aus", "e", " ", "it", " ", "doe", "sn", "'", "t", " ", "exist", "\\", "10", ";", " ", " ", " ", " ", "on", " ", "the", " ", "hypervisor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vm", "\\u", "instances_", "=_", "self_", "._", "driver_", "._", "list", "\\u", "instance", "s", "\\u", "detail_", "(_", "context_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vm", "\\u", "instances_", "=_", "dict_", "(_", "(_", "vm_", "._", "name_", ",_", "vm_", ")_", "for_", "vm_", "in_", "vm", "\\u", "instances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "\\u", "instances_", "=_", "self_", "._", "db_", "._", "instance", "\\u", "get", "\\u", "all", "\\u", "by", "\\u", "host_", "(_", "context_", ",_", "self_", "._", "host_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "num", "\\u", "vm", "\\u", "instances_", "=_", "len_", "(_", "vm", "\\u", "instances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num", "\\u", "db", "\\u", "instances_", "=_", "len_", "(_", "db", "\\u", "instances_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "num", "\\u", "vm", "\\u", "instances_", "!=_", "num", "\\u", "db", "\\u", "instances_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "LOG_", "._", "info_", "(_", "\\u_", "(_", "\"", "Foun", "d", " ", "%", "(", "num", "\\u", "db", "\\u", "instance", "s", ")", "s", " ", "in", " ", "the", " ", "databa", "se", " ", "and", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"%", "(", "num", "\\u", "vm", "\\u", "instance", "s", ")", "s", " ", "on", " ", "the", " ", "hypervisor", ".\"_", ")_", "%_", "locals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "db", "\\u", "instance_", "in_", "db", "\\u", "instances_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "db", "\\u", "instance_", "[_", "\"", "name", "\"_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "db", "\\u", "power", "\\u", "state_", "=_", "db", "\\u", "instance_", "[_", "'", "power", "\\u", "state", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vm", "\\u", "instance_", "=_", "vm", "\\u", "instances_", "._", "get_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "vm", "\\u", "instance_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vm", "\\u", "power", "\\u", "state_", "=_", "power", "\\u", "state_", "._", "NOS", "TAT", "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 ", " _", "vm", "\\u", "power", "\\u", "state_", "=_", "vm", "\\u", "instance_", "._", "state_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "vm", "\\u", "power", "\\u", "state_", "==_", "db", "\\u", "power", "\\u", "state_", ":_", "\\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_", "self_", "._", "\\u", "instance", "\\u", "update_", "(_", "context_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "db", "\\u", "instance_", "[_", "\"", "id", "\"_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "power", "\\u", "state_", "=_", "vm", "\\u", "power", "\\u", "state_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
mikemaccana/imeveryone/usermessages.py
[ { "content": "#!/usr/bin/env python2.6\nimport re\nfrom PIL import Image, ImageOps\nimport urllib2\nimport oembed\nfrom recaptcha.client import captcha\nfrom akismet import Akismet\nimport pifilter\nimport logging\nimport time\nimport uuid\nfrom time import gmtime, strftime\nimport random\nfrom datetime import datetime\nimport urllib\nimport simplejson as json\nfrom math import log\nimport rest\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def startakismet(akismetcfg):\n return Akismet(key=akismetcfg['apikey'], agent=akismetcfg['clientname'])", "metadata": "root.startakismet", "header": "['module', '___EOS___']", "index": 19 }, { "content": "def getembedcode(url, **kwargs):\n '''Oembed + Oohembed. Accept a URL and one of the arguments below, return dict with JSON.\n From sample on http://api.embed.ly/docs/oembed'''\n api_url = 'http://api.embed.ly/1/oembed?'\n ACCEPTED_ARGS = ['maxwidth', 'maxheight', 'format']\n params = {'url':url }\n\n for key, value in kwargs.items():\n if key not in ACCEPTED_ARGS:\n raise ValueError(\"Invalid Argument %s\" % key)\n params[key] = value\n\n oembed_call = \"%s%s\" % (api_url, urllib.urlencode(params))\n result = json.loads(urllib2.urlopen(oembed_call).read())\n if 'html' in result:\n return result['html']\n else: \n return None", "metadata": "root.getembedcode", "header": "['module', '___EOS___']", "index": 23 }, { "content": "def buildtree(master,messagedb):\n '''Recieve a message, return a consolidated tree of all comments'''\n tree = []\n def expandchildren(commenttoexpand):\n '''Expand child comments, adding to tree'''\n childcommentids = commenttoexpand['comments']\n for childcommentid in childcommentids:\n childcomment = messagedb.find_one({'_id':childcommentid}) \n # Make sure DB actually returned some comments\n if childcomment is not None:\n tree.append(childcomment)\n if len(childcomment['comments']): \n tree.append('in')\n expandchildren(childcomment)\n tree.append('out')\n expandchildren(master)\n return tree", "metadata": "root.buildtree", "header": "['module', '___EOS___']", "index": 45 }, { "content": "class Message(object):\n '''Submitted message'''\n \n \n \n \n \n\n \n \n \n \n \n \n \n\n \n ", "metadata": "root.Message", "header": "['module', '___EOS___']", "index": 63 }, { "content": " def __init__(self,config=None,antispam=None,_id=None,parentid=None,localfile=None,handler=None,messagedata=None,dehydrated=None):\n '''Create message'''\n \n\n if dehydrated: \n # Recreate from a dict\n # See http://stackoverflow.com/questions/1305532/convert-python-dict-to-object\n self.__dict__.update(dehydrated) \n return \n \n # FIXME: combine\n if config is None:\n logging.error('Please provide config when creating new messages')\n return\n if antispam is None:\n logging.error('Please provide antispam info when creating new messages')\n return\n if _id is None:\n logging.error('Please provide _id info when creating new messages')\n return\n\n \n # Info that's common across all messages\n # Note we store a list as it's JSON serializable. A native datetime object isn't.\n now = datetime.utcnow()\n self.posttime = {\n 'year':now.year, \n 'month':now.month, \n 'day':now.day, \n 'hour':now.hour, \n 'minute':now.minute, \n 'second':now.second\n }\n self.prettydate = self.getprettydate()\n \n self._id = _id \n self.localfile = localfile\n self.preview, self.embedcode, self.headline, self.intro, self.thread, self.availavatars, self.likecount = None, None, None, None, None, None, None\n self.treecount = 0\n self.useralerts, self.comments = [], []\n self.score = 1\n \n if messagedata:\n # Preconfigured data from injector\n self.author = messagedata['author']\n self.posttext = messagedata['posttext']\n self.challenge = messagedata['challenge']\n self.response = messagedata['response']\n self.ip = messagedata['ip']\n self.useragent = messagedata['useragent']\n self.referer = messagedata['referer']\n self.imagedata = messagedata['imagedata']\n self.host = messagedata['host']\n self.article = messagedata['article']\n self.sessionid = '1'\n elif handler:\n # Create message from handler data\n self.author = 'Anonymous'\n self.posttext = handler.get_argument('posttext')\n self.useragent = handler.request.headers['User-Agent']\n # nginx real IP\n if 'X-Real-Ip' in handler.request.headers:\n self.ip = handler.request.headers['X-Real-Ip'] \n else:\n self.ip = handler.request.remote_ip\n self.referer = handler.request.headers['Referer']\n self.host = handler.request.headers['Host']\n # Add capctha info if enabled\n if handler.application.config['captcha'].as_bool('enabled'):\n self.challenge = handler.get_argument('recaptcha_challenge_field')\n self.response = handler.get_argument('recaptcha_response_field')\n else:\n self.challenge,self.response = None, None\n # Add image data if enabled\n if 'image' in handler.request.files:\n self.imagedata = handler.request.files['image']\n else:\n self.imagedata = None\n self.sessionid = handler.getorsetsessionid()\n\n else: \n logging.error('No handler specified, and not dehydrated! Cannot create message') \n \n # Are we an article or a reply\n self.parentid = parentid\n if self.istop():\n # We're a top-level article\n logging.info('Creating new article '+str(self._id))\n # Available avatars for sessions - copy of config.\n self.availavatars = config['posting']['avatars']\n logging.info('DEBUG:'+str(len(self.availavatars))+' created in this article')\n random.shuffle(self.availavatars)\n # Create dict of session / avatar matchings\n self.sessionavatars = {}\n\n # Thread is myself\n self.thread = self._id\n \n # Grab an avatar from my own list!\n self.sessionavatars[self.sessionid] = self.availavatars.pop()\n logging.info('DEBUG:'+str(len(self.availavatars))+' left in this article')\n \n # Currently only top level messages can have links, pictures or embeds\n # Process embeds (FIXME - must come before saveimages due to check for existing embeds in saveimages)\n self.checklinksandembeds(config)\n\n # If there's no local image file, save image from web url\n if self.localfile is None:\n self.saveimages(config)\n\n # Make preview \n if self.localfile is not None and config['images'].as_bool('enabled'):\n self.makepreviewpic(self.localfile,config['images'])\n logging.info('Made preview picture.')\n else: \n logging.warn('Not making image as local file not specified or images disabled.')\n logging.info('Preview pic is: '+str(self.preview))\n \n else:\n # We're a reply\n logging.info('Creating new reply '+str(self._id)) \n\n # Add our new comment ID as a child of parent, increment parents score \n parent = handler.application.dbconnect.messages.find_one({'_id':int(parentid)})\n if parentid:\n # We're a reply\n parent['comments'].append(_id)\n\n # Increment parent score for message\n parent['score'] += config['scoring'].as_int('comment')\n \n # Every reply copies its 'thread' from its parent, which points back to the original post \n self.thread = parent['thread']\n logging.info('Thread is '+str(self.thread))\n\n # Save parent now\n # Note that 'ancestor' (later) may be the same comment, so we need to save this now.\n logging.info('Adding comment '+str(self._id)+' as child of parent '+str(parentid))\n handler.application.dbconnect.messages.save(parent)\n\n # Take an avatar from the sessions avatar/dict in ancestor\n ancestor = handler.application.dbconnect.messages.find_one({'_id':int(self.thread)})\n if self.sessionid not in ancestor['sessionavatars']:\n # This is the first time this sessionid has commented\n # Grab an available avatar from the ancestor to use for this sessionid\n myavatar = ancestor['availavatars'].pop()\n logging.info('DEBUG:'+str(len(ancestor['availavatars']))+' left in the parent')\n ancestor['sessionavatars'][self.sessionid] = myavatar\n logging.info('Sessionid '+self.sessionid+' has commented in this thread for the first time. Assigned '+myavatar+' for message '+str(self._id))\n ancestor['treecount'] += 1\n handler.application.dbconnect.messages.save(ancestor)\n # Here ancestor is saved to db with correct info, but it gets overridden later \n else: \n logging.info('This sessionid '+self.sessionid+' has commented in this thread before, using existing avatar '+ancestor['sessionavatars'][self.sessionid]) \n \n else: \n logging.warn('Error! Could not find parent with parentid '+str(parentid)+' in DB')\n \n \n \n # Validate the users input \n #self.getimagetext(self.localfile,config['images'])\n self.checktext(config)\n self.checkcaptcha(config)\n self.checkspam(config,antispam)\n self.checkporn(config)\n self.makeintro(config['posting'])\n \n # Override existing links\n self.link = '/discuss/'+str(self._id)", "metadata": "root.Message.__init__", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 65 }, { "content": " def saveimages(self,config):\n '''Save images for original posts'''\n if config['images'].as_bool('enabled'):\n if self.imagedata is None and self.embedcode is None:\n self.useralerts.append(config['alerts']['noimageorembed'])\n elif self.imagedata is not None:\n # Save image data to local file\n imagefile = self.imagedata[0]\n logging.info('Saving image: '+imagefile['filename'])\n self.localfile = config['images']['cachedir']+str(self._id)+'.'+imagefile['filename'].split('.')[-1]\n open(self.localfile,'wb').write(imagefile['body'])\n # Set self.imagedata to None now we've saved our image data to a file.\n # We need this as leaving the unencoded messagedata around will screw mongo up.\n self.imagedata = None\n else:\n # We have no image data as we're an embed only post\n return \n return", "metadata": "root.Message.saveimages", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 236 }, { "content": " def makepreviewpic(self,imagefile,imageconfig):\n '''Reduce images larger than a certain size'''\n myimage = Image.open(imagefile)\n width,height = myimage.size\n aspect = float(width) / float(height)\n maxwidth = imageconfig.as_int('maxwidth')\n maxheight = imageconfig.as_int('maxheight')\n maxsize = (maxwidth,maxheight)\n # Don't bother if image is already smaller\n if width < maxwidth and height < maxheight:\n logging.info('Small image, using existing pic at: '+imagefile)\n self.preview = imagefile\n # Resize, save, return preview file name\n else:\n myimage.thumbnail(maxsize,Image.ANTIALIAS)\n newfilename = imagefile.replace('cache','thumbs').split('.')[-2]+'_preview.'+imagefile.split('.')[-1]\n try:\n myimage.save(newfilename)\n logging.info('Saved preview pic to: '+newfilename)\n self.preview = newfilename\n except:\n pass\n return", "metadata": "root.Message.makepreviewpic", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 255 }, { "content": " def checktext(self,config):\n '''Ensure they're ranting enough, but not too much!'''\n postwords = self.posttext.strip()\n wordlist = postwords.split()\n uniquewords = set(wordlist)\n # Zero sized posts\n if len(postwords) == 0:\n self.useralerts.append(config['alerts']['zero'])\n # Overlong posts \n elif len(wordlist) > config['posting'].as_float('longpost'): \n self.useralerts.append(config['alerts']['overlong'])\n else:\n # Check text isn't full of dupes\n totalwords = len(wordlist)\n totaluniquewords = len(uniquewords)\n # Float so our answer is a float \n if totaluniquewords / float(totalwords) < config['posting'].as_float('threshhold'):\n self.useralerts.append(config['alerts']['notunique'])\n # Check post doesnt mention banned words\n for bannedword in config['posting']['bannedwords']:\n if bannedword in uniquewords:\n self.useralerts.append(config['alerts']['bannedwords'])\n return ", "metadata": "root.Message.checktext", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 280 }, { "content": " def checkcaptcha(self,config):\n '''Check for correct CAPTCHA answer'''\n if config['captcha'].as_bool('enabled'):\n recaptcha_response = captcha.submit(self.challenge, self.response, config['captcha']['privkey'], self.ip)\n if not recaptcha_response.is_valid:\n self.useralerts.append(config['alerts']['nothuman'])\n self.nothuman = True\n return", "metadata": "root.Message.checkcaptcha", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 304 }, { "content": " def checkspam(self,config,antispam):\n '''Check for spam using Akismet'''\n if config['posting']['akismet'].as_bool('enabled'):\n try:\n spam = antispam.comment_check(self.posttext,data = {\n 'user_ip':self.ip,\n 'user_agent':self.useragent,\n 'referrer':self.referer,\n 'SERVER_ADDR':self.host\n }, build_data=True, DEBUG=False)\n # Python Akismet library can fail on some types of unicode\n except UnicodeEncodeError:\n spam = True\n if spam:\n self.useralerts.append(config['alerts']['spam'])\n self.spam = True\n return", "metadata": "root.Message.checkspam", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 313 }, { "content": " def checklinksandembeds(self,config):\n '''Process any links in the text'''\n maxwidth = config['images'].as_int('maxwidth')\n maxheight = config['images'].as_int('maxheight')\n linkre = re.compile(r\"(http://[^ ]+)\")\n for link in linkre.findall(self.posttext):\n # lopp through links gettng embeds\n logging.info('Getting embed data for link: '+link)\n try:\n self.embedcode = getembedcode(link, maxwidth=maxwidth, maxheight=maxheight)\n if self.embedcode:\n logging.info('Embed data found!')\n else:\n logging.info('Embed data not found!') \n except:\n logging.warn('Getting embed data for link failed - most likely embedly 404')\n pass\n self.original = self.posttext\n self.posttext = linkre.sub('', self.posttext)\n return", "metadata": "root.Message.checklinksandembeds", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 331 }, { "content": " def checkporn(self,config):\n '''Check images for porn'''\n def savegrayscale(imagefile):\n '''Convert image to greyscale and save'''\n adultimage = Image.open(imagefile)\n adultimage = ImageOps.grayscale(adultimage)\n adultimage.save(imagefile)\n return\n if self.localfile and config['images'].as_bool('enabled') and config['images'].as_bool('adult'):\n count = 1\n response = {}\n while count < 3:\n try:\n logging.info('Checking for porn, try '+str(count))\n response = pifilter.checkimage(\n self.localfile,\n config['posting']['pifilter']['customerid'],\n aggressive = config['posting']['pifilter'].as_bool('aggressive')\n )\n break\n except:\n logging.error('Could not open pifilter URL')\n time.sleep(5)\n count = count+1\n if 'result' in response:\n if response['result']:\n logging.warn('message submission '+str(self._id)+' with image '+self.localfile+' is porn.')\n # Make a greyscale version and use that instead\n if config['images']['adultaction'] in ['gray','grey']:\n savegrayscale(self.localfile)\n logging.info('Saving greyscale version...')\n else:\n self.useralerts.append(config['alerts']['porn'])\n else:\n logging.info('image is clean')\n else:\n # No response from pifilter\n pass\n return", "metadata": "root.Message.checkporn", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 352 }, { "content": " def makeintro(self,postingconfig):\n '''Reduce the headline text in very long posts if needed'''\n postwords = self.posttext.replace('\\n',' NEWLINE ').split()\n leeway = postingconfig.as_int('leeway')\n choplen = postingconfig.as_int('choplen')\n longpost = postingconfig.as_int('longpost')\n if len(postwords) < leeway:\n self.headline = self.posttext\n else:\n self.headline = ' '.join(postwords[:choplen]).replace('NEWLINE','')+'...'\n self.intro = '...'+' '.join(postwords[choplen:longpost])\n return", "metadata": "root.Message.makeintro", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 392 }, { "content": " def getcountry(self,ip):\n '''Get user country - currently unused'''\n gi = GeoIP.new(GeoIP.GEOIP_MEMORY_CACHE)\n print gi.country_code_by_addr(ip)", "metadata": "root.Message.getcountry", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 405 }, { "content": " def getposttimedt(self):\n '''Return a datetime version of 'posttime' style dictionary '''\n return datetime(self.posttime['year'], self.posttime['month'], self.posttime['day'], self.posttime['hour'], self.posttime['minute'], self.posttime['second']) ", "metadata": "root.Message.getposttimedt", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 410 }, { "content": " def getprettydate(self):\n '''Return pretty printed date, with suffixes (st, nd) and no leading zeros'''\n posttimedt = self.getposttimedt()\n prettytime = str(int(posttimedt.strftime(\"%I\")))+':'+posttimedt.strftime(\"%M %p\")\n daysuffixes = ['st','nd','rd'] + 17*['th'] + ['st','nd','rd'] + 7*['th'] + ['st'] \n prettydate = str(int(posttimedt.strftime(\"%d\")))+daysuffixes[int(posttimedt.strftime(\"%d\"))-1]+posttimedt.strftime(\" %B %Y\")\n return prettytime+' '+prettydate ", "metadata": "root.Message.getprettydate", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 414 }, { "content": " def getrank(self):\n '''Get rank for message. Based on http://amix.dk/blog/post/19574 (Reddit style)\n '''\n order = log(max(abs(self.score), 1), 10)\n sign = 1 if self.score > 0 else -1 if self.score < 0 else 0\n seconds = time.mktime(self.getposttimedt().timetuple()) - 1134028003\n rank = round(order + sign * seconds / 45000, 7)\n return rank", "metadata": "root.Message.getrank", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 422 }, { "content": " def updatetreecount(self,db):\n '''Get total of children and grandchildren'''\n #logging.info('Updating tree count on '+str(self._id))\n \n def addchildrentototal(item):\n '''Add children of a post recursively'''\n # Only count down level posts, not top level \n if item.parentid:\n self.treecount += 1\n if len(item.comments) == 0:\n return\n else:\n for commentid in item.comments:\n commentdoc = db.messages.find_one(commentid)\n # Some docs have been deleted from the DB\n if commentdoc is not None:\n comment = Message(dehydrated=commentdoc)\n addchildrentototal(comment)\n \n self.treecount = 0\n addchildrentototal(self)\n return", "metadata": "root.Message.updatetreecount", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 431 }, { "content": " def getlikecount(self):\n '''Return count of Facebook likes for a target URL'''\n targeturl = 'http://imeveryone.com/discuss/'+str(self._id)\n endpoint = 'https://api.facebook.com'\n page = '/method/fql.query'\n querydict = {\n 'query':'''SELECT total_count FROM link_stat WHERE url=\"'''+targeturl+'''\"''',\n 'format':'json',\n }\n\n fqlhelper = rest.RESTHelper(endpoint='https://api.facebook.com')\n queryresult = fqlhelper.get(page,querydict=querydict,usejson=True)\n self.likecount = queryresult[0]['total_count']\n return", "metadata": "root.Message.getlikecount", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 454 }, { "content": " def istop(self):\n '''Check if message is toplevel'''\n return not self.parentid", "metadata": "root.Message.istop", "header": "['class', 'Message', '(', 'object', ')', ':', '___EOS___']", "index": 469 } ]
[ { "span": "import oembed", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 13 }, { "span": "import uuid", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 11 }, { "span": "from time import gmtime, strftime", "start_line": 11, "start_column": 0, "end_line": 11, "end_column": 33 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python", "2.6", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "PIL_", "import_", "Image_", ",_", "Image", "Ops_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "oem", "bed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "recap", "tcha", "_", "._", "client_", "import_", "captcha", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "aki", "sme", "t_", "import_", "Ak", "isme", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pif", "ilter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "uuid_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "time_", "import_", "gmtime_", ",_", "strftime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "simplejson_", "as_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "math_", "import_", "log_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "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_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "start", "aki", "sme", "t_", "(_", "aki", "sme", "tc", "fg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "Ak", "isme", "t_", "(_", "key_", "=_", "aki", "sme", "tc", "fg_", "[_", "'", "api", "key", "'_", "]_", ",_", "agent_", "=_", "aki", "sme", "tc", "fg_", "[_", "'", "client", "name", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "gete", "mbed", "code_", "(_", "url_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Oe", "mbed", " ", "+", " ", "Oo", "hem", "bed", ".", " ", "Accept", " ", "a", " ", "URL", " ", "and", " ", "one", " ", "of", " ", "the", " ", "argu", "ment", "s", " ", "belo", "w", ",", " ", "return", " ", "dict", " ", "with", " ", "JSO", "N", ".", "\\", "10", ";", " ", " ", " ", " ", "Fro", "m", " ", "sample", " ", "on", " ", "http", "://", "api", ".", "embed", ".", "ly", "/", "docs", "/", "oem", "bed", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api", "\\u", "url_", "=_", "'", "http", "://", "api", ".", "embed", ".", "ly", "/", "1", "/", "oem", "bed", "?'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ACCEPTED", "\\u", "ARGS_", "=_", "[_", "'", "maxw", "idt", "h", "'_", ",_", "'", "max", "height", "'_", ",_", "'", "format", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "{_", "'", "url", "'_", ":_", "url_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "kwargs_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "key_", "not_", "in_", "ACCEPTED", "\\u", "ARGS_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "\"", "Inva", "lid", " ", "Arg", "ument", " ", "%", "s", "\"_", "%_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "params_", "[_", "key_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "oem", "bed", "\\u", "call_", "=_", "\"%", "s", "%", "s", "\"_", "%_", "(_", "api", "\\u", "url_", ",_", "urllib_", "._", "urlencode_", "(_", "params_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "json_", "._", "loads_", "(_", "urllib2_", "._", "urlopen_", "(_", "oem", "bed", "\\u", "call_", ")_", "._", "read_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "html", "'_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "result_", "[_", "'", "html", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "build", "tree_", "(_", "master_", ",_", "message", "db_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Rec", "ieve", " ", "a", " ", "message", ",", " ", "return", " ", "a", " ", "consolidat", "ed", " ", "tree", " ", "of", " ", "all", " ", "comment", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tree_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "expand", "children_", "(_", "comment", "toe", "xpa", "nd_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Expand", " ", "child", " ", "comment", "s", ",", " ", "addin", "g", " ", "to", " ", "tree", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "child", "comment", "ids_", "=_", "comment", "toe", "xpa", "nd_", "[_", "'", "comment", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "child", "comment", "id_", "in_", "child", "comment", "ids_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "child", "comment_", "=_", "message", "db_", "._", "find", "\\u", "one_", "(_", "{_", "'\\u", "id", "'_", ":_", "child", "comment", "id_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "DB", " ", "actual", "ly", " ", "return", "ed", " ", "some", " ", "comments_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "child", "comment_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tree_", "._", "append_", "(_", "child", "comment_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "child", "comment_", "[_", "'", "comment", "s", "'_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "tree_", "._", "append_", "(_", "'", "in", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "expand", "children_", "(_", "child", "comment_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tree_", "._", "append_", "(_", "'", "out", "'_", ")_", "\\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_", "expand", "children_", "(_", "master_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "tree_", "\\u\\u\\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_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Submitte", "d", " ", "message", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "config_", "=_", "None_", ",_", "anti", "spam_", "=_", "None_", ",_", "\\u", "id_", "=_", "None_", ",_", "parent", "id_", "=_", "None_", ",_", "localf", "ile_", "=_", "None_", ",_", "handler_", "=_", "None_", ",_", "message", "data_", "=_", "None_", ",_", "de", "hydra", "ted_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Creat", "e", " ", "message", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "de", "hydra", "ted_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Rec", "reate", " ", "from", " ", "a", " ", "dict_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "http", "://", "stack", "overflow", ".", "com", "/", "question", "s", "/", "130", "553", "2", "/", "convert", "-", "python", "-", "dict", "-", "to", "-", "object_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "dict\\u\\u_", "._", "update_", "(_", "de", "hydra", "ted_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIX", "ME", ":", " ", "combine_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "config_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "'", "Ple", "ase", " ", "provide", " ", "config", " ", "whe", "n", " ", "creati", "ng", " ", "new", " ", "message", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "anti", "spam_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "'", "Ple", "ase", " ", "provide", " ", "anti", "spam", " ", "info", " ", "whe", "n", " ", "creati", "ng", " ", "new", " ", "message", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u", "id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "error_", "(_", "'", "Ple", "ase", " ", "provide", " ", "\\u", "id", " ", "info", " ", "whe", "n", " ", "creati", "ng", " ", "new", " ", "message", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Info", " ", "tha", "t", "'", "s", " ", "common", " ", "acro", "ss", " ", "all", " ", "messages_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "we", " ", "store", " ", "a", " ", "list", " ", "as", " ", "it", "'", "s", " ", "JSO", "N", " ", "serializable", ".", " ", "A", " ", "nativ", "e", " ", "datetime", " ", "object", " ", "isn", "'", "t", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "now_", "=_", "datetime_", "._", "utcnow_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "post", "time_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "year", "'_", ":_", "now_", "._", "year_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "month", "'_", ":_", "now_", "._", "month_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "day", "'_", ":_", "now_", "._", "day_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hour", "'_", ":_", "now_", "._", "hour_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "minute", "'_", ":_", "now_", "._", "minute_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "second", "'_", ":_", "now_", "._", "second_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pretty", "date_", "=_", "self_", "._", "getpr", "ett", "yda", "te_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "id_", "=_", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "localf", "ile_", "=_", "localf", "ile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "preview_", ",_", "self_", "._", "embed", "code_", ",_", "self_", "._", "headline", "_", ",_", "self_", "._", "intro_", ",_", "self_", "._", "thread_", ",_", "self_", "._", "avail", "avat", "ars_", ",_", "self_", "._", "like", "count_", "=_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tree", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "usera", "ler", "ts_", ",_", "self_", "._", "comments_", "=_", "[_", "]_", ",_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "score_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "message", "data_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Precon", "figure", "d", " ", "data", " ", "from", " ", "inject", "or_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "author_", "=_", "message", "data_", "[_", "'", "author", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "post", "text_", "=_", "message", "data_", "[_", "'", "post", "text", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "challenge_", "=_", "message", "data_", "[_", "'", "chall", "enge", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "=_", "message", "data_", "[_", "'", "response", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ip_", "=_", "message", "data_", "[_", "'", "ip", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "usera", "gent", "_", "=_", "message", "data_", "[_", "'", "usera", "gent", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "referer_", "=_", "message", "data_", "[_", "'", "refere", "r", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "image", "data_", "=_", "message", "data_", "[_", "'", "image", "data", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "host_", "=_", "message", "data_", "[_", "'", "host", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "article_", "=_", "message", "data_", "[_", "'", "article", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sessionid", "_", "=_", "'", "1", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "handler_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "message", " ", "from", " ", "handler", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "author_", "=_", "'", "Ano", "nym", "ous", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "post", "text_", "=_", "handler_", "._", "get", "\\u", "argument_", "(_", "'", "post", "text", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "usera", "gent", "_", "=_", "handler_", "._", "request_", "._", "headers_", "[_", "'", "User", "-", "Agent", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "ngin", "x", " ", "real", " ", "IP_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "'", "X", "-", "Real", "-", "Ip", "'_", "in_", "handler_", "._", "request_", "._", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ip_", "=_", "handler_", "._", "request_", "._", "headers_", "[_", "'", "X", "-", "Real", "-", "Ip", "'_", "]_", "\\u\\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_", "._", "ip_", "=_", "handler_", "._", "request_", "._", "remote", "\\u", "ip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "referer_", "=_", "handler_", "._", "request_", "._", "headers_", "[_", "'", "Refer", "er", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "host_", "=_", "handler_", "._", "request_", "._", "headers_", "[_", "'", "Host", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "cap", "ct", "ha", " ", "info", " ", "if", " ", "enabled_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "handler_", "._", "application_", "._", "config_", "[_", "'", "captcha", "'_", "]_", "._", "as", "\\u", "bool_", "(_", "'", "enable", "d", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "challenge_", "=_", "handler_", "._", "get", "\\u", "argument_", "(_", "'", "recap", "tcha", "\\u", "chall", "enge", "\\u", "field", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "response_", "=_", "handler_", "._", "get", "\\u", "argument_", "(_", "'", "recap", "tcha", "\\u", "response", "\\u", "field", "'_", ")_", "\\u\\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_", "._", "challenge_", ",_", "self_", "._", "response_", "=_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Add", " ", "image", " ", "data", " ", "if", " ", "enabled_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "image", "'_", "in_", "handler_", "._", "request_", "._", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "image", "data_", "=_", "handler_", "._", "request_", "._", "files_", "[_", "'", "image", "'_", "]_", "\\u\\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_", "._", "image", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sessionid", "_", "=_", "handler_", "._", "geto", "rse", "tse", "ssion", "id_", "(_", ")_", "\\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 ", " _", "logging_", "._", "error_", "(_", "'", "No", " ", "handler", " ", "specified", ",", " ", "and", " ", "not", " ", "de", "hydra", "ted", "!", " ", "Cann", "ot", " ", "create", " ", "message", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Are", " ", "we", " ", "an", " ", "article", " ", "or", " ", "a", " ", "reply_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "parent", "id_", "=_", "parent", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "isto", "p_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", "'", "re", " ", "a", " ", "top", "-", "level", " ", "article_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "'", "Creat", "ing", " ", "new", " ", "article", " ", "'_", "+_", "str_", "(_", "self_", "._", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Avail", "able", " ", "avat", "ars", " ", "for", " ", "session", "s", " ", "-", " ", "copy", " ", "of", " ", "config", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "avail", "avat", "ars_", "=_", "config_", "[_", "'", "posting", "'_", "]_", "[_", "'", "avat", "ars", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "DEBU", "G", ":'_", "+_", "str_", "(_", "len_", "(_", "self_", "._", "avail", "avat", "ars_", ")_", ")_", "+_", "'", " ", "created", " ", "in", " ", "this", " ", "article", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random_", "._", "shuffle_", "(_", "self_", "._", "avail", "avat", "ars_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Creat", "e", " ", "dict", " ", "of", " ", "session", " ", "/", " ", "avat", "ar", " ", "matchi", "ngs_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session", "avat", "ars_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thread", " ", "is", " ", "mysel", "f_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "thread_", "=_", "self_", "._", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Grab", " ", "an", " ", "avat", "ar", " ", "from", " ", "my", " ", "own", " ", "list", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "session", "avat", "ars_", "[_", "self_", "._", "sessionid", "_", "]_", "=_", "self_", "._", "avail", "avat", "ars_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "DEBU", "G", ":'_", "+_", "str_", "(_", "len_", "(_", "self_", "._", "avail", "avat", "ars_", ")_", ")_", "+_", "'", " ", "left", " ", "in", " ", "this", " ", "article", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Curr", "ent", "ly", " ", "only", " ", "top", " ", "level", " ", "message", "s", " ", "can", " ", "have", " ", "link", "s", ",", " ", "pictures", " ", "or", " ", "embeds", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Process", " ", "embeds", " ", "(", "FIX", "ME", " ", "-", " ", "must", " ", "come", " ", "bef", "ore", " ", "save", "images", " ", "due", " ", "to", " ", "check", " ", "for", " ", "exist", "ing", " ", "embeds", " ", "in", " ", "save", "images", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "check", "link", "sande", "mbed", "s_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "If", " ", "there", "'", "s", " ", "no", " ", "local", " ", "image", " ", "file", ",", " ", "save", " ", "image", " ", "from", " ", "web", " ", "url_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "localf", "ile_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "save", "images_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "previe", "w", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "localf", "ile_", "is_", "not_", "None_", "and_", "config_", "[_", "'", "images", "'_", "]_", "._", "as", "\\u", "bool_", "(_", "'", "enable", "d", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "makep", "review", "pic_", "(_", "self_", "._", "localf", "ile_", ",_", "config_", "[_", "'", "images", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Made", " ", "previe", "w", " ", "pic", "ture", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "warn_", "(_", "'", "Not", " ", "mak", "ing", " ", "image", " ", "as", " ", "local", " ", "file", " ", "not", " ", "specified", " ", "or", " ", "images", " ", "disable", "d", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Preview", " ", "pic", " ", "is", ":", " ", "'_", "+_", "str_", "(_", "self_", "._", "preview_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", "'", "re", " ", "a", " ", "reply_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "'", "Creat", "ing", " ", "new", " ", "repl", "y", " ", "'_", "+_", "str_", "(_", "self_", "._", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "our", " ", "new", " ", "comment", " ", "ID", " ", "as", " ", "a", " ", "child", " ", "of", " ", "parent", ",", " ", "increment", " ", "parents", " ", "score", " _", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "=_", "handler_", "._", "application_", "._", "dbconn", "ect_", "._", "messages_", "._", "find", "\\u", "one_", "(_", "{_", "'\\u", "id", "'_", ":_", "int_", "(_", "parent", "id_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "parent", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", "'", "re", " ", "a", " ", "reply_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parent_", "[_", "'", "comment", "s", "'_", "]_", "._", "append_", "(_", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Increment", " ", "parent", " ", "score", " ", "for", " ", "message_", "\\u\\u\\uNL\\u\\u\\u_", "parent_", "[_", "'", "score", "'_", "]_", "+=_", "config_", "[_", "'", "scor", "ing", "'_", "]_", "._", "as", "\\u", "int_", "(_", "'", "comment", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Every", " ", "repl", "y", " ", "copie", "s", " ", "its", " ", "'", "thread", "'", " ", "from", " ", "its", " ", "parent", ",", " ", "whi", "ch", " ", "points", " ", "back", " ", "to", " ", "the", " ", "original", " ", "post", " _", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "thread_", "=_", "parent_", "[_", "'", "thread", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Thread", " ", "is", " ", "'_", "+_", "str_", "(_", "self_", "._", "thread_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Save", " ", "parent", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", " ", "tha", "t", " ", "'", "ancestor", "'", " ", "(", "late", "r", ")", " ", "may", " ", "be", " ", "the", " ", "same", " ", "comment", ",", " ", "so", " ", "we", " ", "need", " ", "to", " ", "save", " ", "this", " ", "now", "._", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Add", "ing", " ", "comment", " ", "'_", "+_", "str_", "(_", "self_", "._", "\\u", "id_", ")_", "+_", "'", " ", "as", " ", "child", " ", "of", " ", "parent", " ", "'_", "+_", "str_", "(_", "parent", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "application_", "._", "dbconn", "ect_", "._", "messages_", "._", "save_", "(_", "parent_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Tak", "e", " ", "an", " ", "avat", "ar", " ", "from", " ", "the", " ", "session", "s", " ", "avat", "ar", "/", "dict", " ", "in", " ", "ancestor_", "\\u\\u\\uNL\\u\\u\\u_", "ancestor_", "=_", "handler_", "._", "application_", "._", "dbconn", "ect_", "._", "messages_", "._", "find", "\\u", "one_", "(_", "{_", "'\\u", "id", "'_", ":_", "int_", "(_", "self_", "._", "thread_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "sessionid", "_", "not_", "in_", "ancestor_", "[_", "'", "session", "avat", "ars", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "the", " ", "first", " ", "time", " ", "this", " ", "sessionid", " ", "has", " ", "commente", "d_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Grab", " ", "an", " ", "avail", "able", " ", "avat", "ar", " ", "from", " ", "the", " ", "ancestor", " ", "to", " ", "use", " ", "for", " ", "this", " ", "sessionid", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "mya", "vat", "ar_", "=_", "ancestor_", "[_", "'", "avail", "avat", "ars", "'_", "]_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "DEBU", "G", ":'_", "+_", "str_", "(_", "len_", "(_", "ancestor_", "[_", "'", "avail", "avat", "ars", "'_", "]_", ")_", ")_", "+_", "'", " ", "left", " ", "in", " ", "the", " ", "parent", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ancestor_", "[_", "'", "session", "avat", "ars", "'_", "]_", "[_", "self_", "._", "sessionid", "_", "]_", "=_", "mya", "vat", "ar_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Sess", "ioni", "d", " ", "'_", "+_", "self_", "._", "sessionid", "_", "+_", "'", " ", "has", " ", "commente", "d", " ", "in", " ", "this", " ", "thread", " ", "for", " ", "the", " ", "first", " ", "time", ".", " ", "Assign", "ed", " ", "'_", "+_", "mya", "vat", "ar_", "+_", "'", " ", "for", " ", "message", " ", "'_", "+_", "str_", "(_", "self_", "._", "\\u", "id_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ancestor_", "[_", "'", "tree", "count", "'_", "]_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "handler_", "._", "application_", "._", "dbconn", "ect_", "._", "messages_", "._", "save_", "(_", "ancestor_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Her", "e", " ", "ancestor", " ", "is", " ", "saved", " ", "to", " ", "db", " ", "with", " ", "correct", " ", "info", ",", " ", "but", " ", "it", " ", "gets", " ", "overrid", "den", " ", "late", "r", " ", " _", "\\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 ", " ", "_", "logging_", "._", "info_", "(_", "'", "Thi", "s", " ", "sessionid", " ", "'_", "+_", "self_", "._", "sessionid", "_", "+_", "'", " ", "has", " ", "commente", "d", " ", "in", " ", "this", " ", "thread", " ", "bef", "ore", ",", " ", "usi", "ng", " ", "exist", "ing", " ", "avat", "ar", " ", "'_", "+_", "ancestor_", "[_", "'", "session", "avat", "ars", "'_", "]_", "[_", "self_", "._", "sessionid", "_", "]_", ")_", "\\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 ", " _", "logging_", "._", "warn_", "(_", "'", "Error", "!", " ", "Cou", "ld", " ", "not", " ", "find", " ", "parent", " ", "with", " ", "parent", "id", " ", "'_", "+_", "str_", "(_", "parent", "id_", ")_", "+_", "'", " ", "in", " ", "DB", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Validate", " ", "the", " ", "users", " ", "input", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "geti", "mage", "text", "(", "self", ".", "localf", "ile", ",", "config", "['", "images", "'])", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "check", "text_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "captcha", "_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "checks", "pam", "_", "(_", "config_", ",_", "anti", "spam_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "checkp", "orn", "_", "(_", "config_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "make", "intro_", "(_", "config_", "[_", "'", "posting", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Override", " ", "exist", "ing", " ", "links_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "link_", "=_", "'/", "discuss", "/'_", "+_", "str_", "(_", "self_", "._", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save", "images_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Save", " ", "images", " ", "for", " ", "original", " ", "posts", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "config_", "[_", "'", "images", "'_", "]_", "._", "as", "\\u", "bool_", "(_", "'", "enable", "d", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "image", "data_", "is_", "None_", "and_", "self_", "._", "embed", "code_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "usera", "ler", "ts_", "._", "append_", "(_", "config_", "[_", "'", "alert", "s", "'_", "]_", "[_", "'", "noi", "mage", "ore", "mbed", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "image", "data_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Save", " ", "image", " ", "data", " ", "to", " ", "local", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "imagef", "ile_", "=_", "self_", "._", "image", "data_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Sav", "ing", " ", "image", ":", " ", "'_", "+_", "imagef", "ile_", "[_", "'", "filename", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "localf", "ile_", "=_", "config_", "[_", "'", "images", "'_", "]_", "[_", "'", "cachedir", "'_", "]_", "+_", "str_", "(_", "self_", "._", "\\u", "id_", ")_", "+_", "'.'_", "+_", "imagef", "ile_", "[_", "'", "filename", "'_", "]_", "._", "split_", "(_", "'.'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "open_", "(_", "self_", "._", "localf", "ile_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "imagef", "ile_", "[_", "'", "body", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Set", " ", "self", ".", "image", "data", " ", "to", " ", "Non", "e", " ", "now", " ", "we", "'", "ve", " ", "saved", " ", "our", " ", "image", " ", "data", " ", "to", " ", "a", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "need", " ", "this", " ", "as", " ", "leaving", " ", "the", " ", "une", "ncode", "d", " ", "message", "data", " ", "aro", "und", " ", "will", " ", "scre", "w", " ", "mongo", " ", "up", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "image", "data_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "have", " ", "no", " ", "image", " ", "data", " ", "as", " ", "we", "'", "re", " ", "an", " ", "embed", " ", "only", " ", "post_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "makep", "review", "pic_", "(_", "self_", ",_", "imagef", "ile_", ",_", "image", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Reduce", " ", "images", " ", "large", "r", " ", "than", " ", "a", " ", "cert", "ain", " ", "size", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "myi", "mage_", "=_", "Image_", "._", "open_", "(_", "imagef", "ile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "width_", ",_", "height_", "=_", "myi", "mage_", "._", "size_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aspect_", "=_", "float_", "(_", "width_", ")_", "/_", "float_", "(_", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maxw", "idth_", "=_", "image", "config_", "._", "as", "\\u", "int_", "(_", "'", "maxw", "idt", "h", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "height_", "=_", "image", "config_", "._", "as", "\\u", "int_", "(_", "'", "max", "height", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maxsize_", "=_", "(_", "maxw", "idth_", ",_", "max", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "bot", "her", " ", "if", " ", "image", " ", "is", " ", "alr", "ead", "y", " ", "small", "er_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "width_", "<_", "maxw", "idth_", "and_", "height_", "<_", "max", "height_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "'", "Small", " ", "image", ",", " ", "usi", "ng", " ", "exist", "ing", " ", "pic", " ", "at", ":", " ", "'_", "+_", "imagef", "ile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "preview_", "=_", "imagef", "ile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Resize", ",", " ", "save", ",", " ", "return", " ", "previe", "w", " ", "file", " ", "name_", "\\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 ", " _", "myi", "mage_", "._", "thumbnail_", "(_", "maxsize_", ",_", "Image_", "._", "ANTI", "ALIAS_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "newfile", "name_", "=_", "imagef", "ile_", "._", "replace_", "(_", "'", "cache", "'_", ",_", "'", "thumbs", "'_", ")_", "._", "split_", "(_", "'.'_", ")_", "[_", "-_", "2_", "]_", "+_", "'\\u", "previe", "w", ".'_", "+_", "imagef", "ile_", "._", "split_", "(_", "'.'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "myi", "mage_", "._", "save_", "(_", "newfile", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Save", "d", " ", "previe", "w", " ", "pic", " ", "to", ":", " ", "'_", "+_", "newfile", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "preview_", "=_", "newfile", "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_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "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_", "check", "text_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Ensur", "e", " ", "the", "y", "'", "re", " ", "rant", "ing", " ", "eno", "ugh", ",", " ", "but", " ", "not", " ", "too", " ", "muc", "h", "!'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "words_", "=_", "self_", "._", "post", "text_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "wordlist_", "=_", "post", "words_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unique", "words_", "=_", "set_", "(_", "wordlist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Zero", " ", "sized", " ", "posts_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "post", "words_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "usera", "ler", "ts_", "._", "append_", "(_", "config_", "[_", "'", "alert", "s", "'_", "]_", "[_", "'", "zero", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Over", "long", " ", "posts", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "wordlist_", ")_", ">_", "config_", "[_", "'", "posting", "'_", "]_", "._", "as", "\\u", "float_", "(_", "'", "long", "post", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "usera", "ler", "ts_", "._", "append_", "(_", "config_", "[_", "'", "alert", "s", "'_", "]_", "[_", "'", "overl", "ong", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "text", " ", "isn", "'", "t", " ", "full", " ", "of", " ", "dupe", "s_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "total", "words_", "=_", "len_", "(_", "wordlist_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "total", "unique", "words_", "=_", "len_", "(_", "unique", "words_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Float", " ", "so", " ", "our", " ", "answer", " ", "is", " ", "a", " ", "float", " _", "\\u\\u\\uNL\\u\\u\\u_", "if_", "total", "unique", "words_", "/_", "float_", "(_", "total", "words_", ")_", "<_", "config_", "[_", "'", "posting", "'_", "]_", "._", "as", "\\u", "float_", "(_", "'", "thresh", "hold", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "usera", "ler", "ts_", "._", "append_", "(_", "config_", "[_", "'", "alert", "s", "'_", "]_", "[_", "'", "not", "unique", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "post", " ", "doesnt", " ", "menti", "on", " ", "banned", " ", "words_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "banned", "word_", "in_", "config_", "[_", "'", "posting", "'_", "]_", "[_", "'", "banned", "words", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "banned", "word_", "in_", "unique", "words_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "usera", "ler", "ts_", "._", "append_", "(_", "config_", "[_", "'", "alert", "s", "'_", "]_", "[_", "'", "banned", "words", "'_", "]_", ")_", "\\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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "captcha", "_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Check", " ", "for", " ", "correct", " ", "CAPT", "CHA", " ", "answer", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "config_", "[_", "'", "captcha", "'_", "]_", "._", "as", "\\u", "bool_", "(_", "'", "enable", "d", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recap", "tcha", "\\u", "response_", "=_", "captcha", "_", "._", "submit_", "(_", "self_", "._", "challenge_", ",_", "self_", "._", "response_", ",_", "config_", "[_", "'", "captcha", "'_", "]_", "[_", "'", "priv", "key", "'_", "]_", ",_", "self_", "._", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "recap", "tcha", "\\u", "response_", "._", "is", "\\u", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "usera", "ler", "ts_", "._", "append_", "(_", "config_", "[_", "'", "alert", "s", "'_", "]_", "[_", "'", "not", "human", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "not", "human_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "checks", "pam", "_", "(_", "self_", ",_", "config_", ",_", "anti", "spam_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Check", " ", "for", " ", "spam", " ", "usi", "ng", " ", "Ak", "isme", "t", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "config_", "[_", "'", "posting", "'_", "]_", "[_", "'", "aki", "sme", "t", "'_", "]_", "._", "as", "\\u", "bool_", "(_", "'", "enable", "d", "'_", ")_", ":_", "\\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 ", " _", "spam_", "=_", "anti", "spam_", "._", "comment", "\\u", "check_", "(_", "self_", "._", "post", "text_", ",_", "data_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "ip", "'_", ":_", "self_", "._", "ip_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "user", "\\u", "agent", "'_", ":_", "self_", "._", "usera", "gent", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "referrer", "'_", ":_", "self_", "._", "referer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "SERVER", "\\u", "ADDR", "'_", ":_", "self_", "._", "host_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "build", "\\u", "data_", "=_", "True_", ",_", "DEBUG_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "Ak", "isme", "t", " ", "librar", "y", " ", "can", " ", "fail", " ", "on", " ", "some", " ", "types", " ", "of", " ", "unicode_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Unic", "ode", "Encode", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "spam_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "spam_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "usera", "ler", "ts_", "._", "append_", "(_", "config_", "[_", "'", "alert", "s", "'_", "]_", "[_", "'", "spam", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "spam_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "link", "sande", "mbed", "s_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Process", " ", "any", " ", "link", "s", " ", "in", " ", "the", " ", "text", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "maxw", "idth_", "=_", "config_", "[_", "'", "images", "'_", "]_", "._", "as", "\\u", "int_", "(_", "'", "maxw", "idt", "h", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "height_", "=_", "config_", "[_", "'", "images", "'_", "]_", "._", "as", "\\u", "int_", "(_", "'", "max", "height", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "link", "re_", "=_", "re_", "._", "compile_", "(_", "r", "\"(", "http", "://", "[", "^", " ", "]+)\"", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "link_", "in_", "link", "re_", "._", "findall_", "(_", "self_", "._", "post", "text_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "lop", "p", " ", "through", " ", "link", "s", " ", "gett", "ng", " ", "embeds", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "info_", "(_", "'", "Get", "ting", " ", "embed", " ", "data", " ", "for", " ", "link", ":", " ", "'_", "+_", "link_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "embed", "code_", "=_", "gete", "mbed", "code_", "(_", "link_", ",_", "maxw", "idth_", "=_", "maxw", "idth_", ",_", "max", "height_", "=_", "max", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "embed", "code_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logging_", "._", "info_", "(_", "'", "Emb", "ed", " ", "data", " ", "found", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logging_", "._", "info_", "(_", "'", "Emb", "ed", " ", "data", " ", "not", " ", "found", "!'_", ")_", "\\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 ", " _", "logging_", "._", "warn_", "(_", "'", "Get", "ting", " ", "embed", " ", "data", " ", "for", " ", "link", " ", "fail", "ed", " ", "-", " ", "most", " ", "like", "ly", " ", "embed", "ly", " ", "404", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "original_", "=_", "self_", "._", "post", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "post", "text_", "=_", "link", "re_", "._", "sub_", "(_", "''_", ",_", "self_", "._", "post", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "checkp", "orn", "_", "(_", "self_", ",_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Check", " ", "images", " ", "for", " ", "por", "n", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "save", "grayscale", "_", "(_", "imagef", "ile_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Convert", " ", "image", " ", "to", " ", "grey", "scale", " ", "and", " ", "save", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adult", "image_", "=_", "Image_", "._", "open_", "(_", "imagef", "ile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adult", "image_", "=_", "Image", "Ops_", "._", "grayscale", "_", "(_", "adult", "image_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "adult", "image_", "._", "save_", "(_", "imagef", "ile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "localf", "ile_", "and_", "config_", "[_", "'", "images", "'_", "]_", "._", "as", "\\u", "bool_", "(_", "'", "enable", "d", "'_", ")_", "and_", "config_", "[_", "'", "images", "'_", "]_", "._", "as", "\\u", "bool_", "(_", "'", "adult", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "count_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "count_", "<_", "3_", ":_", "\\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 ", " ", "_", "logging_", "._", "info_", "(_", "'", "Check", "ing", " ", "for", " ", "por", "n", ",", " ", "try", " ", "'_", "+_", "str_", "(_", "count_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "pif", "ilter_", "._", "check", "image_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "localf", "ile_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "[_", "'", "posting", "'_", "]_", "[_", "'", "pif", "ilter", "'_", "]_", "[_", "'", "customer", "id", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "aggre", "ssi", "ve_", "=_", "config_", "[_", "'", "posting", "'_", "]_", "[_", "'", "pif", "ilter", "'_", "]_", "._", "as", "\\u", "bool_", "(_", "'", "aggre", "ssi", "ve", "'_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "break_", "\\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 ", " ", "_", "logging_", "._", "error_", "(_", "'", "Cou", "ld", " ", "not", " ", "open", " ", "pif", "ilter", " ", "URL", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time_", "._", "sleep_", "(_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "count_", "=_", "count_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "result", "'_", "in_", "response_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "response_", "[_", "'", "result", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "logging_", "._", "warn_", "(_", "'", "message", " ", "subm", "ission", " ", "'_", "+_", "str_", "(_", "self_", "._", "\\u", "id_", ")_", "+_", "'", " ", "with", " ", "image", " ", "'_", "+_", "self_", "._", "localf", "ile_", "+_", "'", " ", "is", " ", "por", "n", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Make", " ", "a", " ", "grey", "scale", " ", "version", " ", "and", " ", "use", " ", "tha", "t", " ", "inst", "ead_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "config_", "[_", "'", "images", "'_", "]_", "[_", "'", "adult", "action", "'_", "]_", "in_", "[_", "'", "gray", "'_", ",_", "'", "grey", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "save", "grayscale", "_", "(_", "self_", "._", "localf", "ile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Sav", "ing", " ", "grey", "scale", " ", "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 ", " ", " _", "self_", "._", "usera", "ler", "ts_", "._", "append_", "(_", "config_", "[_", "'", "alert", "s", "'_", "]_", "[_", "'", "por", "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 ", " ", "_", "logging_", "._", "info_", "(_", "'", "image", " ", "is", " ", "clean", "'_", ")_", "\\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_", "#", " ", "No", " ", "response", " ", "from", " ", "pif", "ilter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "make", "intro_", "(_", "self_", ",_", "posting", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Reduce", " ", "the", " ", "headline", " ", "text", " ", "in", " ", "very", " ", "long", " ", "posts", " ", "if", " ", "need", "ed", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "words_", "=_", "self_", "._", "post", "text_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "'", " ", "NEWLINE", " ", "'_", ")_", "._", "split_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lee", "way_", "=_", "posting", "config_", "._", "as", "\\u", "int_", "(_", "'", "lee", "way", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chop", "len_", "=_", "posting", "config_", "._", "as", "\\u", "int_", "(_", "'", "chop", "len", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "long", "post_", "=_", "posting", "config_", "._", "as", "\\u", "int_", "(_", "'", "long", "post", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "post", "words_", ")_", "<_", "lee", "way_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "headline", "_", "=_", "self_", "._", "post", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "headline", "_", "=_", "'", " ", "'_", "._", "join_", "(_", "post", "words_", "[_", ":_", "chop", "len_", "]_", ")_", "._", "replace_", "(_", "'", "NEWLINE", "'_", ",_", "''_", ")_", "+_", "'...'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "intro_", "=_", "'...'_", "+_", "'", " ", "'_", "._", "join_", "(_", "post", "words_", "[_", "chop", "len_", ":_", "long", "post_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getco", "untr", "y_", "(_", "self_", ",_", "ip_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Get", " ", "user", " ", "countr", "y", " ", "-", " ", "currentl", "y", " ", "unu", "sed", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gi_", "=_", "Geo", "IP_", "._", "new_", "(_", "Geo", "IP_", "._", "GEO", "IP", "\\u", "MEM", "ORY", "\\u", "CACHE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "gi_", "._", "countr", "y", "\\u", "code", "\\u", "by", "\\u", "addr_", "(_", "ip_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getp", "ost", "timed", "t_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Return", " ", "a", " ", "datetime", " ", "version", " ", "of", " ", "'", "post", "time", "'", " ", "style", " ", "dictionar", "y", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "datetime_", "(_", "self_", "._", "post", "time_", "[_", "'", "year", "'_", "]_", ",_", "self_", "._", "post", "time_", "[_", "'", "month", "'_", "]_", ",_", "self_", "._", "post", "time_", "[_", "'", "day", "'_", "]_", ",_", "self_", "._", "post", "time_", "[_", "'", "hour", "'_", "]_", ",_", "self_", "._", "post", "time_", "[_", "'", "minute", "'_", "]_", ",_", "self_", "._", "post", "time_", "[_", "'", "second", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getpr", "ett", "yda", "te_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Return", " ", "pretty", " ", "printed", " ", "date", ",", " ", "with", " ", "suffixe", "s", " ", "(", "st", ",", " ", "nd", ")", " ", "and", " ", "no", " ", "lead", "ing", " ", "zero", "s", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "post", "timed", "t_", "=_", "self_", "._", "getp", "ost", "timed", "t_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pretty", "time_", "=_", "str_", "(_", "int_", "(_", "post", "timed", "t_", "._", "strftime_", "(_", "\"%", "I", "\"_", ")_", ")_", ")_", "+_", "':'_", "+_", "post", "timed", "t_", "._", "strftime_", "(_", "\"%", "M", " ", "%", "p", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "day", "suffixes_", "=_", "[_", "'", "st", "'_", ",_", "'", "nd", "'_", ",_", "'", "rd", "'_", "]_", "+_", "17_", "*_", "[_", "'", "th", "'_", "]_", "+_", "[_", "'", "st", "'_", ",_", "'", "nd", "'_", ",_", "'", "rd", "'_", "]_", "+_", "7_", "*_", "[_", "'", "th", "'_", "]_", "+_", "[_", "'", "st", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pretty", "date_", "=_", "str_", "(_", "int_", "(_", "post", "timed", "t_", "._", "strftime_", "(_", "\"%", "d", "\"_", ")_", ")_", ")_", "+_", "day", "suffixes_", "[_", "int_", "(_", "post", "timed", "t_", "._", "strftime_", "(_", "\"%", "d", "\"_", ")_", ")_", "-_", "1_", "]_", "+_", "post", "timed", "t_", "._", "strftime_", "(_", "\"", " ", "%", "B", " ", "%", "Y", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "pretty", "time_", "+_", "'", " ", "'_", "+_", "pretty", "date_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getra", "nk_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Get", " ", "rank", " ", "for", " ", "message", ".", " ", "Base", "d", " ", "on", " ", "http", "://", "ami", "x", ".", "dk", "/", "blog", "/", "post", "/", "195", "7", "4", " ", "(", "Reddit", " ", "style", ")", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "order_", "=_", "log_", "(_", "max_", "(_", "abs_", "(_", "self_", "._", "score_", ")_", ",_", "1_", ")_", ",_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sign_", "=_", "1_", "if_", "self_", "._", "score_", ">_", "0_", "else_", "-_", "1_", "if_", "self_", "._", "score_", "<_", "0_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seconds_", "=_", "time_", "._", "mktime_", "(_", "self_", "._", "getp", "ost", "timed", "t_", "(_", ")_", "._", "timetuple_", "(_", ")_", ")_", "-_", "113", "402", "800", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rank_", "=_", "round_", "(_", "order_", "+_", "sign_", "*_", "seconds_", "/_", "4500", "0_", ",_", "7_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "rank_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "update", "tree", "count_", "(_", "self_", ",_", "db_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Get", " ", "total", " ", "of", " ", "child", "ren", " ", "and", " ", "grand", "child", "ren", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "logg", "ing", ".", "info", "('", "Up", "dati", "ng", " ", "tree", " ", "count", " ", "on", " ", "'+", "str", "(", "self", ".\\u", "id", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "addc", "hild", "rent", "oto", "tal_", "(_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Add", " ", "child", "ren", " ", "of", " ", "a", " ", "post", " ", "recurs", "ively", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "count", " ", "down", " ", "level", " ", "posts", ",", " ", "not", " ", "top", " ", "level", " _", "\\u\\u\\uNL\\u\\u\\u_", "if_", "item_", "._", "parent", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tree", "count_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "item_", "._", "comments_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "comment", "id_", "in_", "item_", "._", "comments_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "comment", "doc_", "=_", "db_", "._", "messages_", "._", "find", "\\u", "one_", "(_", "comment", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Some", " ", "docs", " ", "have", " ", "bee", "n", " ", "delete", "d", " ", "from", " ", "the", " ", "DB_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "comment", "doc_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "comment_", "=_", "Message_", "(_", "de", "hydra", "ted_", "=_", "comment", "doc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addc", "hild", "rent", "oto", "tal_", "(_", "comment_", ")_", "\\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_", "self_", "._", "tree", "count_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addc", "hild", "rent", "oto", "tal_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getl", "ike", "count_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Return", " ", "count", " ", "of", " ", "Face", "book", " ", "likes", " ", "for", " ", "a", " ", "target", " ", "URL", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "url_", "=_", "'", "http", "://", "ime", "very", "one", ".", "com", "/", "discuss", "/'_", "+_", "str_", "(_", "self_", "._", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "endpoint_", "=_", "'", "https", "://", "api", ".", "facebook", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "page_", "=_", "'/", "method", "/", "fq", "l", ".", "query", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "dict_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "query", "'_", ":_", "'''", "SELECT", " ", "total", "\\u", "count", " ", "FROM", " ", "link", "\\u", "stat", " ", "WHE", "RE", " ", "url", "=\"", "'''_", "+_", "target", "url_", "+_", "'''", "\"'''", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "format", "'_", ":_", "'", "json", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "fq", "lh", "elp", "er_", "=_", "rest_", "._", "REST", "Helper_", "(_", "endpoint_", "=_", "'", "https", "://", "api", ".", "facebook", ".", "com", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "query", "result_", "=_", "fq", "lh", "elp", "er_", "._", "get_", "(_", "page_", ",_", "query", "dict_", "=_", "query", "dict_", ",_", "use", "json_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "like", "count_", "=_", "query", "result_", "[_", "0_", "]_", "[_", "'", "total", "\\u", "count", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Message_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "isto", "p_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Check", " ", "if", " ", "message", " ", "is", " ", "toplevel", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "not_", "self_", "._", "parent", "id_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 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, 0, 1, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
hmason/botomatic/botomatic/example_bots/myuberdriver.py
[ { "content": "import urllib\nimport urllib2\nimport json\nimport re\nimport sys\n\nfrom botomatic import TBot\n\n\nif __name__ == '__main__':\n r = MyUberDriver()\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class MyUberDriver(TBot):\n debug_mode = False\n\n\n", "metadata": "root.MyUberDriver", "header": "['module', '___EOS___']", "index": 8 }, { "content": " def __init__(self):\n handle = \"myuberdriverbot\"\n self.query = \"my uber driver\"\n super(MyUberDriver, self).__init__(handle)", "metadata": "root.MyUberDriver.__init__", "header": "['class', 'MyUberDriver', '(', 'TBot', ')', ':', '___EOS___']", "index": 11 }, { "content": " def run(self):\n # find other people's stuff on twitter and fav/retweet\n for tweet in self.search(\"my uber driver\"):\n if tweet.lang != 'en': # english only\n continue \n\n if \"uber driver\" not in tweet.text:\n continue\n\n try:\n tweet.retweet() # only retweet one each time the script is run\n except:\n pass\n \n break\n\n \n self.wrap_up()", "metadata": "root.MyUberDriver.run", "header": "['class', 'MyUberDriver', '(', 'TBot', ')', ':', '___EOS___']", "index": 17 } ]
[ { "span": "import urllib", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 13 }, { "span": "import urllib2", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 14 }, { "span": "import json", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 11 }, { "span": "import re", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 9 }, { "span": "import sys", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "boto", "mati", "c_", "import_", "TB", "ot_", "\\u\\u\\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 ", " _", "r_", "=_", "My", "Ub", "er", "Driver_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "My", "Ub", "er", "Driver_", "(_", "TB", "ot_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "debug", "\\u", "mode_", "=_", "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\\uNL\\u\\u\\u_", "[SEP]_", "class_", "My", "Ub", "er", "Driver_", "(_", "TB", "ot_", ")_", ":_", "\\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 ", " _", "handle_", "=_", "\"", "myu", "ber", "driver", "bot", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "query_", "=_", "\"", "my", " ", "uber", " ", "driver", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "My", "Ub", "er", "Driver_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "handle_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "Ub", "er", "Driver_", "(_", "TB", "ot_", ")_", ":_", "\\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_", "#", " ", "find", " ", "other", " ", "people", "'", "s", " ", "stu", "ff", " ", "on", " ", "twit", "ter", " ", "and", " ", "fav", "/", "retweet", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "tweet_", "in_", "self_", "._", "search_", "(_", "\"", "my", " ", "uber", " ", "driver", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "tweet_", "._", "lang_", "!=_", "'", "en", "'_", ":_", "#", " ", "english", " ", "only_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\"", "uber", " ", "driver", "\"_", "not_", "in_", "tweet_", "._", "text_", ":_", "\\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_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tweet_", "._", "retweet", "_", "(_", ")_", "#", " ", "only", " ", "retweet", " ", "one", " ", "each", " ", "time", " ", "the", " ", "script", " ", "is", " ", "run_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "break_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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JamesPHoughton/pysd/tests/test-models-master/tests/builtin_max/builtin_max.py
[ { "content": "\nfrom __future__ import division\nimport numpy as np\nfrom pysd import functions\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def time():\n return _t", "metadata": "root.time", "header": "['module', '___EOS___']", "index": 5 }, { "content": "def output():\n \"\"\"\n Type: Flow or Auxiliary\n \n \"\"\"\n return max(time(), 5)", "metadata": "root.output", "header": "['module', '___EOS___']", "index": 8 }, { "content": "def final_time():\n \"\"\"\n Type: Flow or Auxiliary\n \n \"\"\"\n return 10", "metadata": "root.final_time", "header": "['module', '___EOS___']", "index": 15 }, { "content": "def initial_time():\n \"\"\"\n Type: Flow or Auxiliary\n \n \"\"\"\n return 0", "metadata": "root.initial_time", "header": "['module', '___EOS___']", "index": 22 }, { "content": "def saveper():\n \"\"\"\n Type: Flow or Auxiliary\n \n \"\"\"\n return time_step()", "metadata": "root.saveper", "header": "['module', '___EOS___']", "index": 29 }, { "content": "def time_step():\n \"\"\"\n Type: Flow or Auxiliary\n \n \"\"\"\n return 1", "metadata": "root.time_step", "header": "['module', '___EOS___']", "index": 36 } ]
[ { "span": "import numpy as np", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 18 }, { "span": "from pysd import functions", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 26 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "division_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pys", "d_", "import_", "functions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "time_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u", "t_", "\\u\\u\\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_", "output_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Type", ":", " ", "Flow", " ", "or", " ", "Aux", "iliar", "y", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "max_", "(_", "time_", "(_", ")_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "final", "\\u", "time_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Type", ":", " ", "Flow", " ", "or", " ", "Aux", "iliar", "y", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\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_", "def_", "initial", "\\u", "time_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Type", ":", " ", "Flow", " ", "or", " ", "Aux", "iliar", "y", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "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_", "savep", "er_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Type", ":", " ", "Flow", " ", "or", " ", "Aux", "iliar", "y", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "time", "\\u", "step_", "(_", ")_", "\\u\\u\\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_", "time", "\\u", "step_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Type", ":", " ", "Flow", " ", "or", " ", "Aux", "iliar", "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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
CollabQ/CollabQ/.google_appengine/google/appengine/ext/remote_api/remote_api_stub.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\"\"\"An apiproxy stub that calls a remote handler via HTTP.\n\nThis allows easy remote access to the App Engine datastore, and potentially any\nof the other App Engine APIs, using the same interface you use when accessing\nthe service locally.\n\nAn example Python script:\n---\nfrom google.appengine.ext import db\nfrom google.appengine.ext.remote_api import remote_api_stub\nfrom myapp import models\nimport getpass\n\ndef auth_func():\n return (raw_input('Username:'), getpass.getpass('Password:'))\n\nremote_api_stub.ConfigureRemoteDatastore('my-app', '/remote_api', auth_func)\n\n# Now you can access the remote datastore just as if your code was running on\n# App Engine!\n\nhouses = models.House.all().fetch(100)\nfor a_house in q:\n a_house.doors += 1\ndb.put(houses)\n---\n\nA few caveats:\n- Where possible, avoid iterating over queries. Fetching as many results as you\n will need is faster and more efficient. If you don't know how many results\n you need, or you need 'all of them', iterating is fine.\n- Likewise, it's a good idea to put entities in batches. Instead of calling put\n for each individual entity, accumulate them and put them in batches using\n db.put(), if you can.\n- Requests and responses are still limited to 1MB each, so if you have large\n entities or try and fetch or put many of them at once, your requests may fail.\n\"\"\"\n\n\n\n\n\nimport google\nimport os\nimport pickle\nimport random\nimport sha\nimport sys\nimport thread\nimport threading\nimport yaml\n\nfrom google.appengine.api import datastore\nfrom google.appengine.api import apiproxy_rpc\nfrom google.appengine.api import apiproxy_stub_map\nfrom google.appengine.datastore import datastore_pb\nfrom google.appengine.ext.remote_api import remote_api_pb\nfrom google.appengine.runtime import apiproxy_errors\nfrom google.appengine.tools import appengine_rpc\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nALL_SERVICES = set([\n 'capability_service',\n 'datastore_v3',\n 'images',\n 'mail',\n 'memcache',\n 'taskqueue',\n 'urlfetch',\n 'xmpp',\n])\n\n\n\n\n\n\nConfigureRemoteDatastore = ConfigureRemoteApi\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Error(Exception):\n \"\"\"Base class for exceptions in this module.\"\"\"", "metadata": "root.Error", "header": "['module', '___EOS___']", "index": 78 }, { "content": "class ConfigurationError(Error):\n \"\"\"Exception for configuration errors.\"\"\"", "metadata": "root.ConfigurationError", "header": "['module', '___EOS___']", "index": 82 }, { "content": "class UnknownJavaServerError(Error):\n \"\"\"Exception for exceptions returned from a Java remote_api handler.\"\"\"", "metadata": "root.UnknownJavaServerError", "header": "['module', '___EOS___']", "index": 86 }, { "content": "def GetUserAgent():\n \"\"\"Determines the value of the 'User-agent' header to use for HTTP requests.\n\n Returns:\n String containing the 'user-agent' header value, which includes the SDK\n version, the platform information, and the version of Python;\n e.g., \"remote_api/1.0.1 Darwin/9.2.0 Python/2.5.2\".\n \"\"\"\n product_tokens = []\n\n product_tokens.append(\"Google-remote_api/1.0\")\n\n product_tokens.append(appengine_rpc.GetPlatformToken())\n\n python_version = \".\".join(str(i) for i in sys.version_info)\n product_tokens.append(\"Python/%s\" % python_version)\n\n return \" \".join(product_tokens)", "metadata": "root.GetUserAgent", "header": "['module', '___EOS___']", "index": 90 }, { "content": "def GetSourceName():\n return \"Google-remote_api-1.0\"", "metadata": "root.GetSourceName", "header": "['module', '___EOS___']", "index": 110 }, { "content": "class TransactionData(object):\n \"\"\"Encapsulates data about an individual transaction.\"\"\"\n", "metadata": "root.TransactionData", "header": "['module', '___EOS___']", "index": 114 }, { "content": " def __init__(self, thread_id):\n self.thread_id = thread_id\n self.preconditions = {}\n self.entities = {}", "metadata": "root.TransactionData.__init__", "header": "['class', 'TransactionData', '(', 'object', ')', ':', '___EOS___']", "index": 117 }, { "content": "class RemoteStub(object):\n \"\"\"A stub for calling services on a remote server over HTTP.\n\n You can use this to stub out any service that the remote server supports.\n \"\"\"\n\n\n\n\n\n", "metadata": "root.RemoteStub", "header": "['module', '___EOS___']", "index": 123 }, { "content": " def __init__(self, server, path, _test_stub_map=None):\n \"\"\"Constructs a new RemoteStub that communicates with the specified server.\n\n Args:\n server: An instance of a subclass of\n google.appengine.tools.appengine_rpc.AbstractRpcServer.\n path: The path to the handler this stub should send requests to.\n \"\"\"\n self._server = server\n self._path = path\n self._test_stub_map = _test_stub_map", "metadata": "root.RemoteStub.__init__", "header": "['class', 'RemoteStub', '(', 'object', ')', ':', '___EOS___']", "index": 129 }, { "content": " def _PreHookHandler(self, service, call, request, response):\n pass", "metadata": "root.RemoteStub._PreHookHandler", "header": "['class', 'RemoteStub', '(', 'object', ')', ':', '___EOS___']", "index": 141 }, { "content": " def _PostHookHandler(self, service, call, request, response):\n pass", "metadata": "root.RemoteStub._PostHookHandler", "header": "['class', 'RemoteStub', '(', 'object', ')', ':', '___EOS___']", "index": 144 }, { "content": " def MakeSyncCall(self, service, call, request, response):\n self._PreHookHandler(service, call, request, response)\n try:\n test_stub = self._test_stub_map and self._test_stub_map.GetStub(service)\n if test_stub:\n test_stub.MakeSyncCall(service, call, request, response)\n else:\n self._MakeRealSyncCall(service, call, request, response)\n finally:\n self._PostHookHandler(service, call, request, response)", "metadata": "root.RemoteStub.MakeSyncCall", "header": "['class', 'RemoteStub', '(', 'object', ')', ':', '___EOS___']", "index": 147 }, { "content": " def _MakeRealSyncCall(self, service, call, request, response):\n request_pb = remote_api_pb.Request()\n request_pb.set_service_name(service)\n request_pb.set_method(call)\n request_pb.mutable_request().set_contents(request.Encode())\n\n response_pb = remote_api_pb.Response()\n encoded_request = request_pb.Encode()\n encoded_response = self._server.Send(self._path, encoded_request)\n response_pb.ParseFromString(encoded_response)\n\n if response_pb.has_application_error():\n error_pb = response_pb.application_error()\n raise apiproxy_errors.ApplicationError(error_pb.code(),\n error_pb.detail())\n elif response_pb.has_exception():\n raise pickle.loads(response_pb.exception().contents())\n elif response_pb.has_java_exception():\n raise UnknownJavaServerError(\"An unknown error has occured in the \"\n \"Java remote_api handler for this call.\")\n else:\n response.ParseFromString(response_pb.response().contents())", "metadata": "root.RemoteStub._MakeRealSyncCall", "header": "['class', 'RemoteStub', '(', 'object', ')', ':', '___EOS___']", "index": 158 }, { "content": " def CreateRPC(self):\n return apiproxy_rpc.RPC(stub=self)", "metadata": "root.RemoteStub.CreateRPC", "header": "['class', 'RemoteStub', '(', 'object', ')', ':', '___EOS___']", "index": 181 }, { "content": "class RemoteDatastoreStub(RemoteStub):\n \"\"\"A specialised stub for accessing the App Engine datastore remotely.\n\n A specialised stub is required because there are some datastore operations\n that preserve state between calls. This stub makes queries possible.\n Transactions on the remote datastore are unfortunately still impossible.\n \"\"\"\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.RemoteDatastoreStub", "header": "['module', '___EOS___']", "index": 185 }, { "content": " def __init__(self, server, path, default_result_count=20,\n _test_stub_map=None):\n \"\"\"Constructor.\n\n Args:\n server: The server name to connect to.\n path: The URI path on the server.\n default_result_count: The number of items to fetch, by default, in a\n datastore Query or Next operation. This affects the batch size of\n query iterators.\n \"\"\"\n super(RemoteDatastoreStub, self).__init__(server, path, _test_stub_map)\n self.default_result_count = default_result_count\n self.__queries = {}\n self.__transactions = {}\n\n self.__next_local_cursor = 1\n self.__local_cursor_lock = threading.Lock()\n self.__next_local_tx = 1\n self.__local_tx_lock = threading.Lock()", "metadata": "root.RemoteDatastoreStub.__init__", "header": "['class', 'RemoteDatastoreStub', '(', 'RemoteStub', ')', ':', '___EOS___']", "index": 193 }, { "content": " def MakeSyncCall(self, service, call, request, response):\n assert service == 'datastore_v3'\n\n explanation = []\n assert request.IsInitialized(explanation), explanation\n\n handler = getattr(self, '_Dynamic_' + call, None)\n if handler:\n handler(request, response)\n else:\n super(RemoteDatastoreStub, self).MakeSyncCall(service, call, request,\n response)\n\n assert response.IsInitialized(explanation), explanation", "metadata": "root.RemoteDatastoreStub.MakeSyncCall", "header": "['class', 'RemoteDatastoreStub', '(', 'RemoteStub', ')', ':', '___EOS___']", "index": 214 }, { "content": " def _Dynamic_RunQuery(self, query, query_result, cursor_id = None):\n super(RemoteDatastoreStub, self).MakeSyncCall(\n 'datastore_v3', 'RunQuery', query, query_result)\n\n if cursor_id is None:\n self.__local_cursor_lock.acquire()\n try:\n cursor_id = self.__next_local_cursor\n self.__next_local_cursor += 1\n finally:\n self.__local_cursor_lock.release()\n\n if query_result.more_results():\n query.set_offset(query.offset() + query_result.result_size())\n if query.has_limit():\n query.set_limit(query.limit() - query_result.result_size())\n self.__queries[cursor_id] = query\n else:\n self.__queries[cursor_id] = None\n\n query_result.mutable_cursor().set_cursor(cursor_id)", "metadata": "root.RemoteDatastoreStub._Dynamic_RunQuery", "header": "['class', 'RemoteDatastoreStub', '(', 'RemoteStub', ')', ':', '___EOS___']", "index": 229 }, { "content": " def _Dynamic_Next(self, next_request, query_result):\n cursor_id = next_request.cursor().cursor()\n if cursor_id not in self.__queries:\n raise apiproxy_errors.ApplicationError(datastore_pb.Error.BAD_REQUEST,\n 'Cursor %d not found' % cursor_id)\n query = self.__queries[cursor_id]\n\n if query is None:\n query_result.set_more_results(False)\n return\n else:\n if next_request.has_count():\n query.set_count(next_request.count())\n else:\n query.clear_count()\n\n self._Dynamic_RunQuery(query, query_result, cursor_id)", "metadata": "root.RemoteDatastoreStub._Dynamic_Next", "header": "['class', 'RemoteDatastoreStub', '(', 'RemoteStub', ')', ':', '___EOS___']", "index": 251 }, { "content": " def _Dynamic_Get(self, get_request, get_response):\n txid = None\n if get_request.has_transaction():\n txid = get_request.transaction().handle()\n txdata = self.__transactions[txid]\n assert (txdata.thread_id ==\n thread.get_ident()), \"Transactions are single-threaded.\"\n\n keys = [(k, k.Encode()) for k in get_request.key_list()]\n\n new_request = datastore_pb.GetRequest()\n for key, enckey in keys:\n if enckey not in txdata.entities:\n new_request.add_key().CopyFrom(key)\n else:\n new_request = get_request\n\n if new_request.key_size() > 0:\n super(RemoteDatastoreStub, self).MakeSyncCall(\n 'datastore_v3', 'Get', new_request, get_response)\n\n if txid is not None:\n newkeys = new_request.key_list()\n entities = get_response.entity_list()\n for key, entity in zip(newkeys, entities):\n entity_hash = None\n if entity.has_entity():\n entity_hash = sha.new(entity.entity().Encode()).digest()\n txdata.preconditions[key.Encode()] = (key, entity_hash)\n\n new_response = datastore_pb.GetResponse()\n it = iter(get_response.entity_list())\n for key, enckey in keys:\n if enckey in txdata.entities:\n cached_entity = txdata.entities[enckey][1]\n if cached_entity:\n new_response.add_entity().mutable_entity().CopyFrom(cached_entity)\n else:\n new_response.add_entity()\n else:\n new_entity = it.next()\n if new_entity.has_entity():\n assert new_entity.entity().key() == key\n new_response.add_entity().CopyFrom(new_entity)\n else:\n new_response.add_entity()\n get_response.CopyFrom(new_response)", "metadata": "root.RemoteDatastoreStub._Dynamic_Get", "header": "['class', 'RemoteDatastoreStub', '(', 'RemoteStub', ')', ':', '___EOS___']", "index": 269 }, { "content": " def _Dynamic_Put(self, put_request, put_response):\n if put_request.has_transaction():\n entities = put_request.entity_list()\n\n requires_id = lambda x: x.id() == 0 and not x.has_name()\n new_ents = [e for e in entities\n if requires_id(e.key().path().element_list()[-1])]\n id_request = remote_api_pb.PutRequest()\n if new_ents:\n for ent in new_ents:\n e = id_request.add_entity()\n e.mutable_key().CopyFrom(ent.key())\n e.mutable_entity_group()\n id_response = datastore_pb.PutResponse()\n super(RemoteDatastoreStub, self).MakeSyncCall(\n 'remote_datastore', 'GetIDs', id_request, id_response)\n assert id_request.entity_size() == id_response.key_size()\n for key, ent in zip(id_response.key_list(), new_ents):\n ent.mutable_key().CopyFrom(key)\n ent.mutable_entity_group().add_element().CopyFrom(\n key.path().element(0))\n\n txid = put_request.transaction().handle()\n txdata = self.__transactions[txid]\n assert (txdata.thread_id ==\n thread.get_ident()), \"Transactions are single-threaded.\"\n for entity in entities:\n txdata.entities[entity.key().Encode()] = (entity.key(), entity)\n put_response.add_key().CopyFrom(entity.key())\n else:\n super(RemoteDatastoreStub, self).MakeSyncCall(\n 'datastore_v3', 'Put', put_request, put_response)", "metadata": "root.RemoteDatastoreStub._Dynamic_Put", "header": "['class', 'RemoteDatastoreStub', '(', 'RemoteStub', ')', ':', '___EOS___']", "index": 317 }, { "content": " def _Dynamic_Delete(self, delete_request, response):\n if delete_request.has_transaction():\n txid = delete_request.transaction().handle()\n txdata = self.__transactions[txid]\n assert (txdata.thread_id ==\n thread.get_ident()), \"Transactions are single-threaded.\"\n for key in delete_request.key_list():\n txdata.entities[key.Encode()] = (key, None)\n else:\n super(RemoteDatastoreStub, self).MakeSyncCall(\n 'datastore_v3', 'Delete', delete_request, response)", "metadata": "root.RemoteDatastoreStub._Dynamic_Delete", "header": "['class', 'RemoteDatastoreStub', '(', 'RemoteStub', ')', ':', '___EOS___']", "index": 350 }, { "content": " def _Dynamic_BeginTransaction(self, request, transaction):\n self.__local_tx_lock.acquire()\n try:\n txid = self.__next_local_tx\n self.__transactions[txid] = TransactionData(thread.get_ident())\n self.__next_local_tx += 1\n finally:\n self.__local_tx_lock.release()\n transaction.set_handle(txid)", "metadata": "root.RemoteDatastoreStub._Dynamic_BeginTransaction", "header": "['class', 'RemoteDatastoreStub', '(', 'RemoteStub', ')', ':', '___EOS___']", "index": 362 }, { "content": " def _Dynamic_Commit(self, transaction, transaction_response):\n txid = transaction.handle()\n if txid not in self.__transactions:\n raise apiproxy_errors.ApplicationError(\n datastore_pb.Error.BAD_REQUEST,\n 'Transaction %d not found.' % (txid,))\n\n txdata = self.__transactions[txid]\n assert (txdata.thread_id ==\n thread.get_ident()), \"Transactions are single-threaded.\"\n del self.__transactions[txid]\n\n tx = remote_api_pb.TransactionRequest()\n for key, hash in txdata.preconditions.values():\n precond = tx.add_precondition()\n precond.mutable_key().CopyFrom(key)\n if hash:\n precond.set_hash(hash)\n\n puts = tx.mutable_puts()\n deletes = tx.mutable_deletes()\n for key, entity in txdata.entities.values():\n if entity:\n puts.add_entity().CopyFrom(entity)\n else:\n deletes.add_key().CopyFrom(key)\n\n super(RemoteDatastoreStub, self).MakeSyncCall(\n 'remote_datastore', 'Transaction',\n tx, datastore_pb.PutResponse())", "metadata": "root.RemoteDatastoreStub._Dynamic_Commit", "header": "['class', 'RemoteDatastoreStub', '(', 'RemoteStub', ')', ':', '___EOS___']", "index": 372 }, { "content": " def _Dynamic_Rollback(self, transaction, transaction_response):\n txid = transaction.handle()\n self.__local_tx_lock.acquire()\n try:\n if txid not in self.__transactions:\n raise apiproxy_errors.ApplicationError(\n datastore_pb.Error.BAD_REQUEST,\n 'Transaction %d not found.' % (txid,))\n\n txdata = self.__transactions[txid]\n assert (txdata[txid].thread_id ==\n thread.get_ident()), \"Transactions are single-threaded.\"\n del self.__transactions[txid]\n finally:\n self.__local_tx_lock.release()", "metadata": "root.RemoteDatastoreStub._Dynamic_Rollback", "header": "['class', 'RemoteDatastoreStub', '(', 'RemoteStub', ')', ':', '___EOS___']", "index": 403 }, { "content": " def _Dynamic_CreateIndex(self, index, id_response):\n raise apiproxy_errors.CapabilityDisabledError(\n 'The remote datastore does not support index manipulation.')", "metadata": "root.RemoteDatastoreStub._Dynamic_CreateIndex", "header": "['class', 'RemoteDatastoreStub', '(', 'RemoteStub', ')', ':', '___EOS___']", "index": 419 }, { "content": " def _Dynamic_UpdateIndex(self, index, void):\n raise apiproxy_errors.CapabilityDisabledError(\n 'The remote datastore does not support index manipulation.')", "metadata": "root.RemoteDatastoreStub._Dynamic_UpdateIndex", "header": "['class', 'RemoteDatastoreStub', '(', 'RemoteStub', ')', ':', '___EOS___']", "index": 423 }, { "content": " def _Dynamic_DeleteIndex(self, index, void):\n raise apiproxy_errors.CapabilityDisabledError(\n 'The remote datastore does not support index manipulation.')", "metadata": "root.RemoteDatastoreStub._Dynamic_DeleteIndex", "header": "['class', 'RemoteDatastoreStub', '(', 'RemoteStub', ')', ':', '___EOS___']", "index": 427 }, { "content": "def ConfigureRemoteApi(app_id,\n path,\n auth_func,\n servername=None,\n rpc_server_factory=appengine_rpc.HttpRpcServer,\n rtok=None,\n secure=False,\n services=None,\n default_auth_domain=None):\n \"\"\"Does necessary setup to allow easy remote access to App Engine APIs.\n\n Either servername must be provided or app_id must not be None. If app_id\n is None and a servername is provided, this function will send a request\n to the server to retrieve the app_id.\n\n Args:\n app_id: The app_id of your app, as declared in app.yaml.\n path: The path to the remote_api handler for your app\n (for example, '/remote_api').\n auth_func: A function that takes no arguments and returns a\n (username, password) tuple. This will be called if your application\n requires authentication to access the remote_api handler (it should!)\n and you do not already have a valid auth cookie.\n servername: The hostname your app is deployed on. Defaults to\n <app_id>.appspot.com.\n rpc_server_factory: A factory to construct the rpc server for the datastore.\n rtok: The validation token to sent with app_id lookups. If None, a random\n token is used.\n secure: Use SSL when communicating with the server.\n services: A list of services to set up stubs for. If specified, only those\n services are configured; by default all supported services are configured.\n default_auth_domain: The authentication domain to use by default.\n\n Raises:\n urllib2.HTTPError: if app_id is not provided and there is an error while\n retrieving it.\n ConfigurationError: if there is a error configuring the DatstoreFileStub.\n \"\"\"\n if not servername and not app_id:\n raise ConfigurationError('app_id or servername required')\n if not servername:\n servername = '%s.appspot.com' % (app_id,)\n server = rpc_server_factory(servername, auth_func, GetUserAgent(),\n GetSourceName(), debug_data=False, secure=secure)\n if not app_id:\n if not rtok:\n random.seed()\n rtok = str(random.random())[2:]\n urlargs = {'rtok': rtok}\n response = server.Send(path, payload=None, **urlargs)\n if not response.startswith('{'):\n raise ConfigurationError(\n 'Invalid response recieved from server: %s' % response)\n app_info = yaml.load(response)\n if not app_info or 'rtok' not in app_info or 'app_id' not in app_info:\n raise ConfigurationError('Error parsing app_id lookup response')\n if app_info['rtok'] != rtok:\n raise ConfigurationError('Token validation failed during app_id lookup. '\n '(sent %s, got %s)' % (repr(rtok),\n repr(app_info['rtok'])))\n app_id = app_info['app_id']\n\n if services is not None:\n services = set(services)\n unsupported = services.difference(ALL_SERVICES)\n if unsupported:\n raise ConfigurationError('Unsupported service(s): %s'\n % (', '.join(unsupported),))\n else:\n services = set(ALL_SERVICES)\n\n os.environ['APPLICATION_ID'] = app_id\n if default_auth_domain:\n os.environ['AUTH_DOMAIN'] = default_auth_domain\n elif 'AUTH_DOMAIN' not in os.environ:\n os.environ['AUTH_DOMAIN'] = 'gmail.com'\n apiproxy_stub_map.apiproxy = apiproxy_stub_map.APIProxyStubMap()\n if 'datastore_v3' in services:\n services.remove('datastore_v3')\n datastore_stub = RemoteDatastoreStub(server, path)\n apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', datastore_stub)\n stub = RemoteStub(server, path)\n for service in services:\n apiproxy_stub_map.apiproxy.RegisterStub(service, stub)", "metadata": "root.ConfigureRemoteApi", "header": "['module', '___EOS___']", "index": 444 }, { "content": "def MaybeInvokeAuthentication():\n \"\"\"Sends an empty request through to the configured end-point.\n\n If authentication is necessary, this will cause the rpc_server to invoke\n interactive authentication.\n \"\"\"\n datastore_stub = apiproxy_stub_map.apiproxy.GetStub('datastore_v3')\n if isinstance(datastore_stub, RemoteStub):\n datastore_stub._server.Send(datastore_stub._path, payload=None)\n else:\n raise ConfigurationError('remote_api is not configured.')", "metadata": "root.MaybeInvokeAuthentication", "header": "['module', '___EOS___']", "index": 530 } ]
[ { "span": "import google", "start_line": 59, "start_column": 0, "end_line": 59, "end_column": 13 }, { "span": "from google.appengine.api import datastore", "start_line": 69, "start_column": 0, "end_line": 69, "end_column": 42 } ]
[]
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_", "\"\"\"", "An", " ", "api", "proxy", " ", "stub", " ", "tha", "t", " ", "calls", " ", "a", " ", "remote", " ", "handler", " ", "via", " ", "HTTP", ".", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "allow", "s", " ", "easy", " ", "remote", " ", "access", " ", "to", " ", "the", " ", "App", " ", "Engine", " ", "datast", "ore", ",", " ", "and", " ", "potenti", "ally", " ", "any", "\\", "10", ";", "of", " ", "the", " ", "other", " ", "App", " ", "Engine", " ", "API", "s", ",", " ", "usi", "ng", " ", "the", " ", "same", " ", "interface", " ", "you", " ", "use", " ", "whe", "n", " ", "accessi", "ng", "\\", "10", ";", "the", " ", "service", " ", "local", "ly", ".", "\\", "10", ";", "\\", "10", ";", "An", " ", "example", " ", "Pyth", "on", " ", "script", ":", "\\", "10", ";", "---", "\\", "10", ";", "from", " ", "google", ".", "appengine", ".", "ext", " ", "import", " ", "db", "\\", "10", ";", "from", " ", "google", ".", "appengine", ".", "ext", ".", "remote", "\\u", "api", " ", "import", " ", "remote", "\\u", "api", "\\u", "stub", "\\", "10", ";", "from", " ", "myapp", " ", "import", " ", "model", "s", "\\", "10", ";", "import", " ", "getpa", "ss", "\\", "10", ";", "\\", "10", ";", "def", " ", "auth", "\\u", "func", "():", "\\", "10", ";", " ", " ", "return", " ", "(", "raw", "\\u", "input", "('", "User", "name", ":'", "),", " ", "getpa", "ss", ".", "getpa", "ss", "('", "Passw", "ord", ":'", "))\\", "10", ";", "\\", "10", ";", "remote", "\\u", "api", "\\u", "stub", ".", "Configure", "Remo", "te", "Datas", "tore", "('", "my", "-", "app", "',", " ", "'/", "remote", "\\u", "api", "',", " ", "auth", "\\u", "func", ")", "\\", "10", ";", "\\", "10", ";", "#", " ", "No", "w", " ", "you", " ", "can", " ", "access", " ", "the", " ", "remote", " ", "datast", "ore", " ", "just", " ", "as", " ", "if", " ", "your", " ", "code", " ", "was", " ", "runn", "ing", " ", "on", "\\", "10", ";", "#", " ", "App", " ", "Engine", "!", "\\", "10", ";", "\\", "10", ";", "houses", " ", "=", " ", "model", "s", ".", "House", ".", "all", "()", ".", "fetch", "(", "100", ")", "\\", "10", ";", "for", " ", "a", "\\u", "house", " ", "in", " ", "q", ":", "\\", "10", ";", " ", " ", "a", "\\u", "house", ".", "door", "s", " ", "+=", " ", "1", "\\", "10", ";", "db", ".", "put", "(", "houses", ")", "\\", "10", ";", "---", "\\", "10", ";", "\\", "10", ";", "A", " ", "few", " ", "cave", "ats", ":", "\\", "10", ";", "-", " ", "Whe", "re", " ", "possib", "le", ",", " ", "avoid", " ", "iterati", "ng", " ", "over", " ", "querie", "s", ".", " ", "Fe", "tch", "ing", " ", "as", " ", "many", " ", "results", " ", "as", " ", "you", "\\", "10", ";", " ", " ", "will", " ", "need", " ", "is", " ", "faste", "r", " ", "and", " ", "more", " ", "efficien", "t", ".", " ", "If", " ", "you", " ", "don", "'", "t", " ", "know", " ", "how", " ", "many", " ", "results", "\\", "10", ";", " ", " ", "you", " ", "need", ",", " ", "or", " ", "you", " ", "need", " ", "'", "all", " ", "of", " ", "them", "',", " ", "iterati", "ng", " ", "is", " ", "fine", ".", "\\", "10", ";", "-", " ", "Lik", "ew", "ise", ",", " ", "it", "'", "s", " ", "a", " ", "good", " ", "idea", " ", "to", " ", "put", " ", "entit", "ies", " ", "in", " ", "batche", "s", ".", " ", "Ins", "tea", "d", " ", "of", " ", "calling", " ", "put", "\\", "10", ";", " ", " ", "for", " ", "each", " ", "individual", " ", "entity", ",", " ", "accumulate", " ", "them", " ", "and", " ", "put", " ", "them", " ", "in", " ", "batche", "s", " ", "usi", "ng", "\\", "10", ";", " ", " ", "db", ".", "put", "()", ",", " ", "if", " ", "you", " ", "can", ".", "\\", "10", ";", "-", " ", "Request", "s", " ", "and", " ", "response", "s", " ", "are", " ", "still", " ", "limited", " ", "to", " ", "1", "MB", " ", "each", ",", " ", "so", " ", "if", " ", "you", " ", "have", " ", "large", "\\", "10", ";", " ", " ", "entit", "ies", " ", "or", " ", "try", " ", "and", " ", "fetch", " ", "or", " ", "put", " ", "many", " ", "of", " ", "them", " ", "at", " ", "onc", "e", ",", " ", "your", " ", "request", "s", " ", "may", " ", "fail", ".", "\\", "10", ";\"\"\"_", "\\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_", "google_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pickle_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sha_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "thread_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "yaml_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "datastore_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "api", "proxy", "\\u", "rpc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "api_", "import_", "api", "proxy", "\\u", "stub", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "datastore_", "import_", "datast", "ore", "\\u", "pb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "ext_", "._", "remote", "\\u", "api_", "import_", "remote", "\\u", "api", "\\u", "pb_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "runtime_", "import_", "api", "proxy", "\\u", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "google_", "._", "appengine_", "._", "tools_", "import_", "appengine", "\\u", "rpc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "ALL", "\\u", "SERVICES", "_", "=_", "set_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "capab", "ilit", "y", "\\u", "service", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "datast", "ore", "\\u", "v", "3", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "images", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "mail", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "memc", "ache", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "task", "queue", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "urlf", "etch", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "xmpp", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Configure", "Remo", "te", "Datas", "tore_", "=_", "Configure", "Remo", "te", "Api_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Error_", "(_", "Exception_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Base", " ", "class", " ", "for", " ", "exception", "s", " ", "in", " ", "this", " ", "module", ".\"\"\"_", "\\u\\u\\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_", "Configura", "tion", "Error_", "(_", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Except", "ion", " ", "for", " ", "configura", "tion", " ", "error", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Un", "know", "n", "Ja", "va", "Server", "Error_", "(_", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Except", "ion", " ", "for", " ", "exception", "s", " ", "return", "ed", " ", "from", " ", "a", " ", "Ja", "va", " ", "remote", "\\u", "api", " ", "handler", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "User", "Agent_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Det", "erm", "ine", "s", " ", "the", " ", "value", " ", "of", " ", "the", " ", "'", "User", "-", "agent", "'", " ", "header", " ", "to", " ", "use", " ", "for", " ", "HTTP", " ", "request", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Return", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "String", " ", "contain", "ing", " ", "the", " ", "'", "user", "-", "agent", "'", " ", "header", " ", "value", ",", " ", "whi", "ch", " ", "include", "s", " ", "the", " ", "SD", "K", "\\", "10", ";", " ", " ", " ", " ", "version", ",", " ", "the", " ", "platform", " ", "informati", "on", ",", " ", "and", " ", "the", " ", "version", " ", "of", " ", "Pyth", "on", ";", "\\", "10", ";", " ", " ", " ", " ", "e", ".", "g", ".,", " ", "\"", "remote", "\\u", "api", "/", "1.0", ".1", " ", "Dar", "win", "/", "9.2", ".0", " ", "Pyth", "on", "/", "2.5", ".2", "\".\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "product", "\\u", "tokens_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "product", "\\u", "tokens_", "._", "append_", "(_", "\"", "Goo", "gle", "-", "remote", "\\u", "api", "/", "1.0", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "product", "\\u", "tokens_", "._", "append_", "(_", "appengine", "\\u", "rpc_", "._", "Get", "Plat", "form", "Token_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "python", "\\u", "version_", "=_", "\".\"_", "._", "join_", "(_", "str_", "(_", "i_", ")_", "for_", "i_", "in_", "sys_", "._", "version", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "product", "\\u", "tokens_", "._", "append_", "(_", "\"", "Pyth", "on", "/", "%", "s", "\"_", "%_", "python", "\\u", "version_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "\"", " ", "\"_", "._", "join_", "(_", "product", "\\u", "tokens_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Sou", "rce", "Name_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\"", "Goo", "gle", "-", "remote", "\\u", "api", "-1", ".0", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Transa", "ction", "Data_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Enca", "psu", "late", "s", " ", "data", " ", "abo", "ut", " ", "an", " ", "individual", " ", "transaction", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Transa", "ction", "Data_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "thread", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "thread", "\\u", "id_", "=_", "thread", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "precondition", "s_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "entities_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Remo", "te", "Stub_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "stub", " ", "for", " ", "calling", " ", "service", "s", " ", "on", " ", "a", " ", "remote", " ", "server", " ", "over", " ", "HTTP", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "You", " ", "can", " ", "use", " ", "this", " ", "to", " ", "stub", " ", "out", " ", "any", " ", "service", " ", "tha", "t", " ", "the", " ", "remote", " ", "server", " ", "support", "s", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Remo", "te", "Stub_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "server_", ",_", "path_", ",_", "\\u", "test\\u", "stub", "\\u", "map_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Construct", "s", " ", "a", " ", "new", " ", "Remo", "te", "Stu", "b", " ", "tha", "t", " ", "communi", "cate", "s", " ", "with", " ", "the", " ", "specified", " ", "server", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "server", ":", " ", "An", " ", "instance", " ", "of", " ", "a", " ", "subclass", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "google", ".", "appengine", ".", "tool", "s", ".", "appengine", "\\u", "rpc", ".", "Abstract", "Rp", "c", "Server", ".", "\\", "10", ";", " ", " ", "path", ":", " ", "The", " ", "path", " ", "to", " ", "the", " ", "handler", " ", "this", " ", "stub", " ", "shou", "ld", " ", "send", " ", "request", "s", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "server_", "=_", "server_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "path_", "=_", "path_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "test\\u", "stub", "\\u", "map_", "=_", "\\u", "test\\u", "stub", "\\u", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remo", "te", "Stub_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Pre", "Hook", "Handler_", "(_", "self_", ",_", "service_", ",_", "call_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remo", "te", "Stub_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Post", "Hook", "Handler_", "(_", "self_", ",_", "service_", ",_", "call_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remo", "te", "Stub_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Make", "Sync", "Call_", "(_", "self_", ",_", "service_", ",_", "call_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Pre", "Hook", "Handler_", "(_", "service_", ",_", "call_", ",_", "request_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "stub_", "=_", "self_", "._", "\\u", "test\\u", "stub", "\\u", "map_", "and_", "self_", "._", "\\u", "test\\u", "stub", "\\u", "map_", "._", "Get", "Stub_", "(_", "service_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "test\\u", "stub_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "test\\u", "stub_", "._", "Make", "Sync", "Call_", "(_", "service_", ",_", "call_", ",_", "request_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "Make", "Real", "Sync", "Call_", "(_", "service_", ",_", "call_", ",_", "request_", ",_", "response_", ")_", "\\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 ", " _", "self_", "._", "\\u", "Post", "Hook", "Handler_", "(_", "service_", ",_", "call_", ",_", "request_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remo", "te", "Stub_", "(_", "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", "Make", "Real", "Sync", "Call_", "(_", "self_", ",_", "service_", ",_", "call_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request", "\\u", "pb_", "=_", "remote", "\\u", "api", "\\u", "pb_", "._", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "\\u", "pb_", "._", "set\\u", "service", "\\u", "name_", "(_", "service_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "\\u", "pb_", "._", "set\\u", "method_", "(_", "call_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "request", "\\u", "pb_", "._", "mutable", "\\u", "request_", "(_", ")_", "._", "set\\u", "contents_", "(_", "request_", "._", "Encode", "_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response", "\\u", "pb_", "=_", "remote", "\\u", "api", "\\u", "pb_", "._", "Response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "encode", "d\\u", "request_", "=_", "request", "\\u", "pb_", "._", "Encode", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "encode", "d\\u", "response_", "=_", "self_", "._", "\\u", "server_", "._", "Send_", "(_", "self_", "._", "\\u", "path_", ",_", "encode", "d\\u", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response", "\\u", "pb_", "._", "Pars", "e", "Fro", "m", "String_", "(_", "encode", "d\\u", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "response", "\\u", "pb_", "._", "has", "\\u", "applica", "tion", "\\u", "error_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "error", "\\u", "pb_", "=_", "response", "\\u", "pb_", "._", "applica", "tion", "\\u", "error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "api", "proxy", "\\u", "errors_", "._", "Applica", "tion", "Error_", "(_", "error", "\\u", "pb_", "._", "code_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "error", "\\u", "pb_", "._", "detail_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "response", "\\u", "pb_", "._", "has", "\\u", "exception_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "pickle_", "._", "loads_", "(_", "response", "\\u", "pb_", "._", "exception_", "(_", ")_", "._", "contents_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "response", "\\u", "pb_", "._", "has", "\\u", "java", "\\u", "exception_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Un", "know", "n", "Ja", "va", "Server", "Error_", "(_", "\"", "An", " ", "unknown", " ", "error", " ", "has", " ", "occure", "d", " ", "in", " ", "the", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Ja", "va", " ", "remote", "\\u", "api", " ", "handler", " ", "for", " ", "this", " ", "call", ".\"_", ")_", "\\u\\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_", "._", "Pars", "e", "Fro", "m", "String_", "(_", "response", "\\u", "pb_", "._", "response_", "(_", ")_", "._", "contents_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remo", "te", "Stub_", "(_", "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_", "Creat", "e", "RP", "C_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "api", "proxy", "\\u", "rpc_", "._", "RP", "C_", "(_", "stub_", "=_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Remo", "te", "Datas", "tore", "Stub_", "(_", "Remo", "te", "Stub_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "A", " ", "special", "ise", "d", " ", "stub", " ", "for", " ", "accessi", "ng", " ", "the", " ", "App", " ", "Engine", " ", "datast", "ore", " ", "remote", "ly", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "A", " ", "special", "ise", "d", " ", "stub", " ", "is", " ", "require", "d", " ", "bec", "aus", "e", " ", "there", " ", "are", " ", "some", " ", "datast", "ore", " ", "operati", "ons", "\\", "10", ";", " ", " ", "tha", "t", " ", "preserve", " ", "state", " ", "bet", "ween", " ", "calls", ".", " ", "Thi", "s", " ", "stub", " ", "make", "s", " ", "querie", "s", " ", "possib", "le", ".", "\\", "10", ";", " ", " ", "Transactions", " ", "on", " ", "the", " ", "remote", " ", "datast", "ore", " ", "are", " ", "unfo", "rtu", "nat", "el", "y", " ", "still", " ", "impossible", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Remo", "te", "Datas", "tore", "Stub_", "(_", "Remo", "te", "Stub_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "server_", ",_", "path_", ",_", "default", "\\u", "result", "\\u", "count_", "=_", "20_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "test\\u", "stub", "\\u", "map_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Constructor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", "server", ":", " ", "The", " ", "server", " ", "name", " ", "to", " ", "connect", " ", "to", ".", "\\", "10", ";", " ", " ", "path", ":", " ", "The", " ", "URI", " ", "path", " ", "on", " ", "the", " ", "server", ".", "\\", "10", ";", " ", " ", "default", "\\u", "result", "\\u", "count", ":", " ", "The", " ", "number", " ", "of", " ", "items", " ", "to", " ", "fetch", ",", " ", "by", " ", "default", ",", " ", "in", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "datast", "ore", " ", "Query", " ", "or", " ", "Ne", "xt", " ", "operati", "on", ".", " ", "Thi", "s", " ", "affect", "s", " ", "the", " ", "batch", " ", "size", " ", "of", "\\", "10", ";", " ", " ", " ", " ", "query", " ", "iterators", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Remo", "te", "Datas", "tore", "Stub_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "server_", ",_", "path_", ",_", "\\u", "test\\u", "stub", "\\u", "map_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "default", "\\u", "result", "\\u", "count_", "=_", "default", "\\u", "result", "\\u", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "queries_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "transactions_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u\\u", "next", "\\u", "local", "\\u", "cursor_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "local", "\\u", "cursor", "\\u", "lock_", "=_", "threading_", "._", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "next", "\\u", "local", "\\u", "tx_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "local", "\\u", "tx", "\\u", "lock_", "=_", "threading_", "._", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remo", "te", "Datas", "tore", "Stub_", "(_", "Remo", "te", "Stub_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Make", "Sync", "Call_", "(_", "self_", ",_", "service_", ",_", "call_", ",_", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "service_", "==_", "'", "datast", "ore", "\\u", "v", "3", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "explanation_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "request_", "._", "Is", "Initialized", "_", "(_", "explanation_", ")_", ",_", "explanation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "handler_", "=_", "getattr_", "(_", "self_", ",_", "'\\u", "Dynamic", "\\u'_", "+_", "call_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "handler_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "handler_", "(_", "request_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Remo", "te", "Datas", "tore", "Stub_", ",_", "self_", ")_", "._", "Make", "Sync", "Call_", "(_", "service_", ",_", "call_", ",_", "request_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "response_", "._", "Is", "Initialized", "_", "(_", "explanation_", ")_", ",_", "explanation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remo", "te", "Datas", "tore", "Stub_", "(_", "Remo", "te", "Stub_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Dynamic", "\\u", "Run", "Query_", "(_", "self_", ",_", "query_", ",_", "query", "\\u", "result_", ",_", "cursor", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Remo", "te", "Datas", "tore", "Stub_", ",_", "self_", ")_", "._", "Make", "Sync", "Call_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "datast", "ore", "\\u", "v", "3", "'_", ",_", "'", "Run", "Query", "'_", ",_", "query_", ",_", "query", "\\u", "result_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "cursor", "\\u", "id_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "local", "\\u", "cursor", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor", "\\u", "id_", "=_", "self_", "._", "\\u\\u", "next", "\\u", "local", "\\u", "cursor_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "next", "\\u", "local", "\\u", "cursor_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "local", "\\u", "cursor", "\\u", "lock_", "._", "release_", "(_", ")_", "\\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_", "query", "\\u", "result_", "._", "more", "\\u", "results_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "._", "set\\u", "offset_", "(_", "query_", "._", "offset_", "(_", ")_", "+_", "query", "\\u", "result_", "._", "result", "\\u", "size_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "query_", "._", "has", "\\u", "limit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "._", "set\\u", "limit_", "(_", "query_", "._", "limit_", "(_", ")_", "-_", "query", "\\u", "result_", "._", "result", "\\u", "size_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u\\u", "queries_", "[_", "cursor", "\\u", "id_", "]_", "=_", "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 ", " _", "self_", "._", "\\u\\u", "queries_", "[_", "cursor", "\\u", "id_", "]_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query", "\\u", "result_", "._", "mutable", "\\u", "cursor_", "(_", ")_", "._", "set\\u", "cursor_", "(_", "cursor", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remo", "te", "Datas", "tore", "Stub_", "(_", "Remo", "te", "Stub_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Dynamic", "\\u", "Next_", "(_", "self_", ",_", "next", "\\u", "request_", ",_", "query", "\\u", "result_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cursor", "\\u", "id_", "=_", "next", "\\u", "request_", "._", "cursor_", "(_", ")_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cursor", "\\u", "id_", "not_", "in_", "self_", "._", "\\u\\u", "queries_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "api", "proxy", "\\u", "errors_", "._", "Applica", "tion", "Error_", "(_", "datast", "ore", "\\u", "pb_", "._", "Error_", "._", "BAD", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Curs", "or", " ", "%", "d", " ", "not", " ", "found", "'_", "%_", "cursor", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "query_", "=_", "self_", "._", "\\u\\u", "queries_", "[_", "cursor", "\\u", "id_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "query_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query", "\\u", "result_", "._", "set\\u", "more", "\\u", "results_", "(_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "next", "\\u", "request_", "._", "has", "\\u", "count_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "._", "set\\u", "count_", "(_", "next", "\\u", "request_", "._", "count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "query_", "._", "clear", "\\u", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "Dynamic", "\\u", "Run", "Query_", "(_", "query_", ",_", "query", "\\u", "result_", ",_", "cursor", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remo", "te", "Datas", "tore", "Stub_", "(_", "Remo", "te", "Stub_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Dynamic", "\\u", "Get_", "(_", "self_", ",_", "get", "\\u", "request_", ",_", "get", "\\u", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "txid_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "get", "\\u", "request_", "._", "has", "\\u", "transaction_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "txid_", "=_", "get", "\\u", "request_", "._", "transaction_", "(_", ")_", "._", "handle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "data_", "=_", "self_", "._", "\\u\\u", "transactions_", "[_", "txid_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "tx", "data_", "._", "thread", "\\u", "id_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "thread_", "._", "get", "\\u", "ident_", "(_", ")_", ")_", ",_", "\"", "Transactions", " ", "are", " ", "single", "-", "threaded", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "keys_", "=_", "[_", "(_", "k_", ",_", "k_", "._", "Encode", "_", "(_", ")_", ")_", "for_", "k_", "in_", "get", "\\u", "request_", "._", "key", "\\u", "list_", "(_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "request_", "=_", "datast", "ore", "\\u", "pb_", "._", "Get", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "enc", "key_", "in_", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "enc", "key_", "not_", "in_", "tx", "data_", "._", "entities_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "request_", "._", "add", "\\u", "key_", "(_", ")_", "._", "Copy", "From_", "(_", "key_", ")_", "\\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 ", " _", "new", "\\u", "request_", "=_", "get", "\\u", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "new", "\\u", "request_", "._", "key", "\\u", "size_", "(_", ")_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Remo", "te", "Datas", "tore", "Stub_", ",_", "self_", ")_", "._", "Make", "Sync", "Call_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "datast", "ore", "\\u", "v", "3", "'_", ",_", "'", "Get", "'_", ",_", "new", "\\u", "request_", ",_", "get", "\\u", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "txid_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "keys_", "=_", "new", "\\u", "request_", "._", "key", "\\u", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "entities_", "=_", "get", "\\u", "response_", "._", "entity", "\\u", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "entity_", "in_", "zip_", "(_", "new", "keys_", ",_", "entities_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entity", "\\u", "hash_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "entity_", "._", "has", "\\u", "entity_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entity", "\\u", "hash_", "=_", "sha_", "._", "new_", "(_", "entity_", "._", "entity_", "(_", ")_", "._", "Encode", "_", "(_", ")_", ")_", "._", "digest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tx", "data_", "._", "precondition", "s_", "[_", "key_", "._", "Encode", "_", "(_", ")_", "]_", "=_", "(_", "key_", ",_", "entity", "\\u", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "response_", "=_", "datast", "ore", "\\u", "pb_", "._", "Get", "Response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "it_", "=_", "iter_", "(_", "get", "\\u", "response_", "._", "entity", "\\u", "list_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "enc", "key_", "in_", "keys_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "enc", "key_", "in_", "tx", "data_", "._", "entities_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cache", "d\\u", "entity_", "=_", "tx", "data_", "._", "entities_", "[_", "enc", "key_", "]_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cache", "d\\u", "entity_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "response_", "._", "add", "\\u", "entity_", "(_", ")_", "._", "mutable", "\\u", "entity_", "(_", ")_", "._", "Copy", "From_", "(_", "cache", "d\\u", "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 ", " _", "new", "\\u", "response_", "._", "add", "\\u", "entity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "entity_", "=_", "it_", "._", "next_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "entity_", "._", "has", "\\u", "entity_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "new", "\\u", "entity_", "._", "entity_", "(_", ")_", "._", "key_", "(_", ")_", "==_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "response_", "._", "add", "\\u", "entity_", "(_", ")_", "._", "Copy", "From_", "(_", "new", "\\u", "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 ", " _", "new", "\\u", "response_", "._", "add", "\\u", "entity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "get", "\\u", "response_", "._", "Copy", "From_", "(_", "new", "\\u", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remo", "te", "Datas", "tore", "Stub_", "(_", "Remo", "te", "Stub_", ")_", ":_", "\\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", "Dynamic", "\\u", "Put", "_", "(_", "self_", ",_", "put", "\\u", "request_", ",_", "put", "\\u", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "put", "\\u", "request_", "._", "has", "\\u", "transaction_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "entities_", "=_", "put", "\\u", "request_", "._", "entity", "\\u", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "require", "s", "\\u", "id_", "=_", "lambda_", "x_", ":_", "x_", "._", "id_", "(_", ")_", "==_", "0_", "and_", "not_", "x_", "._", "has", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "new", "\\u", "ents_", "=_", "[_", "e_", "for_", "e_", "in_", "entities_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "require", "s", "\\u", "id_", "(_", "e_", "._", "key_", "(_", ")_", "._", "path_", "(_", ")_", "._", "element", "\\u", "list_", "(_", ")_", "[_", "-_", "1_", "]_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "id", "\\u", "request_", "=_", "remote", "\\u", "api", "\\u", "pb_", "._", "Put", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "ents_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "ent_", "in_", "new", "\\u", "ents_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "e_", "=_", "id", "\\u", "request_", "._", "add", "\\u", "entity_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "._", "mutable", "\\u", "key_", "(_", ")_", "._", "Copy", "From_", "(_", "ent_", "._", "key_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "._", "mutable", "\\u", "entity", "\\u", "group_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "id", "\\u", "response_", "=_", "datast", "ore", "\\u", "pb_", "._", "Put", "Response_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Remo", "te", "Datas", "tore", "Stub_", ",_", "self_", ")_", "._", "Make", "Sync", "Call_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "remote", "\\u", "datast", "ore", "'_", ",_", "'", "Get", "ID", "s", "'_", ",_", "id", "\\u", "request_", ",_", "id", "\\u", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "id", "\\u", "request_", "._", "entity", "\\u", "size_", "(_", ")_", "==_", "id", "\\u", "response_", "._", "key", "\\u", "size_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "ent_", "in_", "zip_", "(_", "id", "\\u", "response_", "._", "key", "\\u", "list_", "(_", ")_", ",_", "new", "\\u", "ents_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ent_", "._", "mutable", "\\u", "key_", "(_", ")_", "._", "Copy", "From_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ent_", "._", "mutable", "\\u", "entity", "\\u", "group_", "(_", ")_", "._", "add", "\\u", "element_", "(_", ")_", "._", "Copy", "From_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "._", "path_", "(_", ")_", "._", "element_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "txid_", "=_", "put", "\\u", "request_", "._", "transaction_", "(_", ")_", "._", "handle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "data_", "=_", "self_", "._", "\\u\\u", "transactions_", "[_", "txid_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "tx", "data_", "._", "thread", "\\u", "id_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "thread_", "._", "get", "\\u", "ident_", "(_", ")_", ")_", ",_", "\"", "Transactions", " ", "are", " ", "single", "-", "threaded", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "entity_", "in_", "entities_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tx", "data_", "._", "entities_", "[_", "entity_", "._", "key_", "(_", ")_", "._", "Encode", "_", "(_", ")_", "]_", "=_", "(_", "entity_", "._", "key_", "(_", ")_", ",_", "entity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "put", "\\u", "response_", "._", "add", "\\u", "key_", "(_", ")_", "._", "Copy", "From_", "(_", "entity_", "._", "key_", "(_", ")_", ")_", "\\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 ", " _", "super_", "(_", "Remo", "te", "Datas", "tore", "Stub_", ",_", "self_", ")_", "._", "Make", "Sync", "Call_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "datast", "ore", "\\u", "v", "3", "'_", ",_", "'", "Put", "'_", ",_", "put", "\\u", "request_", ",_", "put", "\\u", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remo", "te", "Datas", "tore", "Stub_", "(_", "Remo", "te", "Stub_", ")_", ":_", "\\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", "Dynamic", "\\u", "Delete_", "(_", "self_", ",_", "delete", "\\u", "request_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "delete", "\\u", "request_", "._", "has", "\\u", "transaction_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "txid_", "=_", "delete", "\\u", "request_", "._", "transaction_", "(_", ")_", "._", "handle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "data_", "=_", "self_", "._", "\\u\\u", "transactions_", "[_", "txid_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "tx", "data_", "._", "thread", "\\u", "id_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "thread_", "._", "get", "\\u", "ident_", "(_", ")_", ")_", ",_", "\"", "Transactions", " ", "are", " ", "single", "-", "threaded", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", "in_", "delete", "\\u", "request_", "._", "key", "\\u", "list_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tx", "data_", "._", "entities_", "[_", "key_", "._", "Encode", "_", "(_", ")_", "]_", "=_", "(_", "key_", ",_", "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 ", " _", "super_", "(_", "Remo", "te", "Datas", "tore", "Stub_", ",_", "self_", ")_", "._", "Make", "Sync", "Call_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "datast", "ore", "\\u", "v", "3", "'_", ",_", "'", "Delete", "'_", ",_", "delete", "\\u", "request_", ",_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remo", "te", "Datas", "tore", "Stub_", "(_", "Remo", "te", "Stub_", ")_", ":_", "\\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", "Dynamic", "\\u", "Begin", "Transaction_", "(_", "self_", ",_", "request_", ",_", "transaction_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "local", "\\u", "tx", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "txid_", "=_", "self_", "._", "\\u\\u", "next", "\\u", "local", "\\u", "tx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "transactions_", "[_", "txid_", "]_", "=_", "Transa", "ction", "Data_", "(_", "thread_", "._", "get", "\\u", "ident_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "next", "\\u", "local", "\\u", "tx_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "local", "\\u", "tx", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "transaction_", "._", "set\\u", "handle_", "(_", "txid_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remo", "te", "Datas", "tore", "Stub_", "(_", "Remo", "te", "Stub_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Dynamic", "\\u", "Commit_", "(_", "self_", ",_", "transaction_", ",_", "transaction", "\\u", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "txid_", "=_", "transaction_", "._", "handle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "txid_", "not_", "in_", "self_", "._", "\\u\\u", "transactions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "api", "proxy", "\\u", "errors_", "._", "Applica", "tion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "datast", "ore", "\\u", "pb_", "._", "Error_", "._", "BAD", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Transa", "ction", " ", "%", "d", " ", "not", " ", "found", ".'_", "%_", "(_", "txid_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tx", "data_", "=_", "self_", "._", "\\u\\u", "transactions_", "[_", "txid_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "tx", "data_", "._", "thread", "\\u", "id_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "thread_", "._", "get", "\\u", "ident_", "(_", ")_", ")_", ",_", "\"", "Transactions", " ", "are", " ", "single", "-", "threaded", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "\\u\\u", "transactions_", "[_", "txid_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tx_", "=_", "remote", "\\u", "api", "\\u", "pb_", "._", "Transa", "ction", "Request_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "hash_", "in_", "tx", "data_", "._", "precondition", "s_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "precon", "d_", "=_", "tx_", "._", "add", "\\u", "precondition", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "precon", "d_", "._", "mutable", "\\u", "key_", "(_", ")_", "._", "Copy", "From_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "hash_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "precon", "d_", "._", "set\\u", "hash_", "(_", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "puts_", "=_", "tx_", "._", "mutable", "\\u", "puts_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "delete", "s_", "=_", "tx_", "._", "mutable", "\\u", "delete", "s_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "entity_", "in_", "tx", "data_", "._", "entities_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "entity_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "puts_", "._", "add", "\\u", "entity_", "(_", ")_", "._", "Copy", "From_", "(_", "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 ", " _", "delete", "s_", "._", "add", "\\u", "key_", "(_", ")_", "._", "Copy", "From_", "(_", "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_", "super_", "(_", "Remo", "te", "Datas", "tore", "Stub_", ",_", "self_", ")_", "._", "Make", "Sync", "Call_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "remote", "\\u", "datast", "ore", "'_", ",_", "'", "Transa", "ction", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tx_", ",_", "datast", "ore", "\\u", "pb_", "._", "Put", "Response_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remo", "te", "Datas", "tore", "Stub_", "(_", "Remo", "te", "Stub_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Dynamic", "\\u", "Roll", "back_", "(_", "self_", ",_", "transaction_", ",_", "transaction", "\\u", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "txid_", "=_", "transaction_", "._", "handle_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "local", "\\u", "tx", "\\u", "lock_", "._", "acquire_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "txid_", "not_", "in_", "self_", "._", "\\u\\u", "transactions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "api", "proxy", "\\u", "errors_", "._", "Applica", "tion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "datast", "ore", "\\u", "pb_", "._", "Error_", "._", "BAD", "\\u", "REQUEST_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Transa", "ction", " ", "%", "d", " ", "not", " ", "found", ".'_", "%_", "(_", "txid_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tx", "data_", "=_", "self_", "._", "\\u\\u", "transactions_", "[_", "txid_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "(_", "tx", "data_", "[_", "txid_", "]_", "._", "thread", "\\u", "id_", "==_", "\\u\\u\\uNL\\u\\u\\u_", "thread_", "._", "get", "\\u", "ident_", "(_", ")_", ")_", ",_", "\"", "Transactions", " ", "are", " ", "single", "-", "threaded", ".\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "self_", "._", "\\u\\u", "transactions_", "[_", "txid_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "local", "\\u", "tx", "\\u", "lock_", "._", "release_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remo", "te", "Datas", "tore", "Stub_", "(_", "Remo", "te", "Stub_", ")_", ":_", "\\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", "Dynamic", "\\u", "Creat", "e", "Index_", "(_", "self_", ",_", "index_", ",_", "id", "\\u", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "api", "proxy", "\\u", "errors_", "._", "Capa", "bilit", "y", "Disa", "ble", "d", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "remote", " ", "datast", "ore", " ", "doe", "s", " ", "not", " ", "support", " ", "index", " ", "manipulati", "on", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remo", "te", "Datas", "tore", "Stub_", "(_", "Remo", "te", "Stub_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Dynamic", "\\u", "Update", "Index_", "(_", "self_", ",_", "index_", ",_", "void_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "api", "proxy", "\\u", "errors_", "._", "Capa", "bilit", "y", "Disa", "ble", "d", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "remote", " ", "datast", "ore", " ", "doe", "s", " ", "not", " ", "support", " ", "index", " ", "manipulati", "on", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Remo", "te", "Datas", "tore", "Stub_", "(_", "Remo", "te", "Stub_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "Dynamic", "\\u", "Delete", "Index_", "(_", "self_", ",_", "index_", ",_", "void_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "api", "proxy", "\\u", "errors_", "._", "Capa", "bilit", "y", "Disa", "ble", "d", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "The", " ", "remote", " ", "datast", "ore", " ", "doe", "s", " ", "not", " ", "support", " ", "index", " ", "manipulati", "on", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Configure", "Remo", "te", "Api_", "(_", "app", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "path_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "auth", "\\u", "func_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "server", "name_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rpc", "\\u", "server", "\\u", "factory_", "=_", "appengine", "\\u", "rpc_", "._", "Http", "Rp", "c", "Server_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "rto", "k_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "secure_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "services_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "default", "\\u", "auth", "\\u", "domain_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Do", "es", " ", "necessar", "y", " ", "setup", " ", "to", " ", "allow", " ", "easy", " ", "remote", " ", "access", " ", "to", " ", "App", " ", "Engine", " ", "API", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Ei", "ther", " ", "server", "name", " ", "must", " ", "be", " ", "provided", " ", "or", " ", "app", "\\u", "id", " ", "must", " ", "not", " ", "be", " ", "Non", "e", ".", " ", " ", "If", " ", "app", "\\u", "id", "\\", "10", ";", " ", " ", "is", " ", "Non", "e", " ", "and", " ", "a", " ", "server", "name", " ", "is", " ", "provided", ",", " ", "this", " ", "function", " ", "will", " ", "send", " ", "a", " ", "request", "\\", "10", ";", " ", " ", "to", " ", "the", " ", "server", " ", "to", " ", "retrieve", " ", "the", " ", "app", "\\u", "id", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Arg", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "app", "\\u", "id", ":", " ", "The", " ", "app", "\\u", "id", " ", "of", " ", "your", " ", "app", ",", " ", "as", " ", "declared", " ", "in", " ", "app", ".", "yaml", ".", "\\", "10", ";", " ", " ", " ", " ", "path", ":", " ", "The", " ", "path", " ", "to", " ", "the", " ", "remote", "\\u", "api", " ", "handler", " ", "for", " ", "your", " ", "app", "\\", "10", ";", " ", " ", "(", "for", " ", "example", ",", " ", "'/", "remote", "\\u", "api", "')", ".", "\\", "10", ";", " ", " ", " ", " ", "auth", "\\u", "func", ":", " ", "A", " ", "function", " ", "tha", "t", " ", "take", "s", " ", "no", " ", "argu", "ment", "s", " ", "and", " ", "return", "s", " ", "a", "\\", "10", ";", " ", " ", "(", "user", "name", ",", " ", "password", ")", " ", "tuple", ".", " ", "Thi", "s", " ", "will", " ", "be", " ", "call", "ed", " ", "if", " ", "your", " ", "applica", "tion", "\\", "10", ";", " ", " ", "require", "s", " ", "authenticat", "ion", " ", "to", " ", "access", " ", "the", " ", "remote", "\\u", "api", " ", "handler", " ", "(", "it", " ", "shou", "ld", "!)", "\\", "10", ";", " ", " ", "and", " ", "you", " ", "do", " ", "not", " ", "alr", "ead", "y", " ", "have", " ", "a", " ", "valid", " ", "auth", " ", "cookie", ".", "\\", "10", ";", " ", " ", " ", " ", "server", "name", ":", " ", "The", " ", "host", "name", " ", "your", " ", "app", " ", "is", " ", "deploye", "d", " ", "on", ".", " ", "Default", "s", " ", "to", "\\", "10", ";", " ", " ", "<", "app", "\\u", "id", ">.", "apps", "pot", ".", "com", ".", "\\", "10", ";", " ", " ", " ", " ", "rpc", "\\u", "server", "\\u", "factor", "y", ":", " ", "A", " ", "factor", "y", " ", "to", " ", "construct", " ", "the", " ", "rpc", " ", "server", " ", "for", " ", "the", " ", "datast", "ore", ".", "\\", "10", ";", " ", " ", " ", " ", "rto", "k", ":", " ", "The", " ", "validation", " ", "token", " ", "to", " ", "sent", " ", "with", " ", "app", "\\u", "id", " ", "lookups", ".", " ", "If", " ", "Non", "e", ",", " ", "a", " ", "random", "\\", "10", ";", " ", " ", "token", " ", "is", " ", "used", ".", "\\", "10", ";", " ", " ", " ", " ", "secure", ":", " ", "Us", "e", " ", "SS", "L", " ", "whe", "n", " ", "communicati", "ng", " ", "with", " ", "the", " ", "server", ".", "\\", "10", ";", " ", " ", " ", " ", "service", "s", ":", " ", "A", " ", "list", " ", "of", " ", "service", "s", " ", "to", " ", "set", " ", "up", " ", "stub", "s", " ", "for", ".", " ", "If", " ", "specified", ",", " ", "only", " ", "tho", "se", "\\", "10", ";", " ", " ", "service", "s", " ", "are", " ", "configur", "ed", ";", " ", "by", " ", "default", " ", "all", " ", "support", "ed", " ", "service", "s", " ", "are", " ", "configur", "ed", ".", "\\", "10", ";", " ", " ", " ", " ", "default", "\\u", "auth", "\\u", "domain", ":", " ", "The", " ", "authenticat", "ion", " ", "domain", " ", "to", " ", "use", " ", "by", " ", "default", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "Rai", "ses", ":", "\\", "10", ";", " ", " ", " ", " ", "url", "lib", "2", ".", "HTTP", "Error", ":", " ", "if", " ", "app", "\\u", "id", " ", "is", " ", "not", " ", "provided", " ", "and", " ", "there", " ", "is", " ", "an", " ", "error", " ", "whi", "le", "\\", "10", ";", " ", " ", "retrie", "ving", " ", "it", ".", "\\", "10", ";", " ", " ", " ", " ", "Configura", "tion", "Error", ":", " ", "if", " ", "there", " ", "is", " ", "a", " ", "error", " ", "configur", "ing", " ", "the", " ", "Dat", "store", "File", "Stu", "b", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "server", "name_", "and_", "not_", "app", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Configura", "tion", "Error_", "(_", "'", "app", "\\u", "id", " ", "or", " ", "server", "name", " ", "require", "d", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "server", "name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "server", "name_", "=_", "'%", "s", ".", "apps", "pot", ".", "com", "'_", "%_", "(_", "app", "\\u", "id_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "server_", "=_", "rpc", "\\u", "server", "\\u", "factory_", "(_", "server", "name_", ",_", "auth", "\\u", "func_", ",_", "Get", "User", "Agent_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Get", "Sou", "rce", "Name_", "(_", ")_", ",_", "debug", "\\u", "data_", "=_", "False_", ",_", "secure_", "=_", "secure_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "app", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "rto", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "random_", "._", "seed_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rto", "k_", "=_", "str_", "(_", "random_", "._", "random_", "(_", ")_", ")_", "[_", "2_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url", "args_", "=_", "{_", "'", "rto", "k", "'_", ":_", "rto", "k_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "server_", "._", "Send_", "(_", "path_", ",_", "payload_", "=_", "None_", ",_", "**_", "url", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "response_", "._", "startswith_", "(_", "'{'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Configura", "tion", "Error_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Inva", "lid", " ", "response", " ", "recieve", "d", " ", "from", " ", "server", ":", " ", "%", "s", "'_", "%_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "app", "\\u", "info_", "=_", "yaml_", "._", "load_", "(_", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "app", "\\u", "info_", "or_", "'", "rto", "k", "'_", "not_", "in_", "app", "\\u", "info_", "or_", "'", "app", "\\u", "id", "'_", "not_", "in_", "app", "\\u", "info_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Configura", "tion", "Error_", "(_", "'", "Error", " ", "pars", "ing", " ", "app", "\\u", "id", " ", "look", "up", " ", "response", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "app", "\\u", "info_", "[_", "'", "rto", "k", "'_", "]_", "!=_", "rto", "k_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Configura", "tion", "Error_", "(_", "'", "Token", " ", "validation", " ", "fail", "ed", " ", "dur", "ing", " ", "app", "\\u", "id", " ", "look", "up", ".", " ", "'_", "\\u\\u\\uNL\\u\\u\\u_", "'(", "sent", " ", "%", "s", ",", " ", "got", " ", "%", "s", ")'_", "%_", "(_", "repr_", "(_", "rto", "k_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "repr_", "(_", "app", "\\u", "info_", "[_", "'", "rto", "k", "'_", "]_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "app", "\\u", "id_", "=_", "app", "\\u", "info_", "[_", "'", "app", "\\u", "id", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "services_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "services_", "=_", "set_", "(_", "services_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "unsup", "porte", "d_", "=_", "services_", "._", "difference_", "(_", "ALL", "\\u", "SERVICES", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "unsup", "porte", "d_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Configura", "tion", "Error_", "(_", "'", "Unsu", "ppo", "rted", " ", "service", "(", "s", "):", " ", "%", "s", "'_", "\\u\\u\\uNL\\u\\u\\u_", "%_", "(_", "',", " ", "'_", "._", "join_", "(_", "unsup", "porte", "d_", ")_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "services_", "=_", "set_", "(_", "ALL", "\\u", "SERVICES", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "os_", "._", "environ_", "[_", "'", "APPLICATION", "\\u", "ID", "'_", "]_", "=_", "app", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "default", "\\u", "auth", "\\u", "domain_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "environ_", "[_", "'", "AUTH", "\\u", "DOM", "AIN", "'_", "]_", "=_", "default", "\\u", "auth", "\\u", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "'", "AUTH", "\\u", "DOM", "AIN", "'_", "not_", "in_", "os_", "._", "environ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "os_", "._", "environ_", "[_", "'", "AUTH", "\\u", "DOM", "AIN", "'_", "]_", "=_", "'", "gma", "il", ".", "com", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "api", "proxy", "\\u", "stub", "\\u", "map_", "._", "api", "proxy_", "=_", "api", "proxy", "\\u", "stub", "\\u", "map_", "._", "API", "Pro", "xy", "Stu", "b", "Map_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "'", "datast", "ore", "\\u", "v", "3", "'_", "in_", "services_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "services_", "._", "remove_", "(_", "'", "datast", "ore", "\\u", "v", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datast", "ore", "\\u", "stub_", "=_", "Remo", "te", "Datas", "tore", "Stub_", "(_", "server_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "api", "proxy", "\\u", "stub", "\\u", "map_", "._", "api", "proxy_", "._", "Register", "Stub_", "(_", "'", "datast", "ore", "\\u", "v", "3", "'_", ",_", "datast", "ore", "\\u", "stub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "stub_", "=_", "Remo", "te", "Stub_", "(_", "server_", ",_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "service_", "in_", "services_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "api", "proxy", "\\u", "stub", "\\u", "map_", "._", "api", "proxy_", "._", "Register", "Stub_", "(_", "service_", ",_", "stub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Ma", "yb", "e", "Invok", "e", "Authentication_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Sen", "ds", " ", "an", " ", "empty", " ", "request", " ", "through", " ", "to", " ", "the", " ", "configur", "ed", " ", "end", "-", "point", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", "If", " ", "authenticat", "ion", " ", "is", " ", "necessar", "y", ",", " ", "this", " ", "will", " ", "caus", "e", " ", "the", " ", "rpc", "\\u", "server", " ", "to", " ", "invoke", "\\", "10", ";", " ", " ", "interactive", " ", "authenticat", "ion", ".", "\\", "10", ";", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "datast", "ore", "\\u", "stub_", "=_", "api", "proxy", "\\u", "stub", "\\u", "map_", "._", "api", "proxy_", "._", "Get", "Stub_", "(_", "'", "datast", "ore", "\\u", "v", "3", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "datast", "ore", "\\u", "stub_", ",_", "Remo", "te", "Stub_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "datast", "ore", "\\u", "stub_", "._", "\\u", "server_", "._", "Send_", "(_", "datast", "ore", "\\u", "stub_", "._", "\\u", "path_", ",_", "payload_", "=_", "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_", "Configura", "tion", "Error_", "(_", "'", "remote", "\\u", "api", " ", "is", " ", "not", " ", "configur", "ed", ".'_", ")_", "\\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,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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
tomekwojcik/iheartgit/iheartgit/handlers/oauth.py
[ { "content": " def on_profile_response(self, response):\n \"\"\"Handles user profile request response.\"\"\"\n if response.error:\n self.send_error()\n \n try:\n github_user = json.loads(response.body)\n except:\n logging.exception('Failed to decode response.')\n self.send_error()\n \n user_id = None\n current_user = User.objects(service='github', nick=github_user['login']).first()\n if current_user != None:\n user_id = unicode(current_user.id)\n logging.info('GitHub user \"%s\" already signed up.' % (github_user['login'], ))\n else: \n user = User(service='github', nick=github_user['login'], url=github_user['html_url'], avatar_url=github_user['avatar_url'])\n \n logging.info('Saving GitHub user \"%s\".' % (github_user['login'], ))\n try:\n user.save()\n except:\n logging.exception('Failed to save user in DB.')\n self.send_error()\n \n user_id = unicode(user.id)\n \n self.set_secure_cookie('user_id', user_id, expires_days=365)\n self.redirect('/#publish')\n self.finish()", "metadata": "root.GitHubCallbackHandler.on_profile_response", "header": "['class', 'GitHubCallbackHandler', '(', 'tornado', '.', 'web', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 47 }, { "content": " def on_callback_response(self, response):\n \"\"\"Handles access token request response.\"\"\"\n if response.error:\n self.send_error()\n \n try:\n response_data = parse_qs(response.body)\n except:\n self.send_error()\n \n request = tornado.httpclient.HTTPRequest('https://api.github.com/user?access_token=' + response_data['access_token'][0], method='GET')\n httpclient = tornado.httpclient.AsyncHTTPClient()\n httpclient.fetch(request, self.on_profile_response)", "metadata": "root.GitHubCallbackHandler.on_callback_response", "header": "['class', 'GitHubCallbackHandler', '(', 'tornado', '.', 'web', '.', 'RequestHandler', ')', ':', '___EOS___']", "index": 79 }, { "content": " def on_profile_response(self, twitter_user):\n \"\"\"Handles user profile request response.\"\"\"\n user_id = None\n current_user = User.objects(service='twitter', nick=twitter_user['username']).first()\n if current_user != None:\n user_id = unicode(current_user.id)\n logging.info('Twitter user \"%s\" already signed up.' % (twitter_user['username'], ))\n if len(current_user.auth) == 0 or current_user.auth['key'] != twitter_user['access_token']['key']:\n current_user.auth = twitter_user['access_token']\n \n try:\n current_user.save()\n except:\n logging.exception('Could not update Twitter user auth token.')\n self.send_error\n else:\n user = User(service='twitter', nick=twitter_user['username'], url='http://twitter.com/' + twitter_user['username'], avatar_url=twitter_user['profile_image_url'])\n user.auth = twitter_user['access_token']\n \n logging.info('Saving Twitter user \"%s\".' % (twitter_user['username'], ))\n try:\n user.save()\n except:\n logging.exception('Failed to save user in DB.')\n self.send_error()\n \n user_id = unicode(user.id)\n \n self.set_secure_cookie('user_id', user_id, expires_days=365)\n self.redirect('/#publish')", "metadata": "root.TwitterHandler.on_profile_response", "header": "['class', 'TwitterHandler', '(', 'BaseHandler', ',', 'tornado', '.', 'auth', '.', 'TwitterMixin', ')', ':', '___EOS___']", "index": 110 } ]
[ { "span": "except:", "start_line": 54, "start_column": 8, "end_line": 54, "end_column": 15 }, { "span": "except:", "start_line": 69, "start_column": 12, "end_line": 69, "end_column": 19 }, { "span": "except:", "start_line": 86, "start_column": 8, "end_line": 86, "end_column": 15 }, { "span": "except:", "start_line": 122, "start_column": 16, "end_line": 122, "end_column": 23 }, { "span": "except:", "start_line": 132, "start_column": 12, "end_line": 132, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Git", "Hub", "Call", "back", "Handler_", "(_", "tornado_", "._", "web_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "on", "\\u", "profile", "\\u", "response_", "(_", "self_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Handle", "s", " ", "user", " ", "profile", " ", "request", " ", "response", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "\\u", "error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "git", "hub", "\\u", "user_", "=_", "json_", "._", "loads_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logging_", "._", "exception_", "(_", "'", "Fail", "ed", " ", "to", " ", "decode", " ", "response", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "user_", "=_", "User_", "._", "objects_", "(_", "service_", "=_", "'", "git", "hub", "'_", ",_", "nick_", "=_", "git", "hub", "\\u", "user_", "[_", "'", "login", "'_", "]_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current", "\\u", "user_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "id_", "=_", "unicode_", "(_", "current", "\\u", "user_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Git", "Hub", " ", "user", " ", "\"%", "s", "\"", " ", "alr", "ead", "y", " ", "sign", "ed", " ", "up", ".'_", "%_", "(_", "git", "hub", "\\u", "user_", "[_", "'", "login", "'_", "]_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "=_", "User_", "(_", "service_", "=_", "'", "git", "hub", "'_", ",_", "nick_", "=_", "git", "hub", "\\u", "user_", "[_", "'", "login", "'_", "]_", ",_", "url_", "=_", "git", "hub", "\\u", "user_", "[_", "'", "html", "\\u", "url", "'_", "]_", ",_", "avat", "ar", "\\u", "url_", "=_", "git", "hub", "\\u", "user_", "[_", "'", "avat", "ar", "\\u", "url", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Sav", "ing", " ", "Git", "Hub", " ", "user", " ", "\"%", "s", "\".'_", "%_", "(_", "git", "hub", "\\u", "user_", "[_", "'", "login", "'_", "]_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "._", "save_", "(_", ")_", "\\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 ", " _", "logging_", "._", "exception_", "(_", "'", "Fail", "ed", " ", "to", " ", "save", " ", "user", " ", "in", " ", "DB", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user", "\\u", "id_", "=_", "unicode_", "(_", "user_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set\\u", "secure", "\\u", "cookie_", "(_", "'", "user", "\\u", "id", "'_", ",_", "user", "\\u", "id_", ",_", "expir", "es", "\\u", "days_", "=_", "365_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "redirect_", "(_", "'/", "#", "publi", "sh", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "finish_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Git", "Hub", "Call", "back", "Handler_", "(_", "tornado_", "._", "web_", "._", "Request", "Handler_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "\\u", "callback", "\\u", "response_", "(_", "self_", ",_", "response_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Handle", "s", " ", "access", " ", "token", " ", "request", " ", "response", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "\\u", "error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response", "\\u", "data_", "=_", "parse", "\\u", "qs_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "send", "\\u", "error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "request_", "=_", "tornado_", "._", "httpc", "lient_", "._", "HTTP", "Request_", "(_", "'", "https", "://", "api", ".", "git", "hub", ".", "com", "/", "user", "?", "access", "\\u", "token", "='_", "+_", "response", "\\u", "data_", "[_", "'", "access", "\\u", "token", "'_", "]_", "[_", "0_", "]_", ",_", "method_", "=_", "'", "GET", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "httpc", "lient_", "=_", "tornado_", "._", "httpc", "lient_", "._", "Async", "HTTP", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "httpc", "lient_", "._", "fetch_", "(_", "request_", ",_", "self_", "._", "on", "\\u", "profile", "\\u", "response_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Twit", "ter", "Handler_", "(_", "Base", "Handler_", ",_", "tornado_", "._", "auth_", "._", "Twit", "ter", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "on", "\\u", "profile", "\\u", "response_", "(_", "self_", ",_", "twit", "ter", "\\u", "user_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Handle", "s", " ", "user", " ", "profile", " ", "request", " ", "response", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "current", "\\u", "user_", "=_", "User_", "._", "objects_", "(_", "service_", "=_", "'", "twit", "ter", "'_", ",_", "nick_", "=_", "twit", "ter", "\\u", "user_", "[_", "'", "user", "name", "'_", "]_", ")_", "._", "first_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "current", "\\u", "user_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user", "\\u", "id_", "=_", "unicode_", "(_", "current", "\\u", "user_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Twit", "ter", " ", "user", " ", "\"%", "s", "\"", " ", "alr", "ead", "y", " ", "sign", "ed", " ", "up", ".'_", "%_", "(_", "twit", "ter", "\\u", "user_", "[_", "'", "user", "name", "'_", "]_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "current", "\\u", "user_", "._", "auth_", ")_", "==_", "0_", "or_", "current", "\\u", "user_", "._", "auth_", "[_", "'", "key", "'_", "]_", "!=_", "twit", "ter", "\\u", "user_", "[_", "'", "access", "\\u", "token", "'_", "]_", "[_", "'", "key", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "user_", "._", "auth_", "=_", "twit", "ter", "\\u", "user_", "[_", "'", "access", "\\u", "token", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "current", "\\u", "user_", "._", "save_", "(_", ")_", "\\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 ", " ", "_", "logging_", "._", "exception_", "(_", "'", "Cou", "ld", " ", "not", " ", "update", " ", "Twit", "ter", " ", "user", " ", "auth", " ", "token", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "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 ", " _", "user_", "=_", "User_", "(_", "service_", "=_", "'", "twit", "ter", "'_", ",_", "nick_", "=_", "twit", "ter", "\\u", "user_", "[_", "'", "user", "name", "'_", "]_", ",_", "url_", "=_", "'", "http", "://", "twit", "ter", ".", "com", "/'_", "+_", "twit", "ter", "\\u", "user_", "[_", "'", "user", "name", "'_", "]_", ",_", "avat", "ar", "\\u", "url_", "=_", "twit", "ter", "\\u", "user_", "[_", "'", "profile", "\\u", "image", "\\u", "url", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "user_", "._", "auth_", "=_", "twit", "ter", "\\u", "user_", "[_", "'", "access", "\\u", "token", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logging_", "._", "info_", "(_", "'", "Sav", "ing", " ", "Twit", "ter", " ", "user", " ", "\"%", "s", "\".'_", "%_", "(_", "twit", "ter", "\\u", "user_", "[_", "'", "user", "name", "'_", "]_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "user_", "._", "save_", "(_", ")_", "\\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 ", " _", "logging_", "._", "exception_", "(_", "'", "Fail", "ed", " ", "to", " ", "save", " ", "user", " ", "in", " ", "DB", ".'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "send", "\\u", "error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "user", "\\u", "id_", "=_", "unicode_", "(_", "user_", "._", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "set\\u", "secure", "\\u", "cookie_", "(_", "'", "user", "\\u", "id", "'_", ",_", "user", "\\u", "id_", ",_", "expir", "es", "\\u", "days_", "=_", "365_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "redirect_", "(_", "'/", "#", "publi", "sh", "'_", ")_", "\\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, 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, 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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, 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 ]
Unused import
rtyler/Spawning/spawning/paste_factory.py
[ { "content": "# Copyright (c) 2008, Donovan Preston\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\n# 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\n# FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# THE SOFTWARE.\n\nimport os\nimport sys\n\nfrom paste.deploy import loadwsgi\n\nfrom spawning import spawning_controller\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def config_factory(args):\n if 'config_url' in args:\n config_url = args['config_url']\n relative_to = args['relative_to']\n global_conf = args['global_conf']\n else:\n config_file = os.path.abspath(args['args'][0])\n config_url = 'config:%s' % (os.path.basename(config_file), )\n relative_to = os.path.dirname(config_file)\n global_conf = {}\n for arg in args['args'][1:]:\n key, value = arg.split('=')\n global_conf[key] = value\n\n ctx = loadwsgi.loadcontext(\n loadwsgi.SERVER,\n config_url,\n relative_to=relative_to,\n global_conf=global_conf)\n\n watch = args.get('watch', None)\n if watch is None:\n watch = []\n if ctx.global_conf['__file__'] not in watch:\n watch.append(ctx.global_conf['__file__'])\n args['watch'] = watch\n\n args['app_factory'] = 'spawning.paste_factory.app_factory'\n args['config_url'] = config_url\n args['relative_to'] = relative_to\n args['source_directories'] = [relative_to]\n args['global_conf'] = ctx.global_conf\n\n debug = ctx.global_conf.get('debug', None)\n if debug is not None:\n args['dev'] = (debug == 'true')\n host = ctx.local_conf.get('host', None)\n if host is not None:\n args['host'] = host\n port = ctx.local_conf.get('port', None)\n if port is not None:\n args['port'] = int(port)\n num_processes = ctx.local_conf.get('num_processes', None)\n if num_processes is not None:\n args['num_processes'] = int(num_processes)\n threadpool_workers = ctx.local_conf.get('threadpool_workers', None)\n if threadpool_workers is not None:\n args['threadpool_workers'] = int(threadpool_workers)\n\n return args", "metadata": "root.config_factory", "header": "['module', '___EOS___']", "index": 30 }, { "content": "def app_factory(config):\n return loadwsgi.loadapp(\n config['config_url'],\n relative_to=config['relative_to'],\n global_conf=config['global_conf'])", "metadata": "root.app_factory", "header": "['module', '___EOS___']", "index": 82 }, { "content": "def server_factory(global_conf, host, port, *args, **kw):\n config_url = 'config:' + os.path.split(global_conf['__file__'])[1]\n relative_to = global_conf['here']\n\n def run(app):\n args = spawning_controller.DEFAULTS.copy()\n args.update(\n {'config_url': config_url, 'relative_to': relative_to, 'global_conf': global_conf})\n\n spawning_controller.run_controller(\n 'spawning.paste_factory.config_factory', args)\n\n return run", "metadata": "root.server_factory", "header": "['module', '___EOS___']", "index": 89 } ]
[ { "span": "import sys", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2008", ",", " ", "Don", "ova", "n", " ", "Prest", "on_", "\\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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "paste_", "._", "deploy_", "import_", "load", "wsgi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "spawn", "ing_", "import_", "spawn", "ing", "\\u", "controller_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "config", "\\u", "factory_", "(_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "config", "\\u", "url", "'_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "url_", "=_", "args_", "[_", "'", "config", "\\u", "url", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relative", "\\u", "to_", "=_", "args_", "[_", "'", "relative", "\\u", "to", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "\\u", "conf_", "=_", "args_", "[_", "'", "global", "\\u", "conf", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "file_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "args_", "[_", "'", "args", "'_", "]_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "config", "\\u", "url_", "=_", "'", "config", ":", "%", "s", "'_", "%_", "(_", "os_", "._", "path_", "._", "basename_", "(_", "config", "\\u", "file_", ")_", ",_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relative", "\\u", "to_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "config", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "\\u", "conf_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "arg_", "in_", "args_", "[_", "'", "args", "'_", "]_", "[_", "1_", ":_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", ",_", "value_", "=_", "arg_", "._", "split_", "(_", "'='_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global", "\\u", "conf_", "[_", "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_", "ctx_", "=_", "load", "wsgi_", "._", "load", "context_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "load", "wsgi_", "._", "SERVER_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "config", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "relative", "\\u", "to_", "=_", "relative", "\\u", "to_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "global", "\\u", "conf_", "=_", "global", "\\u", "conf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "watch_", "=_", "args_", "._", "get_", "(_", "'", "watch", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "watch_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "watch_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "ctx_", "._", "global", "\\u", "conf_", "[_", "'\\u", "\\u", "file", "\\u\\u'_", "]_", "not_", "in_", "watch_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "watch_", "._", "append_", "(_", "ctx_", "._", "global", "\\u", "conf_", "[_", "'\\u", "\\u", "file", "\\u\\u'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "args_", "[_", "'", "watch", "'_", "]_", "=_", "watch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "[_", "'", "app", "\\u", "factor", "y", "'_", "]_", "=_", "'", "spawn", "ing", ".", "paste", "\\u", "factor", "y", ".", "app", "\\u", "factor", "y", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "[_", "'", "config", "\\u", "url", "'_", "]_", "=_", "config", "\\u", "url_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "[_", "'", "relative", "\\u", "to", "'_", "]_", "=_", "relative", "\\u", "to_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "[_", "'", "source", "\\u", "director", "ies", "'_", "]_", "=_", "[_", "relative", "\\u", "to_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "[_", "'", "global", "\\u", "conf", "'_", "]_", "=_", "ctx_", "._", "global", "\\u", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "debug_", "=_", "ctx_", "._", "global", "\\u", "conf_", "._", "get_", "(_", "'", "debug", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "debug_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "[_", "'", "dev", "'_", "]_", "=_", "(_", "debug_", "==_", "'", "true", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "host_", "=_", "ctx_", "._", "local", "\\u", "conf_", "._", "get_", "(_", "'", "host", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "host_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "[_", "'", "host", "'_", "]_", "=_", "host_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "port_", "=_", "ctx_", "._", "local", "\\u", "conf_", "._", "get_", "(_", "'", "port", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "port_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "[_", "'", "port", "'_", "]_", "=_", "int_", "(_", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "num", "\\u", "processes_", "=_", "ctx_", "._", "local", "\\u", "conf_", "._", "get_", "(_", "'", "num", "\\u", "process", "es", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "num", "\\u", "processes_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "[_", "'", "num", "\\u", "process", "es", "'_", "]_", "=_", "int_", "(_", "num", "\\u", "processes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "thread", "pool", "\\u", "workers_", "=_", "ctx_", "._", "local", "\\u", "conf_", "._", "get_", "(_", "'", "thread", "pool", "\\u", "worker", "s", "'_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "thread", "pool", "\\u", "workers_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "[_", "'", "thread", "pool", "\\u", "worker", "s", "'_", "]_", "=_", "int_", "(_", "thread", "pool", "\\u", "workers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "app", "\\u", "factory_", "(_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "load", "wsgi_", "._", "loada", "pp_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "config_", "[_", "'", "config", "\\u", "url", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "relative", "\\u", "to_", "=_", "config_", "[_", "'", "relative", "\\u", "to", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "global", "\\u", "conf_", "=_", "config_", "[_", "'", "global", "\\u", "conf", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "server", "\\u", "factory_", "(_", "global", "\\u", "conf_", ",_", "host_", ",_", "port_", ",_", "*_", "args_", ",_", "**_", "kw_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "config", "\\u", "url_", "=_", "'", "config", ":'_", "+_", "os_", "._", "path_", "._", "split_", "(_", "global", "\\u", "conf_", "[_", "'\\u", "\\u", "file", "\\u\\u'_", "]_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "relative", "\\u", "to_", "=_", "global", "\\u", "conf_", "[_", "'", "here", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run_", "(_", "app_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "spawn", "ing", "\\u", "controller_", "._", "DEFAULTS_", "._", "copy_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "args_", "._", "update_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "config", "\\u", "url", "'_", ":_", "config", "\\u", "url_", ",_", "'", "relative", "\\u", "to", "'_", ":_", "relative", "\\u", "to_", ",_", "'", "global", "\\u", "conf", "'_", ":_", "global", "\\u", "conf_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "spawn", "ing", "\\u", "controller_", "._", "run", "\\u", "controller_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "spawn", "ing", ".", "paste", "\\u", "factor", "y", ".", "config", "\\u", "factor", "y", "'_", ",_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "run_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
spranesh/Redhawk/redhawk/common/writers/xml_writer.py
[ { "content": "#!/usr/bin/env python\n\n\"\"\" Implementation of the XML Writer\"\"\"\n\nfrom __future__ import absolute_import\nfrom __future__ import print_function\nimport redhawk.common.node as N\nimport redhawk.common.types as T\nimport redhawk.utils.util as U\nfrom . import writer\n\nimport lxml.etree as ET\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def WriteToXML(tree):\n s = XMLWriter()\n return s.WriteTree(tree)", "metadata": "root.WriteToXML", "header": "['module', '___EOS___']", "index": 13 }, { "content": "def WriteToFile(tree, filename):\n s = XMLWriter()\n s.GetTree(tree).write(filename)\n return", "metadata": "root.WriteToFile", "header": "['module', '___EOS___']", "index": 18 }, { "content": "class XMLWriter(writer.Writer):\n\n\n\n\n\n", "metadata": "root.XMLWriter", "header": "['module', '___EOS___']", "index": 24 }, { "content": " def __init__(self):\n return", "metadata": "root.XMLWriter.__init__", "header": "['class', 'XMLWriter', '(', 'writer', '.', 'Writer', ')', ':', '___EOS___']", "index": 25 }, { "content": " def __AddChildToElement(self, child, parent_element):\n \"\"\" Adds a Child (which could itself be a list) as a child to the\n parent_element.\"\"\"\n if type(child) is list:\n group_node = ET.SubElement(parent_element, \"ChildGroup\")\n for c in child:\n self.__AddChildToElement(c, group_node)\n else:\n assert(isinstance(child, N.Node) or child == None)\n if child == None:\n print(\"We have a none child?\")\n ET.SubElement(parent_element, \"None\")\n else:\n self.__ConvertToElement(child, parent_element)\n return", "metadata": "root.XMLWriter.__AddChildToElement", "header": "['class', 'XMLWriter', '(', 'writer', '.', 'Writer', ')', ':', '___EOS___']", "index": 28 }, { "content": " def __AddPositionToElement(self, tree, parent_element):\n try:\n line, column, f = tree.position.GetLine(), tree.position.GetColumn(), tree.position.GetFile()\n except AttributeError as e:\n line, column, f = None, None, None\n\n attributes = {\n 'line' : str(line),\n 'column' : str(column),\n 'file' : str(f)\n }\n \n position_element = ET.SubElement(parent_element, \"Position\", attrib=attributes)\n return", "metadata": "root.XMLWriter.__AddPositionToElement", "header": "['class', 'XMLWriter', '(', 'writer', '.', 'Writer', ')', ':', '___EOS___']", "index": 44 }, { "content": " def __ConvertToElement(self, tree, parent_element):\n \"\"\" Converts a tree to an element tree, whose parent is `parent_element`.\"\"\"\n attributes = dict([(key, val) for (key, val) \n in tree.GetXMLAttributes()[1].items() if type(val) is str])\n\n print(attributes)\n print(tree.GetName())\n node_element = ET.SubElement(parent_element, tree.GetName(), attrib=attributes)\n self.__AddPositionToElement(tree, node_element)\n self.__AddChildToElement(tree.GetChildren(), node_element)\n return", "metadata": "root.XMLWriter.__ConvertToElement", "header": "['class', 'XMLWriter', '(', 'writer', '.', 'Writer', ')', ':', '___EOS___']", "index": 59 }, { "content": " def WriteTree(self, tree):\n \"\"\" Implementation of the base class method for writing the tree to a\n string.\"\"\"\n return ET.tostring(self.GetTree(tree))", "metadata": "root.XMLWriter.WriteTree", "header": "['class', 'XMLWriter', '(', 'writer', '.', 'Writer', ')', ':', '___EOS___']", "index": 72 }, { "content": " def GetTree(self, tree):\n root = ET.Element(\"last\")\n self.__ConvertToElement(tree, root)\n tree = ET.ElementTree(root)\n return tree", "metadata": "root.XMLWriter.GetTree", "header": "['class', 'XMLWriter', '(', 'writer', '.', 'Writer', ')', ':', '___EOS___']", "index": 77 } ]
[ { "span": "import redhawk.common.types as T", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 32 }, { "span": "import redhawk.utils.util as U", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 30 } ]
[]
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_", "\"\"\"", " ", "Implementation", " ", "of", " ", "the", " ", "XML", " ", "Write", "r", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "red", "haw", "k_", "._", "common_", "._", "node_", "as_", "N_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "red", "haw", "k_", "._", "common_", "._", "types_", "as_", "T_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "red", "haw", "k_", "._", "utils_", "._", "util_", "as_", "U_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "writer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "lxml_", "._", "etree_", "as_", "ET_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "Write", "To", "XML_", "(_", "tree_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "XML", "Writer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "s_", "._", "Write", "Tree_", "(_", "tree_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Write", "To", "File_", "(_", "tree_", ",_", "filename_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "XML", "Writer_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "._", "Get", "Tree_", "(_", "tree_", ")_", "._", "write_", "(_", "filename_", ")_", "\\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_", "class_", "XML", "Writer_", "(_", "writer_", "._", "Writer_", ")_", ":_", "\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "XML", "Writer_", "(_", "writer_", "._", "Writer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XML", "Writer_", "(_", "writer_", "._", "Writer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "Add", "Chil", "d", "To", "Element_", "(_", "self_", ",_", "child_", ",_", "parent", "\\u", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Add", "s", " ", "a", " ", "Chil", "d", " ", "(", "whi", "ch", " ", "coul", "d", " ", "its", "elf", " ", "be", " ", "a", " ", "list", ")", " ", "as", " ", "a", " ", "child", " ", "to", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "parent", "\\u", "element", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "type_", "(_", "child_", ")_", "is_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "group", "\\u", "node_", "=_", "ET_", "._", "Sub", "Element_", "(_", "parent", "\\u", "element_", ",_", "\"", "Chil", "d", "Group", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "c_", "in_", "child_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "Add", "Chil", "d", "To", "Element_", "(_", "c_", ",_", "group", "\\u", "node_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "(_", "isinstance_", "(_", "child_", ",_", "N_", "._", "Node_", ")_", "or_", "child_", "==_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "child_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "\"", "We", " ", "have", " ", "a", " ", "none", " ", "child", "?\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ET_", "._", "Sub", "Element_", "(_", "parent", "\\u", "element_", ",_", "\"", "Non", "e", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "Convert", "To", "Element_", "(_", "child_", ",_", "parent", "\\u", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XML", "Writer_", "(_", "writer_", "._", "Writer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "Add", "Position", "To", "Element_", "(_", "self_", ",_", "tree_", ",_", "parent", "\\u", "element_", ")_", ":_", "\\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 ", " _", "line_", ",_", "column_", ",_", "f_", "=_", "tree_", "._", "position_", "._", "Get", "Line_", "(_", ")_", ",_", "tree_", "._", "position_", "._", "Get", "Column_", "(_", ")_", ",_", "tree_", "._", "position_", "._", "Get", "File_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Attribute", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "line_", ",_", "column_", ",_", "f_", "=_", "None_", ",_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "attributes_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "line", "'_", ":_", "str_", "(_", "line_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "column", "'_", ":_", "str_", "(_", "column_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "file", "'_", ":_", "str_", "(_", "f_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "position", "\\u", "element_", "=_", "ET_", "._", "Sub", "Element_", "(_", "parent", "\\u", "element_", ",_", "\"", "Position", "\"_", ",_", "attrib_", "=_", "attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XML", "Writer_", "(_", "writer_", "._", "Writer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "Convert", "To", "Element_", "(_", "self_", ",_", "tree_", ",_", "parent", "\\u", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Convert", "s", " ", "a", " ", "tree", " ", "to", " ", "an", " ", "element", " ", "tree", ",", " ", "who", "se", " ", "parent", " ", "is", " ", "`", "parent", "\\u", "element", "`.\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "attributes_", "=_", "dict_", "(_", "[_", "(_", "key_", ",_", "val_", ")_", "for_", "(_", "key_", ",_", "val_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "in_", "tree_", "._", "Get", "XML", "Attributes_", "(_", ")_", "[_", "1_", "]_", "._", "items_", "(_", ")_", "if_", "type_", "(_", "val_", ")_", "is_", "str_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "tree_", "._", "Get", "Name_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "node", "\\u", "element_", "=_", "ET_", "._", "Sub", "Element_", "(_", "parent", "\\u", "element_", ",_", "tree_", "._", "Get", "Name_", "(_", ")_", ",_", "attrib_", "=_", "attributes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "Add", "Position", "To", "Element_", "(_", "tree_", ",_", "node", "\\u", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "Add", "Chil", "d", "To", "Element_", "(_", "tree_", "._", "Get", "Children_", "(_", ")_", ",_", "node", "\\u", "element_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XML", "Writer_", "(_", "writer_", "._", "Writer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Write", "Tree_", "(_", "self_", ",_", "tree_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Implementation", " ", "of", " ", "the", " ", "base", " ", "class", " ", "method", " ", "for", " ", "writ", "ing", " ", "the", " ", "tree", " ", "to", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "string", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "ET_", "._", "tostring_", "(_", "self_", "._", "Get", "Tree_", "(_", "tree_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "XML", "Writer_", "(_", "writer_", "._", "Writer_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Get", "Tree_", "(_", "self_", ",_", "tree_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "root_", "=_", "ET_", "._", "Element_", "(_", "\"", "last", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "Convert", "To", "Element_", "(_", "tree_", ",_", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tree_", "=_", "ET_", "._", "Element", "Tree_", "(_", "root_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "tree_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
francelabs/datafari/windows/python/Lib/site-packages/pip/_vendor/pkg_resources/tests/test_resources.py
[ { "content": " def testDistroBasics(self):\n d = Distribution(\n \"/some/path\",\n project_name=\"FooPkg\",version=\"1.3-1\",py_version=\"2.4\",platform=\"win32\"\n )\n self.checkFooPkg(d)\n\n d = Distribution(\"/some/path\")\n assert d.py_version == sys.version[:3]\n assert d.platform == None", "metadata": "root.TestDistro.testDistroBasics", "header": "['class', 'TestDistro', ':', '___EOS___']", "index": 105 } ]
[ { "span": "d.platform == None", "start_line": 114, "start_column": 15, "end_line": 114, "end_column": 33 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Test", "Distr", "o_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test", "Distr", "o", "Basic", "s_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "Distribution_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"/", "some", "/", "path", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "project", "\\u", "name_", "=_", "\"", "Foo", "Pk", "g", "\"_", ",_", "version_", "=_", "\"", "1.3", "-1", "\"_", ",_", "py", "\\u", "version_", "=_", "\"", "2.4", "\"_", ",_", "platform_", "=_", "\"", "win32", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "check", "Foo", "Pk", "g_", "(_", "d_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "d_", "=_", "Distribution_", "(_", "\"/", "some", "/", "path", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "py", "\\u", "version_", "==_", "sys_", "._", "version_", "[_", ":_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "d_", "._", "platform_", "==_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 2 ]
An assert statement has a side-effect
sympy/sympy/sympy/solvers/tests/test_inequalities.py
[ { "content": "def test_reduce_rational_inequalities_real_relational():\n assert reduce_rational_inequalities([], x) == False\n assert reduce_rational_inequalities(\n [[(x**2 + 3*x + 2)/(x**2 - 16) >= 0]], x, relational=False) == \\\n Union(Interval.open(-oo, -4), Interval(-2, -1), Interval.open(4, oo))\n\n assert reduce_rational_inequalities(\n [[((-2*x - 10)*(3 - x))/((x**2 + 5)*(x - 2)**2) < 0]], x,\n relational=False) == \\\n Union(Interval.open(-5, 2), Interval.open(2, 3))\n\n assert reduce_rational_inequalities([[(x + 1)/(x - 5) <= 0]], x,\n relational=False) == \\\n Interval.Ropen(-1, 5)\n\n assert reduce_rational_inequalities([[(x**2 + 4*x + 3)/(x - 1) > 0]], x,\n relational=False) == \\\n Union(Interval.open(-3, -1), Interval.open(1, oo))\n\n assert reduce_rational_inequalities([[(x**2 - 16)/(x - 1)**2 < 0]], x,\n relational=False) == \\\n Union(Interval.open(-4, 1), Interval.open(1, 4))\n\n assert reduce_rational_inequalities([[(3*x + 1)/(x + 4) >= 1]], x,\n relational=False) == \\\n Union(Interval.open(-oo, -4), Interval.Ropen(S(3)/2, oo))\n\n assert reduce_rational_inequalities([[(x - 8)/x <= 3 - x]], x,\n relational=False) == \\\n Union(Interval.Lopen(-oo, -2), Interval.Lopen(0, 4))\n\n # issue sympy/sympy#10237\n assert reduce_rational_inequalities(\n [[x < oo, x >= 0, -oo < x]], x, relational=False) == Interval(0, oo)", "metadata": "root.test_reduce_rational_inequalities_real_relational", "header": "['module', '___EOS___']", "index": 139 } ]
[ { "span": "assert reduce_rational_inequalities(\n [[(x**2 + 3*x + 2)/(x**2 - 16) >= 0]], x, relational=False) == \\\n Union(Interval.open(-oo, -4), Interval(-2, -1), Interval.open(4, oo))", "start_line": 141, "start_column": 4, "end_line": 143, "end_column": 77 }, { "span": "assert reduce_rational_inequalities(\n [[((-2*x - 10)*(3 - x))/((x**2 + 5)*(x - 2)**2) < 0]], x,\n relational=False) == \\\n Union(Interval.open(-5, 2), Interval.open(2, 3))", "start_line": 145, "start_column": 4, "end_line": 148, "end_column": 56 }, { "span": "assert reduce_rational_inequalities([[(x**2 + 4*x + 3)/(x - 1) > 0]], x,\n relational=False) == \\\n Union(Interval.open(-3, -1), Interval.open(1, oo))", "start_line": 154, "start_column": 4, "end_line": 156, "end_column": 58 }, { "span": "assert reduce_rational_inequalities([[(x**2 - 16)/(x - 1)**2 < 0]], x,\n relational=False) == \\\n Union(Interval.open(-4, 1), Interval.open(1, 4))", "start_line": 158, "start_column": 4, "end_line": 160, "end_column": 56 }, { "span": "assert reduce_rational_inequalities([[(3*x + 1)/(x + 4) >= 1]], x,\n relational=False) == \\\n Union(Interval.open(-oo, -4), Interval.Ropen(S(3)/2, oo))", "start_line": 162, "start_column": 4, "end_line": 164, "end_column": 65 } ]
[]
1
true
[ "[CLS]_", "An", "_", "assert_", "statement_", "has_", "a_", "side_", "-_", "effect_", "[SEP]_", "module_", "\\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", "reduce", "\\u", "rational", "\\u", "inequal", "iti", "es", "\\u", "real", "\\u", "relation", "al_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "reduce", "\\u", "rational", "\\u", "inequal", "ities_", "(_", "[_", "]_", ",_", "x_", ")_", "==_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "reduce", "\\u", "rational", "\\u", "inequal", "ities_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "[_", "(_", "x_", "**_", "2_", "+_", "3_", "*_", "x_", "+_", "2_", ")_", "/_", "(_", "x_", "**_", "2_", "-_", "16_", ")_", ">=_", "0_", "]_", "]_", ",_", "x_", ",_", "relation", "al_", "=_", "False_", ")_", "==_", "Union_", "(_", "Interval_", "._", "open_", "(_", "-_", "oo_", ",_", "-_", "4_", ")_", ",_", "Interval_", "(_", "-_", "2_", ",_", "-_", "1_", ")_", ",_", "Interval_", "._", "open_", "(_", "4_", ",_", "oo_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "reduce", "\\u", "rational", "\\u", "inequal", "ities_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "[_", "(_", "(_", "-_", "2_", "*_", "x_", "-_", "10_", ")_", "*_", "(_", "3_", "-_", "x_", ")_", ")_", "/_", "(_", "(_", "x_", "**_", "2_", "+_", "5_", ")_", "*_", "(_", "x_", "-_", "2_", ")_", "**_", "2_", ")_", "<_", "0_", "]_", "]_", ",_", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "relation", "al_", "=_", "False_", ")_", "==_", "Union_", "(_", "Interval_", "._", "open_", "(_", "-_", "5_", ",_", "2_", ")_", ",_", "Interval_", "._", "open_", "(_", "2_", ",_", "3_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "reduce", "\\u", "rational", "\\u", "inequal", "ities_", "(_", "[_", "[_", "(_", "x_", "+_", "1_", ")_", "/_", "(_", "x_", "-_", "5_", ")_", "<=_", "0_", "]_", "]_", ",_", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "relation", "al_", "=_", "False_", ")_", "==_", "Interval_", "._", "Ro", "pen_", "(_", "-_", "1_", ",_", "5_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "reduce", "\\u", "rational", "\\u", "inequal", "ities_", "(_", "[_", "[_", "(_", "x_", "**_", "2_", "+_", "4_", "*_", "x_", "+_", "3_", ")_", "/_", "(_", "x_", "-_", "1_", ")_", ">_", "0_", "]_", "]_", ",_", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "relation", "al_", "=_", "False_", ")_", "==_", "Union_", "(_", "Interval_", "._", "open_", "(_", "-_", "3_", ",_", "-_", "1_", ")_", ",_", "Interval_", "._", "open_", "(_", "1_", ",_", "oo_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "reduce", "\\u", "rational", "\\u", "inequal", "ities_", "(_", "[_", "[_", "(_", "x_", "**_", "2_", "-_", "16_", ")_", "/_", "(_", "x_", "-_", "1_", ")_", "**_", "2_", "<_", "0_", "]_", "]_", ",_", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "relation", "al_", "=_", "False_", ")_", "==_", "Union_", "(_", "Interval_", "._", "open_", "(_", "-_", "4_", ",_", "1_", ")_", ",_", "Interval_", "._", "open_", "(_", "1_", ",_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "reduce", "\\u", "rational", "\\u", "inequal", "ities_", "(_", "[_", "[_", "(_", "3_", "*_", "x_", "+_", "1_", ")_", "/_", "(_", "x_", "+_", "4_", ")_", ">=_", "1_", "]_", "]_", ",_", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "relation", "al_", "=_", "False_", ")_", "==_", "Union_", "(_", "Interval_", "._", "open_", "(_", "-_", "oo_", ",_", "-_", "4_", ")_", ",_", "Interval_", "._", "Ro", "pen_", "(_", "S_", "(_", "3_", ")_", "/_", "2_", ",_", "oo_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "reduce", "\\u", "rational", "\\u", "inequal", "ities_", "(_", "[_", "[_", "(_", "x_", "-_", "8_", ")_", "/_", "x_", "<=_", "3_", "-_", "x_", "]_", "]_", ",_", "x_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "relation", "al_", "=_", "False_", ")_", "==_", "Union_", "(_", "Interval_", "._", "Lo", "pen_", "(_", "-_", "oo_", ",_", "-_", "2_", ")_", ",_", "Interval_", "._", "Lo", "pen_", "(_", "0_", ",_", "4_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "issue", " ", "symp", "y", "/", "symp", "y", "#", "1023", "7_", "\\u\\u\\uNL\\u\\u\\u_", "assert_", "reduce", "\\u", "rational", "\\u", "inequal", "ities_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "[_", "x_", "<_", "oo_", ",_", "x_", ">=_", "0_", ",_", "-_", "oo_", "<_", "x_", "]_", "]_", ",_", "x_", ",_", "relation", "al_", "=_", "False_", ")_", "==_", "Interval_", "(_", "0_", ",_", "oo_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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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import json\nimport datetime\nimport logging\nimport mimetypes\nimport urllib\nimport cgi\nimport random\nimport string\n\nfrom hashlib import sha1\nfrom operator import itemgetter\n\nfrom tornado import gen\nfrom tornado import httpclient\n\nfrom boto.s3.connection import S3Connection\nfrom boto.s3.key import Key\n\n\nfrom main.helper import *\nfrom main.db import *\nfrom main.db2 import *\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nhandlers = [\n (r'/api2/entity', API2EntityList),\n (r'/api2/entity-(.*)/childs', API2EntityChilds),\n (r'/api2/entity-(.*)/referrals', API2EntityReferrals),\n (r'/api2/entity-(.*)/picture', API2EntityPicture),\n (r'/api2/entity-(.*)/rights', API2EntityRights),\n (r'/api2/entity-(.*)/share', API2EntityShare),\n (r'/api2/entity-(.*)/parents', API2EntityParents),\n (r'/api2/entity-(.*)', API2Entity),\n (r'/api2/file', API2FileUpload),\n (r'/api2/file/s3', API2AmazonFileUpload),\n (r'/api2/file/url', API2UrlFileUpload),\n (r'/api2/file-(.*)', API2File),\n (r'/api2/definition', API2DefinitionList),\n (r'/api2/definition-(.*)', API2Definition),\n (r'/api2/cmdi-xml/(.*)', API2CmdiXml),\n (r'/api2/email', API2Email),\n (r'/api2/user/auth', API2UserAuth),\n (r'/api2/user/auth/(.*)/(.*)', API2UserAuthTokenProvider),\n (r'/api2/user/auth/(.*)', API2UserAuthToken),\n (r'/api2/history', API2History),\n (r'/api2/changed', API2Changed),\n (r'/api2/tagcloud', API2TagCloud),\n (r'/api2/user', API2User),\n (r'/api2/ping', API2Ping),\n (r'/api2(.*)', API2NotFound),\n]\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class API2TagCloud(myRequestHandler, Entity2):", "metadata": "root.API2TagCloud", "header": "['module', '___EOS___']", "index": 27 }, { "content": " @web.removeslash\n def get(self):\n #\n # Get entity list\n #\n db_result = self.get_tag_cloud(\n definition = self.get_argument('definition', default=None, strip=True),\n limit = self.get_argument('limit', default=None, strip=True),\n )\n\n if len(db_result) == 0:\n self.json({\n 'time': round(self.request.request_time(), 3),\n 'count': 0,\n 'result': {\n 'tags': [{\n 'Count': 1,\n 'Tag': '(>< V ><)',\n 'nLog': 1,\n 'Log': 1,\n 'nCount': 1\n },],\n 'range': {'min': 1, 'max': 1},\n 'logRange': {'min': 1, 'max': 1}\n }\n })\n return\n\n seq_count = [x['Count'] for x in db_result]\n seq_log = [x['Log'] for x in db_result]\n min_cnt = min(seq_count)\n max_cnt = max(seq_count)\n min_log = min(seq_log)\n max_log = max(seq_log)\n\n for row in db_result:\n row['nCount'] = 1.0 * (row['Count'] - min_cnt) / (max_cnt - min_cnt) if (max_cnt > min_cnt) else 1\n row['nLog'] = 1.0 * (row['Log'] - min_log) / (max_log - min_log) if (max_log > min_log) else 1\n\n self.json({\n 'time': round(self.request.request_time(), 3),\n 'count': len(db_result),\n 'result': {\n 'tags': db_result,\n 'range': {'min': min_cnt, 'max': max_cnt},\n 'logRange': {'min': min_log, 'max': max_log}\n }\n })", "metadata": "root.API2TagCloud.get", "header": "['class', 'API2TagCloud', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___EOS___']", "index": 28 }, { "content": "class API2EntityList(myRequestHandler, Entity2):", "metadata": "root.API2EntityList", "header": "['module', '___EOS___']", "index": 80 }, { "content": " @web.removeslash\n def get(self):\n #\n # Get entity list\n #\n db_result = self.get_entities_info(\n definition = self.get_argument('definition', default=None, strip=True),\n query = self.get_argument('query', default=None, strip=True),\n limit = self.get_argument('limit', default=None, strip=True),\n page = self.get_argument('page', default=None, strip=True)\n )\n\n result = {}\n for e in db_result.get('entities', []):\n result.setdefault(e.get('id'), {}).setdefault('definition', {})['keyname'] = e.get('definition') if e.get('definition') else None\n result.setdefault(e.get('id'), {}).setdefault('definition', {})['label'] = e.get('label') if e.get('label') else None\n result.setdefault(e.get('id'), {}).setdefault('definition', {})['label_plural'] = e.get('label_plural') if e.get('label_plural') else None\n result.setdefault(e.get('id'), {}).setdefault('definition', {})['table_header'] = e.get('displaytableheader').split('|') if e.get('displaytableheader') else None\n result.setdefault(e.get('id'), {})['id'] = e.get('id') if e.get('id') else None\n result.setdefault(e.get('id'), {})['sort'] = e.get('sort') if e.get('sort') else None\n result.setdefault(e.get('id'), {}).setdefault('changed', {})['dt'] = e.get('changed') if e.get('changed') else None\n result.setdefault(e.get('id'), {}).setdefault('changed', {})['ts'] = e.get('changed_ts') if e.get('changed_ts') else None\n result.setdefault(e.get('id'), {})['name'] = e.get('displayname') if e.get('displayname') else None\n result.setdefault(e.get('id'), {})['info'] = e.get('displayinfo') if e.get('displayinfo') else None\n result.setdefault(e.get('id'), {})['table'] = e.get('displaytable').split('|') if e.get('displaytable') else None\n\n self.json({\n 'result': sorted(result.values(), key=itemgetter('sort')),\n 'time': round(self.request.request_time(), 3),\n 'count': db_result.get('count', 0),\n })", "metadata": "root.API2EntityList.get", "header": "['class', 'API2EntityList', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___EOS___']", "index": 81 }, { "content": "class API2CmdiXml(myRequestHandler, Entity):", "metadata": "root.API2CmdiXml", "header": "['module', '___EOS___']", "index": 116 }, { "content": " @web.removeslash\n def get(self, entity_id=None):\n if not entity_id:\n return self.json({\n 'error': 'No entity ID!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n entity = self.get_entities(entity_id=entity_id, limit=1)\n if not entity:\n return self.json({\n 'error': 'Entity with given ID is not found!',\n 'time': round(self.request.request_time(), 3),\n }, 404)\n entity['definition'] = {'keyname': entity['definition_keyname']}\n\n xml = \"\"\"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n <CMD xmlns=\"http://www.clarin.eu/cmd/\"\n xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n CMDVersion=\"1.1\"\n xsi:schemaLocation=\"%(XSD)s\">\n <Header></Header>\n <Resources>\n <ResourceProxyList></ResourceProxyList>\n <JournalFileProxyList></JournalFileProxyList>\n <ResourceRelationList></ResourceRelationList>\n </Resources>\n <Components>\n <%(Component)s>\n <GeneralInfo>\n <ResourceName xml:lang=\"en\">%(ResourceName)s</ResourceName>\n <Version xml:lang=\"en\">%(Version)s</Version>\n <LastUpdate>%(LastUpdate)s</LastUpdate>\n <LegalOwner xml:lang=\"en\">%(LegalOwner)s</LegalOwner>\n </GeneralInfo>\n </%(Component)s>\n </Components>\n </CMD>\"\"\" % {\n 'XSD' : entity['properties']['XSD'].get('values',[{'value':''}])[0]['value'],\n 'Component' : entity['properties']['Component'].get('values',[{'value':''}])[0]['value'],\n 'ResourceName' : entity['properties']['ResourceName'].get('values',[{'value':''}])[0]['value'],\n 'Version' : entity['properties']['Version'].get('values',[{'value':''}])[0]['value'],\n 'LastUpdate' : entity['properties']['LastUpdate'].get('values',[{'value':''}])[0]['value'],\n 'LegalOwner' : entity['properties']['LegalOwner'].get('values',[{'value':''}])[0]['value'],\n }\n\n mimetypes.init()\n mime = mimetypes.types_map.get('.xml', 'application/octet-stream')\n filename = 'entu-cmd-%s.xml' % entity_id\n self.add_header('Content-Type', mime)\n # self.add_header('Content-Disposition', 'attachment; filename=\"%s\"' % filename)\n self.write(xml)", "metadata": "root.API2CmdiXml.get", "header": "['class', 'API2CmdiXml', '(', 'myRequestHandler', ',', 'Entity', ')', ':', '___EOS___']", "index": 117 }, { "content": "class API2Entity(myRequestHandler, Entity):\n\n\n\n\n\n", "metadata": "root.API2Entity", "header": "['module', '___EOS___']", "index": 173 }, { "content": " @web.removeslash\n def get(self, entity_id=None):\n #\n # Get entity (with given ID)\n #\n if not entity_id:\n return self.json({\n 'error': 'No entity ID!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n try:\n entity = self.get_entities(entity_id=entity_id, limit=1)\n except Exception, e:\n return self.json({\n 'error': 'Something is wrong here!',\n 'time': round(self.request.request_time(), 3),\n }, 500)\n\n if not entity:\n return self.json({\n 'error': 'Entity with given ID is not found!',\n 'time': round(self.request.request_time(), 3),\n }, 404)\n entity['definition'] = {'keyname': entity['definition_keyname']}\n\n self.json({\n 'result': entity,\n 'time': round(self.request.request_time(), 3),\n })", "metadata": "root.API2Entity.get", "header": "['class', 'API2Entity', '(', 'myRequestHandler', ',', 'Entity', ')', ':', '___EOS___']", "index": 174 }, { "content": " @web.removeslash\n def put(self, entity_id=None):\n #\n # Change entity (with given ID) properties\n #\n if not self.current_user:\n return self.json({\n 'error': 'Forbidden!',\n 'time': round(self.request.request_time(), 3),\n }, 403)\n\n if not entity_id:\n return self.json({\n 'error': 'No entity ID!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n # entity = self.get_entities(entity_id=entity_id, limit=1)\n # if not entity:\n # return self.json({\n # 'error': 'Entity with given ID is not found!',\n # 'time': round(self.request.request_time(), 3),\n # }, 404)\n\n new_properties = {}\n for dataproperty, value in self.request.arguments.iteritems():\n if dataproperty in ['user', 'policy', 'signature']:\n continue\n\n if '.' in dataproperty:\n property_definition_keyname = dataproperty.split('.')[0]\n old_property_id = dataproperty.split('.')[1]\n else:\n property_definition_keyname = dataproperty\n old_property_id = None\n\n if type(value) is not list:\n value = [value]\n\n for v in value:\n new_property_id = self.set_property(entity_id=entity_id, old_property_id=old_property_id, property_definition_keyname=property_definition_keyname, value=v)\n if new_property_id:\n new_properties.setdefault(property_definition_keyname, []).append({'id': new_property_id, 'value': v})\n\n self.json({\n 'result': {\n 'id': entity_id,\n 'properties': new_properties\n },\n 'time': round(self.request.request_time(), 3),\n }, 201)", "metadata": "root.API2Entity.put", "header": "['class', 'API2Entity', '(', 'myRequestHandler', ',', 'Entity', ')', ':', '___EOS___']", "index": 206 }, { "content": " @web.removeslash\n def post(self, entity_id=None):\n #\n # Create new child entity (under entity with given ID)\n #\n if not self.current_user:\n return self.json({\n 'error': 'Forbidden!',\n 'time': round(self.request.request_time(), 3),\n }, 403)\n\n if not entity_id:\n return self.json({\n 'error': 'No entity ID!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n entity = self.get_entities(entity_id=entity_id, limit=1)\n if not entity:\n return self.json({\n 'error': 'Entity with given ID is not found!',\n 'time': round(self.request.request_time(), 3),\n }, 404)\n\n definition = self.get_argument('definition', default=None, strip=True)\n if not definition:\n return self.json({\n 'error': 'No definition!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n entity_id = self.create_entity(entity_definition_keyname=definition, parent_entity_id=entity_id)\n\n for dataproperty, value in self.request.arguments.iteritems():\n if dataproperty in ['user', 'policy', 'signature', 'definition']:\n continue\n if type(value) is not list:\n value = [value]\n for v in value:\n new_property_id = self.set_property(entity_id=entity_id, property_definition_keyname=dataproperty, value=v)\n\n self.json({\n 'result': {\n 'id': entity_id,\n },\n 'time': round(self.request.request_time(), 3),\n }, 201)", "metadata": "root.API2Entity.post", "header": "['class', 'API2Entity', '(', 'myRequestHandler', ',', 'Entity', ')', ':', '___EOS___']", "index": 259 }, { "content": " @web.removeslash\n def delete(self, entity_id=None):\n #\n # Delete entity (with given ID)\n #\n if not entity_id:\n return self.json({\n 'error': 'No entity ID!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n result = self.delete_entity(entity_id=entity_id)\n if not result:\n return self.json({\n 'error': 'Forbidden!',\n 'time': round(self.request.request_time(), 3),\n }, 403)\n\n self.json({\n 'result': {\n 'id': entity_id,\n },\n 'time': round(self.request.request_time(), 3),\n })", "metadata": "root.API2Entity.delete", "header": "['class', 'API2Entity', '(', 'myRequestHandler', ',', 'Entity', ')', ':', '___EOS___']", "index": 308 }, { "content": "class API2EntityChilds(myRequestHandler, Entity2):", "metadata": "root.API2EntityChilds", "header": "['module', '___EOS___']", "index": 336 }, { "content": " @web.removeslash\n def get(self, entity_id=None):\n if not entity_id:\n return self.json({\n 'error': 'No entity ID!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n db_result = self.get_entities_info(\n parent_entity_id = entity_id,\n definition = self.get_argument('definition', default=None, strip=True),\n query = self.get_argument('query', default=None, strip=True),\n limit = self.get_argument('limit', default=None, strip=True),\n page = self.get_argument('page', default=None, strip=True)\n )\n\n result = {}\n for e in db_result.get('entities', []):\n result.setdefault(e.get('definition'), {})['definition'] = e.get('definition') if e.get('definition') else None\n result.setdefault(e.get('definition'), {})['label'] = e.get('label') if e.get('label') else None\n result.setdefault(e.get('definition'), {})['label_plural'] = e.get('label_plural') if e.get('label_plural') else None\n result.setdefault(e.get('definition'), {})['table_header'] = e.get('displaytableheader').split('|') if e.get('displaytableheader') else None\n result.setdefault(e.get('definition'), {}).setdefault('entities', {}).setdefault(e.get('id'), {})['id'] = e.get('id') if e.get('id') else None\n result.setdefault(e.get('definition'), {}).setdefault('entities', {}).setdefault(e.get('id'), {})['sort'] = e.get('sort') if e.get('sort') else None\n result.setdefault(e.get('definition'), {}).setdefault('entities', {}).setdefault(e.get('id'), {})['name'] = e.get('displayname') if e.get('displayname') else None\n result.setdefault(e.get('definition'), {}).setdefault('entities', {}).setdefault(e.get('id'), {})['info'] = e.get('displayinfo') if e.get('displayinfo') else None\n result.setdefault(e.get('definition'), {}).setdefault('entities', {}).setdefault(e.get('id'), {})['table'] = e.get('displaytable').split('|') if e.get('displaytable') else None\n for r in result.values():\n r['entities'] = sorted(r.get('entities', {}).values(), key=itemgetter('sort'))\n\n self.json({\n 'result': result,\n 'time': round(self.request.request_time(), 3),\n 'count': db_result.get('count', 0),\n })", "metadata": "root.API2EntityChilds.get", "header": "['class', 'API2EntityChilds', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___EOS___']", "index": 337 }, { "content": "class API2EntityReferrals(myRequestHandler, Entity2):", "metadata": "root.API2EntityReferrals", "header": "['module', '___EOS___']", "index": 376 }, { "content": " @web.removeslash\n def get(self, entity_id=None):\n if not entity_id:\n return self.json({\n 'error': 'No entity ID!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n db_result = self.get_entities_info(\n referred_to_entity_id = entity_id,\n definition = self.get_argument('definition', default=None, strip=True),\n query = self.get_argument('query', default=None, strip=True),\n limit = self.get_argument('limit', default=None, strip=True),\n page = self.get_argument('page', default=None, strip=True)\n )\n\n result = {}\n for e in db_result.get('entities', []):\n result.setdefault(e.get('definition'), {})['definition'] = e.get('definition') if e.get('definition') else None\n result.setdefault(e.get('definition'), {})['label'] = e.get('label') if e.get('label') else None\n result.setdefault(e.get('definition'), {})['label_plural'] = e.get('label_plural') if e.get('label_plural') else None\n result.setdefault(e.get('definition'), {})['table_header'] = e.get('displaytableheader').split('|') if e.get('displaytableheader') else None\n result.setdefault(e.get('definition'), {}).setdefault('entities', {}).setdefault(e.get('id'), {})['id'] = e.get('id') if e.get('id') else None\n result.setdefault(e.get('definition'), {}).setdefault('entities', {}).setdefault(e.get('id'), {})['sort'] = e.get('sort') if e.get('sort') else None\n result.setdefault(e.get('definition'), {}).setdefault('entities', {}).setdefault(e.get('id'), {})['name'] = e.get('displayname') if e.get('displayname') else None\n result.setdefault(e.get('definition'), {}).setdefault('entities', {}).setdefault(e.get('id'), {})['info'] = e.get('displayinfo') if e.get('displayinfo') else None\n result.setdefault(e.get('definition'), {}).setdefault('entities', {}).setdefault(e.get('id'), {})['table'] = e.get('displaytable').split('|') if e.get('displaytable') else None\n for r in result.values():\n r['entities'] = sorted(r.get('entities', {}).values(), key=itemgetter('sort'))\n\n self.json({\n 'result': result,\n 'time': round(self.request.request_time(), 3),\n 'count': db_result.get('count', 0),\n })", "metadata": "root.API2EntityReferrals.get", "header": "['class', 'API2EntityReferrals', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___EOS___']", "index": 377 }, { "content": "class API2File(myRequestHandler, Entity):\n", "metadata": "root.API2File", "header": "['module', '___EOS___']", "index": 416 }, { "content": " @web.removeslash\n def get(self, file_id=None):\n #\n # Get file (with given ID)\n #\n if not file_id:\n return self.json({\n 'error': 'No file ID!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n files = self.get_file(file_id=file_id, sharing_key=self.get_argument('key', default=None, strip=True))\n if not files:\n return self.json({\n 'error': 'File with given ID is not found!',\n 'time': round(self.request.request_time(), 3),\n }, 404)\n\n if files[0].get('url'):\n return self.redirect(files[0].get('url'))\n\n if files[0].get('s3key'):\n try:\n AWS_BUCKET = self.app_settings('auth-s3', '\\n', True).split('\\n')[0]\n AWS_ACCESS_KEY = self.app_settings('auth-s3', '\\n', True).split('\\n')[1]\n AWS_SECRET_KEY = self.app_settings('auth-s3', '\\n', True).split('\\n')[2]\n except Exception, e:\n return self.json({\n 'error': 'Amazon S3 bucket, key or secret not set!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n s3_conn = S3Connection(AWS_ACCESS_KEY, AWS_SECRET_KEY)\n s3_bucket = s3_conn.get_bucket(AWS_BUCKET, validate=False)\n s3_key = s3_bucket.get_key(files[0].get('s3key'))\n if not s3_key:\n return self.json({\n 'error': 'File not found from Amazon S3!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n s3_url = s3_key.generate_url(expires_in=3600, query_auth=True)\n return self.redirect(s3_url)\n\n if not files[0].get('file'):\n return self.json({\n 'error': 'No file!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n mimetypes.init()\n mime = mimetypes.types_map.get('.%s' % files[0].get('filename').lower().split('.')[-1], 'application/octet-stream')\n\n filename = files[0].get('filename')\n\n self.add_header('Content-Type', mime)\n self.add_header('Content-Disposition', 'inline; filename=\"%s\"' % filename)\n self.write(files[0].get('file'))", "metadata": "root.API2File.get", "header": "['class', 'API2File', '(', 'myRequestHandler', ',', 'Entity', ')', ':', '___EOS___']", "index": 417 }, { "content": " @web.removeslash\n def delete(self, file_id=None):\n #\n # Delete file (with given ID)\n #\n pass", "metadata": "root.API2File.delete", "header": "['class', 'API2File', '(', 'myRequestHandler', ',', 'Entity', ')', ':', '___EOS___']", "index": 475 }, { "content": "class API2FileUpload(myRequestHandler, Entity):", "metadata": "root.API2FileUpload", "header": "['module', '___EOS___']", "index": 485 }, { "content": " @web.removeslash\n def post(self):\n #\n # Upload/create file\n #\n if not self.current_user:\n return self.json({\n 'error': 'Forbidden!',\n 'time': round(self.request.request_time(), 3),\n }, 403)\n\n if self.request.headers.get('Content-Type', '').startswith('multipart/form-data'):\n uploaded_file = self.request.files.get('file', [{}])[0].body\n else:\n uploaded_file = self.request.body\n\n if not uploaded_file:\n return self.json({\n 'error': 'No file!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n if not self.request.headers.get('Content-Type', '').startswith('multipart/form-data'):\n try:\n file_size = int(self.request.headers.get('Content-Length', 0))\n except Exception:\n return self.json({\n 'error': 'Content-Length header not set!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n if file_size != len(uploaded_file):\n return self.json({\n 'error': 'File not complete!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n entity_id = self.get_argument('entity', default=None, strip=True)\n if not entity_id:\n return self.json({\n 'error': 'No entity ID!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n # entity = self.get_entities(entity_id=entity_id, limit=1)\n # if not entity:\n # return self.json({\n # 'error': 'Entity with given ID is not found!',\n # 'time': round(self.request.request_time(), 3),\n # }, 404)\n\n property_definition_keyname = self.get_argument('property', default=None, strip=True)\n if not property_definition_keyname:\n return self.json({\n 'error': 'No property!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n filename = self.get_argument('filename', default=None, strip=True)\n if not filename:\n return self.json({\n 'error': 'No filename!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n new_property_id = self.set_property(entity_id=entity_id, property_definition_keyname=property_definition_keyname, value={'filename': filename, 'body': uploaded_file})\n if new_property_id:\n properties = {property_definition_keyname: [{'id': new_property_id, 'value': filename}]}\n else:\n properties = None\n\n self.json({\n 'result': {\n 'id': entity_id,\n 'properties': properties\n },\n 'time': round(self.request.request_time(), 3),\n })", "metadata": "root.API2FileUpload.post", "header": "['class', 'API2FileUpload', '(', 'myRequestHandler', ',', 'Entity', ')', ':', '___EOS___']", "index": 486 }, { "content": "class API2AmazonFileUpload(myRequestHandler, Entity):", "metadata": "root.API2AmazonFileUpload", "header": "['module', '___EOS___']", "index": 568 }, { "content": " def post(self):\n #\n # Upload/create file\n #\n try:\n AWS_BUCKET = self.app_settings('auth-s3', '\\n', True).split('\\n')[0]\n AWS_ACCESS_KEY = self.app_settings('auth-s3', '\\n', True).split('\\n')[1]\n AWS_SECRET_KEY = self.app_settings('auth-s3', '\\n', True).split('\\n')[2]\n except Exception, e:\n return self.json({\n 'error': 'Amazon S3 bucket, key or secret not set!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n if not self.current_user:\n return self.json({\n 'error': 'Forbidden!',\n 'time': round(self.request.request_time(), 3),\n }, 403)\n\n entity_id = self.get_argument('entity', default=None, strip=True)\n if not entity_id:\n return self.json({\n 'error': 'No entity ID!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n # entity = self.get_entities(entity_id=entity_id, limit=1)\n # if not entity:\n # return self.json({\n # 'error': 'Entity with given ID is not found!',\n # 'time': round(self.request.request_time(), 3),\n # }, 404)\n\n property_definition_keyname = self.get_argument('property', default=None, strip=True)\n if not property_definition_keyname:\n return self.json({\n 'error': 'No property!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n filename = self.get_argument('filename', default=None, strip=True)\n if not filename:\n return self.json({\n 'error': 'No filename!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n filetype = self.get_argument('filetype', None, True)\n if not filetype:\n filetype = 'binary/octet-stream'\n\n filesize = self.get_argument('filesize', 0, True)\n if int(filesize) > 4294967295:\n return self.json({\n 'error': 'Max file size is 4294967295 bytes!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n key = '%s_2/%s' % (self.app_settings('database-name'), entity_id)\n\n new_property_id = self.set_property(entity_id=entity_id, property_definition_keyname=property_definition_keyname, value={'filename': filename, 's3key': key, 'filesize': filesize})\n if new_property_id:\n properties = {property_definition_keyname: [{'id': new_property_id, 'value': filename}]}\n else:\n properties = None\n\n key = '%s/%s' % (key, new_property_id)\n\n policy = {\n 'expiration': (datetime.datetime.utcnow()+datetime.timedelta(hours=1)).strftime('%Y-%m-%dT%H:%M:%SZ'),\n 'conditions': [\n {'bucket': AWS_BUCKET},\n ['starts-with', '$key', key],\n {'acl': 'private'},\n {'success_action_status': '201'},\n {'x-amz-server-side-encryption': 'AES256'},\n {'Content-Type': filetype},\n ['starts-with', '$Content-Disposition', 'inline; filename'],\n ]\n }\n encoded_policy = json.dumps(policy).encode('utf-8').encode('base64').replace('\\n','')\n signature = hmac.new(str(AWS_SECRET_KEY), str(encoded_policy), sha1).digest().encode('base64').replace('\\n','')\n\n self.json({\n 'result': {\n 'id': entity_id,\n 'properties': properties,\n 's3': {\n 'url': 'https://%s.s3.amazonaws.com/' % AWS_BUCKET,\n 'data': {\n 'key': key,\n 'acl': 'private',\n 'success_action_status': '201',\n 'x-amz-server-side-encryption': 'AES256',\n 'AWSAccessKeyId': AWS_ACCESS_KEY,\n 'policy': encoded_policy,\n 'signature': signature,\n 'Content-Type': filetype,\n 'Content-Disposition': 'inline; filename*=UTF-8\\'\\'%s' % urllib.quote(filename.encode('utf-8')),\n }\n }\n },\n 'time': round(self.request.request_time(), 3),\n })", "metadata": "root.API2AmazonFileUpload.post", "header": "['class', 'API2AmazonFileUpload', '(', 'myRequestHandler', ',', 'Entity', ')', ':', '___EOS___']", "index": 569 }, { "content": "class API2UrlFileUpload(myRequestHandler, Entity):", "metadata": "root.API2UrlFileUpload", "header": "['module', '___EOS___']", "index": 678 }, { "content": " @gen.coroutine\n def post(self):\n #\n # Upload/create file\n #\n try:\n AWS_BUCKET = self.app_settings('auth-s3', '\\n', True).split('\\n')[0]\n AWS_ACCESS_KEY = self.app_settings('auth-s3', '\\n', True).split('\\n')[1]\n AWS_SECRET_KEY = self.app_settings('auth-s3', '\\n', True).split('\\n')[2]\n except Exception, e:\n self.json({\n 'error': 'Amazon S3 bucket, key or secret not set!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n return\n\n if not self.current_user:\n self.json({\n 'error': 'Forbidden!',\n 'time': round(self.request.request_time(), 3),\n }, 403)\n return\n\n entity_id = self.get_argument('entity', default=None, strip=True)\n if not entity_id:\n self.json({\n 'error': 'No entity ID!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n return\n\n # entity = self.get_entities(entity_id=entity_id, limit=1)\n # if not entity:\n # return self.json({\n # 'error': 'Entity with given ID is not found!',\n # 'time': round(self.request.request_time(), 3),\n # }, 404)\n\n property_definition_keyname = self.get_argument('property', default=None, strip=True)\n if not property_definition_keyname:\n self.json({\n 'error': 'No property!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n return\n\n url = self.get_argument('url', default=None, strip=True)\n if not url:\n self.json({\n 'error': 'No url!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n return\n\n filename = self.get_argument('filename', default=None, strip=True)\n\n download = self.get_argument('download', default='false', strip=True)\n if download.lower() != 'true':\n new_property_id = self.set_property(entity_id=entity_id, property_definition_keyname=property_definition_keyname, value={'filename': filename, 'url': url})\n\n if new_property_id:\n properties = {property_definition_keyname: [{'id': new_property_id, 'value': filename}]}\n else:\n properties = None\n\n self.json({\n 'result': {\n 'id': entity_id,\n 'properties': properties\n },\n 'time': round(self.request.request_time(), 3),\n })\n return\n\n http_client = httpclient.AsyncHTTPClient()\n response = yield http_client.fetch(url)\n\n if response.headers.get('Content-Type', None):\n filetype = response.headers.get('Content-Type')\n else:\n filetype = 'binary/octet-stream'\n\n if not filename and response.headers.get('Content-Disposition', None):\n filename_value, filename_params = cgi.parse_header(response.headers.get('Content-Disposition'))\n if filename_params.get('filename', None):\n filename = filename_params.get('filename').decode('utf-8')\n elif filename_params.get('filename*', None):\n filename = urllib.unquote(filename_params.get('filename*').replace('UTF-8\\'\\'', ''))\n\n if not filename:\n filename = url.split('#')[0].split('?')[0].split('/')[-1]\n\n filesize = len(response.body)\n if int(filesize) > 4294967295:\n self.json({\n 'error': 'Max file size is 4294967295 bytes!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n return\n\n key = '%s/%s' % (self.app_settings('database-name'), entity_id)\n\n new_property_id = self.set_property(entity_id=entity_id, property_definition_keyname=property_definition_keyname, value={'filename': filename, 's3key': key, 'filesize': filesize})\n if new_property_id:\n properties = {property_definition_keyname: [{'id': new_property_id, 'value': filename}]}\n else:\n properties = None\n\n key = '%s/%s' % (key, new_property_id)\n\n s3_conn = S3Connection(AWS_ACCESS_KEY, AWS_SECRET_KEY)\n s3_bucket = s3_conn.get_bucket(AWS_BUCKET, validate=False)\n s3_file = Key(s3_bucket)\n\n s3_file.key = key\n s3_file.content_type = filetype\n s3_file.set_metadata('Content-Disposition', 'inline; filename*=UTF-8\\'\\'%s' % urllib.quote(filename.encode('utf-8')))\n s3_file.set_contents_from_string(response.body, encrypt_key=True)\n\n self.json({\n 'result': {\n 'id': entity_id,\n 'properties': properties,\n },\n 'time': round(self.request.request_time(), 3),\n })", "metadata": "root.API2UrlFileUpload.post", "header": "['class', 'API2UrlFileUpload', '(', 'myRequestHandler', ',', 'Entity', ')', ':', '___EOS___']", "index": 679 }, { "content": "class API2EntityPicture(myRequestHandler, Entity2):", "metadata": "root.API2EntityPicture", "header": "['module', '___EOS___']", "index": 809 }, { "content": " @web.removeslash\n def get(self, entity_id=None):\n picture = self.get_entity_picture(entity_id)\n\n if not picture:\n return self.redirect('https://secure.gravatar.com/avatar/%s?d=identicon&s=150' % (hashlib.md5(str(entity_id)).hexdigest()))\n\n if picture.get('picture'):\n self.add_header('Content-Type', 'image/jpeg')\n return self.write(picture.get('picture'))\n\n elif picture.get('definition', '') == 'person':\n return self.redirect('https://secure.gravatar.com/avatar/%s?d=wavatar&s=150' % (hashlib.md5(str(entity_id)).hexdigest()))\n\n elif picture.get('definition', '') in ['audiovideo', 'book', 'methodical', 'periodical', 'textbook', 'workbook']:\n return self.redirect('/photo-by-isbn?entity=%s' % entity_id)\n\n else:\n return self.redirect('https://secure.gravatar.com/avatar/%s?d=identicon&s=150' % (hashlib.md5(str(entity_id)).hexdigest()))", "metadata": "root.API2EntityPicture.get", "header": "['class', 'API2EntityPicture', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___EOS___']", "index": 810 }, { "content": "class API2EntityRights(myRequestHandler, Entity2):", "metadata": "root.API2EntityRights", "header": "['module', '___EOS___']", "index": 833 }, { "content": " def post(self, entity_id):\n if not self.current_user:\n return self.json({\n 'error': 'Forbidden!',\n 'time': round(self.request.request_time(), 3),\n }, 403)\n\n if not entity_id:\n return self.json({\n 'error': 'No entity ID!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n right = self.get_argument('right', default=None, strip=True)\n if right and right not in ['viewer', 'expander', 'editor', 'owner']:\n return self.json({\n 'error': 'Right type must be set!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n related_entity_id = self.get_argument('entity', default=None, strip=True)\n if not related_entity_id:\n return self.json({\n 'error': 'Entity ID must be set!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n response = self.set_entity_right(entity_id=entity_id, related_entity_id=related_entity_id, right=right)\n\n self.json({\n 'result': response,\n 'time': round(self.request.request_time(), 3),\n })", "metadata": "root.API2EntityRights.post", "header": "['class', 'API2EntityRights', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___EOS___']", "index": 834 }, { "content": "class API2EntityShare(myRequestHandler, Entity):", "metadata": "root.API2EntityShare", "header": "['module', '___EOS___']", "index": 871 }, { "content": " def post(self, entity_id):\n if not self.current_user:\n return self.json({\n 'error': 'Forbidden!',\n 'time': round(self.request.request_time(), 3),\n }, 403)\n\n to = StrToList(self.get_argument('to', default=None, strip=True))\n if not to:\n return self.json({\n 'error': 'To address must be set!',\n 'time': round(self.request.request_time(), 3),\n }, 404)\n\n if not entity_id:\n return self.json({\n 'error': 'No entity ID!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n entity = self.get_entities(entity_id=entity_id, limit=1)\n if not entity:\n return self.json({\n 'error': 'Entity with given ID is not found!',\n 'time': round(self.request.request_time(), 3),\n }, 404)\n\n url = 'https://%s/entity/%s/%s' % (self.request.headers.get('Host'), entity.get('definition_keyname', ''), entity.get('id'))\n\n message = self.get_argument('message', default='', strip=True)\n\n response = self.mail_send(\n to = to,\n subject = entity.get('displayname', ''),\n message = '%s\\n\\n%s\\n\\n%s\\n%s' % (message, url, self.current_user.get('name', ''), self.current_user.get('email', '')),\n html = False,\n tag = ['entu', 'share']\n )\n\n self.json({\n 'result': response,\n 'time': round(self.request.request_time(), 3),\n })", "metadata": "root.API2EntityShare.post", "header": "['class', 'API2EntityShare', '(', 'myRequestHandler', ',', 'Entity', ')', ':', '___EOS___']", "index": 872 }, { "content": "class API2Email(myRequestHandler, Entity2):\n\n", "metadata": "root.API2Email", "header": "['module', '___EOS___']", "index": 919 }, { "content": " def get(self):\n pass", "metadata": "root.API2Email.get", "header": "['class', 'API2Email', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___EOS___']", "index": 920 }, { "content": " def post(self):\n if not self.current_user:\n return self.json({\n 'error': 'Forbidden!',\n 'time': round(self.request.request_time(), 3),\n }, 403)\n\n to = self.get_argument('to', default=None, strip=True)\n if not to:\n return self.json({\n 'error': 'To address must be set!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n subject = self.get_argument('subject', default=None, strip=True)\n if not subject:\n return self.json({\n 'error': 'Subject must be set!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n message = self.get_argument('message', default=None, strip=True)\n if not message:\n return self.json({\n 'error': 'Message must be set!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n campaign = self.get_argument('campaign', default=None, strip=True)\n\n tag = self.get_argument('tag', default=None, strip=True)\n\n response = self.mail_send(\n to = to,\n subject = subject,\n message = message,\n html = True,\n campaign = campaign,\n tag = tag\n )\n\n self.json({\n 'result': response,\n 'time': round(self.request.request_time(), 3),\n })", "metadata": "root.API2Email.post", "header": "['class', 'API2Email', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___EOS___']", "index": 924 }, { "content": "class API2DefinitionList(myRequestHandler, Entity2):", "metadata": "root.API2DefinitionList", "header": "['module', '___EOS___']", "index": 973 }, { "content": " @web.removeslash\n def get(self):\n menu = self.get_menu()\n\n self.json({\n 'result': menu,\n 'time': round(self.request.request_time(), 3),\n })", "metadata": "root.API2DefinitionList.get", "header": "['class', 'API2DefinitionList', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___EOS___']", "index": 974 }, { "content": "class API2Definition(myRequestHandler, Entity2):", "metadata": "root.API2Definition", "header": "['module', '___EOS___']", "index": 986 }, { "content": " @web.removeslash\n def get(self, definition_id=None):\n if not definition_id:\n return self.json({\n 'error': 'No definition ID!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n definitions = self.get_entity_definitions(definition_id=definition_id)\n if not definitions:\n return self.json({\n 'error': 'Definition with given ID is not found!',\n 'time': round(self.request.request_time(), 3),\n }, 404)\n\n self.json({\n 'result': definitions,\n 'time': round(self.request.request_time(), 3),\n })", "metadata": "root.API2Definition.get", "header": "['class', 'API2Definition', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___EOS___']", "index": 987 }, { "content": "class API2User(myRequestHandler, Entity):", "metadata": "root.API2User", "header": "['module', '___EOS___']", "index": 1010 }, { "content": " @web.removeslash\n def get(self):\n if not self.current_user:\n return self.json({\n 'error': 'No logged in user!',\n 'time': round(self.request.request_time(), 3),\n }, 404)\n\n person = self.get_entities(entity_id=self.current_user.get('id'), limit=1)\n\n result = self.current_user\n result['person'] = person\n\n del result['access_token']\n del result['api_key']\n\n self.json({\n 'result': result,\n 'time': round(self.request.request_time(), 3),\n })", "metadata": "root.API2User.get", "header": "['class', 'API2User', '(', 'myRequestHandler', ',', 'Entity', ')', ':', '___EOS___']", "index": 1011 }, { "content": "class API2UserAuth(myRequestHandler, Entity2):\n\n", "metadata": "root.API2UserAuth", "header": "['module', '___EOS___']", "index": 1035 }, { "content": " @web.removeslash\n @web.authenticated\n def get(self):\n self.redirect('/api2/user')", "metadata": "root.API2UserAuth.get", "header": "['class', 'API2UserAuth', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___EOS___']", "index": 1036 }, { "content": " @web.removeslash\n def post(self):\n state = self.get_argument('state', default=None, strip=True)\n if not state:\n return self.json({\n 'error': 'State parameter must be set!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n redirect_url = self.get_argument('redirect_url', default=None, strip=True)\n provider = self.get_argument('provider', default=None, strip=True)\n\n token = hashlib.md5('%s.%s.%s' % (state, redirect_url, ''.join(random.choice(string.ascii_letters + string.digits) for x in range(16)))).hexdigest()\n\n tmp_filename = '%s.authtoken' % token\n tmp_file = json.dumps({\n 'state': state,\n 'redirect_url': redirect_url,\n 'provider': provider\n })\n\n self.set_tmp_file(filename=tmp_filename, content=tmp_file)\n\n self.json({\n 'result': {\n 'state': state,\n 'auth_url': '%s/%s' % (self.request.full_url(), token)\n },\n 'time': round(self.request.request_time(), 3),\n })", "metadata": "root.API2UserAuth.post", "header": "['class', 'API2UserAuth', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___EOS___']", "index": 1042 }, { "content": "class API2UserAuthTokenProvider(myRequestHandler, Entity2):", "metadata": "root.API2UserAuthTokenProvider", "header": "['module', '___EOS___']", "index": 1076 }, { "content": " @web.removeslash\n def get(self, token, provider):\n self.set_cookie(name='auth_provider', value=provider, expires_days=1, domain=self.settings['cookie_domain'])\n self.redirect('/api2/user/auth/%s' % token)", "metadata": "root.API2UserAuthTokenProvider.get", "header": "['class', 'API2UserAuthTokenProvider', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___EOS___']", "index": 1077 }, { "content": "class API2UserAuthToken(myRequestHandler, Entity2):\n\n", "metadata": "root.API2UserAuthToken", "header": "['module', '___EOS___']", "index": 1085 }, { "content": " @web.removeslash\n @web.authenticated\n def get(self, token):\n self.clear_cookie('auth_provider', domain=self.settings['cookie_domain'])\n\n if not token:\n return self.json({\n 'error': 'No token!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n filename = '%s.authtoken' % token\n tmp_file = self.get_tmp_file(filename=filename)\n\n if not tmp_file:\n return self.json({\n 'error': 'Invalid token!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n tmp_file_json = json.loads(tmp_file.get('file', ''))\n\n tmp_file_json['user'] = self.current_user\n\n del tmp_file_json['user']['access_token']\n del tmp_file_json['user']['api_key']\n\n tmp_filename = '%s.usertoken' % token\n tmp_file = json.dumps(tmp_file_json)\n\n self.set_tmp_file(filename=tmp_filename, content=tmp_file)\n\n if tmp_file_json.get('redirect_url', None):\n return self.redirect(tmp_file_json.get('redirect_url'))\n\n self.json({\n 'result': tmp_file_json,\n 'time': round(self.request.request_time(), 3),\n })", "metadata": "root.API2UserAuthToken.get", "header": "['class', 'API2UserAuthToken', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___EOS___']", "index": 1086 }, { "content": " @web.removeslash\n def post(self, token):\n if not token:\n return self.json({\n 'error': 'No token!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n filename = '%s.usertoken' % token\n tmp_file = self.get_tmp_file(filename=filename)\n\n if not tmp_file:\n return self.json({\n 'error': 'Invalid token!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n tmp_file_json = json.loads(tmp_file.get('file', ''))\n\n state = self.get_argument('state', default=None, strip=True)\n if not state:\n return self.json({\n 'error': 'State parameter must be set!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n if state != tmp_file_json.get('state', None):\n return self.json({\n 'error': 'Invalid state!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n\n self.json({\n 'result': tmp_file_json,\n 'time': round(self.request.request_time(), 3),\n })", "metadata": "root.API2UserAuthToken.post", "header": "['class', 'API2UserAuthToken', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___EOS___']", "index": 1127 }, { "content": "class API2History(myRequestHandler, Entity2):", "metadata": "root.API2History", "header": "['module', '___EOS___']", "index": 1168 }, { "content": " @web.removeslash\n @web.authenticated\n def get(self):\n\n limit = self.get_argument('limit', default=10, strip=True)\n if limit > 50:\n limit = 50\n # logging.debug(timestamp)\n timestamp = self.get_argument('timestamp', default=None, strip=True)\n\n if limit == '':\n limit = 10\n\n timeframe = self.get_history_timeframe(limit=limit, timestamp=timestamp)\n events = self.get_history_events(timeframe)\n # logging.debug(events)\n\n self.json({\n 'result': events,\n 'time': round(self.request.request_time(), 3),\n 'count': len(events['events']),\n })", "metadata": "root.API2History.get", "header": "['class', 'API2History', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___EOS___']", "index": 1169 }, { "content": "class API2Changed(myRequestHandler, Entity2):", "metadata": "root.API2Changed", "header": "['module', '___EOS___']", "index": 1195 }, { "content": " @web.removeslash\n @web.authenticated\n def get(self):\n\n timestamp = self.get_argument('timestamp', default=None, strip=True)\n definition = self.get_argument('definition', default=None, strip=True)\n\n try:\n limit = int(self.get_argument('limit', default=50, strip=True))\n except Exception, e:\n return self.json({\n 'error': 'Limit must a number!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n if limit > 500:\n return self.json({\n 'error': 'Limit must be less than 500!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n changed = self.get_recently_changed(timestamp=timestamp, definition=definition, limit=limit)\n\n self.json({\n 'result': changed,\n 'time': round(self.request.request_time(), 3),\n 'count': len(changed),\n })", "metadata": "root.API2Changed.get", "header": "['class', 'API2Changed', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___EOS___']", "index": 1196 }, { "content": "class API2EntityParents(myRequestHandler, Entity2):", "metadata": "root.API2EntityParents", "header": "['module', '___EOS___']", "index": 1228 }, { "content": " @web.removeslash\n @web.authenticated\n def get(self, entity_id=None):\n if not entity_id:\n return self.json({\n 'error': 'No entity ID!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n try:\n id = int(entity_id)\n except Exception, e:\n return self.json({\n 'error': 'Id has to be a number!',\n 'time': round(self.request.request_time(), 3),\n }, 400)\n\n parents = self.get_parents(id=id)\n\n return self.json({\n 'result': parents,\n 'time': round(self.request.request_time(), 3),\n })", "metadata": "root.API2EntityParents.get", "header": "['class', 'API2EntityParents', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___EOS___']", "index": 1229 }, { "content": "class API2Ping(myRequestHandler):\n #\n # just pong\n #", "metadata": "root.API2Ping", "header": "['module', '___EOS___']", "index": 1256 }, { "content": " def get(self):\n self.json({\n 'result': 'pong',\n 'time': round(self.request.request_time(), 3),\n })", "metadata": "root.API2Ping.get", "header": "['class', 'API2Ping', '(', 'myRequestHandler', ')', ':', '___NEWLINE___', '#', '___NL___', '# just pong', '___NL___', '#', '___NL___', '___EOS___']", "index": 1260 }, { "content": "class API2NotFound(myRequestHandler, Entity2):\n #\n # Nice error if API method not found\n #\n\n\n", "metadata": "root.API2NotFound", "header": "['module', '___EOS___']", "index": 1269 }, { "content": " def get(self, url):\n self.json({\n 'error': '\\'%s\\' not found' % url,\n 'time': round(self.request.request_time(), 3),\n }, 404)", "metadata": "root.API2NotFound.get", "header": "['class', 'API2NotFound', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___NEWLINE___', '#', '___NL___', '# Nice error if API method not found', '___NL___', '#', '___NL___', '___EOS___']", "index": 1273 }, { "content": " def put(self, url):\n self.get(url)", "metadata": "root.API2NotFound.put", "header": "['class', 'API2NotFound', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___NEWLINE___', '#', '___NL___', '# Nice error if API method not found', '___NL___', '#', '___NL___', '___EOS___']", "index": 1279 }, { "content": " def post(self, url):\n self.get(url)", "metadata": "root.API2NotFound.post", "header": "['class', 'API2NotFound', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___NEWLINE___', '#', '___NL___', '# Nice error if API method not found', '___NL___', '#', '___NL___', '___EOS___']", "index": 1282 }, { "content": " def delete(self, url):\n self.get(url)", "metadata": "root.API2NotFound.delete", "header": "['class', 'API2NotFound', '(', 'myRequestHandler', ',', 'Entity2', ')', ':', '___NEWLINE___', '#', '___NL___', '# Nice error if API method not found', '___NL___', '#', '___NL___', '___EOS___']", "index": 1285 } ]
[ { "span": "import logging", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 14 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "hmac_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "logging_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "mimetypes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "urllib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "cgi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "hashlib_", "import_", "sha1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "operator_", "import_", "itemgetter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "tornado_", "import_", "gen_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "tornado_", "import_", "httpc", "lient_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "boto_", "._", "s3_", "._", "connection_", "import_", "S", "3", "Connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "boto_", "._", "s3_", "._", "key_", "import_", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "main_", "._", "helper_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "main_", "._", "db_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "main_", "._", "db", "2_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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EWLINE\\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\\uDEDENT\\u\\u\\u_", "handlers_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "entity", "'_", ",_", "API", "2E", "nti", "ty", "List_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "entity", "-(", ".*)", "/", "child", "s", "'_", ",_", "API", "2E", "nti", "ty", "Chil", "ds_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "entity", "-(", ".*)", "/", "referral", "s", "'_", ",_", "API", "2E", "nti", "ty", "Refer", "ral", "s_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "entity", "-(", ".*)", "/", "pic", "ture", "'_", ",_", "API", "2E", "nti", "ty", "Picture", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "entity", "-(", ".*)", "/", "rights", "'_", ",_", "API", "2E", "nti", "ty", "Rig", "hts", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "entity", "-(", ".*)", "/", "share", "'_", ",_", "API", "2E", "nti", "ty", "Share", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "entity", "-(", ".*)", "/", "parents", "'_", ",_", "API", "2E", "nti", "ty", "Parent", "s_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "entity", "-(", ".*)", "'_", ",_", "API", "2E", "nti", "ty_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "file", "'_", ",_", "API", "2", "File", "Upload_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "file", "/", "s3", "'_", ",_", "API", "2", "Ama", "zon", "File", "Upload_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "file", "/", "url", "'_", ",_", "API", "2", "Ur", "l", "File", "Upload_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "file", "-(", ".*)", "'_", ",_", "API", "2", "File_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "definit", "ion", "'_", ",_", "API", "2", "Definit", "ion", "List_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "definit", "ion", "-(", ".*)", "'_", ",_", "API", "2", "Definition_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "cmd", "i", "-", "xml", "/(.", "*)'_", ",_", "API", "2", "Cmd", "i", "Xml_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "email", "'_", ",_", "API", "2E", "mail_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "user", "/", "auth", "'_", ",_", "API", "2", "User", "Auth_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "user", "/", "auth", "/(.", "*)", "/(.", "*)'_", ",_", "API", "2", "User", "Auth", "Token", "Provider_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "user", "/", "auth", "/(.", "*)'_", ",_", "API", "2", "User", "Auth", "Token_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "histo", "ry", "'_", ",_", "API", "2", "History_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "change", "d", "'_", ",_", "API", "2", "Changed_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "tag", "cloud", "'_", ",_", "API", "2", "Ta", "g", "Cloud_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "user", "'_", ",_", "API", "2", "User_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "/", "ping", "'_", ",_", "API", "2", "Ping", "_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "r", "'/", "api", "2", "(.*)", "'_", ",_", "API", "2", "Not", "Found_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "API", "2", "Ta", "g", "Cloud_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "Ta", "g", "Cloud_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "entity", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "\\u", "result_", "=_", "self_", "._", "get", "\\u", "tag", "\\u", "cloud_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "definition_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "definit", "ion", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "limit", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "db", "\\u", "result_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "count", "'_", ":_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tags", "'_", ":_", "[_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Count", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Ta", "g", "'_", ":_", "'(", "><", " ", "V", " ", "><", ")'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "n", "Log", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Log", "'_", ":_", "1_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "n", "Count", "'_", ":_", "1_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "range", "'_", ":_", "{_", "'", "min", "'_", ":_", "1_", ",_", "'", "max", "'_", ":_", "1_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "log", "Range", "'_", ":_", "{_", "'", "min", "'_", ":_", "1_", ",_", "'", "max", "'_", ":_", "1_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\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_", "seq", "\\u", "count_", "=_", "[_", "x_", "[_", "'", "Count", "'_", "]_", "for_", "x_", "in_", "db", "\\u", "result_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "seq", "\\u", "log_", "=_", "[_", "x_", "[_", "'", "Log", "'_", "]_", "for_", "x_", "in_", "db", "\\u", "result_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "cnt_", "=_", "min_", "(_", "seq", "\\u", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "cnt_", "=_", "max_", "(_", "seq", "\\u", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "min", "\\u", "log_", "=_", "min_", "(_", "seq", "\\u", "log_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "max", "\\u", "log_", "=_", "max_", "(_", "seq", "\\u", "log_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "row_", "in_", "db", "\\u", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "row_", "[_", "'", "n", "Count", "'_", "]_", "=_", "1.0_", "*_", "(_", "row_", "[_", "'", "Count", "'_", "]_", "-_", "min", "\\u", "cnt_", ")_", "/_", "(_", "max", "\\u", "cnt_", "-_", "min", "\\u", "cnt_", ")_", "if_", "(_", "max", "\\u", "cnt_", ">_", "min", "\\u", "cnt_", ")_", "else_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "row_", "[_", "'", "n", "Log", "'_", "]_", "=_", "1.0_", "*_", "(_", "row_", "[_", "'", "Log", "'_", "]_", "-_", "min", "\\u", "log_", ")_", "/_", "(_", "max", "\\u", "log_", "-_", "min", "\\u", "log_", ")_", "if_", "(_", "max", "\\u", "log_", ">_", "min", "\\u", "log_", ")_", "else_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "count", "'_", ":_", "len_", "(_", "db", "\\u", "result_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "tags", "'_", ":_", "db", "\\u", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "range", "'_", ":_", "{_", "'", "min", "'_", ":_", "min", "\\u", "cnt_", ",_", "'", "max", "'_", ":_", "max", "\\u", "cnt_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "log", "Range", "'_", ":_", "{_", "'", "min", "'_", ":_", "min", "\\u", "log_", ",_", "'", "max", "'_", ":_", "max", "\\u", "log_", "}_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2E", "nti", "ty", "List_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2E", "nti", "ty", "List_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "entity", " ", "list_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "db", "\\u", "result_", "=_", "self_", "._", "get", "\\u", "entit", "ies", "\\u", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "definition_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "definit", "ion", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "query", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "limit", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "page_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "page", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e_", "in_", "db", "\\u", "result_", "._", "get_", "(_", "'", "entit", "ies", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "'", "definit", "ion", "'_", ",_", "{_", "}_", ")_", "[_", "'", "keyn", "ame", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "'", "definit", "ion", "'_", ",_", "{_", "}_", ")_", "[_", "'", "label", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "label", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "label", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "'", "definit", "ion", "'_", ",_", "{_", "}_", ")_", "[_", "'", "label", "\\u", "plural", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "label", "\\u", "plural", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "label", "\\u", "plural", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "'", "definit", "ion", "'_", ",_", "{_", "}_", ")_", "[_", "'", "table", "\\u", "header", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "display", "table", "header", "'_", ")_", "._", "split_", "(_", "'|'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "display", "table", "header", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "id", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "sort", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "sort", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "sort", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "'", "change", "d", "'_", ",_", "{_", "}_", ")_", "[_", "'", "dt", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "change", "d", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "change", "d", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "'", "change", "d", "'_", ",_", "{_", "}_", ")_", "[_", "'", "ts", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "change", "d\\u", "ts", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "change", "d\\u", "ts", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "name", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "displayname", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "displayname", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "info", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "display", "info", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "display", "info", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "table", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "display", "table", "'_", ")_", "._", "split_", "(_", "'|'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "display", "table", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "sorted_", "(_", "result_", "._", "values_", "(_", ")_", ",_", "key_", "=_", "itemgetter_", "(_", "'", "sort", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "count", "'_", ":_", "db", "\\u", "result_", "._", "get_", "(_", "'", "count", "'_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2", "Cmd", "i", "Xml_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "Cmd", "i", "Xml_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "entity", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "entity", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "entity", " ", "ID", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "entity_", "=_", "self_", "._", "get", "\\u", "entities_", "(_", "entity", "\\u", "id_", "=_", "entity", "\\u", "id_", ",_", "limit_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "entity_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Entit", "y", " ", "with", " ", "give", "n", " ", "ID", " ", "is", " ", "not", " ", "found", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "entity_", "[_", "'", "definit", "ion", "'_", "]_", "=_", "{_", "'", "keyn", "ame", "'_", ":_", "entity_", "[_", "'", "definit", "ion", "\\u", "keyn", "ame", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "xml_", "=_", "\"\"\"", "<", "?", "xml", " ", "version", "=\"", "1.0", "\"", " ", "encoding", "=\"", "UT", "F", "-", "8", "\"?", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "CMD", " ", "xml", "ns", "=\"", "http", "://", "www", ".", "clari", "n", ".", "eu", "/", "cmd", "/\"", "\\", "10", ";", " ", " ", " ", " ", " ", "xml", "ns", ":", "xsi", "=\"", "http", "://", "www", ".", "w3", ".", "org", "/", "200", "1", "/", "XML", "Schema", "-", "instance", "\"", "\\", "10", ";", " ", " ", " ", " ", " ", "CMD", "Version", "=\"", "1.1", "\"", "\\", "10", ";", " ", " ", " ", " ", " ", "xsi", ":", "schema", "Locat", "ion", "=\"", "%", "(", "XSD", ")", "s", "\">", "\\", "10", ";", " ", " ", " ", " ", "<", "Head", "er", "><", "/", "Head", "er", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "Reso", "urc", "es", ">", "\\", "10", ";", " ", " ", "<", "Reso", "urc", "e", "Pro", "xy", "List", "><", "/", "Reso", "urc", "e", "Pro", "xy", "List", ">", "\\", "10", ";", " ", " ", "<", "Journ", "al", "File", "Pro", "xy", "List", "><", "/", "Journ", "al", "File", "Pro", "xy", "List", ">", "\\", "10", ";", " ", " ", "<", "Reso", "urc", "e", "Relation", "List", "><", "/", "Reso", "urc", "e", "Relation", "List", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "Reso", "urc", "es", ">", "\\", "10", ";", " ", " ", " ", " ", "<", "Compo", "nent", "s", ">", "\\", "10", ";", " ", " ", "<", "%", "(", "Compo", "nent", ")", "s", ">", "\\", "10", ";", " ", " ", "<", "General", "Info", ">", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "<", "Reso", "urc", "e", "Name", " ", "xml", ":", "lang", "=\"", "en", "\">", "%", "(", "Reso", "urc", "e", "Name", ")", "s", "</", "Reso", "urc", "e", "Name", ">", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "<", "Version", " ", "xml", ":", "lang", "=\"", "en", "\">", "%", "(", "Version", ")", "s", "</", "Version", ">", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "<", "Las", "t", "Update", ">", "%", "(", "Las", "t", "Update", ")", "s", "</", "Las", "t", "Update", ">", "\\", "10", ";", " ", " ", " ", " ", " ", " ", "<", "Legal", "Owne", "r", " ", "xml", ":", "lang", "=\"", "en", "\">", "%", "(", "Legal", "Owne", "r", ")", "s", "</", "Legal", "Owne", "r", ">", "\\", "10", ";", " ", " ", "</", "General", "Info", ">", "\\", "10", ";", " ", " ", "</", "%", "(", "Compo", "nent", ")", "s", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "Compo", "nent", "s", ">", "\\", "10", ";", " ", " ", " ", " ", "</", "CMD", ">\"\"\"_", "%_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "XSD", "'_", ":_", "entity_", "[_", "'", "proper", "ties", "'_", "]_", "[_", "'", "XSD", "'_", "]_", "._", "get_", "(_", "'", "values", "'_", ",_", "[_", "{_", "'", "value", "'_", ":_", "''_", "}_", "]_", ")_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Compo", "nent", "'_", ":_", "entity_", "[_", "'", "proper", "ties", "'_", "]_", "[_", "'", "Compo", "nent", "'_", "]_", "._", "get_", "(_", "'", "values", "'_", ",_", "[_", "{_", "'", "value", "'_", ":_", "''_", "}_", "]_", ")_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Reso", "urc", "e", "Name", "'_", ":_", "entity_", "[_", "'", "proper", "ties", "'_", "]_", "[_", "'", "Reso", "urc", "e", "Name", "'_", "]_", "._", "get_", "(_", "'", "values", "'_", ",_", "[_", "{_", "'", "value", "'_", ":_", "''_", "}_", "]_", ")_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Version", "'_", ":_", "entity_", "[_", "'", "proper", "ties", "'_", "]_", "[_", "'", "Version", "'_", "]_", "._", "get_", "(_", "'", "values", "'_", ",_", "[_", "{_", "'", "value", "'_", ":_", "''_", "}_", "]_", ")_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Las", "t", "Update", "'_", ":_", "entity_", "[_", "'", "proper", "ties", "'_", "]_", "[_", "'", "Las", "t", "Update", "'_", "]_", "._", "get_", "(_", "'", "values", "'_", ",_", "[_", "{_", "'", "value", "'_", ":_", "''_", "}_", "]_", ")_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Legal", "Owne", "r", "'_", ":_", "entity_", "[_", "'", "proper", "ties", "'_", "]_", "[_", "'", "Legal", "Owne", "r", "'_", "]_", "._", "get_", "(_", "'", "values", "'_", ",_", "[_", "{_", "'", "value", "'_", ":_", "''_", "}_", "]_", ")_", "[_", "0_", "]_", "[_", "'", "value", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mimetypes_", "._", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mime_", "=_", "mimetypes_", "._", "types", "\\u", "map_", "._", "get_", "(_", "'.", "xml", "'_", ",_", "'", "applica", "tion", "/", "oct", "et", "-", "stream", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "filename_", "=_", "'", "ent", "u", "-", "cmd", "-%", "s", ".", "xml", "'_", "%_", "entity", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "header_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "mime_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "self", ".", "add", "\\u", "header", "('", "Conten", "t", "-", "Dispo", "sition", "',", " ", "'", "attach", "ment", ";", " ", "filename", "=\"", "%", "s", "\"'", " ", "%", " ", "filename", ")_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "write_", "(_", "xml_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "API", "2E", "nti", "ty_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\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_", "API", "2E", "nti", "ty_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "entity", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "entity", " ", "(", "with", " ", "give", "n", " ", "ID", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "entity", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "entity", " ", "ID", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\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 ", " _", "entity_", "=_", "self_", "._", "get", "\\u", "entities_", "(_", "entity", "\\u", "id_", "=_", "entity", "\\u", "id_", ",_", "limit_", "=_", "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 ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Some", "thing", " ", "is", " ", "wrong", " ", "here", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "500_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "entity_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Entit", "y", " ", "with", " ", "give", "n", " ", "ID", " ", "is", " ", "not", " ", "found", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "entity_", "[_", "'", "definit", "ion", "'_", "]_", "=_", "{_", "'", "keyn", "ame", "'_", ":_", "entity_", "[_", "'", "definit", "ion", "\\u", "keyn", "ame", "'_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "entity_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2E", "nti", "ty_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "put_", "(_", "self_", ",_", "entity", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Change", " ", "entity", " ", "(", "with", " ", "give", "n", " ", "ID", ")", " ", "properties_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "current", "\\u", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "For", "bid", "den", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "entity", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "entity", " ", "ID", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "entity", " ", "=", " ", "self", ".", "get", "\\u", "entit", "ies", "(", "entity", "\\u", "id", "=", "entity", "\\u", "id", ",", " ", "limit", "=", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "not", " ", "entity", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "self", ".", "json", "({", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'", "error", "':", " ", "'", "Entit", "y", " ", "with", " ", "give", "n", " ", "ID", " ", "is", " ", "not", " ", "found", "!'", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'", "time", "':", " ", "round", "(", "self", ".", "request", ".", "request", "\\u", "time", "()", ",", " ", "3", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "},", " ", "404", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "properties_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "datapro", "pert", "y_", ",_", "value_", "in_", "self_", "._", "request_", "._", "arguments_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "datapro", "pert", "y_", "in_", "[_", "'", "user", "'_", ",_", "'", "policy", "'_", ",_", "'", "signa", "ture", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'.'_", "in_", "datapro", "pert", "y_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "property", "\\u", "definit", "ion", "\\u", "keyname_", "=_", "datapro", "pert", "y_", "._", "split_", "(_", "'.'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "property", "\\u", "id_", "=_", "datapro", "pert", "y_", "._", "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 ", " _", "property", "\\u", "definit", "ion", "\\u", "keyname_", "=_", "datapro", "pert", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "old", "\\u", "property", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "value_", ")_", "is_", "not_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "[_", "value_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "v_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "property", "\\u", "id_", "=_", "self_", "._", "set\\u", "property_", "(_", "entity", "\\u", "id_", "=_", "entity", "\\u", "id_", ",_", "old", "\\u", "property", "\\u", "id_", "=_", "old", "\\u", "property", "\\u", "id_", ",_", "property", "\\u", "definit", "ion", "\\u", "keyname_", "=_", "property", "\\u", "definit", "ion", "\\u", "keyname_", ",_", "value_", "=_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "property", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "new", "\\u", "properties_", "._", "setdefault_", "(_", "property", "\\u", "definit", "ion", "\\u", "keyname_", ",_", "[_", "]_", ")_", "._", "append_", "(_", "{_", "'", "id", "'_", ":_", "new", "\\u", "property", "\\u", "id_", ",_", "'", "value", "'_", ":_", "v_", "}_", ")_", "\\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_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "entity", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "proper", "ties", "'_", ":_", "new", "\\u", "properties_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "201_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2E", "nti", "ty_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "post_", "(_", "self_", ",_", "entity", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Creat", "e", " ", "new", " ", "child", " ", "entity", " ", "(", "under", " ", "entity", " ", "with", " ", "give", "n", " ", "ID", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "current", "\\u", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "For", "bid", "den", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "entity", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "entity", " ", "ID", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "entity_", "=_", "self_", "._", "get", "\\u", "entities_", "(_", "entity", "\\u", "id_", "=_", "entity", "\\u", "id_", ",_", "limit_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "entity_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Entit", "y", " ", "with", " ", "give", "n", " ", "ID", " ", "is", " ", "not", " ", "found", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "definition_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "definit", "ion", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "definition_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "definit", "ion", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "entity", "\\u", "id_", "=_", "self_", "._", "create", "\\u", "entity_", "(_", "entity", "\\u", "definit", "ion", "\\u", "keyname_", "=_", "definition_", ",_", "parent", "\\u", "entity", "\\u", "id_", "=_", "entity", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "datapro", "pert", "y_", ",_", "value_", "in_", "self_", "._", "request_", "._", "arguments_", "._", "iteritems_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "datapro", "pert", "y_", "in_", "[_", "'", "user", "'_", ",_", "'", "policy", "'_", ",_", "'", "signa", "ture", "'_", ",_", "'", "definit", "ion", "'_", "]_", ":_", "\\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_", "type_", "(_", "value_", ")_", "is_", "not_", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "[_", "value_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "v_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "property", "\\u", "id_", "=_", "self_", "._", "set\\u", "property_", "(_", "entity", "\\u", "id_", "=_", "entity", "\\u", "id_", ",_", "property", "\\u", "definit", "ion", "\\u", "keyname_", "=_", "datapro", "pert", "y_", ",_", "value_", "=_", "v_", ")_", "\\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_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "entity", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "201_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2E", "nti", "ty_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "entity", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "entity", " ", "(", "with", " ", "give", "n", " ", "ID", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "entity", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "entity", " ", "ID", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "self_", "._", "delete", "\\u", "entity_", "(_", "entity", "\\u", "id_", "=_", "entity", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "For", "bid", "den", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "entity", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2E", "nti", "ty", "Chil", "ds_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2E", "nti", "ty", "Chil", "ds_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "entity", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "entity", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "entity", " ", "ID", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db", "\\u", "result_", "=_", "self_", "._", "get", "\\u", "entit", "ies", "\\u", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "parent", "\\u", "entity", "\\u", "id_", "=_", "entity", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "definition_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "definit", "ion", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "query", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "limit", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "page_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "page", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e_", "in_", "db", "\\u", "result_", "._", "get_", "(_", "'", "entit", "ies", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "definit", "ion", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "label", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "label", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "label", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "label", "\\u", "plural", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "label", "\\u", "plural", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "label", "\\u", "plural", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "table", "\\u", "header", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "display", "table", "header", "'_", ")_", "._", "split_", "(_", "'|'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "display", "table", "header", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "'", "entit", "ies", "'_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "id", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "'", "entit", "ies", "'_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "sort", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "sort", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "sort", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "'", "entit", "ies", "'_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "name", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "displayname", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "displayname", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "'", "entit", "ies", "'_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "info", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "display", "info", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "display", "info", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "'", "entit", "ies", "'_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "table", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "display", "table", "'_", ")_", "._", "split_", "(_", "'|'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "display", "table", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "r_", "in_", "result_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "[_", "'", "entit", "ies", "'_", "]_", "=_", "sorted_", "(_", "r_", "._", "get_", "(_", "'", "entit", "ies", "'_", ",_", "{_", "}_", ")_", "._", "values_", "(_", ")_", ",_", "key_", "=_", "itemgetter_", "(_", "'", "sort", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "count", "'_", ":_", "db", "\\u", "result_", "._", "get_", "(_", "'", "count", "'_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2E", "nti", "ty", "Refer", "ral", "s_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2E", "nti", "ty", "Refer", "ral", "s_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "entity", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "entity", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "entity", " ", "ID", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "db", "\\u", "result_", "=_", "self_", "._", "get", "\\u", "entit", "ies", "\\u", "info_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "referred", "\\u", "to", "\\u", "entity", "\\u", "id_", "=_", "entity", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "definition_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "definit", "ion", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "query_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "query", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "limit_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "limit", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "page_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "page", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "e_", "in_", "db", "\\u", "result_", "._", "get_", "(_", "'", "entit", "ies", "'_", ",_", "[_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "definit", "ion", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "label", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "label", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "label", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "label", "\\u", "plural", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "label", "\\u", "plural", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "label", "\\u", "plural", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "table", "\\u", "header", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "display", "table", "header", "'_", ")_", "._", "split_", "(_", "'|'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "display", "table", "header", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "'", "entit", "ies", "'_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "id", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "'", "entit", "ies", "'_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "sort", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "sort", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "sort", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "'", "entit", "ies", "'_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "name", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "displayname", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "displayname", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "'", "entit", "ies", "'_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "info", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "display", "info", "'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "display", "info", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "definit", "ion", "'_", ")_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "'", "entit", "ies", "'_", ",_", "{_", "}_", ")_", "._", "setdefault_", "(_", "e_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "{_", "}_", ")_", "[_", "'", "table", "'_", "]_", "=_", "e_", "._", "get_", "(_", "'", "display", "table", "'_", ")_", "._", "split_", "(_", "'|'_", ")_", "if_", "e_", "._", "get_", "(_", "'", "display", "table", "'_", ")_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "r_", "in_", "result_", "._", "values_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "[_", "'", "entit", "ies", "'_", "]_", "=_", "sorted_", "(_", "r_", "._", "get_", "(_", "'", "entit", "ies", "'_", ",_", "{_", "}_", ")_", "._", "values_", "(_", ")_", ",_", "key_", "=_", "itemgetter_", "(_", "'", "sort", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "count", "'_", ":_", "db", "\\u", "result_", "._", "get_", "(_", "'", "count", "'_", ",_", "0_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2", "File_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "File_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "file", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "file", " ", "(", "with", " ", "give", "n", " ", "ID", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "file", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "file", " ", "ID", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "files_", "=_", "self_", "._", "get", "\\u", "file_", "(_", "file", "\\u", "id_", "=_", "file", "\\u", "id_", ",_", "shar", "ing", "\\u", "key_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "key", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "files_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "File", " ", "with", " ", "give", "n", " ", "ID", " ", "is", " ", "not", " ", "found", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "files_", "[_", "0_", "]_", "._", "get_", "(_", "'", "url", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "redirect_", "(_", "files_", "[_", "0_", "]_", "._", "get_", "(_", "'", "url", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "files_", "[_", "0_", "]_", "._", "get_", "(_", "'", "s3", "key", "'_", ")_", ":_", "\\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 ", " _", "AW", "S", "\\u", "BUCKET", "_", "=_", "self_", "._", "app", "\\u", "settings_", "(_", "'", "auth", "-", "s3", "'_", ",_", "'\\\\", "n", "'_", ",_", "True_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AW", "S", "\\u", "ACCESS", "\\u", "KEY_", "=_", "self_", "._", "app", "\\u", "settings_", "(_", "'", "auth", "-", "s3", "'_", ",_", "'\\\\", "n", "'_", ",_", "True_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AW", "S", "\\u", "SEC", "RET", "\\u", "KEY_", "=_", "self_", "._", "app", "\\u", "settings_", "(_", "'", "auth", "-", "s3", "'_", ",_", "'\\\\", "n", "'_", ",_", "True_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "[_", "2_", "]_", "\\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_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Ama", "zon", " ", "S", "3", " ", "bucket", ",", " ", "key", " ", "or", " ", "secret", " ", "not", " ", "set", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s3", "\\u", "conn_", "=_", "S", "3", "Connection_", "(_", "AW", "S", "\\u", "ACCESS", "\\u", "KEY_", ",_", "AW", "S", "\\u", "SEC", "RET", "\\u", "KEY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s3", "\\u", "bucket_", "=_", "s3", "\\u", "conn_", "._", "get", "\\u", "bucket_", "(_", "AW", "S", "\\u", "BUCKET", "_", ",_", "validate_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s3", "\\u", "key_", "=_", "s3", "\\u", "bucket_", "._", "get", "\\u", "key_", "(_", "files_", "[_", "0_", "]_", "._", "get_", "(_", "'", "s3", "key", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "s3", "\\u", "key_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "File", " ", "not", " ", "found", " ", "from", " ", "Ama", "zon", " ", "S", "3", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "s3", "\\u", "url_", "=_", "s3", "\\u", "key_", "._", "generat", "e\\u", "url_", "(_", "expir", "es", "\\u", "in_", "=_", "3600_", ",_", "query", "\\u", "auth_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "redirect_", "(_", "s3", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "files_", "[_", "0_", "]_", "._", "get_", "(_", "'", "file", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "file", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mimetypes_", "._", "init_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "mime_", "=_", "mimetypes_", "._", "types", "\\u", "map_", "._", "get_", "(_", "'.", "%", "s", "'_", "%_", "files_", "[_", "0_", "]_", "._", "get_", "(_", "'", "filename", "'_", ")_", "._", "lower_", "(_", ")_", "._", "split_", "(_", "'.'_", ")_", "[_", "-_", "1_", "]_", ",_", "'", "applica", "tion", "/", "oct", "et", "-", "stream", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "filename_", "=_", "files_", "[_", "0_", "]_", "._", "get_", "(_", "'", "filename", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "\\u", "header_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "mime_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "header_", "(_", "'", "Conten", "t", "-", "Dispo", "sition", "'_", ",_", "'", "inline", ";", " ", "filename", "=\"", "%", "s", "\"'_", "%_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "write_", "(_", "files_", "[_", "0_", "]_", "._", "get_", "(_", "'", "file", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "File_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "delete_", "(_", "self_", ",_", "file", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Delete", " ", "file", " ", "(", "with", " ", "give", "n", " ", "ID", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2", "File", "Upload_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "File", "Upload_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Upload", "/", "create", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "current", "\\u", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "For", "bid", "den", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "request_", "._", "headers_", "._", "get_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "''_", ")_", "._", "startswith_", "(_", "'", "multip", "art", "/", "form", "-", "data", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uploade", "d\\u", "file_", "=_", "self_", "._", "request_", "._", "files_", "._", "get_", "(_", "'", "file", "'_", ",_", "[_", "{_", "}_", "]_", ")_", "[_", "0_", "]_", "._", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "uploade", "d\\u", "file_", "=_", "self_", "._", "request_", "._", "body_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "uploade", "d\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "file", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "request_", "._", "headers_", "._", "get_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "''_", ")_", "._", "startswith_", "(_", "'", "multip", "art", "/", "form", "-", "data", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "file", "\\u", "size_", "=_", "int_", "(_", "self_", "._", "request_", "._", "headers_", "._", "get_", "(_", "'", "Conten", "t", "-", "Length", "'_", ",_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Conten", "t", "-", "Length", " ", "header", " ", "not", " ", "set", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "file", "\\u", "size_", "!=_", "len_", "(_", "uploade", "d\\u", "file_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "File", " ", "not", " ", "complete", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "entity", "\\u", "id_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "entity", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "entity", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "entity", " ", "ID", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "entity", " ", "=", " ", "self", ".", "get", "\\u", "entit", "ies", "(", "entity", "\\u", "id", "=", "entity", "\\u", "id", ",", " ", "limit", "=", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "not", " ", "entity", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "self", ".", "json", "({", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'", "error", "':", " ", "'", "Entit", "y", " ", "with", " ", "give", "n", " ", "ID", " ", "is", " ", "not", " ", "found", "!'", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'", "time", "':", " ", "round", "(", "self", ".", "request", ".", "request", "\\u", "time", "()", ",", " ", "3", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "},", " ", "404", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "property", "\\u", "definit", "ion", "\\u", "keyname_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "property", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "property", "\\u", "definit", "ion", "\\u", "keyname_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "property", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filename_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "filename", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "filename", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "new", "\\u", "property", "\\u", "id_", "=_", "self_", "._", "set\\u", "property_", "(_", "entity", "\\u", "id_", "=_", "entity", "\\u", "id_", ",_", "property", "\\u", "definit", "ion", "\\u", "keyname_", "=_", "property", "\\u", "definit", "ion", "\\u", "keyname_", ",_", "value_", "=_", "{_", "'", "filename", "'_", ":_", "filename_", ",_", "'", "body", "'_", ":_", "uploade", "d\\u", "file_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "property", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "properties_", "=_", "{_", "property", "\\u", "definit", "ion", "\\u", "keyname_", ":_", "[_", "{_", "'", "id", "'_", ":_", "new", "\\u", "property", "\\u", "id_", ",_", "'", "value", "'_", ":_", "filename_", "}_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "properties_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "entity", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "proper", "ties", "'_", ":_", "properties_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2", "Ama", "zon", "File", "Upload_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "Ama", "zon", "File", "Upload_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\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\\uNL\\u\\u\\u_", "#", " ", "Upload", "/", "create", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\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 ", " _", "AW", "S", "\\u", "BUCKET", "_", "=_", "self_", "._", "app", "\\u", "settings_", "(_", "'", "auth", "-", "s3", "'_", ",_", "'\\\\", "n", "'_", ",_", "True_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AW", "S", "\\u", "ACCESS", "\\u", "KEY_", "=_", "self_", "._", "app", "\\u", "settings_", "(_", "'", "auth", "-", "s3", "'_", ",_", "'\\\\", "n", "'_", ",_", "True_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AW", "S", "\\u", "SEC", "RET", "\\u", "KEY_", "=_", "self_", "._", "app", "\\u", "settings_", "(_", "'", "auth", "-", "s3", "'_", ",_", "'\\\\", "n", "'_", ",_", "True_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "[_", "2_", "]_", "\\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_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Ama", "zon", " ", "S", "3", " ", "bucket", ",", " ", "key", " ", "or", " ", "secret", " ", "not", " ", "set", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "self_", "._", "current", "\\u", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "For", "bid", "den", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "entity", "\\u", "id_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "entity", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "entity", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "entity", " ", "ID", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "entity", " ", "=", " ", "self", ".", "get", "\\u", "entit", "ies", "(", "entity", "\\u", "id", "=", "entity", "\\u", "id", ",", " ", "limit", "=", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "not", " ", "entity", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "self", ".", "json", "({", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'", "error", "':", " ", "'", "Entit", "y", " ", "with", " ", "give", "n", " ", "ID", " ", "is", " ", "not", " ", "found", "!'", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'", "time", "':", " ", "round", "(", "self", ".", "request", ".", "request", "\\u", "time", "()", ",", " ", "3", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "},", " ", "404", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "property", "\\u", "definit", "ion", "\\u", "keyname_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "property", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "property", "\\u", "definit", "ion", "\\u", "keyname_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "property", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filename_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "filename", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "filename", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filetype_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "filet", "ype", "'_", ",_", "None_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "filetype_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filetype_", "=_", "'", "binar", "y", "/", "oct", "et", "-", "stream", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filesize_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "files", "ize", "'_", ",_", "0_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "int_", "(_", "filesize_", ")_", ">_", "429496729", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Max", " ", "file", " ", "size", " ", "is", " ", "429496729", "5", " ", "bytes", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key_", "=_", "'%", "s", "\\u", "2", "/", "%", "s", "'_", "%_", "(_", "self_", "._", "app", "\\u", "settings_", "(_", "'", "databa", "se", "-", "name", "'_", ")_", ",_", "entity", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "property", "\\u", "id_", "=_", "self_", "._", "set\\u", "property_", "(_", "entity", "\\u", "id_", "=_", "entity", "\\u", "id_", ",_", "property", "\\u", "definit", "ion", "\\u", "keyname_", "=_", "property", "\\u", "definit", "ion", "\\u", "keyname_", ",_", "value_", "=_", "{_", "'", "filename", "'_", ":_", "filename_", ",_", "'", "s3", "key", "'_", ":_", "key_", ",_", "'", "files", "ize", "'_", ":_", "filesize_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "property", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "properties_", "=_", "{_", "property", "\\u", "definit", "ion", "\\u", "keyname_", ":_", "[_", "{_", "'", "id", "'_", ":_", "new", "\\u", "property", "\\u", "id_", ",_", "'", "value", "'_", ":_", "filename_", "}_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "properties_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key_", "=_", "'%", "s", "/", "%", "s", "'_", "%_", "(_", "key_", ",_", "new", "\\u", "property", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "policy_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "expir", "ation", "'_", ":_", "(_", "datetime_", "._", "datetime_", "._", "utcnow_", "(_", ")_", "+_", "datetime_", "._", "timedelta_", "(_", "hours_", "=_", "1_", ")_", ")_", "._", "strftime_", "(_", "'%", "Y", "-%", "m", "-%", "d", "T", "%", "H", ":", "%", "M", ":", "%", "SZ", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "condition", "s", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "bucket", "'_", ":_", "AW", "S", "\\u", "BUCKET", "_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "starts", "-", "with", "'_", ",_", "'$", "key", "'_", ",_", "key_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "acl", "'_", ":_", "'", "private", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "success", "\\u", "action", "\\u", "status", "'_", ":_", "'", "201", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "x", "-", "am", "z", "-", "server", "-", "side", "-", "encrypt", "ion", "'_", ":_", "'", "AE", "S2", "56", "'_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "Conten", "t", "-", "Type", "'_", ":_", "filetype_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "starts", "-", "with", "'_", ",_", "'$", "Conten", "t", "-", "Dispo", "sition", "'_", ",_", "'", "inline", ";", " ", "filename", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "encode", "d\\u", "policy_", "=_", "json_", "._", "dumps_", "(_", "policy_", ")_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", "._", "encode_", "(_", "'", "base64", "'_", ")_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "signature_", "=_", "hmac_", "._", "new_", "(_", "str_", "(_", "AW", "S", "\\u", "SEC", "RET", "\\u", "KEY_", ")_", ",_", "str_", "(_", "encode", "d\\u", "policy_", ")_", ",_", "sha1_", ")_", "._", "digest_", "(_", ")_", "._", "encode_", "(_", "'", "base64", "'_", ")_", "._", "replace_", "(_", "'\\\\", "n", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "entity", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "proper", "ties", "'_", ":_", "properties_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "s3", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "url", "'_", ":_", "'", "https", "://", "%", "s", ".", "s3", ".", "amaz", "ona", "ws", ".", "com", "/'_", "%_", "AW", "S", "\\u", "BUCKET", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "data", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "key", "'_", ":_", "key_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "acl", "'_", ":_", "'", "private", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "success", "\\u", "action", "\\u", "status", "'_", ":_", "'", "201", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "x", "-", "am", "z", "-", "server", "-", "side", "-", "encrypt", "ion", "'_", ":_", "'", "AE", "S2", "56", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "AW", "SA", "ccess", "Key", "Id", "'_", ":_", "AW", "S", "\\u", "ACCESS", "\\u", "KEY_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "policy", "'_", ":_", "encode", "d\\u", "policy_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "signa", "ture", "'_", ":_", "signature_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Conten", "t", "-", "Type", "'_", ":_", "filetype_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "Conten", "t", "-", "Dispo", "sition", "'_", ":_", "'", "inline", ";", " ", "filename", "*=", "UT", "F", "-", "8", "\\\\'\\\\", "'%", "s", "'_", "%_", "urllib_", "._", "quote_", "(_", "filename_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2", "Ur", "l", "File", "Upload_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "Ur", "l", "File", "Upload_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "gen_", "._", "coroutine_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Upload", "/", "create", " ", "file_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\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 ", " _", "AW", "S", "\\u", "BUCKET", "_", "=_", "self_", "._", "app", "\\u", "settings_", "(_", "'", "auth", "-", "s3", "'_", ",_", "'\\\\", "n", "'_", ",_", "True_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AW", "S", "\\u", "ACCESS", "\\u", "KEY_", "=_", "self_", "._", "app", "\\u", "settings_", "(_", "'", "auth", "-", "s3", "'_", ",_", "'\\\\", "n", "'_", ",_", "True_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "AW", "S", "\\u", "SEC", "RET", "\\u", "KEY_", "=_", "self_", "._", "app", "\\u", "settings_", "(_", "'", "auth", "-", "s3", "'_", ",_", "'\\\\", "n", "'_", ",_", "True_", ")_", "._", "split_", "(_", "'\\\\", "n", "'_", ")_", "[_", "2_", "]_", "\\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_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Ama", "zon", " ", "S", "3", " ", "bucket", ",", " ", "key", " ", "or", " ", "secret", " ", "not", " ", "set", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\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_", "self_", "._", "current", "\\u", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "For", "bid", "den", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "403_", ")_", "\\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_", "entity", "\\u", "id_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "entity", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "entity", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "entity", " ", "ID", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "entity", " ", "=", " ", "self", ".", "get", "\\u", "entit", "ies", "(", "entity", "\\u", "id", "=", "entity", "\\u", "id", ",", " ", "limit", "=", "1", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "not", " ", "entity", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "self", ".", "json", "({", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'", "error", "':", " ", "'", "Entit", "y", " ", "with", " ", "give", "n", " ", "ID", " ", "is", " ", "not", " ", "found", "!'", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "'", "time", "':", " ", "round", "(", "self", ".", "request", ".", "request", "\\u", "time", "()", ",", " ", "3", "),", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "},", " ", "404", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "property", "\\u", "definit", "ion", "\\u", "keyname_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "property", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "property", "\\u", "definit", "ion", "\\u", "keyname_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "property", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\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_", "url_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "url", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "url_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "url", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\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_", "filename_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "filename", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "download_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "download", "'_", ",_", "default_", "=_", "'", "fal", "se", "'_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "download_", "._", "lower_", "(_", ")_", "!=_", "'", "true", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "property", "\\u", "id_", "=_", "self_", "._", "set\\u", "property_", "(_", "entity", "\\u", "id_", "=_", "entity", "\\u", "id_", ",_", "property", "\\u", "definit", "ion", "\\u", "keyname_", "=_", "property", "\\u", "definit", "ion", "\\u", "keyname_", ",_", "value_", "=_", "{_", "'", "filename", "'_", ":_", "filename_", ",_", "'", "url", "'_", ":_", "url_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "new", "\\u", "property", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "properties_", "=_", "{_", "property", "\\u", "definit", "ion", "\\u", "keyname_", ":_", "[_", "{_", "'", "id", "'_", ":_", "new", "\\u", "property", "\\u", "id_", ",_", "'", "value", "'_", ":_", "filename_", "}_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "properties_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "entity", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "proper", "ties", "'_", ":_", "properties_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\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_", "http", "\\u", "client_", "=_", "httpc", "lient_", "._", "Async", "HTTP", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "response_", "=_", "yield_", "http", "\\u", "client_", "._", "fetch_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "response_", "._", "headers_", "._", "get_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filetype_", "=_", "response_", "._", "headers_", "._", "get_", "(_", "'", "Conten", "t", "-", "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 ", " _", "filetype_", "=_", "'", "binar", "y", "/", "oct", "et", "-", "stream", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "filename_", "and_", "response_", "._", "headers_", "._", "get_", "(_", "'", "Conten", "t", "-", "Dispo", "sition", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename", "\\u", "value_", ",_", "filename", "\\u", "params_", "=_", "cgi_", "._", "parse", "\\u", "header_", "(_", "response_", "._", "headers_", "._", "get_", "(_", "'", "Conten", "t", "-", "Dispo", "sition", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "filename", "\\u", "params_", "._", "get_", "(_", "'", "filename", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "filename", "\\u", "params_", "._", "get_", "(_", "'", "filename", "'_", ")_", "._", "decode_", "(_", "'", "utf", "-", "8", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "filename", "\\u", "params_", "._", "get_", "(_", "'", "filename", "*'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "urllib_", "._", "unquote_", "(_", "filename", "\\u", "params_", "._", "get_", "(_", "'", "filename", "*'_", ")_", "._", "replace_", "(_", "'", "UT", "F", "-", "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_", "if_", "not_", "filename_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "filename_", "=_", "url_", "._", "split_", "(_", "'#'_", ")_", "[_", "0_", "]_", "._", "split_", "(_", "'?'_", ")_", "[_", "0_", "]_", "._", "split_", "(_", "'/'_", ")_", "[_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filesize_", "=_", "len_", "(_", "response_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "int_", "(_", "filesize_", ")_", ">_", "429496729", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Max", " ", "file", " ", "size", " ", "is", " ", "429496729", "5", " ", "bytes", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\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_", "key_", "=_", "'%", "s", "/", "%", "s", "'_", "%_", "(_", "self_", "._", "app", "\\u", "settings_", "(_", "'", "databa", "se", "-", "name", "'_", ")_", ",_", "entity", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "new", "\\u", "property", "\\u", "id_", "=_", "self_", "._", "set\\u", "property_", "(_", "entity", "\\u", "id_", "=_", "entity", "\\u", "id_", ",_", "property", "\\u", "definit", "ion", "\\u", "keyname_", "=_", "property", "\\u", "definit", "ion", "\\u", "keyname_", ",_", "value_", "=_", "{_", "'", "filename", "'_", ":_", "filename_", ",_", "'", "s3", "key", "'_", ":_", "key_", ",_", "'", "files", "ize", "'_", ":_", "filesize_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "new", "\\u", "property", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "properties_", "=_", "{_", "property", "\\u", "definit", "ion", "\\u", "keyname_", ":_", "[_", "{_", "'", "id", "'_", ":_", "new", "\\u", "property", "\\u", "id_", ",_", "'", "value", "'_", ":_", "filename_", "}_", "]_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "properties_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "key_", "=_", "'%", "s", "/", "%", "s", "'_", "%_", "(_", "key_", ",_", "new", "\\u", "property", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s3", "\\u", "conn_", "=_", "S", "3", "Connection_", "(_", "AW", "S", "\\u", "ACCESS", "\\u", "KEY_", ",_", "AW", "S", "\\u", "SEC", "RET", "\\u", "KEY_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s3", "\\u", "bucket_", "=_", "s3", "\\u", "conn_", "._", "get", "\\u", "bucket_", "(_", "AW", "S", "\\u", "BUCKET", "_", ",_", "validate_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s3", "\\u", "file_", "=_", "Key_", "(_", "s3", "\\u", "bucket_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "s3", "\\u", "file_", "._", "key_", "=_", "key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s3", "\\u", "file_", "._", "content", "\\u", "type_", "=_", "filetype_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s3", "\\u", "file_", "._", "set\\u", "metadata_", "(_", "'", "Conten", "t", "-", "Dispo", "sition", "'_", ",_", "'", "inline", ";", " ", "filename", "*=", "UT", "F", "-", "8", "\\\\'\\\\", "'%", "s", "'_", "%_", "urllib_", "._", "quote_", "(_", "filename_", "._", "encode_", "(_", "'", "utf", "-", "8", "'_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s3", "\\u", "file_", "._", "set\\u", "content", "s", "\\u", "from", "\\u", "string_", "(_", "response_", "._", "body_", ",_", "encrypt", "\\u", "key_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "id", "'_", ":_", "entity", "\\u", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "proper", "ties", "'_", ":_", "properties_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2E", "nti", "ty", "Picture", "_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2E", "nti", "ty", "Picture", "_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "entity", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "picture_", "=_", "self_", "._", "get", "\\u", "entity", "\\u", "picture_", "(_", "entity", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "picture_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "redirect_", "(_", "'", "https", "://", "secure", ".", "gravatar", ".", "com", "/", "avat", "ar", "/", "%", "s", "?", "d", "=", "identi", "con", "&", "s", "=", "150", "'_", "%_", "(_", "hashlib_", "._", "md5_", "(_", "str_", "(_", "entity", "\\u", "id_", ")_", ")_", "._", "hexdigest_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "picture_", "._", "get_", "(_", "'", "pic", "ture", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "header_", "(_", "'", "Conten", "t", "-", "Type", "'_", ",_", "'", "image", "/", "jpeg", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "write_", "(_", "picture_", "._", "get_", "(_", "'", "pic", "ture", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "picture_", "._", "get_", "(_", "'", "definit", "ion", "'_", ",_", "''_", ")_", "==_", "'", "person", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "redirect_", "(_", "'", "https", "://", "secure", ".", "gravatar", ".", "com", "/", "avat", "ar", "/", "%", "s", "?", "d", "=", "wav", "ata", "r", "&", "s", "=", "150", "'_", "%_", "(_", "hashlib_", "._", "md5_", "(_", "str_", "(_", "entity", "\\u", "id_", ")_", ")_", "._", "hexdigest_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "picture_", "._", "get_", "(_", "'", "definit", "ion", "'_", ",_", "''_", ")_", "in_", "[_", "'", "audio", "video", "'_", ",_", "'", "book", "'_", ",_", "'", "method", "ical", "'_", ",_", "'", "periodic", "al", "'_", ",_", "'", "textb", "ook", "'_", ",_", "'", "workbook", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "redirect_", "(_", "'/", "photo", "-", "by", "-", "isbn", "?", "entity", "=", "%", "s", "'_", "%_", "entity", "\\u", "id_", ")_", "\\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 ", " _", "return_", "self_", "._", "redirect_", "(_", "'", "https", "://", "secure", ".", "gravatar", ".", "com", "/", "avat", "ar", "/", "%", "s", "?", "d", "=", "identi", "con", "&", "s", "=", "150", "'_", "%_", "(_", "hashlib_", "._", "md5_", "(_", "str_", "(_", "entity", "\\u", "id_", ")_", ")_", "._", "hexdigest_", "(_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2E", "nti", "ty", "Rig", "hts", "_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2E", "nti", "ty", "Rig", "hts", "_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "post_", "(_", "self_", ",_", "entity", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "current", "\\u", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "For", "bid", "den", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "entity", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "entity", " ", "ID", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "right_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "right", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "right_", "and_", "right_", "not_", "in_", "[_", "'", "viewer", "'_", ",_", "'", "expander", "'_", ",_", "'", "editor", "'_", ",_", "'", "owner", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Rig", "ht", " ", "type", " ", "must", " ", "be", " ", "set", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "relate", "d\\u", "entity", "\\u", "id_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "entity", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "relate", "d\\u", "entity", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Entit", "y", " ", "ID", " ", "must", " ", "be", " ", "set", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "self_", "._", "set\\u", "entity", "\\u", "right_", "(_", "entity", "\\u", "id_", "=_", "entity", "\\u", "id_", ",_", "relate", "d\\u", "entity", "\\u", "id_", "=_", "relate", "d\\u", "entity", "\\u", "id_", ",_", "right_", "=_", "right_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2E", "nti", "ty", "Share", "_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2E", "nti", "ty", "Share", "_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "post_", "(_", "self_", ",_", "entity", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "current", "\\u", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "For", "bid", "den", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "to_", "=_", "Str", "To", "List_", "(_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "to", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "to_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "To", " ", "address", " ", "must", " ", "be", " ", "set", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "entity", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "entity", " ", "ID", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "entity_", "=_", "self_", "._", "get", "\\u", "entities_", "(_", "entity", "\\u", "id_", "=_", "entity", "\\u", "id_", ",_", "limit_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "entity_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Entit", "y", " ", "with", " ", "give", "n", " ", "ID", " ", "is", " ", "not", " ", "found", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "url_", "=_", "'", "https", "://", "%", "s", "/", "entity", "/", "%", "s", "/", "%", "s", "'_", "%_", "(_", "self_", "._", "request_", "._", "headers_", "._", "get_", "(_", "'", "Host", "'_", ")_", ",_", "entity_", "._", "get_", "(_", "'", "definit", "ion", "\\u", "keyn", "ame", "'_", ",_", "''_", ")_", ",_", "entity_", "._", "get_", "(_", "'", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "message", "'_", ",_", "default_", "=_", "''_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "mail", "\\u", "send_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "to_", "=_", "to_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "subject_", "=_", "entity_", "._", "get_", "(_", "'", "displayname", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "'%", "s", "\\\\", "n", "\\\\", "n", "%", "s", "\\\\", "n", "\\\\", "n", "%", "s", "\\\\", "n", "%", "s", "'_", "%_", "(_", "message_", ",_", "url_", ",_", "self_", "._", "current", "\\u", "user_", "._", "get_", "(_", "'", "name", "'_", ",_", "''_", ")_", ",_", "self_", "._", "current", "\\u", "user_", "._", "get_", "(_", "'", "email", "'_", ",_", "''_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "html_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "=_", "[_", "'", "ent", "u", "'_", ",_", "'", "share", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2E", "mail_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "API", "2E", "mail_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2E", "mail_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\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_", "not_", "self_", "._", "current", "\\u", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "For", "bid", "den", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "403_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "to_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "to", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "to_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "To", " ", "address", " ", "must", " ", "be", " ", "set", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "subject_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "subject", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "subject_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Sub", "ject", " ", "must", " ", "be", " ", "set", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "message_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "message", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "message_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Messag", "e", " ", "must", " ", "be", " ", "set", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "campaign_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "camp", "aig", "n", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "tag", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "self_", "._", "mail", "\\u", "send_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "to_", "=_", "to_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "subject_", "=_", "subject_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", "=_", "message_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "html_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "campaign_", "=_", "campaign_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tag_", "=_", "tag_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "response_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2", "Definit", "ion", "List_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "Definit", "ion", "List_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "menu_", "=_", "self_", "._", "get", "\\u", "menu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "menu_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2", "Definition_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "Definition_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "definit", "ion", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "definit", "ion", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "definit", "ion", " ", "ID", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "definitions_", "=_", "self_", "._", "get", "\\u", "entity", "\\u", "definitions_", "(_", "definit", "ion", "\\u", "id_", "=_", "definit", "ion", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "definitions_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Definit", "ion", " ", "with", " ", "give", "n", " ", "ID", " ", "is", " ", "not", " ", "found", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "definitions_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2", "User_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "User_", "(_", "my", "Request", "Handler_", ",_", "Entity_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "current", "\\u", "user_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "logged", " ", "in", " ", "user", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "person_", "=_", "self_", "._", "get", "\\u", "entities_", "(_", "entity", "\\u", "id_", "=_", "self_", "._", "current", "\\u", "user_", "._", "get_", "(_", "'", "id", "'_", ")_", ",_", "limit_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "result_", "=_", "self_", "._", "current", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "[_", "'", "person", "'_", "]_", "=_", "person_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "result_", "[_", "'", "access", "\\u", "token", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "result_", "[_", "'", "api", "\\u", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "result_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2", "User", "Auth_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "User", "Auth_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "web_", "._", "authenticated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "redirect_", "(_", "'/", "api", "2", "/", "user", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "User", "Auth_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "post_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "state_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "state", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "State", " ", "parameter", " ", "must", " ", "be", " ", "set", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "redirec", "t", "\\u", "url_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "redirec", "t", "\\u", "url", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "provider_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "provide", "r", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "token_", "=_", "hashlib_", "._", "md5_", "(_", "'%", "s", ".", "%", "s", ".", "%", "s", "'_", "%_", "(_", "state_", ",_", "redirec", "t", "\\u", "url_", ",_", "''_", "._", "join_", "(_", "random_", "._", "choice_", "(_", "string_", "._", "ascii", "\\u", "letters_", "+_", "string_", "._", "digits_", ")_", "for_", "x_", "in_", "range_", "(_", "16_", ")_", ")_", ")_", ")_", "._", "hexdigest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmp", "\\u", "filename_", "=_", "'%", "s", ".", "autht", "oken", "'_", "%_", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "\\u", "file_", "=_", "json_", "._", "dumps_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "state", "'_", ":_", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "redirec", "t", "\\u", "url", "'_", ":_", "redirec", "t", "\\u", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "provide", "r", "'_", ":_", "provider_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "tmp", "\\u", "file_", "(_", "filename_", "=_", "tmp", "\\u", "filename_", ",_", "content_", "=_", "tmp", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "state", "'_", ":_", "state_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "auth", "\\u", "url", "'_", ":_", "'%", "s", "/", "%", "s", "'_", "%_", "(_", "self_", "._", "request_", "._", "full", "\\u", "url_", "(_", ")_", ",_", "token_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2", "User", "Auth", "Token", "Provider_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "User", "Auth", "Token", "Provider_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "token_", ",_", "provider_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "set\\u", "cookie_", "(_", "name_", "=_", "'", "auth", "\\u", "provide", "r", "'_", ",_", "value_", "=_", "provider_", ",_", "expir", "es", "\\u", "days_", "=_", "1_", ",_", "domain_", "=_", "self_", "._", "settings_", "[_", "'", "cookie", "\\u", "domain", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "redirect_", "(_", "'/", "api", "2", "/", "user", "/", "auth", "/", "%", "s", "'_", "%_", "token_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "API", "2", "User", "Auth", "Token_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "User", "Auth", "Token_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "web_", "._", "authenticated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "clear", "\\u", "cookie_", "(_", "'", "auth", "\\u", "provide", "r", "'_", ",_", "domain_", "=_", "self_", "._", "settings_", "[_", "'", "cookie", "\\u", "domain", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "token_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "token", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filename_", "=_", "'%", "s", ".", "autht", "oken", "'_", "%_", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "\\u", "file_", "=_", "self_", "._", "get", "\\u", "tmp", "\\u", "file_", "(_", "filename_", "=_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "tmp", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Inva", "lid", " ", "token", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp", "\\u", "file", "\\u", "json_", "=_", "json_", "._", "loads_", "(_", "tmp", "\\u", "file_", "._", "get_", "(_", "'", "file", "'_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmp", "\\u", "file", "\\u", "json_", "[_", "'", "user", "'_", "]_", "=_", "self_", "._", "current", "\\u", "user_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "del_", "tmp", "\\u", "file", "\\u", "json_", "[_", "'", "user", "'_", "]_", "[_", "'", "access", "\\u", "token", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "tmp", "\\u", "file", "\\u", "json_", "[_", "'", "user", "'_", "]_", "[_", "'", "api", "\\u", "key", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tmp", "\\u", "filename_", "=_", "'%", "s", ".", "usert", "oken", "'_", "%_", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "\\u", "file_", "=_", "json_", "._", "dumps_", "(_", "tmp", "\\u", "file", "\\u", "json_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "set\\u", "tmp", "\\u", "file_", "(_", "filename_", "=_", "tmp", "\\u", "filename_", ",_", "content_", "=_", "tmp", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tmp", "\\u", "file", "\\u", "json_", "._", "get_", "(_", "'", "redirec", "t", "\\u", "url", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "redirect_", "(_", "tmp", "\\u", "file", "\\u", "json_", "._", "get_", "(_", "'", "redirec", "t", "\\u", "url", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "tmp", "\\u", "file", "\\u", "json_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "User", "Auth", "Token_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "post_", "(_", "self_", ",_", "token_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "token_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "token", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "filename_", "=_", "'%", "s", ".", "usert", "oken", "'_", "%_", "token_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tmp", "\\u", "file_", "=_", "self_", "._", "get", "\\u", "tmp", "\\u", "file_", "(_", "filename_", "=_", "filename_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "tmp", "\\u", "file_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Inva", "lid", " ", "token", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "tmp", "\\u", "file", "\\u", "json_", "=_", "json_", "._", "loads_", "(_", "tmp", "\\u", "file_", "._", "get_", "(_", "'", "file", "'_", ",_", "''_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "state_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "state", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "state_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "State", " ", "parameter", " ", "must", " ", "be", " ", "set", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "state_", "!=_", "tmp", "\\u", "file", "\\u", "json_", "._", "get_", "(_", "'", "state", "'_", ",_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Inva", "lid", " ", "state", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "tmp", "\\u", "file", "\\u", "json_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2", "History_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "History_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "web_", "._", "authenticated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limit_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "limit", "'_", ",_", "default_", "=_", "10_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "limit_", ">_", "50_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limit_", "=_", "50_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "logg", "ing", ".", "debug", "(", "timestamp", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "timestamp_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "timestamp", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "limit_", "==_", "''_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "limit_", "=_", "10_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "timeframe", "_", "=_", "self_", "._", "get", "\\u", "histo", "ry", "\\u", "timeframe", "_", "(_", "limit_", "=_", "limit_", ",_", "timestamp_", "=_", "timestamp_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "events_", "=_", "self_", "._", "get", "\\u", "histo", "ry", "\\u", "events_", "(_", "timeframe", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "logg", "ing", ".", "debug", "(", "events", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "events_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "count", "'_", ":_", "len_", "(_", "events_", "[_", "'", "events", "'_", "]_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2", "Changed_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "Changed_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "web_", "._", "authenticated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "timestamp_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "timestamp", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "definition_", "=_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "definit", "ion", "'_", ",_", "default_", "=_", "None_", ",_", "strip_", "=_", "True_", ")_", "\\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 ", " _", "limit_", "=_", "int_", "(_", "self_", "._", "get", "\\u", "argument_", "(_", "'", "limit", "'_", ",_", "default_", "=_", "50_", ",_", "strip_", "=_", "True_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ",_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Limit", " ", "must", " ", "a", " ", "number", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "limit_", ">_", "500_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Limit", " ", "must", " ", "be", " ", "less", " ", "than", " ", "500", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "changed_", "=_", "self_", "._", "get", "\\u", "recent", "ly", "\\u", "changed_", "(_", "timestamp_", "=_", "timestamp_", ",_", "definition_", "=_", "definition_", ",_", "limit_", "=_", "limit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "changed_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "count", "'_", ":_", "len_", "(_", "changed_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2E", "nti", "ty", "Parent", "s_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2E", "nti", "ty", "Parent", "s_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "web_", "._", "remove", "slash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "web_", "._", "authenticated_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "get_", "(_", "self_", ",_", "entity", "\\u", "id_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "entity", "\\u", "id_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "No", " ", "entity", " ", "ID", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\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 ", " _", "id_", "=_", "int_", "(_", "entity", "\\u", "id_", ")_", "\\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_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'", "Id", " ", "has", " ", "to", " ", "be", " ", "a", " ", "number", "!'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "400_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "parents_", "=_", "self_", "._", "get", "\\u", "parents_", "(_", "id_", "=_", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "parents_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2", "Ping", "_", "(_", "my", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "pong", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "Ping", "_", "(_", "my", "Request", "Handler_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "just", " ", "pong", "_", "\\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\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "result", "'_", ":_", "'", "pong", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "API", "2", "Not", "Found_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Nic", "e", " ", "error", " ", "if", " ", "API", " ", "method", " ", "not", " ", "found_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "Not", "Found_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Nic", "e", " ", "error", " ", "if", " ", "API", " ", "method", " ", "not", " ", "found_", "\\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\\uINDENT\\u\\u\\u ", " _", "def_", "get_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "json_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "error", "'_", ":_", "'\\\\'", "%", "s", "\\\\'", " ", "not", " ", "found", "'_", "%_", "url_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "time", "'_", ":_", "round_", "(_", "self_", "._", "request_", "._", "request", "\\u", "time_", "(_", ")_", ",_", "3_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "404_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "Not", "Found_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Nic", "e", " ", "error", " ", "if", " ", "API", " ", "method", " ", "not", " ", "found_", "\\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_", "def_", "put_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "Not", "Found_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Nic", "e", " ", "error", " ", "if", " ", "API", " ", "method", " ", "not", " ", "found_", "\\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_", "def_", "post_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "API", "2", "Not", "Found_", "(_", "my", "Request", "Handler_", ",_", "Entit", "y2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Nic", "e", " ", "error", " ", "if", " ", "API", " ", "method", " ", "not", " ", "found_", "\\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_", "def_", "delete_", "(_", "self_", ",_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "get_", "(_", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/future/types/newbytes.py
[ { "content": "\"\"\"\nPure-Python implementation of a Python 3-like bytes object for Python 2.\n\nWhy do this? Without it, the Python 2 bytes object is a very, very\ndifferent beast to the Python 3 bytes object.\n\"\"\"\n\nfrom collections import Iterable\nfrom numbers import Integral\nimport string\n\nfrom future.utils import istext, isbytes, PY3, with_metaclass\nfrom future.types import no, issubset\nfrom future.types.newobject import newobject\n\n\n_builtin_bytes = bytes\n\nif PY3:\n # We'll probably never use newstr on Py3 anyway...\n unicode = str\n\n\n\n\n\n\n__all__ = ['newbytes']\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class BaseNewBytes(type):", "metadata": "root.BaseNewBytes", "header": "['module', '___EOS___']", "index": 23 }, { "content": " def __instancecheck__(cls, instance):\n if cls == newbytes:\n return isinstance(instance, _builtin_bytes)\n else:\n return issubclass(instance.__class__, cls)", "metadata": "root.BaseNewBytes.__instancecheck__", "header": "['class', 'BaseNewBytes', '(', 'type', ')', ':', '___EOS___']", "index": 24 }, { "content": "class newbytes(with_metaclass(BaseNewBytes, _builtin_bytes)):\n \"\"\"\n A backport of the Python 3 bytes object to Py2\n \"\"\"\n \n\n\n\n\n \n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n unorderable_err = 'unorderable types: bytes() and {0}'\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.newbytes", "header": "['module', '___EOS___']", "index": 31 }, { "content": " def __new__(cls, *args, **kwargs):\n \"\"\"\n From the Py3 bytes docstring:\n\n bytes(iterable_of_ints) -> bytes\n bytes(string, encoding[, errors]) -> bytes\n bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer\n bytes(int) -> bytes object of size given by the parameter initialized with null bytes\n bytes() -> empty bytes object\n \n Construct an immutable array of bytes from:\n - an iterable yielding integers in range(256)\n - a text string encoded using the specified encoding\n - any object implementing the buffer API.\n - an integer\n \"\"\"\n \n encoding = None\n errors = None\n\n if len(args) == 0:\n return super(newbytes, cls).__new__(cls)\n elif len(args) >= 2:\n args = list(args)\n if len(args) == 3:\n errors = args.pop()\n encoding=args.pop()\n # Was: elif isinstance(args[0], newbytes):\n # We use type() instead of the above because we're redefining\n # this to be True for all unicode string subclasses. Warning:\n # This may render newstr un-subclassable.\n if type(args[0]) == newbytes:\n # Special-case: for consistency with Py3.3, we return the same object\n # (with the same id) if a newbytes object is passed into the\n # newbytes constructor.\n return args[0]\n elif isinstance(args[0], _builtin_bytes):\n value = args[0]\n elif isinstance(args[0], unicode):\n try:\n if 'encoding' in kwargs:\n assert encoding is None\n encoding = kwargs['encoding']\n if 'errors' in kwargs:\n assert errors is None\n errors = kwargs['errors']\n except AssertionError:\n raise TypeError('Argument given by name and position')\n if encoding is None:\n raise TypeError('unicode string argument without an encoding')\n ###\n # Was: value = args[0].encode(**kwargs)\n # Python 2.6 string encode() method doesn't take kwargs:\n # Use this instead:\n newargs = [encoding]\n if errors is not None:\n newargs.append(errors)\n value = args[0].encode(*newargs)\n ### \n elif isinstance(args[0], Iterable):\n if len(args[0]) == 0:\n # This could be an empty list or tuple. Return b'' as on Py3.\n value = b''\n else:\n # Was: elif len(args[0])>0 and isinstance(args[0][0], Integral):\n # # It's a list of integers\n # But then we can't index into e.g. frozensets. Try to proceed\n # anyway.\n try:\n values = [chr(x) for x in args[0]]\n value = b''.join(values)\n except:\n raise ValueError('bytes must be in range(0, 256)')\n elif isinstance(args[0], Integral):\n if args[0] < 0:\n raise ValueError('negative count')\n value = b'\\x00' * args[0]\n else:\n value = args[0]\n return super(newbytes, cls).__new__(cls, value)", "metadata": "root.newbytes.__new__", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 35 }, { "content": " def __repr__(self):\n return 'b' + super(newbytes, self).__repr__()", "metadata": "root.newbytes.__repr__", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 116 }, { "content": " def __str__(self):\n return 'b' + \"'{0}'\".format(super(newbytes, self).__str__())", "metadata": "root.newbytes.__str__", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 119 }, { "content": " def __getitem__(self, y):\n value = super(newbytes, self).__getitem__(y)\n if isinstance(y, Integral):\n return ord(value)\n else:\n return newbytes(value)", "metadata": "root.newbytes.__getitem__", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 122 }, { "content": " def __getslice__(self, *args):\n return self.__getitem__(slice(*args))", "metadata": "root.newbytes.__getslice__", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 129 }, { "content": " def __contains__(self, key):\n if isinstance(key, int):\n newbyteskey = newbytes([key])\n # Don't use isinstance() here because we only want to catch\n # newbytes, not Python 2 str:\n elif type(key) == newbytes:\n newbyteskey = key\n else:\n newbyteskey = newbytes(key)\n return issubset(list(newbyteskey), list(self))", "metadata": "root.newbytes.__contains__", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 132 }, { "content": " @no(unicode)\n def __add__(self, other):\n return newbytes(super(newbytes, self).__add__(other))", "metadata": "root.newbytes.__add__", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 143 }, { "content": " @no(unicode)\n def __radd__(self, left):\n return newbytes(left) + self", "metadata": "root.newbytes.__radd__", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 147 }, { "content": " @no(unicode)\n def __mul__(self, other):\n return newbytes(super(newbytes, self).__mul__(other))", "metadata": "root.newbytes.__mul__", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 151 }, { "content": " @no(unicode)\n def __rmul__(self, other):\n return newbytes(super(newbytes, self).__rmul__(other))", "metadata": "root.newbytes.__rmul__", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 155 }, { "content": " def join(self, iterable_of_bytes):\n errmsg = 'sequence item {0}: expected bytes, {1} found'\n if isbytes(iterable_of_bytes) or istext(iterable_of_bytes):\n raise TypeError(errmsg.format(0, type(iterable_of_bytes)))\n for i, item in enumerate(iterable_of_bytes):\n if istext(item):\n raise TypeError(errmsg.format(i, type(item)))\n return newbytes(super(newbytes, self).join(iterable_of_bytes))", "metadata": "root.newbytes.join", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 159 }, { "content": " @classmethod\n def fromhex(cls, string):\n # Only on Py2:\n return cls(string.replace(' ', '').decode('hex'))", "metadata": "root.newbytes.fromhex", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 168 }, { "content": " @no(unicode)\n def find(self, sub, *args):\n return super(newbytes, self).find(sub, *args)", "metadata": "root.newbytes.find", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 173 }, { "content": " @no(unicode)\n def rfind(self, sub, *args):\n return super(newbytes, self).rfind(sub, *args)", "metadata": "root.newbytes.rfind", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 177 }, { "content": " @no(unicode, (1, 2))\n def replace(self, old, new, *args):\n return newbytes(super(newbytes, self).replace(old, new, *args))", "metadata": "root.newbytes.replace", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 181 }, { "content": " def encode(self, *args):\n raise AttributeError(\"encode method has been disabled in newbytes\")", "metadata": "root.newbytes.encode", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 185 }, { "content": " def decode(self, encoding='utf-8', errors='strict'):\n \"\"\"\n Returns a newstr (i.e. unicode subclass)\n\n Decode B using the codec registered for encoding. Default encoding\n is 'utf-8'. errors may be given to set a different error\n handling scheme. Default is 'strict' meaning that encoding errors raise\n a UnicodeDecodeError. Other possible values are 'ignore' and 'replace'\n as well as any other name registered with codecs.register_error that is\n able to handle UnicodeDecodeErrors.\n \"\"\"\n # Py2 str.encode() takes encoding and errors as optional parameter,\n # not keyword arguments as in Python 3 str.\n\n from future.types.newstr import newstr\n\n if errors == 'surrogateescape':\n from future.utils.surrogateescape import register_surrogateescape\n register_surrogateescape()\n\n return newstr(super(newbytes, self).decode(encoding, errors))\n\n # This is currently broken:\n # # We implement surrogateescape error handling here in addition rather\n # # than relying on the custom error handler from\n # # future.utils.surrogateescape to be registered globally, even though\n # # that is fine in the case of decoding. (But not encoding: see the\n # # comments in newstr.encode()``.)\n #\n # if errors == 'surrogateescape':\n # # Decode char by char\n # mybytes = []\n # for code in self:\n # # Code is an int\n # if 0x80 <= code <= 0xFF:\n # b = 0xDC00 + code\n # elif code <= 0x7F:\n # b = _unichr(c).decode(encoding=encoding)\n # else:\n # # # It may be a bad byte\n # # FIXME: What to do in this case? See the Py3 docs / tests.\n # # # Try swallowing it.\n # # continue\n # # print(\"RAISE!\")\n # raise NotASurrogateError\n # mybytes.append(b)\n # return newbytes(mybytes)\n # return newbytes(super(newstr, self).decode(encoding, errors))", "metadata": "root.newbytes.decode", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 188 }, { "content": " @no(unicode)\n def startswith(self, prefix, *args):\n return super(newbytes, self).startswith(prefix, *args)", "metadata": "root.newbytes.startswith", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 237 }, { "content": " @no(unicode)\n def endswith(self, prefix, *args):\n return super(newbytes, self).endswith(prefix, *args)", "metadata": "root.newbytes.endswith", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 241 }, { "content": " @no(unicode)\n def split(self, sep=None, maxsplit=-1):\n # Py2 str.split() takes maxsplit as an optional parameter, not as a\n # keyword argument as in Python 3 bytes.\n parts = super(newbytes, self).split(sep, maxsplit)\n return [newbytes(part) for part in parts]", "metadata": "root.newbytes.split", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 245 }, { "content": " def splitlines(self, keepends=False):\n \"\"\"\n B.splitlines([keepends]) -> list of lines\n\n Return a list of the lines in B, breaking at line boundaries.\n Line breaks are not included in the resulting list unless keepends\n is given and true.\n \"\"\"\n # Py2 str.splitlines() takes keepends as an optional parameter,\n # not as a keyword argument as in Python 3 bytes.\n parts = super(newbytes, self).splitlines(keepends)\n return [newbytes(part) for part in parts]", "metadata": "root.newbytes.splitlines", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 252 }, { "content": " @no(unicode)\n def rsplit(self, sep=None, maxsplit=-1):\n # Py2 str.rsplit() takes maxsplit as an optional parameter, not as a\n # keyword argument as in Python 3 bytes.\n parts = super(newbytes, self).rsplit(sep, maxsplit)\n return [newbytes(part) for part in parts]", "metadata": "root.newbytes.rsplit", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 265 }, { "content": " @no(unicode)\n def partition(self, sep):\n parts = super(newbytes, self).partition(sep)\n return tuple(newbytes(part) for part in parts)", "metadata": "root.newbytes.partition", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 272 }, { "content": " @no(unicode)\n def rpartition(self, sep):\n parts = super(newbytes, self).rpartition(sep)\n return tuple(newbytes(part) for part in parts)", "metadata": "root.newbytes.rpartition", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 277 }, { "content": " @no(unicode, (1,))\n def rindex(self, sub, *args):\n '''\n S.rindex(sub [,start [,end]]) -> int\n\n Like S.rfind() but raise ValueError when the substring is not found.\n '''\n pos = self.rfind(sub, *args)\n if pos == -1:\n raise ValueError('substring not found')", "metadata": "root.newbytes.rindex", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 282 }, { "content": " @no(unicode)\n def index(self, sub, *args):\n '''\n Returns index of sub in bytes.\n Raises ValueError if byte is not in bytes and TypeError if can't\n be converted bytes or its length is not 1.\n '''\n if isinstance(sub, int):\n if len(args) == 0:\n start, end = 0, len(self)\n elif len(args) == 1:\n start = args[0]\n elif len(args) == 2:\n start, end = args\n else:\n raise TypeError('takes at most 3 arguments')\n return list(self)[start:end].index(sub)\n if not isinstance(sub, bytes):\n try:\n sub = self.__class__(sub)\n except (TypeError, ValueError):\n raise TypeError(\"can't convert sub to bytes\")\n try:\n return super(newbytes, self).index(sub, *args)\n except ValueError:\n raise ValueError('substring not found')", "metadata": "root.newbytes.index", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 293 }, { "content": " def __eq__(self, other):\n if isinstance(other, (_builtin_bytes, bytearray)):\n return super(newbytes, self).__eq__(other)\n else:\n return False", "metadata": "root.newbytes.__eq__", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 320 }, { "content": " def __ne__(self, other):\n if isinstance(other, _builtin_bytes):\n return super(newbytes, self).__ne__(other)\n else:\n return True", "metadata": "root.newbytes.__ne__", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 326 }, { "content": " def __lt__(self, other):\n if not isbytes(other):\n raise TypeError(self.unorderable_err.format(type(other)))\n return super(newbytes, self).__lt__(other)", "metadata": "root.newbytes.__lt__", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 334 }, { "content": " def __le__(self, other):\n if not isbytes(other):\n raise TypeError(self.unorderable_err.format(type(other)))\n return super(newbytes, self).__le__(other)", "metadata": "root.newbytes.__le__", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 339 }, { "content": " def __gt__(self, other):\n if not isbytes(other):\n raise TypeError(self.unorderable_err.format(type(other)))\n return super(newbytes, self).__gt__(other)", "metadata": "root.newbytes.__gt__", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 344 }, { "content": " def __ge__(self, other):\n if not isbytes(other):\n raise TypeError(self.unorderable_err.format(type(other)))\n return super(newbytes, self).__ge__(other)", "metadata": "root.newbytes.__ge__", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 349 }, { "content": " def __native__(self):\n # We can't just feed a newbytes object into str(), because\n # newbytes.__str__() returns e.g. \"b'blah'\", consistent with Py3 bytes.\n return super(newbytes, self).__str__()", "metadata": "root.newbytes.__native__", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 354 }, { "content": " def __getattribute__(self, name):\n \"\"\"\n A trick to cause the ``hasattr`` builtin-fn to return False for\n the 'encode' method on Py2.\n \"\"\"\n if name in ['encode', u'encode']:\n raise AttributeError(\"encode method has been disabled in newbytes\")\n return super(newbytes, self).__getattribute__(name)", "metadata": "root.newbytes.__getattribute__", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 359 }, { "content": " @no(unicode)\n def rstrip(self, bytes_to_strip=None):\n \"\"\"\n Strip trailing bytes contained in the argument.\n If the argument is omitted, strip trailing ASCII whitespace.\n \"\"\" \n return newbytes(super(newbytes, self).rstrip(bytes_to_strip))", "metadata": "root.newbytes.rstrip", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 368 }, { "content": " @no(unicode)\n def strip(self, bytes_to_strip=None):\n \"\"\"\n Strip leading and trailing bytes contained in the argument.\n If the argument is omitted, strip trailing ASCII whitespace.\n \"\"\" \n return newbytes(super(newbytes, self).strip(bytes_to_strip))", "metadata": "root.newbytes.strip", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 376 }, { "content": " def lower(self):\n \"\"\"\n b.lower() -> copy of b\n \n Return a copy of b with all ASCII characters converted to lowercase.\n \"\"\" \n return newbytes(super(newbytes, self).lower())", "metadata": "root.newbytes.lower", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 384 }, { "content": " @no(unicode)\n def upper(self):\n \"\"\"\n b.upper() -> copy of b\n \n Return a copy of b with all ASCII characters converted to uppercase.\n \"\"\" \n return newbytes(super(newbytes, self).upper())", "metadata": "root.newbytes.upper", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 392 }, { "content": " @classmethod\n @no(unicode)\n def maketrans(cls, frm, to):\n \"\"\"\n B.maketrans(frm, to) -> translation table\n\n Return a translation table (a bytes object of length 256) suitable\n for use in the bytes or bytearray translate method where each byte\n in frm is mapped to the byte at the same position in to.\n The bytes objects frm and to must be of the same length.\n \"\"\"\n return newbytes(string.maketrans(frm, to))", "metadata": "root.newbytes.maketrans", "header": "['class', 'newbytes', '(', 'with_metaclass', '(', 'BaseNewBytes', ',', '_builtin_bytes', ')', ')', ':', '___EOS___']", "index": 401 } ]
[ { "span": "from future.types.newobject import newobject", "start_line": 13, "start_column": 0, "end_line": 13, "end_column": 44 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Pur", "e-", "Pyth", "on", " ", "implementation", " ", "of", " ", "a", " ", "Pyth", "on", " ", "3", "-", "like", " ", "bytes", " ", "object", " ", "for", " ", "Pyth", "on", " ", "2", ".", "\\", "10", ";", "\\", "10", ";", "Wh", "y", " ", "do", " ", "this", "?", " ", "With", "out", " ", "it", ",", " ", "the", " ", "Pyth", "on", " ", "2", " ", "bytes", " ", "object", " ", "is", " ", "a", " ", "very", ",", " ", "very", "\\", "10", ";", "different", " ", "bea", "st", " ", "to", " ", "the", " ", "Pyth", "on", " ", "3", " ", "bytes", " ", "object", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "collections_", "import_", "Iterable_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numbers_", "import_", "Integral_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "string_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "future_", "._", "utils_", "import_", "iste", "xt_", ",_", "isb", "ytes_", ",_", "PY", "3_", ",_", "with", "\\u", "metaclass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "future_", "._", "types_", "import_", "no_", ",_", "issubset_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "future_", "._", "types_", "._", "newo", "bject_", "import_", "newo", "bject_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "bui", "lti", "n", "\\u", "bytes_", "=_", "bytes_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "PY", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", "'", "ll", " ", "probab", "ly", " ", "neve", "r", " ", "use", " ", "newst", "r", " ", "on", " ", "Py", "3", " ", "anyway", "..._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unicode_", "=_", "str_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "all\\u\\u_", "=_", "[_", "'", "newb", "ytes", "'_", "]_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Base", "New", "Bytes_", "(_", "type_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Base", "New", "Bytes_", "(_", "type_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "instance", "check", "\\u\\u_", "(_", "cls_", ",_", "instance_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cls_", "==_", "newb", "ytes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "isinstance_", "(_", "instance_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", "\\u\\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_", "issubclass_", "(_", "instance_", "._", "\\u\\u", "class\\u\\u_", ",_", "cls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "backp", "ort", " ", "of", " ", "the", " ", "Pyth", "on", " ", "3", " ", "bytes", " ", "object", " ", "to", " ", "Py", "2", "\\", "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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "uno", "rder", "able", "\\u", "err_", "=_", "'", "uno", "rder", "able", " ", "types", ":", " ", "bytes", "()", " ", "and", " ", "{", "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_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Fro", "m", " ", "the", " ", "Py", "3", " ", "bytes", " ", "docstr", "ing", ":", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "bytes", "(", "iterable", "\\u", "of", "\\u", "ints", ")", " ", "->", " ", "bytes", "\\", "10", ";", " ", " ", " ", " ", "bytes", "(", "string", ",", " ", "encoding", "[", ",", " ", "error", "s", "])", " ", "->", " ", "bytes", "\\", "10", ";", " ", " ", " ", " ", "bytes", "(", "bytes", "\\u", "or", "\\u", "buffer", ")", " ", "->", " ", "immutable", " ", "copy", " ", "of", " ", "bytes", "\\u", "or", "\\u", "buffer", "\\", "10", ";", " ", " ", " ", " ", "bytes", "(", "int", ")", " ", "->", " ", "bytes", " ", "object", " ", "of", " ", "size", " ", "give", "n", " ", "by", " ", "the", " ", "parameter", " ", "initialize", "d", " ", "with", " ", "null", " ", "bytes", "\\", "10", ";", " ", " ", " ", " ", "bytes", "()", " ", "->", " ", "empty", " ", "bytes", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Construct", " ", "an", " ", "immutable", " ", "array", " ", "of", " ", "bytes", " ", "from", ":", "\\", "10", ";", " ", " ", "-", " ", "an", " ", "iterable", " ", "yield", "ing", " ", "integ", "ers", " ", "in", " ", "range", "(", "256", ")", "\\", "10", ";", " ", " ", "-", " ", "a", " ", "text", " ", "string", " ", "encode", "d", " ", "usi", "ng", " ", "the", " ", "specified", " ", "encoding", "\\", "10", ";", " ", " ", "-", " ", "any", " ", "object", " ", "implement", "ing", " ", "the", " ", "buffer", " ", "API", ".", "\\", "10", ";", " ", " ", "-", " ", "an", " ", "integ", "er", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "encoding_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "newb", "ytes_", ",_", "cls_", ")_", "._", "\\u\\u", "new\\u\\u_", "(_", "cls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "args_", ")_", ">=_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "args_", "=_", "list_", "(_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "args_", ")_", "==_", "3_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errors_", "=_", "args_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "encoding_", "=_", "args_", "._", "pop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wa", "s", ":", " ", "eli", "f", " ", "isin", "stance", "(", "args", "[", "0", "],", " ", "newb", "ytes", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "We", " ", "use", " ", "type", "()", " ", "inst", "ead", " ", "of", " ", "the", " ", "above", " ", "bec", "aus", "e", " ", "we", "'", "re", " ", "rede", "fini", "ng_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "to", " ", "be", " ", "Tru", "e", " ", "for", " ", "all", " ", "unicode", " ", "string", " ", "subclasses", ".", " ", "Warn", "ing", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "may", " ", "render", " ", "newst", "r", " ", "un", "-", "subclass", "able", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "type_", "(_", "args_", "[_", "0_", "]_", ")_", "==_", "newb", "ytes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Special", "-", "case", ":", " ", "for", " ", "consiste", "nc", "y", " ", "with", " ", "Py", "3.3", ",", " ", "we", " ", "return", " ", "the", " ", "same", " ", "object_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "with", " ", "the", " ", "same", " ", "id", ")", " ", "if", " ", "a", " ", "newb", "ytes", " ", "object", " ", "is", " ", "pass", "ed", " ", "int", "o", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "newb", "ytes", " ", "construct", "or", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "args_", "[_", "0_", "]_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "args_", "[_", "0_", "]_", ",_", "unicode_", ")_", ":_", "\\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_", "'", "encoding", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "assert_", "encoding_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "encoding_", "=_", "kwargs_", "[_", "'", "encoding", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "error", "s", "'_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "assert_", "errors_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "errors_", "=_", "kwargs_", "[_", "'", "error", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Assert", "ion", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "Arg", "ument", " ", "give", "n", " ", "by", " ", "name", " ", "and", " ", "position", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "encoding_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "'", "unicode", " ", "string", " ", "argu", "ment", " ", "with", "out", " ", "an", " ", "encoding", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Wa", "s", ":", " ", " ", " ", "value", " ", "=", " ", "args", "[", "0", "].", "encode", "(*", "*", "kwarg", "s", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pyth", "on", " ", "2.6", " ", "string", " ", "encode", "()", " ", "method", " ", "doe", "sn", "'", "t", " ", "take", " ", "kwarg", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "e", " ", "this", " ", "inst", "ead", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "newa", "rgs_", "=_", "[_", "encoding_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "errors_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newa", "rgs_", "._", "append_", "(_", "errors_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "args_", "[_", "0_", "]_", "._", "encode_", "(_", "*_", "newa", "rgs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "args_", "[_", "0_", "]_", ",_", "Iterable_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", "[_", "0_", "]_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "coul", "d", " ", "be", " ", "an", " ", "empty", " ", "list", " ", "or", " ", "tuple", ".", " ", "Return", " ", "b", "''", " ", "as", " ", "on", " ", "Py", "3._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "b", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wa", "s", ":", " ", "eli", "f", " ", "len", "(", "args", "[", "0", "])", ">", "0", " ", "and", " ", "isin", "stance", "(", "args", "[", "0", "][", "0", "],", " ", "Integra", "l", "):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "#", " ", "It", "'", "s", " ", "a", " ", "list", " ", "of", " ", "integers_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Bu", "t", " ", "then", " ", "we", " ", "can", "'", "t", " ", "index", " ", "int", "o", " ", "e", ".", "g", ".", " ", "frozen", "sets", ".", " ", "Tr", "y", " ", "to", " ", "proceed", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "anyway", "._", "\\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 ", " ", "_", "values_", "=_", "[_", "chr_", "(_", "x_", ")_", "for_", "x_", "in_", "args_", "[_", "0_", "]_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "b", "''_", "._", "join_", "(_", "values_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Value", "Error_", "(_", "'", "bytes", " ", "must", " ", "be", " ", "in", " ", "range", "(", "0", ",", " ", "256", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "args_", "[_", "0_", "]_", ",_", "Integral_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "args_", "[_", "0_", "]_", "<_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "negati", "ve", " ", "count", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "b", "'\\\\", "x0", "0", "'_", "*_", "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 ", " _", "value_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "newb", "ytes_", ",_", "cls_", ")_", "._", "\\u\\u", "new\\u\\u_", "(_", "cls_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\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_", "'", "b", "'_", "+_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "\\u\\u", "repr\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "str\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "'", "b", "'_", "+_", "\"'{", "0", "}'\"_", "._", "format_", "(_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\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_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "\\u\\u", "getitem\\u\\u_", "(_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "y_", ",_", "Integral_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ord_", "(_", "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_", "newb", "ytes_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\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", "gets", "lice", "\\u\\u_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u\\u", "getitem\\u\\u_", "(_", "slice_", "(_", "*_", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "contains\\u\\u_", "(_", "self_", ",_", "key_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "key_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newb", "ytes", "key_", "=_", "newb", "ytes_", "(_", "[_", "key_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Don", "'", "t", " ", "use", " ", "isin", "stance", "()", " ", "here", " ", "bec", "aus", "e", " ", "we", " ", "only", " ", "want", " ", "to", " ", "catch", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "newb", "ytes", ",", " ", "not", " ", "Pyth", "on", " ", "2", " ", "str", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "type_", "(_", "key_", ")_", "==_", "newb", "ytes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "newb", "ytes", "key_", "=_", "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 ", " _", "newb", "ytes", "key_", "=_", "newb", "ytes_", "(_", "key_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "issubset_", "(_", "list_", "(_", "newb", "ytes", "key_", ")_", ",_", "list_", "(_", "self_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no_", "(_", "unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "add\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "newb", "ytes_", "(_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "\\u\\u", "add\\u\\u_", "(_", "other_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no_", "(_", "unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "rad", "d\\u\\u_", "(_", "self_", ",_", "left_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "newb", "ytes_", "(_", "left_", ")_", "+_", "self_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no_", "(_", "unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "mul\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "newb", "ytes_", "(_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "\\u\\u", "mul\\u\\u_", "(_", "other_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no_", "(_", "unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "rm", "ul", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "newb", "ytes_", "(_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "\\u\\u", "rm", "ul", "\\u\\u_", "(_", "other_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "join_", "(_", "self_", ",_", "iterable", "\\u", "of", "\\u", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "errmsg_", "=_", "'", "sequence", " ", "item", " ", "{", "0", "}:", " ", "expected", " ", "bytes", ",", " ", "{", "1", "}", " ", "found", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isb", "ytes_", "(_", "iterable", "\\u", "of", "\\u", "bytes_", ")_", "or_", "iste", "xt_", "(_", "iterable", "\\u", "of", "\\u", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "errmsg_", "._", "format_", "(_", "0_", ",_", "type_", "(_", "iterable", "\\u", "of", "\\u", "bytes_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "i_", ",_", "item_", "in_", "enumerate_", "(_", "iterable", "\\u", "of", "\\u", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "iste", "xt_", "(_", "item_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "errmsg_", "._", "format_", "(_", "i_", ",_", "type_", "(_", "item_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "newb", "ytes_", "(_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "join_", "(_", "iterable", "\\u", "of", "\\u", "bytes_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\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_", "fromhe", "x_", "(_", "cls_", ",_", "string_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "On", "ly", " ", "on", " ", "Py", "2", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "cls_", "(_", "string_", "._", "replace_", "(_", "'", " ", "'_", ",_", "''_", ")_", "._", "decode_", "(_", "'", "hex", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no_", "(_", "unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "find_", "(_", "self_", ",_", "sub_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "find_", "(_", "sub_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no_", "(_", "unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "rfind_", "(_", "self_", ",_", "sub_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "rfind_", "(_", "sub_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no_", "(_", "unicode_", ",_", "(_", "1_", ",_", "2_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "replace_", "(_", "self_", ",_", "old_", ",_", "new_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "newb", "ytes_", "(_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "replace_", "(_", "old_", ",_", "new_", ",_", "*_", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "encode_", "(_", "self_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Attribute", "Error_", "(_", "\"", "encode", " ", "method", " ", "has", " ", "bee", "n", " ", "disable", "d", " ", "in", " ", "newb", "ytes", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "decode_", "(_", "self_", ",_", "encoding_", "=_", "'", "utf", "-", "8", "'_", ",_", "errors_", "=_", "'", "strict", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "a", " ", "newst", "r", " ", "(", "i", ".", "e", ".", " ", "unicode", " ", "subclass", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Decode", " ", "B", " ", "usi", "ng", " ", "the", " ", "codec", " ", "register", "ed", " ", "for", " ", "encoding", ".", " ", "Default", " ", "encoding", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "'", "utf", "-", "8", "'.", " ", "error", "s", " ", "may", " ", "be", " ", "give", "n", " ", "to", " ", "set", " ", "a", " ", "different", " ", "error", "\\", "10", ";", " ", " ", " ", " ", "handling", " ", "sche", "me", ".", " ", " ", "Default", " ", "is", " ", "'", "strict", "'", " ", "meaning", " ", "tha", "t", " ", "encoding", " ", "error", "s", " ", "raise", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "Unic", "ode", "Decode", "Error", ".", " ", " ", "Ot", "her", " ", "possib", "le", " ", "values", " ", "are", " ", "'", "ignore", "'", " ", "and", " ", "'", "replace", "'", "\\", "10", ";", " ", " ", " ", " ", "as", " ", "well", " ", "as", " ", "any", " ", "other", " ", "name", " ", "register", "ed", " ", "with", " ", "codec", "s", ".", "register", "\\u", "error", " ", "tha", "t", " ", "is", "\\", "10", ";", " ", " ", " ", " ", "able", " ", "to", " ", "handle", " ", "Unic", "ode", "Decode", "Error", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Py", "2", " ", "str", ".", "encode", "()", " ", "take", "s", " ", "encoding", " ", "and", " ", "error", "s", " ", "as", " ", "option", "al", " ", "parameter", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "keyw", "ord", " ", "argu", "ment", "s", " ", "as", " ", "in", " ", "Pyth", "on", " ", "3", " ", "str", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "future_", "._", "types_", "._", "newst", "r_", "import_", "newst", "r_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "errors_", "==_", "'", "surrogate", "escape", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "future_", "._", "utils_", "._", "surrogate", "escape_", "import_", "register", "\\u", "surrogate", "escape_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "register", "\\u", "surrogate", "escape_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "newst", "r_", "(_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "decode_", "(_", "encoding_", ",_", "errors_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "is", " ", "currentl", "y", " ", "broken", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "We", " ", "implement", " ", "surrogate", "escape", " ", "error", " ", "handling", " ", "here", " ", "in", " ", "addition", " ", "rat", "her_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "than", " ", "rely", "ing", " ", "on", " ", "the", " ", "custom", " ", "error", " ", "handler", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "future", ".", "util", "s", ".", "surrogate", "escape", " ", "to", " ", "be", " ", "register", "ed", " ", "global", "ly", ",", " ", "even", " ", "tho", "ugh", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "tha", "t", " ", "is", " ", "fine", " ", "in", " ", "the", " ", "case", " ", "of", " ", "deco", "ding", ".", " ", "(", "Bu", "t", " ", "not", " ", "encoding", ":", " ", "see", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "comment", "s", " ", "in", " ", "newst", "r", ".", "encode", "()``", ".)", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "error", "s", " ", "==", " ", "'", "surrogate", "escape", "':", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "#", " ", "Decode", " ", "char", " ", "by", " ", "char_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "myb", "ytes", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "code", " ", "in", " ", "self", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "#", " ", "Code", " ", "is", " ", "an", " ", "int_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "if", " ", "0x80", " ", "<=", " ", "code", " ", "<=", " ", "0xFF", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "b", " ", "=", " ", "0xD", "C0", "0", " ", "+", " ", "code_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "eli", "f", " ", "code", " ", "<=", " ", "0x7", "F", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "b", " ", "=", " ", "\\u", "uni", "chr", "(", "c", ").", "decode", "(", "encoding", "=", "encoding", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "else", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "#", " ", "#", " ", "It", " ", "may", " ", "be", " ", "a", " ", "bad", " ", "byte_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "#", " ", "FIX", "ME", ":", " ", "What", " ", "to", " ", "do", " ", "in", " ", "this", " ", "case", "?", " ", "See", " ", "the", " ", "Py", "3", " ", "docs", " ", "/", " ", "tests", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "#", " ", "#", " ", "Tr", "y", " ", "swa", "llow", "ing", " ", "it", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "#", " ", "continue_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "#", " ", "print", "(\"", "RAI", "SE", "!\"", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "raise", " ", "Not", "AS", "urr", "oga", "te", "Error_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "myb", "ytes", ".", "append", "(", "b", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "newb", "ytes", "(", "myb", "ytes", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "return", " ", "newb", "ytes", "(", "super", "(", "newst", "r", ",", " ", "self", ").", "decode", "(", "encoding", ",", " ", "error", "s", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no_", "(_", "unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "startswith_", "(_", "self_", ",_", "prefix_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "startswith_", "(_", "prefix_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no_", "(_", "unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "endswith_", "(_", "self_", ",_", "prefix_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "endswith_", "(_", "prefix_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no_", "(_", "unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "split_", "(_", "self_", ",_", "sep_", "=_", "None_", ",_", "maxsp", "lit_", "=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Py", "2", " ", "str", ".", "split", "()", " ", "take", "s", " ", "maxsp", "lit", " ", "as", " ", "an", " ", "option", "al", " ", "parameter", ",", " ", "not", " ", "as", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "keyw", "ord", " ", "argu", "ment", " ", "as", " ", "in", " ", "Pyth", "on", " ", "3", " ", "bytes", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "=_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "split_", "(_", "sep_", ",_", "maxsp", "lit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "newb", "ytes_", "(_", "part_", ")_", "for_", "part_", "in_", "parts_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "splitlines_", "(_", "self_", ",_", "keep", "ends_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "B", ".", "split", "lines", "([", "keep", "ends", "])", " ", "->", " ", "list", " ", "of", " ", "lines", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "list", " ", "of", " ", "the", " ", "lines", " ", "in", " ", "B", ",", " ", "break", "ing", " ", "at", " ", "line", " ", "bound", "aries", ".", "\\", "10", ";", " ", " ", " ", " ", "Line", " ", "breaks", " ", "are", " ", "not", " ", "include", "d", " ", "in", " ", "the", " ", "result", "ing", " ", "list", " ", "unl", "ess", " ", "keep", "ends", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "give", "n", " ", "and", " ", "true", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Py", "2", " ", "str", ".", "split", "lines", "()", " ", "take", "s", " ", "keep", "ends", " ", "as", " ", "an", " ", "option", "al", " ", "parameter", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "not", " ", "as", " ", "a", " ", "keyw", "ord", " ", "argu", "ment", " ", "as", " ", "in", " ", "Pyth", "on", " ", "3", " ", "bytes", "._", "\\u\\u\\uNL\\u\\u\\u_", "parts_", "=_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "splitlines_", "(_", "keep", "ends_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "newb", "ytes_", "(_", "part_", ")_", "for_", "part_", "in_", "parts_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no_", "(_", "unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "rsplit_", "(_", "self_", ",_", "sep_", "=_", "None_", ",_", "maxsp", "lit_", "=_", "-_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Py", "2", " ", "str", ".", "rsp", "lit", "()", " ", "take", "s", " ", "maxsp", "lit", " ", "as", " ", "an", " ", "option", "al", " ", "parameter", ",", " ", "not", " ", "as", " ", "a_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "keyw", "ord", " ", "argu", "ment", " ", "as", " ", "in", " ", "Pyth", "on", " ", "3", " ", "bytes", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "=_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "rsplit_", "(_", "sep_", ",_", "maxsp", "lit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "[_", "newb", "ytes_", "(_", "part_", ")_", "for_", "part_", "in_", "parts_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no_", "(_", "unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "partition_", "(_", "self_", ",_", "sep_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "=_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "partition_", "(_", "sep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "tuple_", "(_", "newb", "ytes_", "(_", "part_", ")_", "for_", "part_", "in_", "parts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no_", "(_", "unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "rpartition_", "(_", "self_", ",_", "sep_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "parts_", "=_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "rpartition_", "(_", "sep_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "tuple_", "(_", "newb", "ytes_", "(_", "part_", ")_", "for_", "part_", "in_", "parts_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no_", "(_", "unicode_", ",_", "(_", "1_", ",_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "rindex", "_", "(_", "self_", ",_", "sub_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "S", ".", "rindex", "(", "sub", " ", "[", ",", "start", " ", "[", ",", "end", "]])", " ", "->", " ", "int", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Lik", "e", " ", "S", ".", "rfi", "nd", "()", " ", "but", " ", "raise", " ", "Value", "Error", " ", "whe", "n", " ", "the", " ", "substring", " ", "is", " ", "not", " ", "found", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pos_", "=_", "self_", "._", "rfind_", "(_", "sub_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "pos_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "substring", " ", "not", " ", "found", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no_", "(_", "unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "index_", "(_", "self_", ",_", "sub_", ",_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "index", " ", "of", " ", "sub", " ", "in", " ", "bytes", ".", "\\", "10", ";", " ", " ", " ", " ", "Rai", "ses", " ", "Value", "Error", " ", "if", " ", "byte", " ", "is", " ", "not", " ", "in", " ", "bytes", " ", "and", " ", "Type", "Error", " ", "if", " ", "can", "'", "t", "\\", "10", ";", " ", " ", " ", " ", "be", " ", "convert", "ed", " ", "bytes", " ", "or", " ", "its", " ", "length", " ", "is", " ", "not", " ", "1", ".", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "sub_", ",_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", ",_", "end_", "=_", "0_", ",_", "len_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "args_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", "=_", "args_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "len_", "(_", "args_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start_", ",_", "end_", "=_", "args_", "\\u\\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_", "(_", "'", "take", "s", " ", "at", " ", "most", " ", "3", " ", "argu", "ment", "s", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "list_", "(_", "self_", ")_", "[_", "start_", ":_", "end_", "]_", "._", "index_", "(_", "sub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "sub_", ",_", "bytes_", ")_", ":_", "\\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_", "=_", "self_", "._", "\\u\\u", "class\\u\\u_", "(_", "sub_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Type", "Error_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "\"", "can", "'", "t", " ", "convert", " ", "sub", " ", "to", " ", "bytes", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "index_", "(_", "sub_", ",_", "*_", "args_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", "'", "substring", " ", "not", " ", "found", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\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", "eq\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "(_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ",_", "bytearray_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "\\u\\u", "eq\\u\\u_", "(_", "other_", ")_", "\\u\\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_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\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", "ne\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "other_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "\\u\\u", "ne\\u\\u_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "lt\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isb", "ytes_", "(_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "self_", "._", "uno", "rder", "able", "\\u", "err_", "._", "format_", "(_", "type_", "(_", "other_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "\\u\\u", "lt\\u\\u_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "le", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isb", "ytes_", "(_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "self_", "._", "uno", "rder", "able", "\\u", "err_", "._", "format_", "(_", "type_", "(_", "other_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "\\u\\u", "le", "\\u\\u_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "gt", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isb", "ytes_", "(_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "self_", "._", "uno", "rder", "able", "\\u", "err_", "._", "format_", "(_", "type_", "(_", "other_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "\\u\\u", "gt", "\\u\\u_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "ge", "\\u\\u_", "(_", "self_", ",_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "isb", "ytes_", "(_", "other_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Type", "Error_", "(_", "self_", "._", "uno", "rder", "able", "\\u", "err_", "._", "format_", "(_", "type_", "(_", "other_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "\\u\\u", "ge", "\\u\\u_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "nativ", "e\\u", "\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "can", "'", "t", " ", "just", " ", "feed", " ", "a", " ", "newb", "ytes", " ", "object", " ", "int", "o", " ", "str", "()", ",", " ", "bec", "aus", "e_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "newb", "ytes", ".\\u", "\\u", "str", "\\u\\u()", " ", "return", "s", " ", "e", ".", "g", ".", " ", "\"", "b", "'", "bla", "h", "'\",", " ", "consistent", " ", "with", " ", "Py", "3", " ", "bytes", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "\\u\\u", "str\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "getattribute\\u\\u_", "(_", "self_", ",_", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "A", " ", "trick", " ", "to", " ", "caus", "e", " ", "the", " ", "``", "has", "attr", "``", " ", "bui", "lti", "n", "-", "fn", " ", "to", " ", "return", " ", "Fal", "se", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "'", "encode", "'", " ", "method", " ", "on", " ", "Py", "2", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "name_", "in_", "[_", "'", "encode", "'_", ",_", "u", "'", "encode", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Attribute", "Error_", "(_", "\"", "encode", " ", "method", " ", "has", " ", "bee", "n", " ", "disable", "d", " ", "in", " ", "newb", "ytes", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "\\u\\u", "getattribute\\u\\u_", "(_", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no_", "(_", "unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "rstrip_", "(_", "self_", ",_", "bytes", "\\u", "to", "\\u", "strip_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Strip", " ", "trail", "ing", " ", "bytes", " ", "contain", "ed", " ", "in", " ", "the", " ", "argu", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "argu", "ment", " ", "is", " ", "omit", "ted", ",", " ", "strip", " ", "trail", "ing", " ", "ASCII", " ", "whitespace", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "newb", "ytes_", "(_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "rstrip_", "(_", "bytes", "\\u", "to", "\\u", "strip_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no_", "(_", "unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "strip_", "(_", "self_", ",_", "bytes", "\\u", "to", "\\u", "strip_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Strip", " ", "lead", "ing", " ", "and", " ", "trail", "ing", " ", "bytes", " ", "contain", "ed", " ", "in", " ", "the", " ", "argu", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "the", " ", "argu", "ment", " ", "is", " ", "omit", "ted", ",", " ", "strip", " ", "trail", "ing", " ", "ASCII", " ", "whitespace", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "newb", "ytes_", "(_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "strip_", "(_", "bytes", "\\u", "to", "\\u", "strip_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "lower_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "b", ".", "lower", "()", " ", "->", " ", "copy", " ", "of", " ", "b", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "copy", " ", "of", " ", "b", " ", "with", " ", "all", " ", "ASCII", " ", "character", "s", " ", "convert", "ed", " ", "to", " ", "lower", "case", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "newb", "ytes_", "(_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "lower_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "no_", "(_", "unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "upper_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "b", ".", "upper", "()", " ", "->", " ", "copy", " ", "of", " ", "b", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "copy", " ", "of", " ", "b", " ", "with", " ", "all", " ", "ASCII", " ", "character", "s", " ", "convert", "ed", " ", "to", " ", "upper", "case", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "newb", "ytes_", "(_", "super_", "(_", "newb", "ytes_", ",_", "self_", ")_", "._", "upper_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "newb", "ytes_", "(_", "with", "\\u", "metaclass_", "(_", "Base", "New", "Bytes_", ",_", "\\u", "bui", "lti", "n", "\\u", "bytes_", ")_", ")_", ":_", "\\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_", "@_", "no_", "(_", "unicode_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "maket", "rans_", "(_", "cls_", ",_", "frm_", ",_", "to_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "B", ".", "maket", "rans", "(", "frm", ",", " ", "to", ")", " ", "->", " ", "translatio", "n", " ", "table", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Return", " ", "a", " ", "translatio", "n", " ", "table", " ", "(", "a", " ", "bytes", " ", "object", " ", "of", " ", "length", " ", "256", ")", " ", "suit", "able", "\\", "10", ";", " ", " ", " ", " ", "for", " ", "use", " ", "in", " ", "the", " ", "bytes", " ", "or", " ", "bytea", "rray", " ", "translat", "e", " ", "method", " ", "where", " ", "each", " ", "byte", "\\", "10", ";", " ", " ", " ", " ", "in", " ", "frm", " ", "is", " ", "mapp", "ed", " ", "to", " ", "the", " ", "byte", " ", "at", " ", "the", " ", "same", " ", "position", " ", "in", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "bytes", " ", "object", "s", " ", "frm", " ", "and", " ", "to", " ", "must", " ", "be", " ", "of", " ", "the", " ", "same", " ", "length", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "newb", "ytes_", "(_", "string_", "._", "maket", "rans_", "(_", "frm_", ",_", "to_", ")_", ")_", "\\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,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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 ]
Unreachable code
saltstack/salt/salt/modules/boto_asg.py
[ { "content": "def get_instances(name, lifecycle_state=\"InService\", health_status=\"Healthy\",\n attribute=\"private_ip_address\", attributes=None, region=None,\n key=None, keyid=None, profile=None):\n '''\n return attribute of all instances in the named autoscale group.\n\n CLI example::\n\n salt-call boto_asg.get_instances my_autoscale_group_name\n\n '''\n conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)\n ec2_conn = _get_ec2_conn(region=region, key=key, keyid=keyid, profile=profile)\n try:\n asgs = conn.get_all_groups(names=[name])\n except boto.exception.BotoServerError as e:\n log.debug(e)\n return False\n if len(asgs) != 1:\n log.debug(\"name '{0}' returns multiple ASGs: {1}\".format(name, [asg.name for asg in asgs]))\n return False\n asg = asgs[0]\n instance_ids = []\n # match lifecycle_state and health_status\n for i in asg.instances:\n if lifecycle_state is not None and i.lifecycle_state != lifecycle_state:\n continue\n if health_status is not None and i.health_status != health_status:\n continue\n instance_ids.append(i.instance_id)\n # get full instance info, so that we can return the attribute\n instances = ec2_conn.get_only_instances(instance_ids=instance_ids)\n if attributes:\n return [[getattr(instance, attr).encode(\"ascii\") for attr in attributes] for instance in instances]\n else:\n # properly handle case when not all instances have the requested attribute\n return [getattr(instance, attribute).encode(\"ascii\") for instance in instances if getattr(instance, attribute)]\n return [getattr(instance, attribute).encode(\"ascii\") for instance in instances]", "metadata": "root.get_instances", "header": "['module', '___EOS___']", "index": 584 } ]
[ { "span": "return [getattr(instance, attribute).encode(\"ascii\") for instance in instances]", "start_line": 621, "start_column": 4, "end_line": 621, "end_column": 83 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "get", "\\u", "instances_", "(_", "name_", ",_", "lifecycle", "\\u", "state_", "=_", "\"", "In", "Service", "\"_", ",_", "health", "\\u", "status_", "=_", "\"", "Health", "y", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "attribute_", "=_", "\"", "private", "\\u", "ip", "\\u", "address", "\"_", ",_", "attributes_", "=_", "None_", ",_", "region_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "key_", "=_", "None_", ",_", "keyid", "_", "=_", "None_", ",_", "profile_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "return", " ", "attribute", " ", "of", " ", "all", " ", "instance", "s", " ", "in", " ", "the", " ", "named", " ", "autoscale", " ", "group", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "CLI", " ", "example", "::", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "salt", "-", "call", " ", "boto", "\\u", "asg", ".", "get", "\\u", "instance", "s", " ", "my", "\\u", "autoscale", "\\u", "group", "\\u", "name", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conn_", "=_", "\\u", "get", "\\u", "conn_", "(_", "region_", "=_", "region_", ",_", "key_", "=_", "key_", ",_", "keyid", "_", "=_", "keyid", "_", ",_", "profile_", "=_", "profile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ec", "2", "\\u", "conn_", "=_", "\\u", "get", "\\u", "ec", "2", "\\u", "conn_", "(_", "region_", "=_", "region_", ",_", "key_", "=_", "key_", ",_", "keyid", "_", "=_", "keyid", "_", ",_", "profile_", "=_", "profile_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "asg", "s_", "=_", "conn_", "._", "get", "\\u", "all", "\\u", "groups_", "(_", "names_", "=_", "[_", "name_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "boto_", "._", "exception_", "._", "Bot", "o", "Server", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "asg", "s_", ")_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "\"", "name", " ", "'{", "0", "}'", " ", "return", "s", " ", "multiple", " ", "AS", "Gs", ":", " ", "{", "1", "}\"_", "._", "format_", "(_", "name_", ",_", "[_", "asg", "_", "._", "name_", "for_", "asg", "_", "in_", "asg", "s_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "asg", "_", "=_", "asg", "s_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "instance", "\\u", "ids_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "match", " ", "lifecycle", "\\u", "state", " ", "and", " ", "health", "\\u", "status_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "i_", "in_", "asg", "_", "._", "instances_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "lifecycle", "\\u", "state_", "is_", "not_", "None_", "and_", "i_", "._", "lifecycle", "\\u", "state_", "!=_", "lifecycle", "\\u", "state_", ":_", "\\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_", "health", "\\u", "status_", "is_", "not_", "None_", "and_", "i_", "._", "health", "\\u", "status_", "!=_", "health", "\\u", "status_", ":_", "\\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_", "instance", "\\u", "ids_", "._", "append_", "(_", "i_", "._", "instance", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "get", " ", "full", " ", "instance", " ", "info", ",", " ", "so", " ", "tha", "t", " ", "we", " ", "can", " ", "return", " ", "the", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "instances_", "=_", "ec", "2", "\\u", "conn_", "._", "get", "\\u", "only", "\\u", "instances_", "(_", "instance", "\\u", "ids_", "=_", "instance", "\\u", "ids_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "attributes_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "[_", "getattr_", "(_", "instance_", ",_", "attr_", ")_", "._", "encode_", "(_", "\"", "ascii", "\"_", ")_", "for_", "attr_", "in_", "attributes_", "]_", "for_", "instance_", "in_", "instances_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "proper", "ly", " ", "handle", " ", "case", " ", "whe", "n", " ", "not", " ", "all", " ", "instance", "s", " ", "have", " ", "the", " ", "request", "ed", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "getattr_", "(_", "instance_", ",_", "attribute_", ")_", "._", "encode_", "(_", "\"", "ascii", "\"_", ")_", "for_", "instance_", "in_", "instances_", "if_", "getattr_", "(_", "instance_", ",_", "attribute_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "getattr_", "(_", "instance_", ",_", "attribute_", ")_", "._", "encode_", "(_", "\"", "ascii", "\"_", ")_", "for_", "instance_", "in_", "instances_", "]_" ]
[ 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,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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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Unused import
pyjs/pyjs/pyjswidgets/pyjamas/ui/MouseListener.py
[ { "content": "# Copyright 2006 James Tauber and contributors\n# Copyright (C) 2009 Luke Kenneth Casson Leighton <[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.\nfrom pyjamas import DOM\nfrom pyjamas.ui import Event\nfrom pyjamas.EventController import Handler\n\n\nMOUSE_EVENTS = [ \"mousedown\", \"mouseup\", \"mousemove\", \"mouseover\", \"mouseout\"]\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def fireMouseEvent(listeners, sender, event):\n x = DOM.eventGetClientX(event) - DOM.getAbsoluteLeft(sender.getElement())\n y = DOM.eventGetClientY(event) - DOM.getAbsoluteTop(sender.getElement())\n\n etype = DOM.eventGetType(event)\n if etype == \"mousedown\":\n for listener in listeners:\n listener.onMouseDown(sender, x, y)\n return True\n elif etype == \"mouseup\":\n for listener in listeners:\n listener.onMouseUp(sender, x, y)\n return True\n elif etype == \"mousemove\":\n for listener in listeners:\n listener.onMouseMove(sender, x, y)\n return True\n elif etype == \"mouseover\":\n to_element = DOM.eventGetToElement(event)\n if to_element and not DOM.isOrHasChild(sender.getElement(), to_element):\n for listener in listeners:\n listener.onMouseEnter(sender)\n return True\n elif etype == \"mouseout\":\n to_element = DOM.eventGetToElement(event)\n if to_element and not DOM.isOrHasChild(sender.getElement(), to_element):\n for listener in listeners:\n listener.onMouseLeave(sender)\n return True\n return False", "metadata": "root.fireMouseEvent", "header": "['module', '___EOS___']", "index": 18 }, { "content": "class MouseHandler(object):\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root.MouseHandler", "header": "['module', '___EOS___']", "index": 51 }, { "content": " def __init__(self, preventDefault=False):\n\n self._mouseListeners = []\n self._mousePreventDefault = preventDefault\n self.sinkEvents( Event.MOUSEEVENTS )", "metadata": "root.MouseHandler.__init__", "header": "['class', 'MouseHandler', '(', 'object', ')', ':', '___EOS___']", "index": 53 }, { "content": " def onBrowserEvent(self, event):\n etype = DOM.eventGetType(event)\n if etype in MOUSE_EVENTS:\n if self._mousePreventDefault:\n DOM.eventPreventDefault(event)\n return fireMouseEvent(self._mouseListeners, self, event)\n return False", "metadata": "root.MouseHandler.onBrowserEvent", "header": "['class', 'MouseHandler', '(', 'object', ')', ':', '___EOS___']", "index": 59 }, { "content": " def addMouseListener(self, listener):\n self._mouseListeners.append(listener)", "metadata": "root.MouseHandler.addMouseListener", "header": "['class', 'MouseHandler', '(', 'object', ')', ':', '___EOS___']", "index": 67 }, { "content": " def removeMouseListener(self, listener):\n self._mouseListeners.remove(listener)", "metadata": "root.MouseHandler.removeMouseListener", "header": "['class', 'MouseHandler', '(', 'object', ')', ':', '___EOS___']", "index": 70 }, { "content": " def onMouseMove(self, sender, x, y):\n pass", "metadata": "root.MouseHandler.onMouseMove", "header": "['class', 'MouseHandler', '(', 'object', ')', ':', '___EOS___']", "index": 73 }, { "content": " def onMouseDown(self, sender, x, y):\n pass", "metadata": "root.MouseHandler.onMouseDown", "header": "['class', 'MouseHandler', '(', 'object', ')', ':', '___EOS___']", "index": 76 }, { "content": " def onMouseUp(self, sender, x, y):\n pass", "metadata": "root.MouseHandler.onMouseUp", "header": "['class', 'MouseHandler', '(', 'object', ')', ':', '___EOS___']", "index": 79 }, { "content": " def onMouseEnter(self, sender):\n pass", "metadata": "root.MouseHandler.onMouseEnter", "header": "['class', 'MouseHandler', '(', 'object', ')', ':', '___EOS___']", "index": 82 }, { "content": " def onMouseLeave(self, sender):\n pass", "metadata": "root.MouseHandler.onMouseLeave", "header": "['class', 'MouseHandler', '(', 'object', ')', ':', '___EOS___']", "index": 85 }, { "content": " def onMouseGlassEnter(self, sender):\n pass", "metadata": "root.MouseHandler.onMouseGlassEnter", "header": "['class', 'MouseHandler', '(', 'object', ')', ':', '___EOS___']", "index": 88 }, { "content": " def onMouseGlassLeave(self, sender):\n pass", "metadata": "root.MouseHandler.onMouseGlassLeave", "header": "['class', 'MouseHandler', '(', 'object', ')', ':', '___EOS___']", "index": 91 }, { "content": "class MouseWheelHandler(object):\n\n\n\n\n", "metadata": "root.MouseWheelHandler", "header": "['module', '___EOS___']", "index": 94 }, { "content": " def __init__(self, preventDefault=False):\n\n self._mouseWheelListeners = []\n self._mouseWheelPreventDefault = preventDefault\n self.sinkEvents( Event.ONMOUSEWHEEL )", "metadata": "root.MouseWheelHandler.__init__", "header": "['class', 'MouseWheelHandler', '(', 'object', ')', ':', '___EOS___']", "index": 96 }, { "content": " def onBrowserEvent(self, event):\n etype = DOM.eventGetType(event)\n if etype == \"mousewheel\":\n if self._mouseWheelPreventDefault:\n DOM.eventPreventDefault(event)\n velocity = DOM.eventGetMouseWheelVelocityY(event)\n for listener in self._mouseWheelListeners:\n listener.onMouseWheel(self, velocity)\n return True", "metadata": "root.MouseWheelHandler.onBrowserEvent", "header": "['class', 'MouseWheelHandler', '(', 'object', ')', ':', '___EOS___']", "index": 102 }, { "content": " def addMouseWheelListener(self, listener):\n self._mouseWheelListeners.append(listener)", "metadata": "root.MouseWheelHandler.addMouseWheelListener", "header": "['class', 'MouseWheelHandler', '(', 'object', ')', ':', '___EOS___']", "index": 112 }, { "content": " def removeMouseWheelListener(self, listener):\n self._mouseWheelListeners.remove(listener)", "metadata": "root.MouseWheelHandler.removeMouseWheelListener", "header": "['class', 'MouseWheelHandler', '(', 'object', ')', ':', '___EOS___']", "index": 115 }, { "content": " def onMouseWheel(self, sender, velocity):\n pass", "metadata": "root.MouseWheelHandler.onMouseWheel", "header": "['class', 'MouseWheelHandler', '(', 'object', ')', ':', '___EOS___']", "index": 118 } ]
[ { "span": "from pyjamas.EventController import Handler", "start_line": 16, "start_column": 0, "end_line": 16, "end_column": 43 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "2006", " ", "Jam", "es", " ", "Tau", "ber", " ", "and", " ", "contributor", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "200", "9", " ", "Lu", "ke", " ", "Ken", "net", "h", " ", "Cass", "on", " ", "Lei", "ght", "on", " ", "<", "lk", "cl", "@", "lk", "cl", ".", "net", ">_", "\\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_", "from_", "pyj", "ama", "s_", "import_", "DOM_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "ui_", "import_", "Event_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "pyj", "ama", "s_", "._", "Event", "Controller_", "import_", "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\\uDEDENT\\u\\u\\u_", "MOUSE", "\\u", "EVENTS", "_", "=_", "[_", "\"", "mouse", "down", "\"_", ",_", "\"", "mouse", "up", "\"_", ",_", "\"", "mouse", "move", "\"_", ",_", "\"", "mouse", "over", "\"_", ",_", "\"", "mouse", "out", "\"_", "]_", "\\u\\u\\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_", "def_", "fire", "Mouse", "Event_", "(_", "listeners_", ",_", "sender_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "x_", "=_", "DOM_", "._", "event", "Get", "Client", "X_", "(_", "event_", ")_", "-_", "DOM_", "._", "get", "Abs", "olute", "Left_", "(_", "sender_", "._", "get", "Element_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "DOM_", "._", "event", "Get", "Client", "Y_", "(_", "event_", ")_", "-_", "DOM_", "._", "get", "Abs", "olute", "Top_", "(_", "sender_", "._", "get", "Element_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "etype_", "=_", "DOM_", "._", "event", "Get", "Type_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "etype_", "==_", "\"", "mouse", "down", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "listener_", "in_", "listeners_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "listener_", "._", "on", "Mouse", "Down_", "(_", "sender_", ",_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "etype_", "==_", "\"", "mouse", "up", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "listener_", "in_", "listeners_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "listener_", "._", "on", "Mouse", "Up_", "(_", "sender_", ",_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "etype_", "==_", "\"", "mouse", "move", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "listener_", "in_", "listeners_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "listener_", "._", "on", "Mouse", "Move_", "(_", "sender_", ",_", "x_", ",_", "y_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "etype_", "==_", "\"", "mouse", "over", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "element_", "=_", "DOM_", "._", "event", "Get", "To", "Element_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "to", "\\u", "element_", "and_", "not_", "DOM_", "._", "is", "Or", "Has", "Child_", "(_", "sender_", "._", "get", "Element_", "(_", ")_", ",_", "to", "\\u", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "listener_", "in_", "listeners_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "listener_", "._", "on", "Mouse", "Enter", "_", "(_", "sender_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "etype_", "==_", "\"", "mouse", "out", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "to", "\\u", "element_", "=_", "DOM_", "._", "event", "Get", "To", "Element_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "to", "\\u", "element_", "and_", "not_", "DOM_", "._", "is", "Or", "Has", "Child_", "(_", "sender_", "._", "get", "Element_", "(_", ")_", ",_", "to", "\\u", "element_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "listener_", "in_", "listeners_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "listener_", "._", "on", "Mouse", "Leav", "e_", "(_", "sender_", ")_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Mouse", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mouse", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "prevent", "Default_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mouse", "Listen", "ers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mouse", "Prev", "ent", "Default_", "=_", "prevent", "Default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sink", "Events_", "(_", "Event_", "._", "MOUSE", "EVENTS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mouse", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Brows", "er", "Event_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etype_", "=_", "DOM_", "._", "event", "Get", "Type_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "etype_", "in_", "MOUSE", "\\u", "EVENTS", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "mouse", "Prev", "ent", "Default_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "DOM_", "._", "event", "Prev", "ent", "Default_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "fire", "Mouse", "Event_", "(_", "self_", "._", "\\u", "mouse", "Listen", "ers_", ",_", "self_", ",_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mouse", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "Mouse", "Listener_", "(_", "self_", ",_", "listener_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mouse", "Listen", "ers_", "._", "append_", "(_", "listener_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mouse", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "Mouse", "Listener_", "(_", "self_", ",_", "listener_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mouse", "Listen", "ers_", "._", "remove_", "(_", "listener_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mouse", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Mouse", "Move_", "(_", "self_", ",_", "sender_", ",_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mouse", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Mouse", "Down_", "(_", "self_", ",_", "sender_", ",_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mouse", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Mouse", "Up_", "(_", "self_", ",_", "sender_", ",_", "x_", ",_", "y_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mouse", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Mouse", "Enter", "_", "(_", "self_", ",_", "sender_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mouse", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Mouse", "Leav", "e_", "(_", "self_", ",_", "sender_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mouse", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Mouse", "Gla", "ss", "Enter", "_", "(_", "self_", ",_", "sender_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mouse", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Mouse", "Gla", "ss", "Leav", "e_", "(_", "self_", ",_", "sender_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Mouse", "Whe", "el", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Mouse", "Whe", "el", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "prevent", "Default_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mouse", "Whe", "el", "Listen", "ers_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "mouse", "Whe", "el", "Prev", "ent", "Default_", "=_", "prevent", "Default_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sink", "Events_", "(_", "Event_", "._", "ON", "MOUSE", "WHE", "EL_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mouse", "Whe", "el", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Brows", "er", "Event_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "etype_", "=_", "DOM_", "._", "event", "Get", "Type_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "etype_", "==_", "\"", "mouse", "wheel", "\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u", "mouse", "Whe", "el", "Prev", "ent", "Default_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "DOM_", "._", "event", "Prev", "ent", "Default_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "velocity_", "=_", "DOM_", "._", "event", "Get", "Mouse", "Whe", "el", "Velocity", "Y_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "listener_", "in_", "self_", "._", "\\u", "mouse", "Whe", "el", "Listen", "ers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "listener_", "._", "on", "Mouse", "Whe", "el_", "(_", "self_", ",_", "velocity_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mouse", "Whe", "el", "Handler_", "(_", "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_", "add", "Mouse", "Whe", "el", "Listener_", "(_", "self_", ",_", "listener_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mouse", "Whe", "el", "Listen", "ers_", "._", "append_", "(_", "listener_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mouse", "Whe", "el", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "remove", "Mouse", "Whe", "el", "Listener_", "(_", "self_", ",_", "listener_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "mouse", "Whe", "el", "Listen", "ers_", "._", "remove_", "(_", "listener_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mouse", "Whe", "el", "Handler_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "on", "Mouse", "Whe", "el_", "(_", "self_", ",_", "sender_", ",_", "velocity_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
rsms/smisk/lib/smisk/serialization/all.py
[ { "content": "# encoding: utf-8\n# Load as many built-in serializers as possible\nimport smisk.serialization.json, \\\n smisk.serialization.php_serial, \\\n smisk.serialization.plain_text, \\\n smisk.serialization.plist, \\\n smisk.serialization.python_pickle, \\\n smisk.serialization.python_py, \\\n smisk.serialization.xhtml, \\\n smisk.serialization.xmlgeneric, \\\n smisk.serialization.xmlrpc, \\\n smisk.serialization.xspf, \\\n smisk.serialization.yaml_serial\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import smisk.serialization.json, \\\n smisk.serialization.php_serial, \\\n smisk.serialization.plain_text, \\\n smisk.serialization.plist, \\\n smisk.serialization.python_pickle, \\\n smisk.serialization.python_py, \\\n smisk.serialization.xhtml, \\\n smisk.serialization.xmlgeneric, \\\n smisk.serialization.xmlrpc, \\\n smisk.serialization.xspf, \\\n smisk.serialization.yaml_serial", "start_line": 2, "start_column": 0, "end_line": 12, "end_column": 38 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "encoding", ":", " ", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Load", " ", "as", " ", "many", " ", "bui", "lt", "-", "in", " ", "serialize", "rs", " ", "as", " ", "possible_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "smi", "sk_", "._", "serialization_", "._", "json_", ",_", "smi", "sk_", "._", "serialization_", "._", "php", "\\u", "serial_", ",_", "smi", "sk_", "._", "serialization_", "._", "plain", "\\u", "text_", ",_", "smi", "sk_", "._", "serialization_", "._", "plist_", ",_", "smi", "sk_", "._", "serialization_", "._", "python", "\\u", "pickle_", ",_", "smi", "sk_", "._", "serialization_", "._", "python", "\\u", "py_", ",_", "smi", "sk_", "._", "serialization_", "._", "xh", "tml_", ",_", "smi", "sk_", "._", "serialization_", "._", "xml", "generic_", ",_", "smi", "sk_", "._", "serialization_", "._", "xmlrpc", "_", ",_", "smi", "sk_", "._", "serialization_", "._", "xsp", "f_", ",_", "smi", "sk_", "._", "serialization_", "._", "yaml", "\\u", "serial_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 ]
Except block handles 'BaseException'
azoft-dev-team/imagrium/env/Lib/isql.py
[ { "content": " def do_p(self, arg):\n \"\"\"\\nExecute a python expression.\\n\"\"\"\n try:\n exec arg.strip() in globals()\n except:\n print sys.exc_info()[1]\n return False", "metadata": "root.IsqlCmd.do_p", "header": "['class', 'IsqlCmd', '(', 'cmd', '.', 'Cmd', ')', ':', '___EOS___']", "index": 61 }, { "content": " def default(self, arg):\n try:\n token = arg.strip()\n if not token:\n return False\n comment = [token.startswith(x) for x in self.comment]\n if reduce(lambda x,y: x or y, comment):\n return False\n if token[0] == '\\\\':\n token = token[1:]\n # is it possible the line contains the delimiter\n if len(token) >= len(self.delimiter):\n # does the line end with the delimiter\n if token[-1 * len(self.delimiter):] == self.delimiter:\n # now add all up to the delimiter\n self.sqlbuffer.append(token[:-1 * len(self.delimiter)])\n if self.sqlbuffer:\n q = \" \".join(self.sqlbuffer)\n print q\n self.db.isql(q, **self.kw)\n self.sqlbuffer = []\n if self.db.updatecount:\n print\n if self.db.updatecount == 1:\n print \"1 row affected\"\n else:\n print \"%d rows affected\" % (self.db.updatecount)\n print\n return False\n if token:\n self.sqlbuffer.append(token)\n except:\n self.sqlbuffer = []\n print\n print sys.exc_info()[1]\n print\n return False", "metadata": "root.IsqlCmd.default", "header": "['class', 'IsqlCmd', '(', 'cmd', '.', 'Cmd', ')', ':', '___EOS___']", "index": 159 } ]
[ { "span": "except:", "start_line": 65, "start_column": 8, "end_line": 65, "end_column": 15 }, { "span": "except:", "start_line": 190, "start_column": 8, "end_line": 190, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Is", "ql", "Cmd_", "(_", "cmd_", "._", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "do", "\\u", "p_", "(_", "self_", ",_", "arg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\\\", "n", "Execut", "e", " ", "a", " ", "python", " ", "express", "ion", ".\\\\", "n", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "exec_", "arg_", "._", "strip_", "(_", ")_", "in_", "globals_", "(_", ")_", "\\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_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Is", "ql", "Cmd_", "(_", "cmd_", "._", "Cmd_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "default_", "(_", "self_", ",_", "arg_", ")_", ":_", "\\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 ", " _", "token_", "=_", "arg_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "token_", ":_", "\\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_", "comment_", "=_", "[_", "token_", "._", "startswith_", "(_", "x_", ")_", "for_", "x_", "in_", "self_", "._", "comment_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "reduce_", "(_", "lambda_", "x_", ",_", "y_", ":_", "x_", "or_", "y_", ",_", "comment_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "token_", "[_", "0_", "]_", "==_", "'\\\\\\\\'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "token_", "=_", "token_", "[_", "1_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "is", " ", "it", " ", "possib", "le", " ", "the", " ", "line", " ", "contain", "s", " ", "the", " ", "delimiter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "token_", ")_", ">=_", "len_", "(_", "self_", "._", "delimiter_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "doe", "s", " ", "the", " ", "line", " ", "end", " ", "with", " ", "the", " ", "delimiter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "token_", "[_", "-_", "1_", "*_", "len_", "(_", "self_", "._", "delimiter_", ")_", ":_", "]_", "==_", "self_", "._", "delimiter_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "now", " ", "add", " ", "all", " ", "up", " ", "to", " ", "the", " ", "delimiter_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "sql", "buffer_", "._", "append_", "(_", "token_", "[_", ":_", "-_", "1_", "*_", "len_", "(_", "self_", "._", "delimiter_", ")_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "sql", "buffer_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "q_", "=_", "\"", " ", "\"_", "._", "join_", "(_", "self_", "._", "sql", "buffer_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "q_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "db_", "._", "is", "ql_", "(_", "q_", ",_", "**_", "self_", "._", "kw_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sql", "buffer_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "db_", "._", "update", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "db_", "._", "update", "count_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"", "1", " ", "row", " ", "affect", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "print_", "\"%", "d", " ", "rows", " ", "affect", "ed", "\"_", "%_", "(_", "self_", "._", "db_", "._", "update", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\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_", "token_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sql", "buffer_", "._", "append_", "(_", "token_", ")_", "\\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_", "._", "sql", "buffer_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,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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, 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 ]
Unused import
ipython/ipython-py3k/IPython/core/tests/test_iplib.py
[ { "content": "\"\"\"Tests for the key interactiveshell module, where the main ipython class is defined.\n\"\"\"\n#-----------------------------------------------------------------------------\n# Module imports\n#-----------------------------------------------------------------------------\n\n# stdlib\nimport os\nimport shutil\nimport tempfile\n\n# third party\nimport nose.tools as nt\n\n# our own packages\nfrom IPython.testing import decorators as dec\nfrom IPython.testing.globalipapp import get_ipython\n\n#-----------------------------------------------------------------------------\n# Globals\n#-----------------------------------------------------------------------------\n\n# Get the public instance of IPython\nip = get_ipython()\n\n#-----------------------------------------------------------------------------\n# Test functions\n#-----------------------------------------------------------------------------\n\n\n\n# Tests for reporting of exceptions in various modes, handling of SystemExit,\n# and %tb functionality. This is really a mix of testing ultraTB and interactiveshell.\n\n\n\n\n\n\n\n\n\n \n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@dec.parametric\ndef test_reset():\n \"\"\"reset must clear most namespaces.\"\"\"\n # The number of variables in the private user_ns_hidden is not zero, but it\n # should be constant regardless of what we do\n nvars_config_ns = len(ip.user_ns_hidden)\n\n # Check that reset runs without error\n ip.reset()\n\n # Once we've reset it (to clear of any junk that might have been there from\n # other tests, we can count how many variables are in the user's namespace\n nvars_user_ns = len(ip.user_ns)\n\n # Now add a few variables to user_ns, and check that reset clears them\n ip.user_ns['x'] = 1\n ip.user_ns['y'] = 1\n ip.reset()\n \n # Finally, check that all namespaces have only as many variables as we\n # expect to find in them:\n for ns in ip.ns_refs_table:\n if ns is ip.user_ns:\n nvars_expected = nvars_user_ns\n elif ns is ip.user_ns_hidden:\n nvars_expected = nvars_config_ns\n else:\n nvars_expected = 0\n \n yield nt.assert_equals(len(ns), nvars_expected)", "metadata": "root.test_reset", "header": "['module', '___EOS___']", "index": 29 }, { "content": "def doctest_tb_plain():\n \"\"\"\nIn [18]: xmode plain\nException reporting mode: Plain\n\nIn [19]: run simpleerr.py\nTraceback (most recent call last):\n ...line 32, in <module>\n bar(mode)\n ...line 16, in bar\n div0()\n ...line 8, in div0\n x/y\nZeroDivisionError: division by zero\n \"\"\"", "metadata": "root.doctest_tb_plain", "header": "['module', '___EOS___']", "index": 64 }, { "content": "def doctest_tb_context():\n \"\"\"\nIn [3]: xmode context\nException reporting mode: Context\n\nIn [4]: run simpleerr.py\n---------------------------------------------------------------------------\nZeroDivisionError Traceback (most recent call last)\n<BLANKLINE>\n... in <module>()\n 30 mode = 'div'\n 31 \n---> 32 bar(mode)\n<BLANKLINE>\n... in bar(mode)\n 14 \"bar\"\n 15 if mode=='div':\n---> 16 div0()\n 17 elif mode=='exit':\n 18 try:\n<BLANKLINE>\n... in div0()\n 6 x = 1\n 7 y = 0\n----> 8 x/y\n 9 \n 10 def sysexit(stat, mode):\n<BLANKLINE>\nZeroDivisionError: division by zero\n\"\"\"", "metadata": "root.doctest_tb_context", "header": "['module', '___EOS___']", "index": 81 }, { "content": "def doctest_tb_verbose():\n \"\"\"\nIn [5]: xmode verbose\nException reporting mode: Verbose\n\nIn [6]: run simpleerr.py\n---------------------------------------------------------------------------\nZeroDivisionError Traceback (most recent call last)\n<BLANKLINE>\n... in <module>()\n 30 mode = 'div'\n 31 \n---> 32 bar(mode)\n global bar = <function bar at ...>\n global mode = 'div'\n<BLANKLINE>\n... in bar(mode='div')\n 14 \"bar\"\n 15 if mode=='div':\n---> 16 div0()\n global div0 = <function div0 at ...>\n 17 elif mode=='exit':\n 18 try:\n<BLANKLINE>\n... in div0()\n 6 x = 1\n 7 y = 0\n----> 8 x/y\n x = 1\n y = 0\n 9 \n 10 def sysexit(stat, mode):\n<BLANKLINE>\nZeroDivisionError: division by zero\n \"\"\"", "metadata": "root.doctest_tb_verbose", "header": "['module', '___EOS___']", "index": 113 }, { "content": "def doctest_tb_sysexit():\n \"\"\"\nIn [17]: %xmode plain\nException reporting mode: Plain\n\nIn [18]: %run simpleerr.py exit\nAn exception has occurred, use %tb to see the full traceback.\nSystemExit: (1, 'Mode = exit')\n\nIn [19]: %run simpleerr.py exit 2\nAn exception has occurred, use %tb to see the full traceback.\nSystemExit: (2, 'Mode = exit')\n\nIn [20]: %tb\nTraceback (most recent call last):\n File ... in <module>\n bar(mode)\n File ... line 22, in bar\n sysexit(stat, mode)\n File ... line 11, in sysexit\n raise SystemExit(stat, 'Mode = %s' % mode)\nSystemExit: (2, 'Mode = exit')\n\nIn [21]: %xmode context\nException reporting mode: Context\n\nIn [22]: %tb\n---------------------------------------------------------------------------\nSystemExit Traceback (most recent call last)\n<BLANKLINE>\n...<module>()\n 30 mode = 'div'\n 31 \n---> 32 bar(mode)\n<BLANKLINE>\n...bar(mode)\n 20 except:\n 21 stat = 1\n---> 22 sysexit(stat, mode)\n 23 else:\n 24 raise ValueError('Unknown mode')\n<BLANKLINE>\n...sysexit(stat, mode)\n 9 \n 10 def sysexit(stat, mode):\n---> 11 raise SystemExit(stat, 'Mode = %s' % mode)\n 12 \n 13 def bar(mode):\n<BLANKLINE>\nSystemExit: (2, 'Mode = exit')\n\nIn [23]: %xmode verbose\nException reporting mode: Verbose\n\nIn [24]: %tb\n---------------------------------------------------------------------------\nSystemExit Traceback (most recent call last)\n<BLANKLINE>\n... in <module>()\n 30 mode = 'div'\n 31 \n---> 32 bar(mode)\n global bar = <function bar at ...>\n global mode = 'exit'\n<BLANKLINE>\n... in bar(mode='exit')\n 20 except:\n 21 stat = 1\n---> 22 sysexit(stat, mode)\n global sysexit = <function sysexit at ...>\n stat = 2\n mode = 'exit'\n 23 else:\n 24 raise ValueError('Unknown mode')\n<BLANKLINE>\n... in sysexit(stat=2, mode='exit')\n 9 \n 10 def sysexit(stat, mode):\n---> 11 raise SystemExit(stat, 'Mode = %s' % mode)\n global SystemExit = undefined\n stat = 2\n mode = 'exit'\n 12 \n 13 def bar(mode):\n<BLANKLINE>\nSystemExit: (2, 'Mode = exit')\n \"\"\"", "metadata": "root.doctest_tb_sysexit", "header": "['module', '___EOS___']", "index": 150 }, { "content": "def test_run_cell():\n import textwrap\n ip.run_cell('a = 10\\na+=1')\n ip.run_cell('assert a == 11\\nassert 1')\n\n nt.assert_equals(ip.user_ns['a'], 11)\n complex = textwrap.dedent(\"\"\"\n if 1:\n print \"hello\"\n if 1:\n print \"world\"\n \n if 2:\n print \"foo\"\n\n if 3:\n print \"bar\"\n\n if 4:\n print \"bar\"\n \n \"\"\")\n # Simply verifies that this kind of input is run\n ip.run_cell(complex)", "metadata": "root.test_run_cell", "header": "['module', '___EOS___']", "index": 239 }, { "content": "def test_db():\n \"\"\"Test the internal database used for variable persistence.\"\"\"\n ip.db['__unittest_'] = 12\n nt.assert_equals(ip.db['__unittest_'], 12)\n del ip.db['__unittest_']\n assert '__unittest_' not in ip.db", "metadata": "root.test_db", "header": "['module', '___EOS___']", "index": 265 } ]
[ { "span": "import os", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 9 }, { "span": "import shutil", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 13 }, { "span": "import tempfile", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Test", "s", " ", "for", " ", "the", " ", "key", " ", "interactive", "shell", " ", "module", ",", " ", "where", " ", "the", " ", "main", " ", "ipython", " ", "class", " ", "is", " ", "defin", "ed", ".", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Modul", "e", " ", "imports_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "stdlib", "_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "tempfile_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "third", " ", "party_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "nose_", "._", "tools_", "as_", "nt_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "our", " ", "own", " ", "packages_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "IP", "ython_", "._", "testing_", "import_", "decorators_", "as_", "dec_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "IP", "ython_", "._", "testing_", "._", "global", "ipa", "pp_", "import_", "get", "\\u", "ipython", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Globals_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "public", " ", "instance", " ", "of", " ", "IP", "ython_", "\\u\\u\\uNL\\u\\u\\u_", "ip_", "=_", "get", "\\u", "ipython", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "functions_", "\\u\\u\\uNL\\u\\u\\u_", "#-", "--------------", "--------------", "--------------", "--------------", "--------------", "------", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", "s", " ", "for", " ", "reporting", " ", "of", " ", "exception", "s", " ", "in", " ", "vari", "ous", " ", "mode", "s", ",", " ", "handling", " ", "of", " ", "System", "Exi", "t", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "and", " ", "%", "tb", " ", "functional", "it", "y", ".", " ", " ", "Thi", "s", " ", "is", " ", "reall", "y", " ", "a", " ", "mix", " ", "of", " ", "testi", "ng", " ", "ultr", "a", "TB", " ", "and", " ", "interactive", "shell", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "@_", "dec_", "._", "parametr", "ic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "reset_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "reset", " ", "must", " ", "clear", " ", "most", " ", "namespace", "s", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "number", " ", "of", " ", "variab", "les", " ", "in", " ", "the", " ", "private", " ", "user", "\\u", "ns", "\\u", "hidden", " ", "is", " ", "not", " ", "zero", ",", " ", "but", " ", "it_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "shou", "ld", " ", "be", " ", "constant", " ", "rega", "rd", "less", " ", "of", " ", "what", " ", "we", " ", "do_", "\\u\\u\\uNL\\u\\u\\u_", "nvar", "s", "\\u", "config", "\\u", "ns_", "=_", "len_", "(_", "ip_", "._", "user", "\\u", "ns", "\\u", "hidden_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Check", " ", "tha", "t", " ", "reset", " ", "runs", " ", "with", "out", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "ip_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "On", "ce", " ", "we", "'", "ve", " ", "reset", " ", "it", " ", "(", "to", " ", "clear", " ", "of", " ", "any", " ", "junk", " ", "tha", "t", " ", "mig", "ht", " ", "have", " ", "bee", "n", " ", "there", " ", "from_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "other", " ", "tests", ",", " ", "we", " ", "can", " ", "count", " ", "how", " ", "many", " ", "variab", "les", " ", "are", " ", "in", " ", "the", " ", "user", "'", "s", " ", "namespace_", "\\u\\u\\uNL\\u\\u\\u_", "nvar", "s", "\\u", "user", "\\u", "ns_", "=_", "len_", "(_", "ip_", "._", "user", "\\u", "ns_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "No", "w", " ", "add", " ", "a", " ", "few", " ", "variab", "les", " ", "to", " ", "user", "\\u", "ns", ",", " ", "and", " ", "check", " ", "tha", "t", " ", "reset", " ", "clear", "s", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "ip_", "._", "user", "\\u", "ns_", "[_", "'", "x", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "user", "\\u", "ns_", "[_", "'", "y", "'_", "]_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "reset_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Final", "ly", ",", " ", "check", " ", "tha", "t", " ", "all", " ", "namespace", "s", " ", "have", " ", "only", " ", "as", " ", "many", " ", "variab", "les", " ", "as", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "expect", " ", "to", " ", "find", " ", "in", " ", "them", ":_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "ns_", "in_", "ip_", "._", "ns", "\\u", "refs", "\\u", "table_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "ns_", "is_", "ip_", "._", "user", "\\u", "ns_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nvar", "s", "\\u", "expected_", "=_", "nvar", "s", "\\u", "user", "\\u", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "ns_", "is_", "ip_", "._", "user", "\\u", "ns", "\\u", "hidden_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nvar", "s", "\\u", "expected_", "=_", "nvar", "s", "\\u", "config", "\\u", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nvar", "s", "\\u", "expected_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "yield_", "nt_", "._", "assert", "\\u", "equals_", "(_", "len_", "(_", "ns_", ")_", ",_", "nvar", "s", "\\u", "expected_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "docte", "st", "\\u", "tb", "\\u", "plain_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", "In", " ", "[", "1", "8", "]:", " ", "xm", "ode", " ", "plain", "\\", "10", ";", "Except", "ion", " ", "reporting", " ", "mode", ":", " ", "Plai", "n", "\\", "10", ";", "\\", "10", ";", "In", " ", "[", "1", "9", "]:", " ", "run", " ", "simple", "err", ".", "py", "\\", "10", ";", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", "):", "\\", "10", ";", " ", " ", "...", "line", " ", "32", ",", " ", "in", " ", "<", "module", ">", "\\", "10", ";", " ", " ", " ", " ", "bar", "(", "mode", ")", "\\", "10", ";", " ", " ", "...", "line", " ", "16", ",", " ", "in", " ", "bar", "\\", "10", ";", " ", " ", " ", " ", "div", "0", "()", "\\", "10", ";", " ", " ", "...", "line", " ", "8", ",", " ", "in", " ", "div", "0", "\\", "10", ";", " ", " ", " ", " ", "x", "/", "y", "\\", "10", ";", "Zero", "Divis", "ion", "Error", ":", " ", "divisi", "on", " ", "by", " ", "zero", "\\", "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_", "def_", "docte", "st", "\\u", "tb", "\\u", "context_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", "In", " ", "[", "3", "]:", " ", "xm", "ode", " ", "context", "\\", "10", ";", "Except", "ion", " ", "reporting", " ", "mode", ":", " ", "Context", "\\", "10", ";", "\\", "10", ";", "In", " ", "[", "4", "]:", " ", "run", " ", "simple", "err", ".", "py", "\\", "10", ";", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "\\", "10", ";", "Zero", "Divis", "ion", "Error", " ", " ", " ", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", ")", "\\", "10", ";<", "BLANK", "LINE", ">", "\\", "10", ";", "...", " ", "in", " ", "<", "module", ">(", ")", "\\", "10", ";", " ", "30", " ", " ", " ", " ", " ", "mode", " ", "=", " ", "'", "div", "'", "\\", "10", ";", " ", "3", "1", " ", "\\", "10", ";", "---", ">", " ", "32", " ", "bar", "(", "mode", ")", "\\", "10", ";<", "BLANK", "LINE", ">", "\\", "10", ";", "...", " ", "in", " ", "bar", "(", "mode", ")", "\\", "10", ";", " ", "14", " ", "\"", "bar", "\"", "\\", "10", ";", " ", "15", " ", "if", " ", "mode", "=='", "div", "':", "\\", "10", ";", "---", ">", " ", "16", " ", " ", " ", " ", " ", "div", "0", "()", "\\", "10", ";", " ", "1", "7", " ", "eli", "f", " ", "mode", "=='", "exit", "':", "\\", "10", ";", " ", "1", "8", " ", " ", " ", " ", " ", "try", ":", "\\", "10", ";<", "BLANK", "LINE", ">", "\\", "10", ";", "...", " ", "in", " ", "div", "0", "()", "\\", "10", ";", " ", " ", "6", " ", "x", " ", "=", " ", "1", "\\", "10", ";", " ", " ", "7", " ", "y", " ", "=", " ", "0", "\\", "10", ";", "----", ">", " ", "8", " ", "x", "/", "y", "\\", "10", ";", " ", " ", "9", " ", "\\", "10", ";", " ", "10", " ", "def", " ", "sys", "exit", "(", "stat", ",", " ", "mode", "):", "\\", "10", ";<", "BLANK", "LINE", ">", "\\", "10", ";", "Zero", "Divis", "ion", "Error", ":", " ", "divisi", "on", " ", "by", " ", "zero", "\\", "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_", "def_", "docte", "st", "\\u", "tb", "\\u", "verbose_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", "In", " ", "[", "5", "]:", " ", "xm", "ode", " ", "verbo", "se", "\\", "10", ";", "Except", "ion", " ", "reporting", " ", "mode", ":", " ", "Verbos", "e", "\\", "10", ";", "\\", "10", ";", "In", " ", "[", "6", "]:", " ", "run", " ", "simple", "err", ".", "py", "\\", "10", ";", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "\\", "10", ";", "Zero", "Divis", "ion", "Error", " ", " ", " ", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", ")", "\\", "10", ";<", "BLANK", "LINE", ">", "\\", "10", ";", "...", " ", "in", " ", "<", "module", ">(", ")", "\\", "10", ";", " ", "30", " ", " ", " ", " ", " ", "mode", " ", "=", " ", "'", "div", "'", "\\", "10", ";", " ", "3", "1", " ", "\\", "10", ";", "---", ">", " ", "32", " ", "bar", "(", "mode", ")", "\\", "10", ";", " ", " ", " ", " ", "global", " ", "bar", " ", "=", " ", "<", "function", " ", "bar", " ", "at", " ", "...", ">", "\\", "10", ";", " ", " ", " ", " ", "global", " ", "mode", " ", "=", " ", "'", "div", "'", "\\", "10", ";<", "BLANK", "LINE", ">", "\\", "10", ";", "...", " ", "in", " ", "bar", "(", "mode", "='", "div", "')", "\\", "10", ";", " ", "14", " ", "\"", "bar", "\"", "\\", "10", ";", " ", "15", " ", "if", " ", "mode", "=='", "div", "':", "\\", "10", ";", "---", ">", " ", "16", " ", " ", " ", " ", " ", "div", "0", "()", "\\", "10", ";", " ", " ", " ", " ", "global", " ", "div", "0", " ", "=", " ", "<", "function", " ", "div", "0", " ", "at", " ", "...", ">", "\\", "10", ";", " ", "1", "7", " ", "eli", "f", " ", "mode", "=='", "exit", "':", "\\", "10", ";", " ", "1", "8", " ", " ", " ", " ", " ", "try", ":", "\\", "10", ";<", "BLANK", "LINE", ">", "\\", "10", ";", "...", " ", "in", " ", "div", "0", "()", "\\", "10", ";", " ", " ", "6", " ", "x", " ", "=", " ", "1", "\\", "10", ";", " ", " ", "7", " ", "y", " ", "=", " ", "0", "\\", "10", ";", "----", ">", " ", "8", " ", "x", "/", "y", "\\", "10", ";", " ", " ", " ", " ", "x", " ", "=", " ", "1", "\\", "10", ";", " ", " ", " ", " ", "y", " ", "=", " ", "0", "\\", "10", ";", " ", " ", "9", " ", "\\", "10", ";", " ", "10", " ", "def", " ", "sys", "exit", "(", "stat", ",", " ", "mode", "):", "\\", "10", ";<", "BLANK", "LINE", ">", "\\", "10", ";", "Zero", "Divis", "ion", "Error", ":", " ", "divisi", "on", " ", "by", " ", "zero", "\\", "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_", "def_", "docte", "st", "\\u", "tb", "\\u", "sys", "exit_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", "In", " ", "[", "1", "7", "]:", " ", "%", "xm", "ode", " ", "plain", "\\", "10", ";", "Except", "ion", " ", "reporting", " ", "mode", ":", " ", "Plai", "n", "\\", "10", ";", "\\", "10", ";", "In", " ", "[", "1", "8", "]:", " ", "%", "run", " ", "simple", "err", ".", "py", " ", "exit", "\\", "10", ";", "An", " ", "exception", " ", "has", " ", "occur", "red", ",", " ", "use", " ", "%", "tb", " ", "to", " ", "see", " ", "the", " ", "full", " ", "traceback", ".", "\\", "10", ";", "System", "Exi", "t", ":", " ", "(", "1", ",", " ", "'", "Mode", " ", "=", " ", "exit", "')", "\\", "10", ";", "\\", "10", ";", "In", " ", "[", "1", "9", "]:", " ", "%", "run", " ", "simple", "err", ".", "py", " ", "exit", " ", "2", "\\", "10", ";", "An", " ", "exception", " ", "has", " ", "occur", "red", ",", " ", "use", " ", "%", "tb", " ", "to", " ", "see", " ", "the", " ", "full", " ", "traceback", ".", "\\", "10", ";", "System", "Exi", "t", ":", " ", "(", "2", ",", " ", "'", "Mode", " ", "=", " ", "exit", "')", "\\", "10", ";", "\\", "10", ";", "In", " ", "[", "20", "]:", " ", "%", "tb", "\\", "10", ";", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", "):", "\\", "10", ";", " ", " ", "File", " ", "...", " ", "in", " ", "<", "module", ">", "\\", "10", ";", " ", " ", " ", " ", "bar", "(", "mode", ")", "\\", "10", ";", " ", " ", "File", " ", "...", " ", "line", " ", "2", "2", ",", " ", "in", " ", "bar", "\\", "10", ";", " ", " ", " ", " ", "sys", "exit", "(", "stat", ",", " ", "mode", ")", "\\", "10", ";", " ", " ", "File", " ", "...", " ", "line", " ", "11", ",", " ", "in", " ", "sys", "exit", "\\", "10", ";", " ", " ", " ", " ", "raise", " ", "System", "Exi", "t", "(", "stat", ",", " ", "'", "Mode", " ", "=", " ", "%", "s", "'", " ", "%", " ", "mode", ")", "\\", "10", ";", "System", "Exi", "t", ":", " ", "(", "2", ",", " ", "'", "Mode", " ", "=", " ", "exit", "')", "\\", "10", ";", "\\", "10", ";", "In", " ", "[", "21", "]:", " ", "%", "xm", "ode", " ", "context", "\\", "10", ";", "Except", "ion", " ", "reporting", " ", "mode", ":", " ", "Context", "\\", "10", ";", "\\", "10", ";", "In", " ", "[", "2", "2", "]:", " ", "%", "tb", "\\", "10", ";", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "\\", "10", ";", "System", "Exi", "t", " ", " ", " ", " ", " ", " ", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", ")", "\\", "10", ";<", "BLANK", "LINE", ">", "\\", "10", ";", "...", "<", "module", ">(", ")", "\\", "10", ";", " ", "30", " ", " ", " ", " ", " ", "mode", " ", "=", " ", "'", "div", "'", "\\", "10", ";", " ", "3", "1", " ", "\\", "10", ";", "---", ">", " ", "32", " ", "bar", "(", "mode", ")", "\\", "10", ";<", "BLANK", "LINE", ">", "\\", "10", ";", "...", "bar", "(", "mode", ")", "\\", "10", ";", " ", "20", " ", " ", " ", " ", " ", "except", ":", "\\", "10", ";", " ", "21", " ", " ", " ", " ", " ", "stat", " ", "=", " ", "1", "\\", "10", ";", "---", ">", " ", "2", "2", " ", " ", " ", " ", " ", "sys", "exit", "(", "stat", ",", " ", "mode", ")", "\\", "10", ";", " ", "23", " ", "else", ":", "\\", "10", ";", " ", "24", " ", " ", " ", " ", " ", "raise", " ", "Value", "Error", "('", "Un", "know", "n", " ", "mode", "')", "\\", "10", ";<", "BLANK", "LINE", ">", "\\", "10", ";", "...", "sys", "exit", "(", "stat", ",", " ", "mode", ")", "\\", "10", ";", " ", " ", "9", " ", "\\", "10", ";", " ", "10", " ", "def", " ", "sys", "exit", "(", "stat", ",", " ", "mode", "):", "\\", "10", ";", "---", ">", " ", "11", " ", "raise", " ", "System", "Exi", "t", "(", "stat", ",", " ", "'", "Mode", " ", "=", " ", "%", "s", "'", " ", "%", " ", "mode", ")", "\\", "10", ";", " ", "1", "2", " ", "\\", "10", ";", " ", "13", " ", "def", " ", "bar", "(", "mode", "):", "\\", "10", ";<", "BLANK", "LINE", ">", "\\", "10", ";", "System", "Exi", "t", ":", " ", "(", "2", ",", " ", "'", "Mode", " ", "=", " ", "exit", "')", "\\", "10", ";", "\\", "10", ";", "In", " ", "[", "23", "]:", " ", "%", "xm", "ode", " ", "verbo", "se", "\\", "10", ";", "Except", "ion", " ", "reporting", " ", "mode", ":", " ", "Verbos", "e", "\\", "10", ";", "\\", "10", ";", "In", " ", "[", "24", "]:", " ", "%", "tb", "\\", "10", ";", "--------------", "--------------", "--------------", "--------------", "--------------", "-----", "\\", "10", ";", "System", "Exi", "t", " ", " ", " ", " ", " ", " ", "Trace", "back", " ", "(", "most", " ", "recent", " ", "call", " ", "last", ")", "\\", "10", ";<", "BLANK", "LINE", ">", "\\", "10", ";", "...", " ", "in", " ", "<", "module", ">(", ")", "\\", "10", ";", " ", "30", " ", " ", " ", " ", " ", "mode", " ", "=", " ", "'", "div", "'", "\\", "10", ";", " ", "3", "1", " ", "\\", "10", ";", "---", ">", " ", "32", " ", "bar", "(", "mode", ")", "\\", "10", ";", " ", " ", " ", " ", "global", " ", "bar", " ", "=", " ", "<", "function", " ", "bar", " ", "at", " ", "...", ">", "\\", "10", ";", " ", " ", " ", " ", "global", " ", "mode", " ", "=", " ", "'", "exit", "'", "\\", "10", ";<", "BLANK", "LINE", ">", "\\", "10", ";", "...", " ", "in", " ", "bar", "(", "mode", "='", "exit", "')", "\\", "10", ";", " ", "20", " ", " ", " ", " ", " ", "except", ":", "\\", "10", ";", " ", "21", " ", " ", " ", " ", " ", "stat", " ", "=", " ", "1", "\\", "10", ";", "---", ">", " ", "2", "2", " ", " ", " ", " ", " ", "sys", "exit", "(", "stat", ",", " ", "mode", ")", "\\", "10", ";", " ", " ", " ", " ", "global", " ", "sys", "exit", " ", "=", " ", "<", "function", " ", "sys", "exit", " ", "at", " ", "...", ">", "\\", "10", ";", " ", " ", " ", " ", "stat", " ", "=", " ", "2", "\\", "10", ";", " ", " ", " ", " ", "mode", " ", "=", " ", "'", "exit", "'", "\\", "10", ";", " ", "23", " ", "else", ":", "\\", "10", ";", " ", "24", " ", " ", " ", " ", " ", "raise", " ", "Value", "Error", "('", "Un", "know", "n", " ", "mode", "')", "\\", "10", ";<", "BLANK", "LINE", ">", "\\", "10", ";", "...", " ", "in", " ", "sys", "exit", "(", "stat", "=", "2", ",", " ", "mode", "='", "exit", "')", "\\", "10", ";", " ", " ", "9", " ", "\\", "10", ";", " ", "10", " ", "def", " ", "sys", "exit", "(", "stat", ",", " ", "mode", "):", "\\", "10", ";", "---", ">", " ", "11", " ", "raise", " ", "System", "Exi", "t", "(", "stat", ",", " ", "'", "Mode", " ", "=", " ", "%", "s", "'", " ", "%", " ", "mode", ")", "\\", "10", ";", " ", " ", " ", " ", "global", " ", "System", "Exi", "t", " ", "=", " ", "undefined", "\\", "10", ";", " ", " ", " ", " ", "stat", " ", "=", " ", "2", "\\", "10", ";", " ", " ", " ", " ", "mode", " ", "=", " ", "'", "exit", "'", "\\", "10", ";", " ", "1", "2", " ", "\\", "10", ";", " ", "13", " ", "def", " ", "bar", "(", "mode", "):", "\\", "10", ";<", "BLANK", "LINE", ">", "\\", "10", ";", "System", "Exi", "t", ":", " ", "(", "2", ",", " ", "'", "Mode", " ", "=", " ", "exit", "')", "\\", "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_", "def_", "test\\u", "run", "\\u", "cell_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "textwrap_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "run", "\\u", "cell_", "(_", "'", "a", " ", "=", " ", "10", "\\\\", "na", "+=", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "run", "\\u", "cell_", "(_", "'", "assert", " ", "a", " ", "==", " ", "11", "\\\\", "nas", "ser", "t", " ", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "nt_", "._", "assert", "\\u", "equals_", "(_", "ip_", "._", "user", "\\u", "ns_", "[_", "'", "a", "'_", "]_", ",_", "11_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "complex_", "=_", "textwrap_", "._", "dedent_", "(_", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "1", ":", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "hell", "o", "\"", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "1", ":", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "world", "\"", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "2", ":", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "foo", "\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "3", ":", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "bar", "\"", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "if", " ", "4", ":", "\\", "10", ";", " ", " ", " ", " ", "print", " ", "\"", "bar", "\"", "\\", "10", ";", " ", " ", " ", " ", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Simp", "ly", " ", "verifie", "s", " ", "tha", "t", " ", "this", " ", "kind", " ", "of", " ", "input", " ", "is", " ", "run_", "\\u\\u\\uNL\\u\\u\\u_", "ip_", "._", "run", "\\u", "cell_", "(_", "complex_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "db_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "the", " ", "internal", " ", "databa", "se", " ", "used", " ", "for", " ", "variab", "le", " ", "persiste", "nce", ".\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ip_", "._", "db_", "[_", "'\\u", "\\u", "unittest", "\\u'_", "]_", "=_", "12_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nt_", "._", "assert", "\\u", "equals_", "(_", "ip_", "._", "db_", "[_", "'\\u", "\\u", "unittest", "\\u'_", "]_", ",_", "12_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "del_", "ip_", "._", "db_", "[_", "'\\u", "\\u", "unittest", "\\u'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "'\\u", "\\u", "unittest", "\\u'_", "not_", "in_", "ip_", "._", "db_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
numb3r3/crawler-python/dp_crawler.py
[ { "content": "def main():\n\n proxies = {'http': 'http://23.244.180.162:8089', 'https': 'http://23.244.180.162:8089'}\n\n socket_proxies = {'http': 'socket5://1.ss.shadowsocks.net:65535', 'https': 'http://23.244.180.162:8089'}\n\n \n\n techs = dp_specs(\"http://www.dpreview.com/products/panasonic/compacts/panasonic_dmcsz3/specifications\")\n print \"<table>\"\n for k in techs.keys():\n print \"<thead><tr><th>%s<th></tr></thead>\" % k\n print \"<tbody>\"\n for key, value in techs[k]:\n print '<tr><td>%s</td><td>%s</td></tr>' % (key, value)\n print \"</tbody>\"\n # for k in techs:\n # print '<tr><td>%s</td><td>%s</td></tr>' % (k, techs[k].encode('ascii', \"ignore\"))\n print \"</table>\"\n # for dirname, dirnames, filenames in os.walk('D:\\workspace\\camera\\small'):\n # for filename in filenames:\n # file_path = os.path.join(dirname, filename)\n \n # pid = filename[:-5]\n # if not os.path.isfile(os.path.join(\"D:\\workspace\\camera\\images\", pid) + \".jpg\"):\n # amazon_prd_img(pid, \"D:\\workspace\\camera\\images\")\n\n # print pid", "metadata": "root.main", "header": "['module', '___EOS___']", "index": 42 } ]
[ { "span": "proxies ", "start_line": 44, "start_column": 4, "end_line": 44, "end_column": 11 }, { "span": "socket_proxies ", "start_line": 46, "start_column": 4, "end_line": 46, "end_column": 18 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[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 ", " _", "proxies_", "=_", "{_", "'", "http", "'_", ":_", "'", "http", "://", "23.", "244", ".1", "80.", "162", ":", "808", "9", "'_", ",_", "'", "https", "'_", ":_", "'", "http", "://", "23.", "244", ".1", "80.", "162", ":", "808", "9", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "socket", "\\u", "proxies_", "=_", "{_", "'", "http", "'_", ":_", "'", "socket", "5", "://", "1", ".", "ss", ".", "shadow", "socks", ".", "net", ":", "6553", "5", "'_", ",_", "'", "https", "'_", ":_", "'", "http", "://", "23.", "244", ".1", "80.", "162", ":", "808", "9", "'_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tech", "s_", "=_", "dp", "\\u", "specs_", "(_", "\"", "http", "://", "www", ".", "dpr", "evi", "ew", ".", "com", "/", "products", "/", "pan", "aso", "nic", "/", "compact", "s", "/", "pan", "aso", "nic", "\\u", "dm", "cs", "z3", "/", "specifica", "tion", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"<", "table", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "k_", "in_", "tech", "s_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"<", "thea", "d", "><", "tr", "><", "th", ">", "%", "s", "<", "th", "><", "/", "tr", "><", "/", "thea", "d", ">\"_", "%_", "k_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"<", "tbo", "dy", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "key_", ",_", "value_", "in_", "tech", "s_", "[_", "k_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "'<", "tr", "><", "td", ">", "%", "s", "</", "td", "><", "td", ">", "%", "s", "</", "td", "><", "/", "tr", ">'_", "%_", "(_", "key_", ",_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"<", "/", "tbo", "dy", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "k", " ", "in", " ", "tech", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "print", " ", "'<", "tr", "><", "td", ">", "%", "s", "</", "td", "><", "td", ">", "%", "s", "</", "td", "><", "/", "tr", ">'", " ", "%", " ", "(", "k", ",", " ", "tech", "s", "[", "k", "].", "encode", "('", "ascii", "',", " ", "\"", "ignore", "\"))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"<", "/", "table", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "for", " ", "dir", "name", ",", " ", "dir", "names", ",", " ", "filename", "s", " ", "in", " ", "os", ".", "walk", "('", "D", ":\\\\", "works", "pace", "\\\\", "came", "ra", "\\\\", "small", "')", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "filename", " ", "in", " ", "filename", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "file", "\\u", "path", " ", "=", " ", "os", ".", "path", ".", "join", "(", "dir", "name", ",", " ", "filename", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "pid", " ", "=", " ", "filename", "[:", "-", "5", "]_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "if", " ", "not", " ", "os", ".", "path", ".", "isfi", "le", "(", "os", ".", "path", ".", "join", "(\"", "D", ":\\\\", "works", "pace", "\\\\", "came", "ra", "\\\\", "images", "\",", " ", "pid", ")", " ", "+", " ", "\".", "jp", "g", "\"):", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "amaz", "on", "\\u", "prd", "\\u", "img", "(", "pid", ",", " ", "\"", "D", ":\\\\", "works", "pace", "\\\\", "came", "ra", "\\\\", "images", "\")", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", " ", "print", " ", "pid_", "\\u\\u\\uNL\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 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,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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 ]
Imprecise assert
jcassee/django-analytical/analytical/tests/test_tag_uservoice.py
[ { "content": " def assertIn(self, element, container):\n try:\n super(TagTestCase, self).assertIn(element, container)\n except AttributeError:\n self.assertTrue(element in container)", "metadata": "root.UserVoiceTagTestCase.assertIn", "header": "['class', 'UserVoiceTagTestCase', '(', 'TagTestCase', ')', ':', '___EOS___']", "index": 18 } ]
[ { "span": "self.assertTrue(element in container)", "start_line": 22, "start_column": 12, "end_line": 22, "end_column": 49 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "User", "Voic", "e", "Ta", "g", "Test", "Case_", "(_", "Ta", "g", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "assert", "In_", "(_", "self_", ",_", "element_", ",_", "container_", ")_", ":_", "\\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 ", " _", "super_", "(_", "Ta", "g", "Test", "Case_", ",_", "self_", ")_", "._", "assert", "In_", "(_", "element_", ",_", "container_", ")_", "\\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_", "._", "assert", "True_", "(_", "element_", "in_", "container_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Imprecise assert
rvanlaar/easy-transifex/src/transifex/transifex/releases/tests/views.py
[ { "content": " def test_release_create_good_private_resources(self):\n \"\"\"Test Release creation with private resources.\n\n User with access to a private resource should be able to add it to a\n release.\n \"\"\"\n\n resp = self.client['maintainer'].post(self.urls['release_create'],\n {'slug': 'nice-release', 'name': 'Nice Release',\n 'project': self.project.id, 'resources': '|2|',\n 'description': '', 'release_date': '', 'resources_text': '',\n 'stringfreeze_date': '', 'homepage': '', 'long_description': '',\n 'develfreeze_date': '', }, follow=True)\n self.assertEqual(resp.status_code, 200)\n self.assertTemplateUsed(resp, \"projects/release_detail.html\")\n\n # Test that a maintainer can see the private resource.\n resp = self.client['maintainer'].get(reverse('release_detail',\n args=[self.project.slug, 'nice-release']))\n self.assertContains(resp, \"Release 'Nice Release'\", status_code=200)\n self.assertContains(resp, \"1 private resources you have access to.\")\n self.assertContains(resp, \"Portuguese (Brazilian)\")\n\n # Priv proj member can see the private resource.\n resp = self.client['team_member'].get(reverse('release_detail',\n args=[self.project.slug, 'nice-release']))\n self.assertContains(resp, \"Release 'Nice Release'\", status_code=200)\n self.assertContains(resp, \"1 private resources you have access to.\")\n self.assertContains(resp, \"Portuguese (Brazilian)\")\n\n # Priv proj non-member cannot see the private resource.\n resp = self.client['registered'].get(reverse('release_detail',\n args=[self.project.slug, 'nice-release']))\n self.assertContains(resp, \"Release 'Nice Release'\", status_code=200)\n self.assertNotContains(resp, \"private resources\")\n self.assertNotContains(resp, \"Portuguese (Brazilian)\")\n\n # ...even if he is a member of the public project teams.\n resp = self.client['registered'].get(reverse('release_detail',\n args=[self.project.slug, 'nice-release']))\n self.team.members.add(self.user['registered'])\n self.assertTrue(self.user['registered'] in self.team.members.all())\n self.assertContains(resp, \"Release 'Nice Release'\", status_code=200)\n self.assertNotContains(resp, \"private resources\")\n self.assertNotContains(resp, \"Portuguese (Brazilian)\")", "metadata": "root.ReleasesViewsTests.test_release_create_good_private_resources", "header": "['class', 'ReleasesViewsTests', '(', 'base', '.', 'BaseTestCase', ')', ':', '___NEWLINE___', '___NL___', '# Note: The Resource lookup field is tested in the resources app.', '___NL___', '___EOS___']", "index": 49 }, { "content": " def test_release_create_bad_private_resources(self):\n \"\"\"Test Release creation with private resource w/o access.\n\n Public project release with a private resource I don't have access to.\n Use the registered user as the giunea pig.\n \"\"\"\n self.project.maintainers.add(self.user['registered'])\n self.assertFalse(\n self.user['registered'] in self.project_private.maintainers.all()\n )\n r = self.client['registered'].post(self.urls['release_create'],\n {'slug': 'nice-release', 'name': 'Nice Release',\n 'project': self.project.id, 'resources': '|2|',\n 'description': '', 'release_date': '', 'resources_text': '',\n 'stringfreeze_date': '', 'homepage': '', 'long_description': '',\n 'develfreeze_date': '', }, follow=True)\n # The release shouldn't even be allowed to be created.\n self.assertRaises(\n Release.DoesNotExist, self.project.releases.get, slug='nice-release'\n )\n self.assertTemplateUsed(r, \"projects/release_form.html\")\n self.assertContains(r, \"unaccessible private resource\")", "metadata": "root.ReleasesViewsTests.test_release_create_bad_private_resources", "header": "['class', 'ReleasesViewsTests', '(', 'base', '.', 'BaseTestCase', ')', ':', '___NEWLINE___', '___NL___', '# Note: The Resource lookup field is tested in the resources app.', '___NL___', '___EOS___']", "index": 110 }, { "content": " def test_first_resource(self):\n self.project.resources.all().delete()\n self._create_new_resource()\n self.assertTrue(self.res2 in\n self.project.releases.get(slug='all-resources').resources.all())", "metadata": "root.AllReleaseTests.test_first_resource", "header": "['class', 'AllReleaseTests', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 152 }, { "content": " def test_extra_resource(self):\n self._create_new_resource()\n rel_resources = self.project.releases.get(slug='all-resources').resources.all()\n self.assertTrue(self.resource in rel_resources)\n self.assertTrue(self.res2 in rel_resources)", "metadata": "root.AllReleaseTests.test_extra_resource", "header": "['class', 'AllReleaseTests', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 158 }, { "content": " def test_extra_resource_deletion(self):\n self._create_new_resource()\n self.res2.delete()\n rel_resources = self.project.releases.get(slug='all-resources').resources.all()\n self.assertTrue(self.resource in rel_resources)\n self.assertFalse(self.res2 in rel_resources)", "metadata": "root.AllReleaseTests.test_extra_resource_deletion", "header": "['class', 'AllReleaseTests', '(', 'base', '.', 'BaseTestCase', ')', ':', '___EOS___']", "index": 164 } ]
[ { "span": "self.assertTrue(self.user['registered'] in self.team.members.all())", "start_line": 90, "start_column": 8, "end_line": 90, "end_column": 75 }, { "span": "self.assertFalse(\n self.user['registered'] in self.project_private.maintainers.all()\n )", "start_line": 117, "start_column": 8, "end_line": 119, "end_column": 9 }, { "span": "self.assertTrue(self.res2 in\n self.project.releases.get(slug='all-resources').resources.all())", "start_line": 155, "start_column": 8, "end_line": 156, "end_column": 76 }, { "span": "self.assertTrue(self.resource in rel_resources)", "start_line": 161, "start_column": 8, "end_line": 161, "end_column": 55 }, { "span": "self.assertTrue(self.res2 in rel_resources)", "start_line": 162, "start_column": 8, "end_line": 162, "end_column": 51 }, { "span": "self.assertTrue(self.resource in rel_resources)", "start_line": 168, "start_column": 8, "end_line": 168, "end_column": 55 }, { "span": "self.assertFalse(self.res2 in rel_resources)", "start_line": 169, "start_column": 8, "end_line": 169, "end_column": 52 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Release", "s", "View", "s", "Tests_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "The", " ", "Reso", "urc", "e", " ", "look", "up", " ", "field", " ", "is", " ", "tested", " ", "in", " ", "the", " ", "resource", "s", " ", "app", "._", "\\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", "release", "\\u", "create", "\\u", "good", "\\u", "private", "\\u", "resources_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "Release", " ", "creati", "on", " ", "with", " ", "private", " ", "resource", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "User", " ", "with", " ", "access", " ", "to", " ", "a", " ", "private", " ", "resource", " ", "shou", "ld", " ", "be", " ", "able", " ", "to", " ", "add", " ", "it", " ", "to", " ", "a", "\\", "10", ";", " ", " ", " ", " ", "release", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "post_", "(_", "self_", "._", "urls_", "[_", "'", "release", "\\u", "create", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "slug", "'_", ":_", "'", "nice", "-", "release", "'_", ",_", "'", "name", "'_", ":_", "'", "Nic", "e", " ", "Release", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "'_", ":_", "self_", "._", "project_", "._", "id_", ",_", "'", "resource", "s", "'_", ":_", "'|", "2", "|'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "''_", ",_", "'", "release", "\\u", "date", "'_", ":_", "''_", ",_", "'", "resource", "s", "\\u", "text", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "string", "freez", "e\\u", "date", "'_", ":_", "''_", ",_", "'", "home", "page", "'_", ":_", "''_", ",_", "'", "long", "\\u", "description", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "deve", "lf", "ree", "ze", "\\u", "date", "'_", ":_", "''_", ",_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Equal_", "(_", "resp_", "._", "status", "\\u", "code_", ",_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "resp_", ",_", "\"", "project", "s", "/", "release", "\\u", "deta", "il", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Test", " ", "tha", "t", " ", "a", " ", "maintainer", " ", "can", " ", "see", " ", "the", " ", "private", " ", "resource", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "maintainer", "'_", "]_", "._", "get_", "(_", "reverse_", "(_", "'", "release", "\\u", "deta", "il", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "'", "nice", "-", "release", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "\"", "Release", " ", "'", "Nic", "e", " ", "Release", "'\"_", ",_", "status", "\\u", "code_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "\"", "1", " ", "private", " ", "resource", "s", " ", "you", " ", "have", " ", "access", " ", "to", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "\"", "Portug", "ues", "e", " ", "(", "Brazil", "ian", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pri", "v", " ", "proj", " ", "member", " ", "can", " ", "see", " ", "the", " ", "private", " ", "resource", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "team", "\\u", "member", "'_", "]_", "._", "get_", "(_", "reverse_", "(_", "'", "release", "\\u", "deta", "il", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "'", "nice", "-", "release", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "\"", "Release", " ", "'", "Nic", "e", " ", "Release", "'\"_", ",_", "status", "\\u", "code_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "\"", "1", " ", "private", " ", "resource", "s", " ", "you", " ", "have", " ", "access", " ", "to", ".\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "\"", "Portug", "ues", "e", " ", "(", "Brazil", "ian", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Pri", "v", " ", "proj", " ", "non", "-", "member", " ", "cann", "ot", " ", "see", " ", "the", " ", "private", " ", "resource", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "register", "ed", "'_", "]_", "._", "get_", "(_", "reverse_", "(_", "'", "release", "\\u", "deta", "il", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "'", "nice", "-", "release", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "\"", "Release", " ", "'", "Nic", "e", " ", "Release", "'\"_", ",_", "status", "\\u", "code_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Contains_", "(_", "resp_", ",_", "\"", "private", " ", "resource", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Contains_", "(_", "resp_", ",_", "\"", "Portug", "ues", "e", " ", "(", "Brazil", "ian", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "...", "even", " ", "if", " ", "he", " ", "is", " ", "a", " ", "member", " ", "of", " ", "the", " ", "public", " ", "project", " ", "team", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "client_", "[_", "'", "register", "ed", "'_", "]_", "._", "get_", "(_", "reverse_", "(_", "'", "release", "\\u", "deta", "il", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "args_", "=_", "[_", "self_", "._", "project_", "._", "slug_", ",_", "'", "nice", "-", "release", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "team_", "._", "members_", "._", "add_", "(_", "self_", "._", "user_", "[_", "'", "register", "ed", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "user_", "[_", "'", "register", "ed", "'_", "]_", "in_", "self_", "._", "team_", "._", "members_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "resp_", ",_", "\"", "Release", " ", "'", "Nic", "e", " ", "Release", "'\"_", ",_", "status", "\\u", "code_", "=_", "200_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Contains_", "(_", "resp_", ",_", "\"", "private", " ", "resource", "s", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Not", "Contains_", "(_", "resp_", ",_", "\"", "Portug", "ues", "e", " ", "(", "Brazil", "ian", ")\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Release", "s", "View", "s", "Tests_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Not", "e", ":", " ", "The", " ", "Reso", "urc", "e", " ", "look", "up", " ", "field", " ", "is", " ", "tested", " ", "in", " ", "the", " ", "resource", "s", " ", "app", "._", "\\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", "release", "\\u", "create", "\\u", "bad", "\\u", "private", "\\u", "resources_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "Test", " ", "Release", " ", "creati", "on", " ", "with", " ", "private", " ", "resource", " ", "w", "/", "o", " ", "access", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Public", " ", "project", " ", "release", " ", "with", " ", "a", " ", "private", " ", "resource", " ", "I", " ", "don", "'", "t", " ", "have", " ", "access", " ", "to", ".", "\\", "10", ";", " ", " ", " ", " ", "Us", "e", " ", "the", " ", "register", "ed", " ", "user", " ", "as", " ", "the", " ", "gi", "une", "a", " ", "pig", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "project_", "._", "maintainer", "s_", "._", "add_", "(_", "self_", "._", "user_", "[_", "'", "register", "ed", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "user_", "[_", "'", "register", "ed", "'_", "]_", "in_", "self_", "._", "project", "\\u", "private_", "._", "maintainer", "s_", "._", "all_", "(_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "r_", "=_", "self_", "._", "client_", "[_", "'", "register", "ed", "'_", "]_", "._", "post_", "(_", "self_", "._", "urls_", "[_", "'", "release", "\\u", "create", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "'", "slug", "'_", ":_", "'", "nice", "-", "release", "'_", ",_", "'", "name", "'_", ":_", "'", "Nic", "e", " ", "Release", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "project", "'_", ":_", "self_", "._", "project_", "._", "id_", ",_", "'", "resource", "s", "'_", ":_", "'|", "2", "|'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "description", "'_", ":_", "''_", ",_", "'", "release", "\\u", "date", "'_", ":_", "''_", ",_", "'", "resource", "s", "\\u", "text", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "string", "freez", "e\\u", "date", "'_", ":_", "''_", ",_", "'", "home", "page", "'_", ":_", "''_", ",_", "'", "long", "\\u", "description", "'_", ":_", "''_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "deve", "lf", "ree", "ze", "\\u", "date", "'_", ":_", "''_", ",_", "}_", ",_", "follow_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "release", " ", "shou", "ld", "n", "'", "t", " ", "even", " ", "be", " ", "allow", "ed", " ", "to", " ", "be", " ", "created", "._", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "assert", "Raises_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Release_", "._", "Do", "es", "Not", "Exist_", ",_", "self_", "._", "project_", "._", "releases_", "._", "get_", ",_", "slug_", "=_", "'", "nice", "-", "release", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Templa", "te", "Used_", "(_", "r_", ",_", "\"", "project", "s", "/", "release", "\\u", "form", ".", "html", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "Contains_", "(_", "r_", ",_", "\"", "una", "ccess", "ibl", "e", " ", "private", " ", "resource", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "All", "Release", "Tests_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "first", "\\u", "resource_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "project_", "._", "resources_", "._", "all_", "(_", ")_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "create", "\\u", "new", "\\u", "resource_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "res2_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "project_", "._", "releases_", "._", "get_", "(_", "slug_", "=_", "'", "all", "-", "resource", "s", "'_", ")_", "._", "resources_", "._", "all_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "All", "Release", "Tests_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "extra", "\\u", "resource_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "create", "\\u", "new", "\\u", "resource_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rel", "\\u", "resources_", "=_", "self_", "._", "project_", "._", "releases_", "._", "get_", "(_", "slug_", "=_", "'", "all", "-", "resource", "s", "'_", ")_", "._", "resources_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "resource_", "in_", "rel", "\\u", "resources_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "res2_", "in_", "rel", "\\u", "resources_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "All", "Release", "Tests_", "(_", "base_", "._", "Base", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "extra", "\\u", "resource", "\\u", "deletion_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "create", "\\u", "new", "\\u", "resource_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "res2_", "._", "delete_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rel", "\\u", "resources_", "=_", "self_", "._", "project_", "._", "releases_", "._", "get_", "(_", "slug_", "=_", "'", "all", "-", "resource", "s", "'_", ")_", "._", "resources_", "._", "all_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "self_", "._", "resource_", "in_", "rel", "\\u", "resources_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "False_", "(_", "self_", "._", "res2_", "in_", "rel", "\\u", "resources_", ")_", "\\u\\u\\uNEWLINE\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
bitxbay/BitXBay/electru/build/lib/electrum_gui/qt/transaction_dialog.py
[ { "content": "#!/usr/bin/env python\n#\n# Electrum - lightweight Bitcoin client\n# Copyright (C) 2012 thomasv@gitorious\n#\n# This program is free software: you can redistribute it and/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program. If not, see <http://www.gnu.org/licenses/>.\n\nimport sys, time, datetime, re, threading\nfrom electrum.i18n import _, set_language\nfrom electrum.util import print_error, print_msg\nimport os.path, json, ast, traceback\nimport shutil\nimport StringIO\n\n\ntry:\n import PyQt4\nexcept Exception:\n sys.exit(\"Error: Could not import PyQt4 on Linux systems, you may try 'sudo apt-get install python-qt4'\")\n\nfrom PyQt4.QtGui import *\nfrom PyQt4.QtCore import *\nimport PyQt4.QtCore as QtCore\n\nfrom electrum import transaction\nfrom util import MyTreeWidget\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TxDialog(QDialog):\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n", "metadata": "root.TxDialog", "header": "['module', '___EOS___']", "index": 38 }, { "content": " def __init__(self, tx, parent):\n self.tx = tx\n tx_dict = tx.as_dict()\n self.parent = parent\n self.wallet = parent.wallet\n \n QDialog.__init__(self)\n self.setMinimumWidth(600)\n self.setWindowTitle(_(\"Transaction\"))\n self.setModal(1)\n\n vbox = QVBoxLayout()\n self.setLayout(vbox)\n\n vbox.addWidget(QLabel(_(\"Transaction ID:\")))\n self.tx_hash_e = QLineEdit()\n self.tx_hash_e.setReadOnly(True)\n vbox.addWidget(self.tx_hash_e)\n self.status_label = QLabel()\n vbox.addWidget(self.status_label)\n\n self.date_label = QLabel()\n vbox.addWidget(self.date_label)\n self.amount_label = QLabel()\n vbox.addWidget(self.amount_label)\n self.fee_label = QLabel()\n vbox.addWidget(self.fee_label)\n\n self.add_io(vbox)\n\n vbox.addStretch(1)\n\n buttons = QHBoxLayout()\n vbox.addLayout( buttons )\n\n buttons.addStretch(1)\n\n self.sign_button = b = QPushButton(_(\"Sign\"))\n b.clicked.connect(self.sign)\n buttons.addWidget(b)\n\n self.broadcast_button = b = QPushButton(_(\"Broadcast\"))\n b.clicked.connect(self.broadcast)\n b.hide()\n buttons.addWidget(b)\n\n self.save_button = b = QPushButton(_(\"Save\"))\n b.clicked.connect(self.save)\n buttons.addWidget(b)\n\n cancelButton = QPushButton(_(\"Close\"))\n cancelButton.clicked.connect(lambda: self.done(0))\n buttons.addWidget(cancelButton)\n cancelButton.setDefault(True)\n \n self.update()", "metadata": "root.TxDialog.__init__", "header": "['class', 'TxDialog', '(', 'QDialog', ')', ':', '___EOS___']", "index": 40 }, { "content": " def sign(self):\n tx_dict = self.tx.as_dict()\n input_info = json.loads(tx_dict[\"input_info\"])\n self.parent.sign_raw_transaction(self.tx, input_info)\n self.update()", "metadata": "root.TxDialog.sign", "header": "['class', 'TxDialog', '(', 'QDialog', ')', ':', '___EOS___']", "index": 100 }, { "content": " def save(self):\n name = 'signed_%s.txn' % (self.tx.hash()[0:8]) if self.tx.is_complete else 'unsigned.txn'\n fileName = self.parent.getSaveFileName(_(\"Select where to save your signed transaction\"), name, \"*.txn\")\n if fileName:\n with open(fileName, \"w+\") as f:\n f.write(json.dumps(self.tx.as_dict(),indent=4) + '\\n')\n self.show_message(_(\"Transaction saved successfully\"))", "metadata": "root.TxDialog.save", "header": "['class', 'TxDialog', '(', 'QDialog', ')', ':', '___EOS___']", "index": 107 }, { "content": " def update(self):\n\n is_relevant, is_mine, v, fee = self.wallet.get_tx_value(self.tx)\n\n if self.tx.is_complete:\n status = _(\"Status: Signed\")\n self.sign_button.hide()\n tx_hash = self.tx.hash()\n\n if tx_hash in self.wallet.transactions.keys():\n conf, timestamp = self.wallet.verifier.get_confirmations(tx_hash)\n if timestamp:\n time_str = datetime.datetime.fromtimestamp(timestamp).isoformat(' ')[:-3]\n else:\n time_str = 'pending'\n status = _(\"Status: %d confirmations\")%conf\n self.broadcast_button.hide()\n else:\n time_str = None\n conf = 0\n self.broadcast_button.show()\n else:\n status = _(\"Status: Unsigned\")\n time_str = None\n if not self.wallet.is_watching_only():\n self.sign_button.show()\n else:\n self.sign_button.hide()\n self.broadcast_button.hide()\n tx_hash = 'unknown'\n\n self.tx_hash_e.setText(tx_hash)\n self.status_label.setText(status)\n\n if time_str is not None:\n self.date_label.setText(_(\"Date: %s\")%time_str)\n self.date_label.show()\n else:\n self.date_label.hide()\n\n\n # if we are not synchronized, we cannot tell\n if self.parent.network is None or not self.parent.network.is_running() or not self.parent.network.is_connected():\n return\n if not self.wallet.up_to_date:\n return\n\n if is_relevant: \n if is_mine:\n if fee is not None: \n self.amount_label.setText(_(\"Amount sent:\")+' %s'% self.parent.format_amount(v-fee) + ' ' + self.parent.base_unit())\n self.fee_label.setText(_(\"Transaction fee\")+': %s'% self.parent.format_amount(fee) + ' ' + self.parent.base_unit())\n else:\n self.amount_label.setText(_(\"Amount sent:\")+' %s'% self.parent.format_amount(v) + ' ' + self.parent.base_unit())\n self.fee_label.setText(_(\"Transaction fee\")+': '+ _(\"unknown\"))\n else:\n self.amount_label.setText(_(\"Amount received:\")+' %s'% self.parent.format_amount(v) + ' ' + self.parent.base_unit())\n else:\n self.amount_label.setText(_(\"Transaction unrelated to your wallet\"))", "metadata": "root.TxDialog.update", "header": "['class', 'TxDialog', '(', 'QDialog', ')', ':', '___EOS___']", "index": 117 }, { "content": " def exec_menu(self, position,l):\n item = l.itemAt(position)\n if not item: return\n addr = unicode(item.text(0))\n menu = QMenu()\n menu.addAction(_(\"Copy to clipboard\"), lambda: self.parent.app.clipboard().setText(addr))\n menu.exec_(l.viewport().mapToGlobal(position))", "metadata": "root.TxDialog.exec_menu", "header": "['class', 'TxDialog', '(', 'QDialog', ')', ':', '___EOS___']", "index": 178 }, { "content": " def add_io(self, vbox):\n\n if self.tx.locktime > 0:\n vbox.addWidget(QLabel(\"LockTime: %d\\n\" % self.tx.locktime))\n\n vbox.addWidget(QLabel(_(\"Inputs\")))\n lines = map(lambda x: x.get('prevout_hash') + \":%d\"%x.get('prevout_n') + u'\\t' + \"%s\"%x.get('address') , self.tx.inputs )\n i_text = QTextEdit()\n i_text.setText('\\n'.join(lines))\n i_text.setReadOnly(True)\n i_text.setMaximumHeight(100)\n vbox.addWidget(i_text)\n\n vbox.addWidget(QLabel(_(\"Outputs\")))\n lines = map(lambda x: x[0] + u'\\t\\t' + self.parent.format_amount(x[1]), self.tx.outputs)\n o_text = QTextEdit()\n o_text.setText('\\n'.join(lines))\n o_text.setReadOnly(True)\n o_text.setMaximumHeight(100)\n vbox.addWidget(o_text)", "metadata": "root.TxDialog.add_io", "header": "['class', 'TxDialog', '(', 'QDialog', ')', ':', '___EOS___']", "index": 187 }, { "content": " def broadcast(self):\n result, result_message = self.wallet.sendtx( self.tx )\n if result:\n self.show_message(_(\"Transaction successfully sent\")+': %s' % (result_message))\n else:\n self.show_message(_(\"There was a problem sending your transaction:\") + '\\n %s' % (result_message))", "metadata": "root.TxDialog.broadcast", "header": "['class', 'TxDialog', '(', 'QDialog', ')', ':', '___EOS___']", "index": 211 }, { "content": " def show_message(self, msg):\n QMessageBox.information(self, _('Message'), msg, _('OK'))", "metadata": "root.TxDialog.show_message", "header": "['class', 'TxDialog', '(', 'QDialog', ')', ':', '___EOS___']", "index": 218 } ]
[ { "span": "import sys, time, datetime, re, threading", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 41 }, { "span": "from electrum.i18n import _, set_language", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 41 }, { "span": "from electrum.util import print_error, print_msg", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 48 }, { "span": "import os.path, json, ast, traceback", "start_line": 21, "start_column": 0, "end_line": 21, "end_column": 36 }, { "span": "import shutil", "start_line": 22, "start_column": 0, "end_line": 22, "end_column": 13 }, { "span": "import StringIO", "start_line": 23, "start_column": 0, "end_line": 23, "end_column": 15 }, { "span": "import PyQt4", "start_line": 27, "start_column": 4, "end_line": 27, "end_column": 16 }, { "span": "import PyQt4.QtCore as QtCore", "start_line": 33, "start_column": 0, "end_line": 33, "end_column": 29 }, { "span": "from electrum import transaction", "start_line": 35, "start_column": 0, "end_line": 35, "end_column": 32 }, { "span": "from util import MyTreeWidget", "start_line": 36, "start_column": 0, "end_line": 36, "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_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Elect", "rum", " ", "-", " ", "light", "weight", " ", "Bit", "coin", " ", "client_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2012", " ", "tho", "mas", "v", "@", "git", "ori", "ous_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "program", " ", "is", " ", "free", " ", "software", ":", " ", "you", " ", "can", " ", "redis", "tribut", "e", " ", "it", " ", "and", "/", "or", " ", "modify_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "it", " ", "under", " ", "the", " ", "term", "s", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "as", " ", "publi", "shed", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "Free", " ", "Sof", "twa", "re", " ", "Foun", "dati", "on", ",", " ", "eit", "her", " ", "version", " ", "3", " ", "of", " ", "the", " ", "License", ",", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "at", " ", "your", " ", "option", ")", " ", "any", " ", "late", "r", " ", "version", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Thi", "s", " ", "program", " ", "is", " ", "distributed", " ", "in", " ", "the", " ", "hop", "e", " ", "tha", "t", " ", "it", " ", "will", " ", "be", " ", "usef", "ul", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "but", " ", "WITH", "OUT", " ", "ANY", " ", "WAR", "RAN", "TY", ";", " ", "with", "out", " ", "even", " ", "the", " ", "impli", "ed", " ", "warr", "ant", "y", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "or", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", ".", " ", "See", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", " ", "for", " ", "more", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "shou", "ld", " ", "have", " ", "receive", "d", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "GN", "U", " ", "General", " ", "Public", " ", "License", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "along", " ", "with", " ", "this", " ", "program", ".", " ", "If", " ", "not", ",", " ", "see", " ", "<", "http", "://", "www", ".", "gnu", ".", "org", "/", "license", "s", "/>", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", ",_", "time_", ",_", "datetime_", ",_", "re_", ",_", "threading_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "electr", "um_", "._", "i18n_", "import_", "\\u_", ",_", "set\\u", "language_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "electr", "um_", "._", "util_", "import_", "print", "\\u", "error_", ",_", "print", "\\u", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "._", "path_", ",_", "json_", ",_", "ast_", ",_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "shutil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "String", "IO_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\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 ", " _", "import_", "Py", "Qt4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Exception_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "sys_", "._", "exit_", "(_", "\"", "Error", ":", " ", "Cou", "ld", " ", "not", " ", "import", " ", "Py", "Qt", "4", " ", "on", " ", "Lin", "ux", " ", "system", "s", ",", " ", "you", " ", "may", " ", "try", " ", "'", "sudo", " ", "apt", "-", "get", " ", "install", " ", "python", "-", "qt", "4", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "Py", "Qt4_", "._", "Qt", "Gui_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Py", "Qt4_", "._", "Qt", "Core_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "Py", "Qt4_", "._", "Qt", "Core_", "as_", "Qt", "Core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "electr", "um_", "import_", "transaction_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "util_", "import_", "My", "Tree", "Widget_", "\\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_", "Tx", "Dialog_", "(_", "QD", "ial", "og_", ")_", ":_", "\\u\\u\\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\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Tx", "Dialog_", "(_", "QD", "ial", "og_", ")_", ":_", "\\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_", ",_", "tx_", ",_", "parent_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tx_", "=_", "tx_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "\\u", "dict_", "=_", "tx_", "._", "as", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "=_", "parent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "wallet_", "=_", "parent_", "._", "wallet_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "QD", "ial", "og_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Mini", "mum", "Width_", "(_", "600_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Window", "Title_", "(_", "\\u_", "(_", "\"", "Transa", "ction", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Modal_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vbox_", "=_", "QV", "Box", "Layout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Layout_", "(_", "vbox_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vbox_", "._", "add", "Widget_", "(_", "QL", "abel_", "(_", "\\u_", "(_", "\"", "Transa", "ction", " ", "ID", ":\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tx", "\\u", "hash", "\\u", "e_", "=_", "QL", "ine", "Edit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "tx", "\\u", "hash", "\\u", "e_", "._", "set", "Read", "Only_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vbox_", "._", "add", "Widget_", "(_", "self_", "._", "tx", "\\u", "hash", "\\u", "e_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status", "\\u", "label_", "=_", "QL", "abel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vbox_", "._", "add", "Widget_", "(_", "self_", "._", "status", "\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "date", "\\u", "label_", "=_", "QL", "abel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vbox_", "._", "add", "Widget_", "(_", "self_", "._", "date", "\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "amo", "unt", "\\u", "label_", "=_", "QL", "abel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vbox_", "._", "add", "Widget_", "(_", "self_", "._", "amo", "unt", "\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fe", "e\\u", "label_", "=_", "QL", "abel_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vbox_", "._", "add", "Widget_", "(_", "self_", "._", "fe", "e\\u", "label_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "add", "\\u", "io_", "(_", "vbox_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vbox_", "._", "add", "Stretch_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "buttons_", "=_", "Q", "HB", "ox", "Layout_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vbox_", "._", "add", "Layout_", "(_", "buttons_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "buttons_", "._", "add", "Stretch_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sign", "\\u", "button_", "=_", "b_", "=_", "QP", "ush", "Button_", "(_", "\\u_", "(_", "\"", "Sign", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "clicked_", "._", "connect_", "(_", "self_", "._", "sign_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buttons_", "._", "add", "Widget_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "broadcast", "\\u", "button_", "=_", "b_", "=_", "QP", "ush", "Button_", "(_", "\\u_", "(_", "\"", "Broad", "cast", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "clicked_", "._", "connect_", "(_", "self_", "._", "broadcast_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "hide_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buttons_", "._", "add", "Widget_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "save", "\\u", "button_", "=_", "b_", "=_", "QP", "ush", "Button_", "(_", "\\u_", "(_", "\"", "Save", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "._", "clicked_", "._", "connect_", "(_", "self_", "._", "save_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buttons_", "._", "add", "Widget_", "(_", "b_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cancel", "Button_", "=_", "QP", "ush", "Button_", "(_", "\\u_", "(_", "\"", "Clos", "e", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cancel", "Button_", "._", "clicked_", "._", "connect_", "(_", "lambda_", ":_", "self_", "._", "done_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buttons_", "._", "add", "Widget_", "(_", "cancel", "Button_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cancel", "Button_", "._", "set", "Default_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tx", "Dialog_", "(_", "QD", "ial", "og_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "sign_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "tx", "\\u", "dict_", "=_", "self_", "._", "tx_", "._", "as", "\\u", "dict_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "input", "\\u", "info_", "=_", "json_", "._", "loads_", "(_", "tx", "\\u", "dict_", "[_", "\"", "input", "\\u", "info", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "parent_", "._", "sign", "\\u", "raw", "\\u", "transaction_", "(_", "self_", "._", "tx_", ",_", "input", "\\u", "info_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "update_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tx", "Dialog_", "(_", "QD", "ial", "og_", ")_", ":_", "\\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 ", " _", "name_", "=_", "'", "sign", "ed", "\\u", "%", "s", ".", "tx", "n", "'_", "%_", "(_", "self_", "._", "tx_", "._", "hash_", "(_", ")_", "[_", "0_", ":_", "8_", "]_", ")_", "if_", "self_", "._", "tx_", "._", "is", "\\u", "complete_", "else_", "'", "unsigned", ".", "tx", "n", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "file", "Name_", "=_", "self_", "._", "parent_", "._", "get", "Save", "File", "Name_", "(_", "\\u_", "(_", "\"", "Select", " ", "where", " ", "to", " ", "save", " ", "your", " ", "sign", "ed", " ", "transaction", "\"_", ")_", ",_", "name_", ",_", "\"*", ".", "tx", "n", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "file", "Name_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "open_", "(_", "file", "Name_", ",_", "\"", "w", "+\"_", ")_", "as_", "f_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "f_", "._", "write_", "(_", "json_", "._", "dumps_", "(_", "self_", "._", "tx_", "._", "as", "\\u", "dict_", "(_", ")_", ",_", "indent_", "=_", "4_", ")_", "+_", "'\\\\", "n", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "show", "\\u", "message_", "(_", "\\u_", "(_", "\"", "Transa", "ction", " ", "saved", " ", "success", "full", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tx", "Dialog_", "(_", "QD", "ial", "og_", ")_", ":_", "\\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_", "update_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "rele", "van", "t_", ",_", "is", "\\u", "mine_", ",_", "v_", ",_", "fee_", "=_", "self_", "._", "wallet_", "._", "get", "\\u", "tx", "\\u", "value_", "(_", "self_", "._", "tx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "tx_", "._", "is", "\\u", "complete_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "status_", "=_", "\\u_", "(_", "\"", "Status", ":", " ", "Signe", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sign", "\\u", "button_", "._", "hide_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "\\u", "hash_", "=_", "self_", "._", "tx_", "._", "hash_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "tx", "\\u", "hash_", "in_", "self_", "._", "wallet_", "._", "transactions_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "conf_", ",_", "timestamp_", "=_", "self_", "._", "wallet_", "._", "verifier_", "._", "get", "\\u", "confirmation", "s_", "(_", "tx", "\\u", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "timestamp_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "time", "\\u", "str_", "=_", "datetime_", "._", "datetime_", "._", "fromtimestamp_", "(_", "timestamp_", ")_", "._", "isoformat_", "(_", "'", " ", "'_", ")_", "[_", ":_", "-_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "time", "\\u", "str_", "=_", "'", "pend", "ing", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status_", "=_", "\\u_", "(_", "\"", "Status", ":", " ", "%", "d", " ", "confirmation", "s", "\"_", ")_", "%_", "conf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "broadcast", "\\u", "button_", "._", "hide_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time", "\\u", "str_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "conf_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "broadcast", "\\u", "button_", "._", "show_", "(_", ")_", "\\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 ", " _", "status_", "=_", "\\u_", "(_", "\"", "Status", ":", " ", "Unsigned", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time", "\\u", "str_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "self_", "._", "wallet_", "._", "is", "\\u", "watch", "ing", "\\u", "only_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sign", "\\u", "button_", "._", "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 ", " _", "self_", "._", "sign", "\\u", "button_", "._", "hide_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "broadcast", "\\u", "button_", "._", "hide_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "\\u", "hash_", "=_", "'", "unknown", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "tx", "\\u", "hash", "\\u", "e_", "._", "set", "Text_", "(_", "tx", "\\u", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "status", "\\u", "label_", "._", "set", "Text_", "(_", "status_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "time", "\\u", "str_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "date", "\\u", "label_", "._", "set", "Text_", "(_", "\\u_", "(_", "\"", "Date", ":", " ", "%", "s", "\"_", ")_", "%_", "time", "\\u", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "date", "\\u", "label_", "._", "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 ", " _", "self_", "._", "date", "\\u", "label_", "._", "hide_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "we", " ", "are", " ", "not", " ", "synchronized", ",", " ", "we", " ", "cann", "ot", " ", "tell_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "parent_", "._", "network_", "is_", "None_", "or_", "not_", "self_", "._", "parent_", "._", "network_", "._", "is", "\\u", "running_", "(_", ")_", "or_", "not_", "self_", "._", "parent_", "._", "network_", "._", "is", "\\u", "connected_", "(_", ")_", ":_", "\\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_", "._", "wallet_", "._", "up", "\\u", "to", "\\u", "date_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "is", "\\u", "rele", "van", "t_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "mine_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "fee_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "amo", "unt", "\\u", "label_", "._", "set", "Text_", "(_", "\\u_", "(_", "\"", "Amo", "unt", " ", "sent", ":\"_", ")_", "+_", "'", " ", "%", "s", "'_", "%_", "self_", "._", "parent_", "._", "format\\u", "amount_", "(_", "v_", "-_", "fee_", ")_", "+_", "'", " ", "'_", "+_", "self_", "._", "parent_", "._", "base", "\\u", "unit_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fe", "e\\u", "label_", "._", "set", "Text_", "(_", "\\u_", "(_", "\"", "Transa", "ction", " ", "fe", "e", "\"_", ")_", "+_", "':", " ", "%", "s", "'_", "%_", "self_", "._", "parent_", "._", "format\\u", "amount_", "(_", "fee_", ")_", "+_", "'", " ", "'_", "+_", "self_", "._", "parent_", "._", "base", "\\u", "unit_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "amo", "unt", "\\u", "label_", "._", "set", "Text_", "(_", "\\u_", "(_", "\"", "Amo", "unt", " ", "sent", ":\"_", ")_", "+_", "'", " ", "%", "s", "'_", "%_", "self_", "._", "parent_", "._", "format\\u", "amount_", "(_", "v_", ")_", "+_", "'", " ", "'_", "+_", "self_", "._", "parent_", "._", "base", "\\u", "unit_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fe", "e\\u", "label_", "._", "set", "Text_", "(_", "\\u_", "(_", "\"", "Transa", "ction", " ", "fe", "e", "\"_", ")_", "+_", "':", " ", "'_", "+_", "\\u_", "(_", "\"", "unknown", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "amo", "unt", "\\u", "label_", "._", "set", "Text_", "(_", "\\u_", "(_", "\"", "Amo", "unt", " ", "receive", "d", ":\"_", ")_", "+_", "'", " ", "%", "s", "'_", "%_", "self_", "._", "parent_", "._", "format\\u", "amount_", "(_", "v_", ")_", "+_", "'", " ", "'_", "+_", "self_", "._", "parent_", "._", "base", "\\u", "unit_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "amo", "unt", "\\u", "label_", "._", "set", "Text_", "(_", "\\u_", "(_", "\"", "Transa", "ction", " ", "unre", "late", "d", " ", "to", " ", "your", " ", "walle", "t", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tx", "Dialog_", "(_", "QD", "ial", "og_", ")_", ":_", "\\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_", "exec", "\\u", "menu_", "(_", "self_", ",_", "position_", ",_", "l_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "item_", "=_", "l_", "._", "item", "At_", "(_", "position_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "item_", ":_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "addr_", "=_", "unicode_", "(_", "item_", "._", "text_", "(_", "0_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "menu_", "=_", "QM", "enu_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "menu_", "._", "add", "Action_", "(_", "\\u_", "(_", "\"", "Copy", " ", "to", " ", "clip", "board", "\"_", ")_", ",_", "lambda_", ":_", "self_", "._", "parent_", "._", "app_", "._", "clipboard_", "(_", ")_", "._", "set", "Text_", "(_", "addr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "menu_", "._", "exec\\u_", "(_", "l_", "._", "viewport_", "(_", ")_", "._", "map", "To", "Global_", "(_", "position_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tx", "Dialog_", "(_", "QD", "ial", "og_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "io_", "(_", "self_", ",_", "vbox_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "tx_", "._", "lock", "time_", ">_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vbox_", "._", "add", "Widget_", "(_", "QL", "abel_", "(_", "\"", "Lock", "Time", ":", " ", "%", "d", "\\\\", "n", "\"_", "%_", "self_", "._", "tx_", "._", "lock", "time_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "vbox_", "._", "add", "Widget_", "(_", "QL", "abel_", "(_", "\\u_", "(_", "\"", "Inp", "uts", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "map_", "(_", "lambda_", "x_", ":_", "x_", "._", "get_", "(_", "'", "prev", "out", "\\u", "hash", "'_", ")_", "+_", "\":", "%", "d", "\"_", "%_", "x_", "._", "get_", "(_", "'", "prev", "out", "\\u", "n", "'_", ")_", "+_", "u", "'\\\\", "t", "'_", "+_", "\"%", "s", "\"_", "%_", "x_", "._", "get_", "(_", "'", "address", "'_", ")_", ",_", "self_", "._", "tx_", "._", "inputs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "text_", "=_", "QT", "ext", "Edit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "text_", "._", "set", "Text_", "(_", "'\\\\", "n", "'_", "._", "join_", "(_", "lines_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "text_", "._", "set", "Read", "Only_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "i", "\\u", "text_", "._", "set", "Maxim", "um", "Height_", "(_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vbox_", "._", "add", "Widget_", "(_", "i", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "vbox_", "._", "add", "Widget_", "(_", "QL", "abel_", "(_", "\\u_", "(_", "\"", "Output", "s", "\"_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lines_", "=_", "map_", "(_", "lambda_", "x_", ":_", "x_", "[_", "0_", "]_", "+_", "u", "'\\\\", "t", "\\\\", "t", "'_", "+_", "self_", "._", "parent_", "._", "format\\u", "amount_", "(_", "x_", "[_", "1_", "]_", ")_", ",_", "self_", "._", "tx_", "._", "outputs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o", "\\u", "text_", "=_", "QT", "ext", "Edit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o", "\\u", "text_", "._", "set", "Text_", "(_", "'\\\\", "n", "'_", "._", "join_", "(_", "lines_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o", "\\u", "text_", "._", "set", "Read", "Only_", "(_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "o", "\\u", "text_", "._", "set", "Maxim", "um", "Height_", "(_", "100_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "vbox_", "._", "add", "Widget_", "(_", "o", "\\u", "text_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tx", "Dialog_", "(_", "QD", "ial", "og_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "broadcast_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "result_", ",_", "result", "\\u", "message_", "=_", "self_", "._", "wallet_", "._", "send", "tx_", "(_", "self_", "._", "tx_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show", "\\u", "message_", "(_", "\\u_", "(_", "\"", "Transa", "ction", " ", "success", "full", "y", " ", "sent", "\"_", ")_", "+_", "':", " ", "%", "s", "'_", "%_", "(_", "result", "\\u", "message_", ")_", ")_", "\\u\\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_", "._", "show", "\\u", "message_", "(_", "\\u_", "(_", "\"", "There", " ", "was", " ", "a", " ", "problem", " ", "sendin", "g", " ", "your", " ", "transaction", ":\"_", ")_", "+_", "'\\\\", "n", " ", "%", "s", "'_", "%_", "(_", "result", "\\u", "message_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tx", "Dialog_", "(_", "QD", "ial", "og_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "\\u", "message_", "(_", "self_", ",_", "msg_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "QM", "essage", "Box_", "._", "information_", "(_", "self_", ",_", "\\u_", "(_", "'", "Messag", "e", "'_", ")_", ",_", "msg_", ",_", "\\u_", "(_", "'", "OK", "'_", ")_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unreachable code
HydraChain/hydrachain/hydrachain/consensus/manager.py
[ { "content": " def add_proposal(self, p, proto=None):\n assert isinstance(p, Proposal)\n assert proto is None or isinstance(proto, HDCProtocol)\n\n def check(valid):\n if not valid:\n self.tracked_protocol_failures.append(InvalidProposalEvidence(None, p))\n log.warn('invalid proposal', p=p)\n raise InvalidProposalError()\n return True\n\n self.log('cm.add_proposal', p=p)\n if p.height < self.height:\n self.log('proposal from the past')\n return\n\n if not check(self.contract.isvalidator(p.sender) and self.contract.isproposer(p)):\n return\n self.ready_validators.add(p.sender)\n\n if not check(p.lockset.is_valid):\n return\n if not check(p.lockset.height == p.height or p.round == 0):\n return\n if not check(p.round - p.lockset.round == 1 or p.round == 0):\n return\n\n # proposal is valid\n if proto is not None: # inactive proto is False\n self.synchronizer.on_proposal(p, proto)\n\n for v in p.lockset:\n self.add_vote(v) # implicitly checks their validity\n if isinstance(p, BlockProposal):\n if not check(p.block.number == p.height):\n return\n if not check(p.lockset.has_noquorum or p.round == 0):\n return\n # validation\n if p.height > self.height:\n self.log('proposal from the future, not in sync', p=p)\n return # note: we are not broadcasting this, as we could not validate\n blk = self.chainservice.link_block(p.block)\n if not check(blk):\n # safeguard for forks:\n # if there is a quorum on a block which can not be applied: panic!\n ls = self.heights[p.height].last_quorum_lockset\n if ls and ls.has_quorum == p.blockhash:\n raise ForkDetectedEvidence(proto, (self.head, p, ls))\n sys.exit(1)\n return\n p._mutable = True\n p._cached_rlp = None\n p.block = blk # block linked to chain\n self.log('successfully linked block')\n self.add_block_proposal(p) # implicitly checks the votes validity\n else:\n assert isinstance(p, VotingInstruction)\n assert p.lockset.round == p.round - 1 and p.height == p.lockset.height\n assert p.round > 0\n assert p.lockset.has_quorum_possible\n assert not p.lockset.has_quorum\n if not check(p.lockset.has_quorum_possible and not p.lockset.has_quorum):\n return\n is_valid = self.heights[p.height].add_proposal(p)\n return is_valid # can be broadcasted", "metadata": "root.ConsensusManager.add_proposal", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 254 }, { "content": " def commit(self):\n self.log('in commit')\n for p in [c for c in self.block_candidates.values() if c.block.prevhash == self.head.hash]:\n assert isinstance(p, BlockProposal)\n ls = self.heights[p.height].last_quorum_lockset\n if ls and ls.has_quorum == p.blockhash:\n self.store_proposal(p)\n self.store_last_committing_lockset(ls)\n success = self.chainservice.commit_block(p.block)\n assert success\n if success:\n self.log('commited', p=p, hash=phx(p.blockhash))\n assert self.head == p.block\n self.commit() # commit all possible\n return True\n else:\n self.log('could not commit', p=p)\n else:\n self.log('no quorum for', p=p)\n if ls:\n self.log('votes', votes=ls.votes)", "metadata": "root.ConsensusManager.commit", "header": "['class', 'ConsensusManager', '(', 'object', ')', ':', '___EOS___']", "index": 433 } ]
[ { "span": "sys.exit(1)", "start_line": 303, "start_column": 20, "end_line": 303, "end_column": 31 }, { "span": "self.log('could not commit', p=p)", "start_line": 449, "start_column": 20, "end_line": 449, "end_column": 53 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "proposal_", "(_", "self_", ",_", "p_", ",_", "proto_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "p_", ",_", "Propos", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "proto_", "is_", "None_", "or_", "isinstance_", "(_", "proto_", ",_", "HD", "CP", "roto", "col_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "check_", "(_", "valid_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "valid_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "tracked", "\\u", "protoc", "ol", "\\u", "failures_", "._", "append_", "(_", "Inva", "lid", "Propos", "al", "Evi", "denc", "e_", "(_", "None_", ",_", "p_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "warn_", "(_", "'", "invalid", " ", "propos", "al", "'_", ",_", "p_", "=_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Inva", "lid", "Propos", "al", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "log_", "(_", "'", "cm", ".", "add", "\\u", "propos", "al", "'_", ",_", "p_", "=_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "p_", "._", "height_", "<_", "self_", "._", "height_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "propos", "al", " ", "from", " ", "the", " ", "past", "'_", ")_", "\\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_", "check_", "(_", "self_", "._", "contract_", "._", "is", "validator_", "(_", "p_", "._", "sender_", ")_", "and_", "self_", "._", "contract_", "._", "isp", "rop", "ose", "r_", "(_", "p_", ")_", ")_", ":_", "\\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_", "._", "read", "y", "\\u", "validators_", "._", "add_", "(_", "p_", "._", "sender_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "check_", "(_", "p_", "._", "lock", "set_", "._", "is", "\\u", "valid_", ")_", ":_", "\\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_", "check_", "(_", "p_", "._", "lock", "set_", "._", "height_", "==_", "p_", "._", "height_", "or_", "p_", "._", "round_", "==_", "0_", ")_", ":_", "\\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_", "check_", "(_", "p_", "._", "round_", "-_", "p_", "._", "lock", "set_", "._", "round_", "==_", "1_", "or_", "p_", "._", "round_", "==_", "0_", ")_", ":_", "\\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_", "#", " ", "propos", "al", " ", "is", " ", "valid_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "proto_", "is_", "not_", "None_", ":_", "#", " ", "inact", "ive", " ", "proto", " ", "is", " ", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "synchronize", "r_", "._", "on", "\\u", "proposal_", "(_", "p_", ",_", "proto_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "v_", "in_", "p_", "._", "lock", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "add", "\\u", "vote_", "(_", "v_", ")_", "#", " ", "implicit", "ly", " ", "checks", " ", "thei", "r", " ", "validity_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "p_", ",_", "Block", "Propos", "al_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "check_", "(_", "p_", "._", "block_", "._", "number_", "==_", "p_", "._", "height_", ")_", ":_", "\\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_", "check_", "(_", "p_", "._", "lock", "set_", "._", "has", "\\u", "no", "quorum", "_", "or_", "p_", "._", "round_", "==_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "validation_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "p_", "._", "height_", ">_", "self_", "._", "height_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "propos", "al", " ", "from", " ", "the", " ", "future", ",", " ", "not", " ", "in", " ", "sync", "'_", ",_", "p_", "=_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "#", " ", "note", ":", " ", "we", " ", "are", " ", "not", " ", "broadcast", "ing", " ", "this", ",", " ", "as", " ", "we", " ", "coul", "d", " ", "not", " ", "validate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "blk_", "=_", "self_", "._", "chain", "service_", "._", "link", "\\u", "block_", "(_", "p_", "._", "block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "check_", "(_", "blk_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "safe", "guard", " ", "for", " ", "fork", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "if", " ", "there", " ", "is", " ", "a", " ", "quorum", " ", "on", " ", "a", " ", "block", " ", "whi", "ch", " ", "can", " ", "not", " ", "be", " ", "applied", ":", " ", "pani", "c", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ls_", "=_", "self_", "._", "heights_", "[_", "p_", "._", "height_", "]_", "._", "last", "\\u", "quorum", "\\u", "lock", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ls_", "and_", "ls_", "._", "has", "\\u", "quorum", "_", "==_", "p_", "._", "block", "hash_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "For", "k", "Detect", "ed", "Evi", "denc", "e_", "(_", "proto_", ",_", "(_", "self_", "._", "head_", ",_", "p_", ",_", "ls_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "p_", "._", "\\u", "mutable", "_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "\\u", "cache", "d\\u", "rlp", "_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "._", "block_", "=_", "blk_", "#", " ", "block", " ", "linked", " ", "to", " ", "chain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "log_", "(_", "'", "success", "full", "y", " ", "linked", " ", "block", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "add", "\\u", "block", "\\u", "proposal_", "(_", "p_", ")_", "#", " ", "implicit", "ly", " ", "checks", " ", "the", " ", "vote", "s", " ", "validity_", "\\u\\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_", "isinstance_", "(_", "p_", ",_", "Vo", "ting", "Instruction_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "p_", "._", "lock", "set_", "._", "round_", "==_", "p_", "._", "round_", "-_", "1_", "and_", "p_", "._", "height_", "==_", "p_", "._", "lock", "set_", "._", "height_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "p_", "._", "round_", ">_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "p_", "._", "lock", "set_", "._", "has", "\\u", "quorum", "\\u", "possible_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "not_", "p_", "._", "lock", "set_", "._", "has", "\\u", "quorum", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "check_", "(_", "p_", "._", "lock", "set_", "._", "has", "\\u", "quorum", "\\u", "possible_", "and_", "not_", "p_", "._", "lock", "set_", "._", "has", "\\u", "quorum", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "is", "\\u", "valid_", "=_", "self_", "._", "heights_", "[_", "p_", "._", "height_", "]_", "._", "add", "\\u", "proposal_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "is", "\\u", "valid_", "#", " ", "can", " ", "be", " ", "broadcast", "ed_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Conse", "nsu", "s", "Manager_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "commit_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "in", " ", "commit", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "p_", "in_", "[_", "c_", "for_", "c_", "in_", "self_", "._", "block", "\\u", "candidates_", "._", "values_", "(_", ")_", "if_", "c_", "._", "block_", "._", "prev", "hash_", "==_", "self_", "._", "head_", "._", "hash_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "p_", ",_", "Block", "Propos", "al_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ls_", "=_", "self_", "._", "heights_", "[_", "p_", "._", "height_", "]_", "._", "last", "\\u", "quorum", "\\u", "lock", "set_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ls_", "and_", "ls_", "._", "has", "\\u", "quorum", "_", "==_", "p_", "._", "block", "hash_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "store", "\\u", "proposal_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "store", "\\u", "last", "\\u", "committ", "ing", "\\u", "lock", "set_", "(_", "ls_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "self_", "._", "chain", "service_", "._", "commit", "\\u", "block_", "(_", "p_", "._", "block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "success_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "success_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "log_", "(_", "'", "commit", "ed", "'_", ",_", "p_", "=_", "p_", ",_", "hash_", "=_", "ph", "x_", "(_", "p_", "._", "block", "hash_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "head_", "==_", "p_", "._", "block_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "commit_", "(_", ")_", "#", " ", "commit", " ", "all", " ", "possible_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "log_", "(_", "'", "coul", "d", " ", "not", " ", "commit", "'_", ",_", "p_", "=_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "log_", "(_", "'", "no", " ", "quorum", " ", "for", "'_", ",_", "p_", "=_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ls_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "log_", "(_", "'", "vote", "s", "'_", ",_", "votes_", "=_", "ls_", "._", "votes_", ")_", "\\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, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
osrg/ryu/ryu/lib/packet/icmpv6.py
[ { "content": "# Copyright (C) 2012 Nippon Telegraph and Telephone Corporation.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n# implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nimport abc\nimport struct\nimport six\nimport sys\nimport array\nimport binascii\n\nfrom . import packet_base\nfrom . import packet_utils\nfrom ryu.lib import addrconv\nfrom ryu.lib import stringify\n\nICMPV6_DST_UNREACH = 1 # dest unreachable, codes:\nICMPV6_PACKET_TOO_BIG = 2 # packet too big\nICMPV6_TIME_EXCEEDED = 3 # time exceeded, code:\nICMPV6_PARAM_PROB = 4 # ip6 header bad\n\nICMPV6_ECHO_REQUEST = 128 # echo service\nICMPV6_ECHO_REPLY = 129 # echo reply\nMLD_LISTENER_QUERY = 130 # multicast listener query\nMLD_LISTENER_REPOR = 131 # multicast listener report\nMLD_LISTENER_DONE = 132 # multicast listener done\nMLDV2_LISTENER_REPORT = 143 # multicast listern report (v2)\n\n# RFC2292 decls\nICMPV6_MEMBERSHIP_QUERY = 130 # group membership query\nICMPV6_MEMBERSHIP_REPORT = 131 # group membership report\nICMPV6_MEMBERSHIP_REDUCTION = 132 # group membership termination\n\nND_ROUTER_SOLICIT = 133 # router solicitation\nND_ROUTER_ADVERT = 134 # router advertisment\nND_NEIGHBOR_SOLICIT = 135 # neighbor solicitation\nND_NEIGHBOR_ADVERT = 136 # neighbor advertisment\nND_REDIREC = 137 # redirect\n\nICMPV6_ROUTER_RENUMBERING = 138 # router renumbering\n\nICMPV6_WRUREQUEST = 139 # who are you request\nICMPV6_WRUREPLY = 140 # who are you reply\nICMPV6_FQDN_QUERY = 139 # FQDN query\nICMPV6_FQDN_REPLY = 140 # FQDN reply\nICMPV6_NI_QUERY = 139 # node information request\nICMPV6_NI_REPLY = 140 # node information reply\n\nICMPV6_MAXTYPE = 201\n\n# ND_OPTIONS from RFC 4861\nND_OPTION_SLA = 1 # Source Link-Layer Address\nND_OPTION_TLA = 2 # Target Link-Layer Address\nND_OPTION_PI = 3 # Prefix Information\nND_OPTION_RH = 4 # Redirected Header\nND_OPTION_MTU = 5 # MTU\n\nMODE_IS_INCLUDE = 1\nMODE_IS_EXCLUDE = 2\nCHANGE_TO_INCLUDE_MODE = 3\nCHANGE_TO_EXCLUDE_MODE = 4\nALLOW_NEW_SOURCES = 5\nBLOCK_OLD_SOURCES = 6\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nicmpv6.set_classes(icmpv6._ICMPV6_TYPES)\nnd_neighbor.set_classes(nd_neighbor._ND_OPTION_TYPES)\nnd_router_solicit.set_classes(nd_router_solicit._ND_OPTION_TYPES)\nnd_router_advert.set_classes(nd_router_advert._ND_OPTION_TYPES)\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class icmpv6(packet_base.PacketBase):\n \"\"\"ICMPv6 (RFC 2463) header encoder/decoder class.\n\n An instance has the following attributes at least.\n Most of them are same to the on-wire counterparts but in host byte order.\n __init__ takes the corresponding args in this order.\n\n .. tabularcolumns:: |l|p{35em}|\n\n ============== ====================\n Attribute Description\n ============== ====================\n type\\_ Type\n code Code\n csum CheckSum\n (0 means automatically-calculate when encoding)\n data Payload.\n\n ryu.lib.packet.icmpv6.echo object, \\\n ryu.lib.packet.icmpv6.nd_neighbor object, \\\n ryu.lib.packet.icmpv6.nd_router_solicit object, \\\n ryu.lib.packet.icmpv6.nd_router_advert object, \\\n ryu.lib.packet.icmpv6.mld object, \\\n or a bytearray.\n ============== ====================\n \"\"\"\n _PACK_STR = '!BBH'\n _MIN_LEN = struct.calcsize(_PACK_STR)\n _ICMPV6_TYPES = {}\n\n\n\n\n", "metadata": "root.icmpv6", "header": "['module', '___EOS___']", "index": 76 }, { "content": " @staticmethod\n def register_icmpv6_type(*args):\n def _register_icmpv6_type(cls):\n for type_ in args:\n icmpv6._ICMPV6_TYPES[type_] = cls\n return cls\n return _register_icmpv6_type", "metadata": "root.icmpv6.register_icmpv6_type", "header": "['class', 'icmpv6', '(', 'packet_base', '.', 'PacketBase', ')', ':', '___EOS___']", "index": 106 }, { "content": " def __init__(self, type_=0, code=0, csum=0, data=None):\n super(icmpv6, self).__init__()\n self.type_ = type_\n self.code = code\n self.csum = csum\n self.data = data", "metadata": "root.icmpv6.__init__", "header": "['class', 'icmpv6', '(', 'packet_base', '.', 'PacketBase', ')', ':', '___EOS___']", "index": 114 }, { "content": " @classmethod\n def parser(cls, buf):\n (type_, code, csum) = struct.unpack_from(cls._PACK_STR, buf)\n msg = cls(type_, code, csum)\n offset = cls._MIN_LEN\n if len(buf) > offset:\n cls_ = cls._ICMPV6_TYPES.get(type_, None)\n if cls_:\n msg.data = cls_.parser(buf, offset)\n else:\n msg.data = buf[offset:]\n\n return msg, None, None", "metadata": "root.icmpv6.parser", "header": "['class', 'icmpv6', '(', 'packet_base', '.', 'PacketBase', ')', ':', '___EOS___']", "index": 121 }, { "content": " def serialize(self, payload, prev):\n hdr = bytearray(struct.pack(icmpv6._PACK_STR, self.type_,\n self.code, self.csum))\n\n if self.data is not None:\n if self.type_ in icmpv6._ICMPV6_TYPES:\n hdr += self.data.serialize()\n else:\n hdr += self.data\n if self.csum == 0:\n self.csum = packet_utils.checksum_ip(prev, len(hdr), hdr + payload)\n struct.pack_into('!H', hdr, 2, self.csum)\n\n return hdr", "metadata": "root.icmpv6.serialize", "header": "['class', 'icmpv6', '(', 'packet_base', '.', 'PacketBase', ')', ':', '___EOS___']", "index": 135 }, { "content": " def __len__(self):\n length = self._MIN_LEN\n if self.data is not None:\n length += len(self.data)\n return length", "metadata": "root.icmpv6.__len__", "header": "['class', 'icmpv6', '(', 'packet_base', '.', 'PacketBase', ')', ':', '___EOS___']", "index": 150 }, { "content": "@icmpv6.register_icmpv6_type(ND_NEIGHBOR_SOLICIT, ND_NEIGHBOR_ADVERT)\nclass nd_neighbor(stringify.StringifyMixin):\n \"\"\"ICMPv6 sub encoder/decoder class for Neighbor Solicitation and\n Neighbor Advertisement messages. (RFC 4861)\n\n This is used with ryu.lib.packet.icmpv6.icmpv6.\n\n An instance has the following attributes at least.\n Most of them are same to the on-wire counterparts but in host byte order.\n __init__ takes the corresponding args in this order.\n\n .. tabularcolumns:: |l|p{35em}|\n\n ============== ====================\n Attribute Description\n ============== ====================\n res R,S,O Flags for Neighbor Advertisement. \\\n The 3 MSBs of \"Reserved\" field for Neighbor Solicitation.\n dst Target Address\n option a derived object of ryu.lib.packet.icmpv6.nd_option \\\n or a bytearray. None if no options.\n ============== ====================\n \"\"\"\n\n _PACK_STR = '!I16s'\n _MIN_LEN = struct.calcsize(_PACK_STR)\n _ND_OPTION_TYPES = {}\n _TYPE = {\n 'ascii': [\n 'dst'\n ]\n }\n\n\n\n\n", "metadata": "root.nd_neighbor", "header": "['module', '___EOS___']", "index": 157 }, { "content": " @staticmethod\n def register_nd_option_type(*args):\n def _register_nd_option_type(cls):\n nd_neighbor._ND_OPTION_TYPES[cls.option_type()] = cls\n return cls\n return _register_nd_option_type(args[0])", "metadata": "root.nd_neighbor.register_nd_option_type", "header": "['class', 'nd_neighbor', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 190 }, { "content": " def __init__(self, res=0, dst='::', option=None):\n self.res = res\n self.dst = dst\n self.option = option", "metadata": "root.nd_neighbor.__init__", "header": "['class', 'nd_neighbor', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 197 }, { "content": " @classmethod\n def parser(cls, buf, offset):\n (res, dst) = struct.unpack_from(cls._PACK_STR, buf, offset)\n offset += cls._MIN_LEN\n option = None\n if len(buf) > offset:\n (type_, ) = struct.unpack_from('!B', buf, offset)\n cls_ = cls._ND_OPTION_TYPES.get(type_)\n if cls_ is not None:\n option = cls_.parser(buf, offset)\n else:\n option = buf[offset:]\n msg = cls(res >> 29, addrconv.ipv6.bin_to_text(dst), option)\n return msg", "metadata": "root.nd_neighbor.parser", "header": "['class', 'nd_neighbor', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 202 }, { "content": " def serialize(self):\n res = self.res << 29\n hdr = bytearray(struct.pack(\n nd_neighbor._PACK_STR, res,\n addrconv.ipv6.text_to_bin(self.dst)))\n if self.option is not None:\n if isinstance(self.option, nd_option):\n hdr.extend(self.option.serialize())\n else:\n hdr.extend(self.option)\n return six.binary_type(hdr)", "metadata": "root.nd_neighbor.serialize", "header": "['class', 'nd_neighbor', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 217 }, { "content": " def __len__(self):\n length = self._MIN_LEN\n if self.option is not None:\n length += len(self.option)\n return length", "metadata": "root.nd_neighbor.__len__", "header": "['class', 'nd_neighbor', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 229 }, { "content": "@icmpv6.register_icmpv6_type(ND_ROUTER_SOLICIT)\nclass nd_router_solicit(stringify.StringifyMixin):\n \"\"\"ICMPv6 sub encoder/decoder class for Router Solicitation messages.\n (RFC 4861)\n\n This is used with ryu.lib.packet.icmpv6.icmpv6.\n\n An instance has the following attributes at least.\n Most of them are same to the on-wire counterparts but in host byte order.\n __init__ takes the corresponding args in this order.\n\n .. tabularcolumns:: |l|p{35em}|\n\n ============== ====================\n Attribute Description\n ============== ====================\n res This field is unused. It MUST be initialized to zero.\n option a derived object of ryu.lib.packet.icmpv6.nd_option \\\n or a bytearray. None if no options.\n ============== ====================\n \"\"\"\n\n _PACK_STR = '!I'\n _MIN_LEN = struct.calcsize(_PACK_STR)\n _ND_OPTION_TYPES = {}\n\n\n\n\n", "metadata": "root.nd_router_solicit", "header": "['module', '___EOS___']", "index": 236 }, { "content": " @staticmethod\n def register_nd_option_type(*args):\n def _register_nd_option_type(cls):\n nd_router_solicit._ND_OPTION_TYPES[cls.option_type()] = cls\n return cls\n return _register_nd_option_type(args[0])", "metadata": "root.nd_router_solicit.register_nd_option_type", "header": "['class', 'nd_router_solicit', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 262 }, { "content": " def __init__(self, res=0, option=None):\n self.res = res\n self.option = option", "metadata": "root.nd_router_solicit.__init__", "header": "['class', 'nd_router_solicit', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 269 }, { "content": " @classmethod\n def parser(cls, buf, offset):\n (res, ) = struct.unpack_from(cls._PACK_STR, buf, offset)\n offset += cls._MIN_LEN\n option = None\n if len(buf) > offset:\n (type_, ) = struct.unpack_from('!B', buf, offset)\n cls_ = cls._ND_OPTION_TYPES.get(type_)\n if cls_ is not None:\n option = cls_.parser(buf, offset)\n else:\n option = buf[offset:]\n msg = cls(res, option)\n return msg", "metadata": "root.nd_router_solicit.parser", "header": "['class', 'nd_router_solicit', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 273 }, { "content": " def serialize(self):\n hdr = bytearray(struct.pack(\n nd_router_solicit._PACK_STR, self.res))\n if self.option is not None:\n if isinstance(self.option, nd_option):\n hdr.extend(self.option.serialize())\n else:\n hdr.extend(self.option)\n return six.binary_type(hdr)", "metadata": "root.nd_router_solicit.serialize", "header": "['class', 'nd_router_solicit', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 288 }, { "content": " def __len__(self):\n length = self._MIN_LEN\n if self.option is not None:\n length += len(self.option)\n return length", "metadata": "root.nd_router_solicit.__len__", "header": "['class', 'nd_router_solicit', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 298 }, { "content": "@icmpv6.register_icmpv6_type(ND_ROUTER_ADVERT)\nclass nd_router_advert(stringify.StringifyMixin):\n \"\"\"ICMPv6 sub encoder/decoder class for Router Advertisement messages.\n (RFC 4861)\n\n This is used with ryu.lib.packet.icmpv6.icmpv6.\n\n An instance has the following attributes at least.\n Most of them are same to the on-wire counterparts but in host byte order.\n __init__ takes the corresponding args in this order.\n\n .. tabularcolumns:: |l|p{35em}|\n\n ============== ====================\n Attribute Description\n ============== ====================\n ch_l Cur Hop Limit.\n res M,O Flags for Router Advertisement.\n rou_l Router Lifetime.\n rea_t Reachable Time.\n ret_t Retrans Timer.\n options List of a derived object of \\\n ryu.lib.packet.icmpv6.nd_option or a bytearray. \\\n None if no options.\n ============== ====================\n \"\"\"\n\n _PACK_STR = '!BBHII'\n _MIN_LEN = struct.calcsize(_PACK_STR)\n _ND_OPTION_TYPES = {}\n\n\n\n\n", "metadata": "root.nd_router_advert", "header": "['module', '___EOS___']", "index": 305 }, { "content": " @staticmethod\n def register_nd_option_type(*args):\n def _register_nd_option_type(cls):\n nd_router_advert._ND_OPTION_TYPES[cls.option_type()] = cls\n return cls\n return _register_nd_option_type(args[0])", "metadata": "root.nd_router_advert.register_nd_option_type", "header": "['class', 'nd_router_advert', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 336 }, { "content": " def __init__(self, ch_l=0, res=0, rou_l=0, rea_t=0, ret_t=0, options=None):\n self.ch_l = ch_l\n self.res = res\n self.rou_l = rou_l\n self.rea_t = rea_t\n self.ret_t = ret_t\n options = options or []\n assert isinstance(options, list)\n self.options = options", "metadata": "root.nd_router_advert.__init__", "header": "['class', 'nd_router_advert', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 343 }, { "content": " @classmethod\n def parser(cls, buf, offset):\n (ch_l, res, rou_l, rea_t, ret_t\n ) = struct.unpack_from(cls._PACK_STR, buf, offset)\n offset += cls._MIN_LEN\n options = []\n while len(buf) > offset:\n (type_, length) = struct.unpack_from('!BB', buf, offset)\n cls_ = cls._ND_OPTION_TYPES.get(type_)\n if cls_ is not None:\n option = cls_.parser(buf, offset)\n else:\n option = buf[offset:offset + (length * 8 - 2)]\n options.append(option)\n offset += len(option)\n msg = cls(ch_l, res >> 6, rou_l, rea_t, ret_t, options)\n return msg", "metadata": "root.nd_router_advert.parser", "header": "['class', 'nd_router_advert', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 353 }, { "content": " def serialize(self):\n res = self.res << 6\n hdr = bytearray(struct.pack(\n nd_router_advert._PACK_STR, self.ch_l, res, self.rou_l,\n self.rea_t, self.ret_t))\n for option in self.options:\n if isinstance(option, nd_option):\n hdr.extend(option.serialize())\n else:\n hdr.extend(option)\n return six.binary_type(hdr)", "metadata": "root.nd_router_advert.serialize", "header": "['class', 'nd_router_advert', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 371 }, { "content": " def __len__(self):\n length = self._MIN_LEN\n for option in self.options:\n length += len(option)\n return length", "metadata": "root.nd_router_advert.__len__", "header": "['class', 'nd_router_advert', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 383 }, { "content": "@six.add_metaclass(abc.ABCMeta)\nclass nd_option(stringify.StringifyMixin):\n\n\n\n", "metadata": "root.nd_option", "header": "['module', '___EOS___']", "index": 390 }, { "content": " @classmethod\n @abc.abstractmethod\n def option_type(cls):\n pass", "metadata": "root.nd_option.option_type", "header": "['class', 'nd_option', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 392 }, { "content": " @abc.abstractmethod\n def __init__(self, _type, length):\n self._type = _type\n self.length = length", "metadata": "root.nd_option.__init__", "header": "['class', 'nd_option', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 397 }, { "content": " @classmethod\n @abc.abstractmethod\n def parser(cls, buf):\n pass", "metadata": "root.nd_option.parser", "header": "['class', 'nd_option', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 402 }, { "content": " @abc.abstractmethod\n def serialize(self):\n pass", "metadata": "root.nd_option.serialize", "header": "['class', 'nd_option', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 407 }, { "content": " def __len__(self):\n return self._MIN_LEN", "metadata": "root.nd_option.__len__", "header": "['class', 'nd_option', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 411 }, { "content": "class nd_option_la(nd_option):\n\n _PACK_STR = '!BB6s'\n _MIN_LEN = struct.calcsize(_PACK_STR)\n _TYPE = {\n 'ascii': [\n 'hw_src'\n ]\n }\n\n\n\n", "metadata": "root.nd_option_la", "header": "['module', '___EOS___']", "index": 415 }, { "content": " @abc.abstractmethod\n def __init__(self, length, hw_src, data):\n super(nd_option_la, self).__init__(self.option_type(), length)\n self.hw_src = hw_src\n self.data = data", "metadata": "root.nd_option_la.__init__", "header": "['class', 'nd_option_la', '(', 'nd_option', ')', ':', '___EOS___']", "index": 425 }, { "content": " @classmethod\n def parser(cls, buf, offset):\n (_, length, hw_src) = struct.unpack_from(cls._PACK_STR, buf, offset)\n msg = cls(length, addrconv.mac.bin_to_text(hw_src))\n offset += cls._MIN_LEN\n if len(buf) > offset:\n msg.data = buf[offset:]\n\n return msg", "metadata": "root.nd_option_la.parser", "header": "['class', 'nd_option_la', '(', 'nd_option', ')', ':', '___EOS___']", "index": 431 }, { "content": " def serialize(self):\n buf = bytearray(struct.pack(\n self._PACK_STR, self.option_type(), self.length,\n addrconv.mac.text_to_bin(self.hw_src)))\n if self.data is not None:\n buf.extend(self.data)\n mod = len(buf) % 8\n if mod:\n buf.extend(bytearray(8 - mod))\n if 0 == self.length:\n self.length = len(buf) // 8\n struct.pack_into('!B', buf, 1, self.length)\n return six.binary_type(buf)", "metadata": "root.nd_option_la.serialize", "header": "['class', 'nd_option_la', '(', 'nd_option', ')', ':', '___EOS___']", "index": 441 }, { "content": " def __len__(self):\n length = self._MIN_LEN\n if self.data is not None:\n length += len(self.data)\n return length", "metadata": "root.nd_option_la.__len__", "header": "['class', 'nd_option_la', '(', 'nd_option', ')', ':', '___EOS___']", "index": 455 }, { "content": "@nd_neighbor.register_nd_option_type\n@nd_router_solicit.register_nd_option_type\n@nd_router_advert.register_nd_option_type\nclass nd_option_sla(nd_option_la):\n \"\"\"ICMPv6 sub encoder/decoder class for Neighbor discovery\n Source Link-Layer Address Option. (RFC 4861)\n\n This is used with ryu.lib.packet.icmpv6.nd_neighbor,\n ryu.lib.packet.icmpv6.nd_router_solicit or\n ryu.lib.packet.icmpv6.nd_router_advert.\n\n An instance has the following attributes at least.\n Most of them are same to the on-wire counterparts but in host byte order.\n __init__ takes the corresponding args in this order.\n\n .. tabularcolumns:: |l|p{35em}|\n\n ============== ====================\n Attribute Description\n ============== ====================\n length length of the option. \\\n (0 means automatically-calculate when encoding)\n hw_src Link-Layer Address. \\\n NOTE: If the address is longer than 6 octets this contains \\\n the first 6 octets in the address. \\\n This implementation assumes the address has at least \\\n 6 octets.\n data A bytearray which contains the rest of Link-Layer Address \\\n and padding. When encoding a packet, it's user's \\\n responsibility to provide necessary padding for 8-octets \\\n alignment required by the protocol.\n ============== ====================\n \"\"\"\n\n", "metadata": "root.nd_option_sla", "header": "['module', '___EOS___']", "index": 462 }, { "content": " @classmethod\n def option_type(cls):\n return ND_OPTION_SLA", "metadata": "root.nd_option_sla.option_type", "header": "['class', 'nd_option_sla', '(', 'nd_option_la', ')', ':', '___EOS___']", "index": 496 }, { "content": " def __init__(self, length=0, hw_src='00:00:00:00:00:00', data=None):\n super(nd_option_sla, self).__init__(length, hw_src, data)", "metadata": "root.nd_option_sla.__init__", "header": "['class', 'nd_option_sla', '(', 'nd_option_la', ')', ':', '___EOS___']", "index": 500 }, { "content": "@nd_neighbor.register_nd_option_type\nclass nd_option_tla(nd_option_la):\n \"\"\"ICMPv6 sub encoder/decoder class for Neighbor discovery\n Target Link-Layer Address Option. (RFC 4861)\n\n This is used with ryu.lib.packet.icmpv6.nd_neighbor.\n\n An instance has the following attributes at least.\n Most of them are same to the on-wire counterparts but in host byte order.\n __init__ takes the corresponding args in this order.\n\n .. tabularcolumns:: |l|p{35em}|\n\n ============== ====================\n Attribute Description\n ============== ====================\n length length of the option. \\\n (0 means automatically-calculate when encoding)\n hw_src Link-Layer Address. \\\n NOTE: If the address is longer than 6 octets this contains \\\n the first 6 octets in the address. \\\n This implementation assumes the address has at least \\\n 6 octets.\n data A bytearray which contains the rest of Link-Layer Address \\\n and padding. When encoding a packet, it's user's \\\n responsibility to provide necessary padding for 8-octets \\\n alignment required by the protocol.\n ============== ====================\n \"\"\"\n\n", "metadata": "root.nd_option_tla", "header": "['module', '___EOS___']", "index": 504 }, { "content": " @classmethod\n def option_type(cls):\n return ND_OPTION_TLA", "metadata": "root.nd_option_tla.option_type", "header": "['class', 'nd_option_tla', '(', 'nd_option_la', ')', ':', '___EOS___']", "index": 534 }, { "content": " def __init__(self, length=0, hw_src='00:00:00:00:00:00', data=None):\n super(nd_option_tla, self).__init__(length, hw_src, data)", "metadata": "root.nd_option_tla.__init__", "header": "['class', 'nd_option_tla', '(', 'nd_option_la', ')', ':', '___EOS___']", "index": 538 }, { "content": "@nd_router_advert.register_nd_option_type\nclass nd_option_pi(nd_option):\n \"\"\"ICMPv6 sub encoder/decoder class for Neighbor discovery\n Prefix Information Option. (RFC 4861)\n\n This is used with ryu.lib.packet.icmpv6.nd_router_advert.\n\n An instance has the following attributes at least.\n Most of them are same to the on-wire counterparts but in host byte order.\n __init__ takes the corresponding args in this order.\n\n .. tabularcolumns:: |l|p{35em}|\n\n ============== ====================\n Attribute Description\n ============== ====================\n length length of the option. \\\n (0 means automatically-calculate when encoding)\n pl Prefix Length.\n res1 L,A,R\\* Flags for Prefix Information.\n val_l Valid Lifetime.\n pre_l Preferred Lifetime.\n res2 This field is unused. It MUST be initialized to zero.\n prefix An IP address or a prefix of an IP address.\n ============== ====================\n\n \\*R flag is defined in (RFC 3775)\n \"\"\"\n\n _PACK_STR = '!BBBBIII16s'\n _MIN_LEN = struct.calcsize(_PACK_STR)\n _TYPE = {\n 'ascii': [\n 'prefix'\n ]\n }\n\n\n\n", "metadata": "root.nd_option_pi", "header": "['module', '___EOS___']", "index": 542 }, { "content": " @classmethod\n def option_type(cls):\n return ND_OPTION_PI", "metadata": "root.nd_option_pi.option_type", "header": "['class', 'nd_option_pi', '(', 'nd_option', ')', ':', '___EOS___']", "index": 579 }, { "content": " def __init__(self, length=0, pl=0, res1=0, val_l=0, pre_l=0, res2=0,\n prefix='::'):\n super(nd_option_pi, self).__init__(self.option_type(), length)\n self.pl = pl\n self.res1 = res1\n self.val_l = val_l\n self.pre_l = pre_l\n self.res2 = res2\n self.prefix = prefix", "metadata": "root.nd_option_pi.__init__", "header": "['class', 'nd_option_pi', '(', 'nd_option', ')', ':', '___EOS___']", "index": 583 }, { "content": " @classmethod\n def parser(cls, buf, offset):\n (_, length, pl, res1, val_l, pre_l, res2, prefix\n ) = struct.unpack_from(cls._PACK_STR, buf, offset)\n msg = cls(length, pl, res1 >> 5, val_l, pre_l, res2,\n addrconv.ipv6.bin_to_text(prefix))\n\n return msg", "metadata": "root.nd_option_pi.parser", "header": "['class', 'nd_option_pi', '(', 'nd_option', ')', ':', '___EOS___']", "index": 593 }, { "content": " def serialize(self):\n res1 = self.res1 << 5\n hdr = bytearray(struct.pack(\n self._PACK_STR, self.option_type(), self.length, self.pl,\n res1, self.val_l, self.pre_l, self.res2,\n addrconv.ipv6.text_to_bin(self.prefix)))\n if 0 == self.length:\n self.length = len(hdr) // 8\n struct.pack_into('!B', hdr, 1, self.length)\n return six.binary_type(hdr)", "metadata": "root.nd_option_pi.serialize", "header": "['class', 'nd_option_pi', '(', 'nd_option', ')', ':', '___EOS___']", "index": 602 }, { "content": "@icmpv6.register_icmpv6_type(ICMPV6_ECHO_REPLY, ICMPV6_ECHO_REQUEST)\nclass echo(stringify.StringifyMixin):\n \"\"\"ICMPv6 sub encoder/decoder class for Echo Request and Echo Reply\n messages.\n\n This is used with ryu.lib.packet.icmpv6.icmpv6 for\n ICMPv6 Echo Request and Echo Reply messages.\n\n An instance has the following attributes at least.\n Most of them are same to the on-wire counterparts but in host byte order.\n __init__ takes the corresponding args in this order.\n\n ============== ====================\n Attribute Description\n ============== ====================\n id Identifier\n seq Sequence Number\n data Data\n ============== ====================\n \"\"\"\n\n _PACK_STR = '!HH'\n _MIN_LEN = struct.calcsize(_PACK_STR)\n\n\n\n", "metadata": "root.echo", "header": "['module', '___EOS___']", "index": 614 }, { "content": " def __init__(self, id_=0, seq=0, data=None):\n self.id = id_\n self.seq = seq\n self.data = data", "metadata": "root.echo.__init__", "header": "['class', 'echo', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 638 }, { "content": " @classmethod\n def parser(cls, buf, offset):\n (id_, seq) = struct.unpack_from(cls._PACK_STR, buf, offset)\n msg = cls(id_, seq)\n offset += cls._MIN_LEN\n\n if len(buf) > offset:\n msg.data = buf[offset:]\n\n return msg", "metadata": "root.echo.parser", "header": "['class', 'echo', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 643 }, { "content": " def serialize(self):\n hdr = bytearray(struct.pack(echo._PACK_STR, self.id,\n self.seq))\n if self.data is not None:\n hdr += bytearray(self.data)\n\n return hdr", "metadata": "root.echo.serialize", "header": "['class', 'echo', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 654 }, { "content": " def __len__(self):\n length = self._MIN_LEN\n if self.data is not None:\n length += len(self.data)\n return length", "metadata": "root.echo.__len__", "header": "['class', 'echo', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 662 }, { "content": "@icmpv6.register_icmpv6_type(\n MLD_LISTENER_QUERY, MLD_LISTENER_REPOR, MLD_LISTENER_DONE)\nclass mld(stringify.StringifyMixin):\n \"\"\"ICMPv6 sub encoder/decoder class for MLD Lister Query,\n MLD Listener Report, and MLD Listener Done messages. (RFC 2710)\n\n http://www.ietf.org/rfc/rfc2710.txt\n\n This is used with ryu.lib.packet.icmpv6.icmpv6.\n\n An instance has the following attributes at least.\n Most of them are same to the on-wire counterparts but in host byte order.\n __init__ takes the corresponding args in this order.\n\n ============== =========================================\n Attribute Description\n ============== =========================================\n maxresp max response time in millisecond. it is\n meaningful only in Query Message.\n address a group address value.\n ============== =========================================\n \"\"\"\n\n _PACK_STR = '!H2x16s'\n _MIN_LEN = struct.calcsize(_PACK_STR)\n _TYPE = {\n 'ascii': [\n 'address'\n ]\n }\n\n\n\n", "metadata": "root.mld", "header": "['module', '___EOS___']", "index": 669 }, { "content": " def __init__(self, maxresp=0, address='::'):\n self.maxresp = maxresp\n self.address = address", "metadata": "root.mld.__init__", "header": "['class', 'mld', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 700 }, { "content": " @classmethod\n def parser(cls, buf, offset):\n if cls._MIN_LEN < len(buf[offset:]):\n msg = mldv2_query.parser(buf[offset:])\n else:\n (maxresp, address) = struct.unpack_from(\n cls._PACK_STR, buf, offset)\n msg = cls(maxresp, addrconv.ipv6.bin_to_text(address))\n\n return msg", "metadata": "root.mld.parser", "header": "['class', 'mld', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 704 }, { "content": " def serialize(self):\n buf = struct.pack(mld._PACK_STR, self.maxresp,\n addrconv.ipv6.text_to_bin(self.address))\n return buf", "metadata": "root.mld.serialize", "header": "['class', 'mld', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 715 }, { "content": " def __len__(self):\n return self._MIN_LEN", "metadata": "root.mld.__len__", "header": "['class', 'mld', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 720 }, { "content": "class mldv2_query(mld):\n \"\"\"\n ICMPv6 sub encoder/decoder class for MLD v2 Lister Query messages.\n (RFC 3810)\n\n http://www.ietf.org/rfc/rfc3810.txt\n\n This is used with ryu.lib.packet.icmpv6.icmpv6.\n\n An instance has the following attributes at least.\n Most of them are same to the on-wire counterparts but in host byte order.\n __init__ takes the corresponding args in this order.\n\n ============== =========================================\n Attribute Description\n ============== =========================================\n maxresp max response time in millisecond. it is\n meaningful only in Query Message.\n address a group address value.\n s_flg when set to 1, routers suppress the timer\n process.\n qrv robustness variable for a querier.\n qqic an interval time for a querier in unit of\n seconds.\n num a number of the multicast servers.\n srcs a list of IPv6 addresses of the multicast\n servers.\n ============== =========================================\n \"\"\"\n\n _PACK_STR = '!H2x16sBBH'\n _MIN_LEN = struct.calcsize(_PACK_STR)\n _TYPE = {\n 'ascii': [\n 'address'\n ],\n 'asciilist': [\n 'srcs'\n ]\n }\n\n\n\n", "metadata": "root.mldv2_query", "header": "['module', '___EOS___']", "index": 724 }, { "content": " def __init__(self, maxresp=0, address='::', s_flg=0, qrv=2,\n qqic=0, num=0, srcs=None):\n super(mldv2_query, self).__init__(maxresp, address)\n self.s_flg = s_flg\n self.qrv = qrv\n self.qqic = qqic\n self.num = num\n srcs = srcs or []\n assert isinstance(srcs, list)\n for src in srcs:\n assert isinstance(src, str)\n self.srcs = srcs", "metadata": "root.mldv2_query.__init__", "header": "['class', 'mldv2_query', '(', 'mld', ')', ':', '___EOS___']", "index": 765 }, { "content": " @classmethod\n def parser(cls, buf):\n (maxresp, address, s_qrv, qqic, num\n ) = struct.unpack_from(cls._PACK_STR, buf)\n s_flg = (s_qrv >> 3) & 0b1\n qrv = s_qrv & 0b111\n offset = cls._MIN_LEN\n srcs = []\n while 0 < len(buf[offset:]) and num > len(srcs):\n assert 16 <= len(buf[offset:])\n (src, ) = struct.unpack_from('16s', buf, offset)\n srcs.append(addrconv.ipv6.bin_to_text(src))\n offset += 16\n assert num == len(srcs)\n return cls(maxresp, addrconv.ipv6.bin_to_text(address), s_flg,\n qrv, qqic, num, srcs)", "metadata": "root.mldv2_query.parser", "header": "['class', 'mldv2_query', '(', 'mld', ')', ':', '___EOS___']", "index": 778 }, { "content": " def serialize(self):\n s_qrv = self.s_flg << 3 | self.qrv\n buf = bytearray(struct.pack(self._PACK_STR, self.maxresp,\n addrconv.ipv6.text_to_bin(self.address), s_qrv,\n self.qqic, self.num))\n for src in self.srcs:\n buf.extend(struct.pack('16s', addrconv.ipv6.text_to_bin(src)))\n if 0 == self.num:\n self.num = len(self.srcs)\n struct.pack_into('!H', buf, 22, self.num)\n return six.binary_type(buf)", "metadata": "root.mldv2_query.serialize", "header": "['class', 'mldv2_query', '(', 'mld', ')', ':', '___EOS___']", "index": 795 }, { "content": " def __len__(self):\n return self._MIN_LEN + len(self.srcs) * 16", "metadata": "root.mldv2_query.__len__", "header": "['class', 'mldv2_query', '(', 'mld', ')', ':', '___EOS___']", "index": 807 }, { "content": "@icmpv6.register_icmpv6_type(MLDV2_LISTENER_REPORT)\nclass mldv2_report(mld):\n \"\"\"\n ICMPv6 sub encoder/decoder class for MLD v2 Lister Report messages.\n (RFC 3810)\n\n http://www.ietf.org/rfc/rfc3810.txt\n\n This is used with ryu.lib.packet.icmpv6.icmpv6.\n\n An instance has the following attributes at least.\n Most of them are same to the on-wire counterparts but in host byte order.\n __init__ takes the corresponding args in this order.\n\n ============== =========================================\n Attribute Description\n ============== =========================================\n record_num a number of the group records.\n records a list of ryu.lib.packet.icmpv6.mldv2_report_group.\n None if no records.\n ============== =========================================\n \"\"\"\n\n _PACK_STR = '!2xH'\n _MIN_LEN = struct.calcsize(_PACK_STR)\n _class_prefixes = ['mldv2_report_group']\n\n\n\n", "metadata": "root.mldv2_report", "header": "['module', '___EOS___']", "index": 811 }, { "content": " def __init__(self, record_num=0, records=None):\n self.record_num = record_num\n records = records or []\n assert isinstance(records, list)\n for record in records:\n assert isinstance(record, mldv2_report_group)\n self.records = records", "metadata": "root.mldv2_report.__init__", "header": "['class', 'mldv2_report', '(', 'mld', ')', ':', '___EOS___']", "index": 838 }, { "content": " @classmethod\n def parser(cls, buf, offset):\n (record_num, ) = struct.unpack_from(cls._PACK_STR, buf, offset)\n offset += cls._MIN_LEN\n records = []\n while 0 < len(buf[offset:]) and record_num > len(records):\n record = mldv2_report_group.parser(buf[offset:])\n records.append(record)\n offset += len(record)\n assert record_num == len(records)\n return cls(record_num, records)", "metadata": "root.mldv2_report.parser", "header": "['class', 'mldv2_report', '(', 'mld', ')', ':', '___EOS___']", "index": 846 }, { "content": " def serialize(self):\n buf = bytearray(struct.pack(self._PACK_STR, self.record_num))\n for record in self.records:\n buf.extend(record.serialize())\n if 0 == self.record_num:\n self.record_num = len(self.records)\n struct.pack_into('!H', buf, 2, self.record_num)\n return six.binary_type(buf)", "metadata": "root.mldv2_report.serialize", "header": "['class', 'mldv2_report', '(', 'mld', ')', ':', '___EOS___']", "index": 858 }, { "content": " def __len__(self):\n records_len = 0\n for record in self.records:\n records_len += len(record)\n return self._MIN_LEN + records_len", "metadata": "root.mldv2_report.__len__", "header": "['class', 'mldv2_report', '(', 'mld', ')', ':', '___EOS___']", "index": 867 }, { "content": "class mldv2_report_group(stringify.StringifyMixin):\n \"\"\"\n ICMPv6 sub encoder/decoder class for MLD v2 Lister Report Group\n Record messages. (RFC 3810)\n\n This is used with ryu.lib.packet.icmpv6.mldv2_report.\n\n An instance has the following attributes at least.\n Most of them are same to the on-wire counterparts but in host byte\n order.\n __init__ takes the corresponding args in this order.\n\n =============== ====================================================\n Attribute Description\n =============== ====================================================\n type\\_ a group record type for v3.\n aux_len the length of the auxiliary data in 32-bit words.\n num a number of the multicast servers.\n address a group address value.\n srcs a list of IPv6 addresses of the multicast servers.\n aux the auxiliary data.\n =============== ====================================================\n \"\"\"\n _PACK_STR = '!BBH16s'\n _MIN_LEN = struct.calcsize(_PACK_STR)\n _TYPE = {\n 'ascii': [\n 'address'\n ],\n 'asciilist': [\n 'srcs'\n ]\n }\n\n\n\n", "metadata": "root.mldv2_report_group", "header": "['module', '___EOS___']", "index": 874 }, { "content": " def __init__(self, type_=0, aux_len=0, num=0, address='::',\n srcs=None, aux=None):\n self.type_ = type_\n self.aux_len = aux_len\n self.num = num\n self.address = address\n srcs = srcs or []\n assert isinstance(srcs, list)\n for src in srcs:\n assert isinstance(src, str)\n self.srcs = srcs\n self.aux = aux", "metadata": "root.mldv2_report_group.__init__", "header": "['class', 'mldv2_report_group', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 908 }, { "content": " @classmethod\n def parser(cls, buf):\n (type_, aux_len, num, address\n ) = struct.unpack_from(cls._PACK_STR, buf)\n offset = cls._MIN_LEN\n srcs = []\n while 0 < len(buf[offset:]) and num > len(srcs):\n assert 16 <= len(buf[offset:])\n (src, ) = struct.unpack_from('16s', buf, offset)\n srcs.append(addrconv.ipv6.bin_to_text(src))\n offset += 16\n assert num == len(srcs)\n aux = None\n if aux_len:\n (aux, ) = struct.unpack_from('%ds' % (aux_len * 4), buf, offset)\n msg = cls(type_, aux_len, num, addrconv.ipv6.bin_to_text(address),\n srcs, aux)\n return msg", "metadata": "root.mldv2_report_group.parser", "header": "['class', 'mldv2_report_group', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 921 }, { "content": " def serialize(self):\n buf = bytearray(struct.pack(self._PACK_STR, self.type_,\n self.aux_len, self.num,\n addrconv.ipv6.text_to_bin(self.address)))\n for src in self.srcs:\n buf.extend(struct.pack('16s', addrconv.ipv6.text_to_bin(src)))\n if 0 == self.num:\n self.num = len(self.srcs)\n struct.pack_into('!H', buf, 2, self.num)\n if self.aux is not None:\n mod = len(self.aux) % 4\n if mod:\n self.aux += bytearray(4 - mod)\n self.aux = six.binary_type(self.aux)\n buf.extend(self.aux)\n if 0 == self.aux_len:\n self.aux_len = len(self.aux) // 4\n struct.pack_into('!B', buf, 1, self.aux_len)\n return six.binary_type(buf)", "metadata": "root.mldv2_report_group.serialize", "header": "['class', 'mldv2_report_group', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 940 }, { "content": " def __len__(self):\n return self._MIN_LEN + len(self.srcs) * 16 + self.aux_len * 4", "metadata": "root.mldv2_report_group.__len__", "header": "['class', 'mldv2_report_group', '(', 'stringify', '.', 'StringifyMixin', ')', ':', '___EOS___']", "index": 960 } ]
[ { "span": "import sys", "start_line": 18, "start_column": 0, "end_line": 18, "end_column": 10 }, { "span": "import array", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 12 }, { "span": "import binascii", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 15 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "C", ")", " ", "2012", " ", "Ni", "ppo", "n", " ", "Tele", "graph", " ", "and", " ", "Telephone", " ", "Cor", "porat", "ion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", "d", " ", "under", " ", "the", " ", "Ap", "ache", " ", "License", ",", " ", "Version", " ", "2.0", " ", "(", "the", " ", "\"", "License", "\");", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "you", " ", "may", " ", "not", " ", "use", " ", "this", " ", "file", " ", "except", " ", "in", " ", "compli", "anc", "e", " ", "with", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "You", " ", "may", " ", "obtain", " ", "a", " ", "copy", " ", "of", " ", "the", " ", "License", " ", "at_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", " ", "http", "://", "www", ".", "apa", "che", ".", "org", "/", "license", "s", "/", "LICENSE", "-", "2.0_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Un", "less", " ", "require", "d", " ", "by", " ", "applica", "ble", " ", "law", " ", "or", " ", "agree", "d", " ", "to", " ", "in", " ", "writ", "ing", ",", " ", "software", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "distributed", " ", "under", " ", "the", " ", "License", " ", "is", " ", "distributed", " ", "on", " ", "an", " ", "\"", "AS", " ", "IS", "\"", " ", "BAS", "IS", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "WITH", "OUT", " ", "WAR", "RAN", "TIES", " ", "OR", " ", "CONDITION", "S", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "eit", "her", " ", "express", " ", "or_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "impli", "ed", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "the", " ", "License", " ", "for", " ", "the", " ", "specific", " ", "language", " ", "govern", "ing", " ", "permissi", "ons", " ", "and_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "limit", "ation", "s", " ", "under", " ", "the", " ", "License", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "abc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "six_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "array_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "binascii_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "import_", "packet", "\\u", "base_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "packet", "\\u", "utils_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ryu", "_", "._", "lib_", "import_", "addr", "conv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "ryu", "_", "._", "lib_", "import_", "stringify", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ICM", "PV", "6", "\\u", "DST", "\\u", "UNRE", "ACH", "_", "=_", "1_", "#", " ", "dest", " ", "unreachable", ",", " ", "codes", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ICM", "PV", "6", "\\u", "PACKET", "\\u", "TOO", "\\u", "BIG", "_", "=_", "2_", "#", " ", "packet", " ", "too", " ", "big_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ICM", "PV", "6", "\\u", "TIME", "\\u", "EXCE", "EDE", "D_", "=_", "3_", "#", " ", "time", " ", "exceed", "ed", ",", " ", "code", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ICM", "PV", "6", "\\u", "PARAM", "\\u", "PROB", "_", "=_", "4_", "#", " ", "ip6", " ", "header", " ", "bad_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ICM", "PV", "6", "\\u", "ECHO", "\\u", "REQUEST_", "=_", "128_", "#", " ", "echo", " ", "service_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ICM", "PV", "6", "\\u", "ECHO", "\\u", "REPLY_", "=_", "129_", "#", " ", "echo", " ", "reply_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ML", "D", "\\u", "LISTEN", "ER", "\\u", "QUERY_", "=_", "130_", "#", " ", "multica", "st", " ", "listen", "er", " ", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ML", "D", "\\u", "LISTEN", "ER", "\\u", "REPO", "R_", "=_", "131_", "#", " ", "multica", "st", " ", "listen", "er", " ", "report_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ML", "D", "\\u", "LISTEN", "ER", "\\u", "DONE_", "=_", "132_", "#", " ", "multica", "st", " ", "listen", "er", " ", "done_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ML", "DV", "2", "\\u", "LISTEN", "ER", "\\u", "REPORT", "_", "=_", "143_", "#", " ", "multica", "st", " ", "liste", "rn", " ", "report", " ", "(", "v2", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "RF", "C2", "292", " ", "decl", "s_", "\\u\\u\\uNL\\u\\u\\u_", "ICM", "PV", "6", "\\u", "MEMBER", "SHIP", "\\u", "QUERY_", "=_", "130_", "#", " ", "group", " ", "member", "ship", " ", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ICM", "PV", "6", "\\u", "MEMBER", "SHIP", "\\u", "REPORT", "_", "=_", "131_", "#", " ", "group", " ", "member", "ship", " ", "report_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ICM", "PV", "6", "\\u", "MEMBER", "SHIP", "\\u", "RED", "UCT", "ION_", "=_", "132_", "#", " ", "group", " ", "member", "ship", " ", "termination", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ND", "\\u", "ROUTER", "\\u", "SOL", "ICIT", "_", "=_", "133_", "#", " ", "router", " ", "solicit", "ation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ND", "\\u", "ROUTER", "\\u", "ADV", "ERT", "_", "=_", "134_", "#", " ", "router", " ", "adver", "tis", "ment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ND", "\\u", "NEI", "GH", "BOR", "\\u", "SOL", "ICIT", "_", "=_", "135_", "#", " ", "neighbor", " ", "solicit", "ation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ND", "\\u", "NEI", "GH", "BOR", "\\u", "ADV", "ERT", "_", "=_", "136_", "#", " ", "neighbor", " ", "adver", "tis", "ment_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ND", "\\u", "RED", "IRE", "C_", "=_", "137_", "#", " ", "redirect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ICM", "PV", "6", "\\u", "ROUTER", "\\u", "REN", "UM", "BER", "ING_", "=_", "138_", "#", " ", "router", " ", "ren", "umber", "ing_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ICM", "PV", "6", "\\u", "WR", "URE", "QUEST_", "=_", "139_", "#", " ", "who", " ", "are", " ", "you", " ", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ICM", "PV", "6", "\\u", "WR", "URE", "PL", "Y_", "=_", "140_", "#", " ", "who", " ", "are", " ", "you", " ", "reply_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ICM", "PV", "6", "\\u", "FQ", "DN", "\\u", "QUERY_", "=_", "139_", "#", " ", "FQ", "DN", " ", "query_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ICM", "PV", "6", "\\u", "FQ", "DN", "\\u", "REPLY_", "=_", "140_", "#", " ", "FQ", "DN", " ", "reply_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ICM", "PV", "6", "\\u", "NI", "\\u", "QUERY_", "=_", "139_", "#", " ", "node", " ", "informati", "on", " ", "request_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ICM", "PV", "6", "\\u", "NI", "\\u", "REPLY_", "=_", "140_", "#", " ", "node", " ", "informati", "on", " ", "reply_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ICM", "PV", "6", "\\u", "MAX", "TYPE_", "=_", "201_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ND", "\\u", "OPTION", "S", " ", "from", " ", "RF", "C", " ", "486", "1_", "\\u\\u\\uNL\\u\\u\\u_", "ND", "\\u", "OPTION", "\\u", "SLA", "_", "=_", "1_", "#", " ", "Sou", "rce", " ", "Link", "-", "Layer", " ", "Address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ND", "\\u", "OPTION", "\\u", "TL", "A_", "=_", "2_", "#", " ", "Target", " ", "Link", "-", "Layer", " ", "Address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ND", "\\u", "OPTION", "\\u", "PI_", "=_", "3_", "#", " ", "Pref", "ix", " ", "Information_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ND", "\\u", "OPTION", "\\u", "RH", "_", "=_", "4_", "#", " ", "Redirect", "ed", " ", "Header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ND", "\\u", "OPTION", "\\u", "MT", "U_", "=_", "5_", "#", " ", "MT", "U_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MODE", "\\u", "IS", "\\u", "INCLUDE", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "MODE", "\\u", "IS", "\\u", "EXCLUDE", "_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CHANGE", "\\u", "TO", "\\u", "INCLUDE", "\\u", "MODE_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CHANGE", "\\u", "TO", "\\u", "EXCLUDE", "\\u", "MODE_", "=_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ALLOW", "\\u", "NEW", "\\u", "SOURCES", "_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "BLOCK", "\\u", "OLD", "\\u", "SOURCES", "_", "=_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "icmp", "v6_", "._", "set\\u", "classes_", "(_", "icmp", "v6_", "._", "\\u", "ICM", "PV", "6", "\\u", "TYPES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nd", "\\u", "neighbor_", "._", "set\\u", "classes_", "(_", "nd", "\\u", "neighbor_", "._", "\\u", "ND", "\\u", "OPTION", "\\u", "TYPES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nd", "\\u", "router", "\\u", "solicit", "_", "._", "set\\u", "classes_", "(_", "nd", "\\u", "router", "\\u", "solicit", "_", "._", "\\u", "ND", "\\u", "OPTION", "\\u", "TYPES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "nd", "\\u", "router", "\\u", "adver", "t_", "._", "set\\u", "classes_", "(_", "nd", "\\u", "router", "\\u", "adver", "t_", "._", "\\u", "ND", "\\u", "OPTION", "\\u", "TYPES_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "icmp", "v6_", "(_", "packet", "\\u", "base_", "._", "Packe", "t", "Base_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "ICM", "Pv6", " ", "(", "RF", "C", " ", "246", "3", ")", " ", "header", " ", "encode", "r", "/", "decode", "r", " ", "class", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "instance", " ", "has", " ", "the", " ", "follow", "ing", " ", "attribute", "s", " ", "at", " ", "leas", "t", ".", "\\", "10", ";", " ", " ", " ", " ", "Mos", "t", " ", "of", " ", "them", " ", "are", " ", "same", " ", "to", " ", "the", " ", "on", "-", "wire", " ", "counter", "part", "s", " ", "but", " ", "in", " ", "host", " ", "byte", " ", "order", ".", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u", "init", "\\u\\u", " ", "take", "s", " ", "the", " ", "correspond", "ing", " ", "args", " ", "in", " ", "this", " ", "order", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "tabular", "column", "s", "::", " ", "|", "l", "|", "p", "{", "3", "5e", "m", "}|", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "Attribute", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "type", "\\\\\\u", " ", " ", " ", " ", " ", "Type", "\\", "10", ";", " ", " ", " ", " ", "code", " ", " ", " ", "Code", "\\", "10", ";", " ", " ", " ", " ", "csu", "m", " ", " ", " ", "Check", "Sum", "\\", "10", ";", " ", "(", "0", " ", "means", " ", "automati", "call", "y", "-", "calcul", "ate", " ", "whe", "n", " ", "encoding", ")", "\\", "10", ";", " ", " ", " ", " ", "data", " ", " ", " ", "Pay", "load", ".", "\\", "10", ";", "\\", "10", ";", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "echo", " ", "object", ",", " ", "\\\\", "\\", "10", ";", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "nd", "\\u", "neighbor", " ", "object", ",", " ", "\\\\", "\\", "10", ";", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "nd", "\\u", "router", "\\u", "solicit", " ", "object", ",", " ", "\\\\", "\\", "10", ";", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "nd", "\\u", "router", "\\u", "adver", "t", " ", "object", ",", " ", "\\\\", "\\", "10", ";", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "mld", " ", "object", ",", " ", "\\\\", "\\", "10", ";", " ", "or", " ", "a", " ", "bytea", "rray", ".", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PACK", "\\u", "STR_", "=_", "'!", "BB", "H", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "MIN", "\\u", "LEN_", "=_", "struct_", "._", "calcsize_", "(_", "\\u", "PACK", "\\u", "STR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ICM", "PV", "6", "\\u", "TYPES_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "icmp", "v6_", "(_", "packet", "\\u", "base_", "._", "Packe", "t", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register", "\\u", "icmp", "v6", "\\u", "type_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "register", "\\u", "icmp", "v6", "\\u", "type_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "type\\u_", "in_", "args_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "icmp", "v6_", "._", "\\u", "ICM", "PV", "6", "\\u", "TYPES_", "[_", "type\\u_", "]_", "=_", "cls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "cls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "register", "\\u", "icmp", "v6", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "icmp", "v6_", "(_", "packet", "\\u", "base_", "._", "Packe", "t", "Base_", ")_", ":_", "\\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_", ",_", "type\\u_", "=_", "0_", ",_", "code_", "=_", "0_", ",_", "csu", "m_", "=_", "0_", ",_", "data_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "icmp", "v6_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "type\\u_", "=_", "type\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "code_", "=_", "code_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "csu", "m_", "=_", "csu", "m_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "icmp", "v6_", "(_", "packet", "\\u", "base_", "._", "Packe", "t", "Base_", ")_", ":_", "\\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_", "parser_", "(_", "cls_", ",_", "buf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "type\\u_", ",_", "code_", ",_", "csu", "m_", ")_", "=_", "struct_", "._", "unpack", "\\u", "from_", "(_", "cls_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "cls_", "(_", "type\\u_", ",_", "code_", ",_", "csu", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "=_", "cls_", "._", "\\u", "MIN", "\\u", "LEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "buf_", ")_", ">_", "offset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "cls", "\\u_", "=_", "cls_", "._", "\\u", "ICM", "PV", "6", "\\u", "TYPES_", "._", "get_", "(_", "type\\u_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cls", "\\u_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "._", "data_", "=_", "cls", "\\u_", "._", "parser_", "(_", "buf_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "._", "data_", "=_", "buf_", "[_", "offset_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "msg_", ",_", "None_", ",_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "icmp", "v6_", "(_", "packet", "\\u", "base_", "._", "Packe", "t", "Base_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "serialize_", "(_", "self_", ",_", "payload_", ",_", "prev_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hdr_", "=_", "bytearray_", "(_", "struct_", "._", "pack_", "(_", "icmp", "v6_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "self_", "._", "type\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "code_", ",_", "self_", "._", "csu", "m_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "data_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "type\\u_", "in_", "icmp", "v6_", "._", "\\u", "ICM", "PV", "6", "\\u", "TYPES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hdr_", "+=_", "self_", "._", "data_", "._", "serialize_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hdr_", "+=_", "self_", "._", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "csu", "m_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "csu", "m_", "=_", "packet", "\\u", "utils_", "._", "checks", "um", "\\u", "ip_", "(_", "prev_", ",_", "len_", "(_", "hdr_", ")_", ",_", "hdr_", "+_", "payload_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "struct_", "._", "pack", "\\u", "into_", "(_", "'!", "H", "'_", ",_", "hdr_", ",_", "2_", ",_", "self_", "._", "csu", "m_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "hdr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "icmp", "v6_", "(_", "packet", "\\u", "base_", "._", "Packe", "t", "Base_", ")_", ":_", "\\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 ", " _", "length_", "=_", "self_", "._", "\\u", "MIN", "\\u", "LEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "data_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "length_", "+=_", "len_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "icmp", "v6_", "._", "register", "\\u", "icmp", "v6", "\\u", "type_", "(_", "ND", "\\u", "NEI", "GH", "BOR", "\\u", "SOL", "ICIT", "_", ",_", "ND", "\\u", "NEI", "GH", "BOR", "\\u", "ADV", "ERT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "nd", "\\u", "neighbor_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "ICM", "Pv6", " ", "sub", " ", "encode", "r", "/", "decode", "r", " ", "class", " ", "for", " ", "Neighbor", " ", "Soli", "cit", "ation", " ", "and", "\\", "10", ";", " ", " ", " ", " ", "Neighbor", " ", "Advert", "ise", "ment", " ", "message", "s", ".", " ", "(", "RF", "C", " ", "486", "1", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "used", " ", "with", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "icmp", "v6", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "instance", " ", "has", " ", "the", " ", "follow", "ing", " ", "attribute", "s", " ", "at", " ", "leas", "t", ".", "\\", "10", ";", " ", " ", " ", " ", "Mos", "t", " ", "of", " ", "them", " ", "are", " ", "same", " ", "to", " ", "the", " ", "on", "-", "wire", " ", "counter", "part", "s", " ", "but", " ", "in", " ", "host", " ", "byte", " ", "order", ".", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u", "init", "\\u\\u", " ", "take", "s", " ", "the", " ", "correspond", "ing", " ", "args", " ", "in", " ", "this", " ", "order", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "tabular", "column", "s", "::", " ", "|", "l", "|", "p", "{", "3", "5e", "m", "}|", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "Attribute", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "res", " ", " ", " ", " ", "R", ",", "S", ",", "O", " ", "Fla", "gs", " ", "for", " ", "Neighbor", " ", "Advert", "ise", "ment", ".", " ", "\\\\", "\\", "10", ";", " ", "The", " ", "3", " ", "MS", "Bs", " ", "of", " ", "\"", "Reserve", "d", "\"", " ", "field", " ", "for", " ", "Neighbor", " ", "Soli", "cit", "ation", ".", "\\", "10", ";", " ", " ", " ", " ", "dst", " ", " ", " ", " ", "Target", " ", "Address", "\\", "10", ";", " ", " ", " ", " ", "option", " ", " ", " ", " ", " ", "a", " ", "derive", "d", " ", "object", " ", "of", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "nd", "\\u", "option", " ", "\\\\", "\\", "10", ";", " ", "or", " ", "a", " ", "bytea", "rray", ".", " ", "Non", "e", " ", "if", " ", "no", " ", "options", ".", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PACK", "\\u", "STR_", "=_", "'!", "I1", "6", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "MIN", "\\u", "LEN_", "=_", "struct_", "._", "calcsize_", "(_", "\\u", "PACK", "\\u", "STR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ND", "\\u", "OPTION", "\\u", "TYPES_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "TYPE_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ascii", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "dst", "'_", "\\u\\u\\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_", "[SEP]_", "class_", "nd", "\\u", "neighbor_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register", "\\u", "nd", "\\u", "option", "\\u", "type_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "register", "\\u", "nd", "\\u", "option", "\\u", "type_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nd", "\\u", "neighbor_", "._", "\\u", "ND", "\\u", "OPTION", "\\u", "TYPES_", "[_", "cls_", "._", "option", "\\u", "type_", "(_", ")_", "]_", "=_", "cls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "register", "\\u", "nd", "\\u", "option", "\\u", "type_", "(_", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "neighbor_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\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_", ",_", "res_", "=_", "0_", ",_", "dst_", "=_", "'::'", "_", ",_", "option_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "res_", "=_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "dst_", "=_", "dst_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "option_", "=_", "option_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "neighbor_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\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_", "parser_", "(_", "cls_", ",_", "buf_", ",_", "offset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "res_", ",_", "dst_", ")_", "=_", "struct_", "._", "unpack", "\\u", "from_", "(_", "cls_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "buf_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "+=_", "cls_", "._", "\\u", "MIN", "\\u", "LEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "buf_", ")_", ">_", "offset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "type\\u_", ",_", ")_", "=_", "struct_", "._", "unpack", "\\u", "from_", "(_", "'!", "B", "'_", ",_", "buf_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls", "\\u_", "=_", "cls_", "._", "\\u", "ND", "\\u", "OPTION", "\\u", "TYPES_", "._", "get_", "(_", "type\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cls", "\\u_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option_", "=_", "cls", "\\u_", "._", "parser_", "(_", "buf_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option_", "=_", "buf_", "[_", "offset_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "cls_", "(_", "res_", ">>_", "29_", ",_", "addr", "conv_", "._", "ipv6_", "._", "bin", "\\u", "to", "\\u", "text_", "(_", "dst_", ")_", ",_", "option_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "neighbor_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "serialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "res_", "<<_", "29_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hdr_", "=_", "bytearray_", "(_", "struct_", "._", "pack_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "nd", "\\u", "neighbor_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "res_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "addr", "conv_", "._", "ipv6_", "._", "text", "\\u", "to", "\\u", "bin_", "(_", "self_", "._", "dst_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "option_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "self_", "._", "option_", ",_", "nd", "\\u", "option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hdr_", "._", "extend_", "(_", "self_", "._", "option_", "._", "serialize_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hdr_", "._", "extend_", "(_", "self_", "._", "option_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "six_", "._", "binar", "y", "\\u", "type_", "(_", "hdr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "neighbor_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\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 ", " _", "length_", "=_", "self_", "._", "\\u", "MIN", "\\u", "LEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "option_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "length_", "+=_", "len_", "(_", "self_", "._", "option_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "icmp", "v6_", "._", "register", "\\u", "icmp", "v6", "\\u", "type_", "(_", "ND", "\\u", "ROUTER", "\\u", "SOL", "ICIT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "nd", "\\u", "router", "\\u", "solicit", "_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "ICM", "Pv6", " ", "sub", " ", "encode", "r", "/", "decode", "r", " ", "class", " ", "for", " ", "Route", "r", " ", "Soli", "cit", "ation", " ", "message", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "(", "RF", "C", " ", "486", "1", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "used", " ", "with", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "icmp", "v6", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "instance", " ", "has", " ", "the", " ", "follow", "ing", " ", "attribute", "s", " ", "at", " ", "leas", "t", ".", "\\", "10", ";", " ", " ", " ", " ", "Mos", "t", " ", "of", " ", "them", " ", "are", " ", "same", " ", "to", " ", "the", " ", "on", "-", "wire", " ", "counter", "part", "s", " ", "but", " ", "in", " ", "host", " ", "byte", " ", "order", ".", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u", "init", "\\u\\u", " ", "take", "s", " ", "the", " ", "correspond", "ing", " ", "args", " ", "in", " ", "this", " ", "order", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "tabular", "column", "s", "::", " ", "|", "l", "|", "p", "{", "3", "5e", "m", "}|", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "Attribute", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "res", " ", " ", " ", " ", "Thi", "s", " ", "field", " ", "is", " ", "unu", "sed", ".", " ", " ", "It", " ", "MUS", "T", " ", "be", " ", "initialize", "d", " ", "to", " ", "zero", ".", "\\", "10", ";", " ", " ", " ", " ", "option", " ", " ", " ", " ", " ", "a", " ", "derive", "d", " ", "object", " ", "of", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "nd", "\\u", "option", " ", "\\\\", "\\", "10", ";", " ", "or", " ", "a", " ", "bytea", "rray", ".", " ", "Non", "e", " ", "if", " ", "no", " ", "options", ".", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PACK", "\\u", "STR_", "=_", "'!", "I", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "MIN", "\\u", "LEN_", "=_", "struct_", "._", "calcsize_", "(_", "\\u", "PACK", "\\u", "STR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ND", "\\u", "OPTION", "\\u", "TYPES_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "nd", "\\u", "router", "\\u", "solicit", "_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register", "\\u", "nd", "\\u", "option", "\\u", "type_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "register", "\\u", "nd", "\\u", "option", "\\u", "type_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nd", "\\u", "router", "\\u", "solicit", "_", "._", "\\u", "ND", "\\u", "OPTION", "\\u", "TYPES_", "[_", "cls_", "._", "option", "\\u", "type_", "(_", ")_", "]_", "=_", "cls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "register", "\\u", "nd", "\\u", "option", "\\u", "type_", "(_", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "router", "\\u", "solicit", "_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\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_", ",_", "res_", "=_", "0_", ",_", "option_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "res_", "=_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "option_", "=_", "option_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "router", "\\u", "solicit", "_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\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_", "parser_", "(_", "cls_", ",_", "buf_", ",_", "offset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "res_", ",_", ")_", "=_", "struct_", "._", "unpack", "\\u", "from_", "(_", "cls_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "buf_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "+=_", "cls_", "._", "\\u", "MIN", "\\u", "LEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "option_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "buf_", ")_", ">_", "offset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "type\\u_", ",_", ")_", "=_", "struct_", "._", "unpack", "\\u", "from_", "(_", "'!", "B", "'_", ",_", "buf_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls", "\\u_", "=_", "cls_", "._", "\\u", "ND", "\\u", "OPTION", "\\u", "TYPES_", "._", "get_", "(_", "type\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cls", "\\u_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option_", "=_", "cls", "\\u_", "._", "parser_", "(_", "buf_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option_", "=_", "buf_", "[_", "offset_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "cls_", "(_", "res_", ",_", "option_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "router", "\\u", "solicit", "_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "serialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hdr_", "=_", "bytearray_", "(_", "struct_", "._", "pack_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "nd", "\\u", "router", "\\u", "solicit", "_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "self_", "._", "res_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "option_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "self_", "._", "option_", ",_", "nd", "\\u", "option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hdr_", "._", "extend_", "(_", "self_", "._", "option_", "._", "serialize_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hdr_", "._", "extend_", "(_", "self_", "._", "option_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "six_", "._", "binar", "y", "\\u", "type_", "(_", "hdr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "router", "\\u", "solicit", "_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\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 ", " _", "length_", "=_", "self_", "._", "\\u", "MIN", "\\u", "LEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "option_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "length_", "+=_", "len_", "(_", "self_", "._", "option_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "icmp", "v6_", "._", "register", "\\u", "icmp", "v6", "\\u", "type_", "(_", "ND", "\\u", "ROUTER", "\\u", "ADV", "ERT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "nd", "\\u", "router", "\\u", "adver", "t_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "ICM", "Pv6", " ", "sub", " ", "encode", "r", "/", "decode", "r", " ", "class", " ", "for", " ", "Route", "r", " ", "Advert", "ise", "ment", " ", "message", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "(", "RF", "C", " ", "486", "1", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "used", " ", "with", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "icmp", "v6", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "instance", " ", "has", " ", "the", " ", "follow", "ing", " ", "attribute", "s", " ", "at", " ", "leas", "t", ".", "\\", "10", ";", " ", " ", " ", " ", "Mos", "t", " ", "of", " ", "them", " ", "are", " ", "same", " ", "to", " ", "the", " ", "on", "-", "wire", " ", "counter", "part", "s", " ", "but", " ", "in", " ", "host", " ", "byte", " ", "order", ".", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u", "init", "\\u\\u", " ", "take", "s", " ", "the", " ", "correspond", "ing", " ", "args", " ", "in", " ", "this", " ", "order", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "tabular", "column", "s", "::", " ", "|", "l", "|", "p", "{", "3", "5e", "m", "}|", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "Attribute", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "ch", "\\u", "l", " ", " ", " ", "Cur", " ", "Hop", " ", "Limit", ".", "\\", "10", ";", " ", " ", " ", " ", "res", " ", " ", " ", " ", "M", ",", "O", " ", "Fla", "gs", " ", "for", " ", "Route", "r", " ", "Advert", "ise", "ment", ".", "\\", "10", ";", " ", " ", " ", " ", "rou", "\\u", "l", " ", " ", "Route", "r", " ", "Life", "time", ".", "\\", "10", ";", " ", " ", " ", " ", "rea", "\\u", "t", " ", " ", "Reach", "able", " ", "Time", ".", "\\", "10", ";", " ", " ", " ", " ", "ret", "\\u", "t", " ", " ", "Retr", "ans", " ", "Time", "r", ".", "\\", "10", ";", " ", " ", " ", " ", "options", " ", " ", " ", " ", "List", " ", "of", " ", "a", " ", "derive", "d", " ", "object", " ", "of", " ", "\\\\", "\\", "10", ";", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "nd", "\\u", "option", " ", "or", " ", "a", " ", "bytea", "rray", ".", " ", "\\\\", "\\", "10", ";", " ", "Non", "e", " ", "if", " ", "no", " ", "options", ".", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PACK", "\\u", "STR_", "=_", "'!", "BB", "HI", "I", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "MIN", "\\u", "LEN_", "=_", "struct_", "._", "calcsize_", "(_", "\\u", "PACK", "\\u", "STR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ND", "\\u", "OPTION", "\\u", "TYPES_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "nd", "\\u", "router", "\\u", "adver", "t_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "staticmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "register", "\\u", "nd", "\\u", "option", "\\u", "type_", "(_", "*_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "register", "\\u", "nd", "\\u", "option", "\\u", "type_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nd", "\\u", "router", "\\u", "adver", "t_", "._", "\\u", "ND", "\\u", "OPTION", "\\u", "TYPES_", "[_", "cls_", "._", "option", "\\u", "type_", "(_", ")_", "]_", "=_", "cls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "\\u", "register", "\\u", "nd", "\\u", "option", "\\u", "type_", "(_", "args_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "router", "\\u", "adver", "t_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\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_", ",_", "ch", "\\u", "l_", "=_", "0_", ",_", "res_", "=_", "0_", ",_", "rou", "\\u", "l_", "=_", "0_", ",_", "rea", "\\u", "t_", "=_", "0_", ",_", "ret", "\\u", "t_", "=_", "0_", ",_", "options_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "ch", "\\u", "l_", "=_", "ch", "\\u", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "res_", "=_", "res_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rou", "\\u", "l_", "=_", "rou", "\\u", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "rea", "\\u", "t_", "=_", "rea", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "ret", "\\u", "t_", "=_", "ret", "\\u", "t_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "=_", "options_", "or_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "options_", ",_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "options_", "=_", "options_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "router", "\\u", "adver", "t_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\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_", "parser_", "(_", "cls_", ",_", "buf_", ",_", "offset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "ch", "\\u", "l_", ",_", "res_", ",_", "rou", "\\u", "l_", ",_", "rea", "\\u", "t_", ",_", "ret", "\\u", "t_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "=_", "struct_", "._", "unpack", "\\u", "from_", "(_", "cls_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "buf_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "+=_", "cls_", "._", "\\u", "MIN", "\\u", "LEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "options_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "buf_", ")_", ">_", "offset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "type\\u_", ",_", "length_", ")_", "=_", "struct_", "._", "unpack", "\\u", "from_", "(_", "'!", "BB", "'_", ",_", "buf_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "cls", "\\u_", "=_", "cls_", "._", "\\u", "ND", "\\u", "OPTION", "\\u", "TYPES_", "._", "get_", "(_", "type\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cls", "\\u_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option_", "=_", "cls", "\\u_", "._", "parser_", "(_", "buf_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "option_", "=_", "buf_", "[_", "offset_", ":_", "offset_", "+_", "(_", "length_", "*_", "8_", "-_", "2_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "options_", "._", "append_", "(_", "option_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "+=_", "len_", "(_", "option_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "cls_", "(_", "ch", "\\u", "l_", ",_", "res_", ">>_", "6_", ",_", "rou", "\\u", "l_", ",_", "rea", "\\u", "t_", ",_", "ret", "\\u", "t_", ",_", "options_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "router", "\\u", "adver", "t_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "serialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res_", "=_", "self_", "._", "res_", "<<_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hdr_", "=_", "bytearray_", "(_", "struct_", "._", "pack_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "nd", "\\u", "router", "\\u", "adver", "t_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "self_", "._", "ch", "\\u", "l_", ",_", "res_", ",_", "self_", "._", "rou", "\\u", "l_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "rea", "\\u", "t_", ",_", "self_", "._", "ret", "\\u", "t_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "option_", "in_", "self_", "._", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "option_", ",_", "nd", "\\u", "option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hdr_", "._", "extend_", "(_", "option_", "._", "serialize_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hdr_", "._", "extend_", "(_", "option_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "six_", "._", "binar", "y", "\\u", "type_", "(_", "hdr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "router", "\\u", "adver", "t_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\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 ", " _", "length_", "=_", "self_", "._", "\\u", "MIN", "\\u", "LEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "option_", "in_", "self_", "._", "options_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "length_", "+=_", "len_", "(_", "option_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "six_", "._", "add", "\\u", "metaclass_", "(_", "abc_", "._", "ABC", "Meta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "nd", "\\u", "option_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\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_", "[SEP]_", "class_", "nd", "\\u", "option_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "abc_", "._", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "option", "\\u", "type_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "option_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "abc_", "._", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "\\u", "type_", ",_", "length_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "type_", "=_", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "length_", "=_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "option_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\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_", "@_", "abc_", "._", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "parser_", "(_", "cls_", ",_", "buf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "option_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "abc_", "._", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "serialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "option_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\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_", "self_", "._", "\\u", "MIN", "\\u", "LEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "nd", "\\u", "option", "\\u", "la_", "(_", "nd", "\\u", "option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "PACK", "\\u", "STR_", "=_", "'!", "BB", "6", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "MIN", "\\u", "LEN_", "=_", "struct_", "._", "calcsize_", "(_", "\\u", "PACK", "\\u", "STR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "TYPE_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ascii", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "hw", "\\u", "src", "'_", "\\u\\u\\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_", "[SEP]_", "class_", "nd", "\\u", "option", "\\u", "la_", "(_", "nd", "\\u", "option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "abc_", "._", "abstractmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "length_", ",_", "hw", "\\u", "src_", ",_", "data_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "nd", "\\u", "option", "\\u", "la_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", "._", "option", "\\u", "type_", "(_", ")_", ",_", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "hw", "\\u", "src_", "=_", "hw", "\\u", "src_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "option", "\\u", "la_", "(_", "nd", "\\u", "option_", ")_", ":_", "\\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_", "parser_", "(_", "cls_", ",_", "buf_", ",_", "offset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "\\u_", ",_", "length_", ",_", "hw", "\\u", "src_", ")_", "=_", "struct_", "._", "unpack", "\\u", "from_", "(_", "cls_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "buf_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "cls_", "(_", "length_", ",_", "addr", "conv_", "._", "mac_", "._", "bin", "\\u", "to", "\\u", "text_", "(_", "hw", "\\u", "src_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "+=_", "cls_", "._", "\\u", "MIN", "\\u", "LEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "buf_", ")_", ">_", "offset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "._", "data_", "=_", "buf_", "[_", "offset_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "option", "\\u", "la_", "(_", "nd", "\\u", "option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "serialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "=_", "bytearray_", "(_", "struct_", "._", "pack_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "self_", "._", "option", "\\u", "type_", "(_", ")_", ",_", "self_", "._", "length_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "addr", "conv_", "._", "mac_", "._", "text", "\\u", "to", "\\u", "bin_", "(_", "self_", "._", "hw", "\\u", "src_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "data_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "._", "extend_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "mod_", "=_", "len_", "(_", "buf_", ")_", "%_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "._", "extend_", "(_", "bytearray_", "(_", "8_", "-_", "mod_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "0_", "==_", "self_", "._", "length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "length_", "=_", "len_", "(_", "buf_", ")_", "//_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "struct_", "._", "pack", "\\u", "into_", "(_", "'!", "B", "'_", ",_", "buf_", ",_", "1_", ",_", "self_", "._", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "six_", "._", "binar", "y", "\\u", "type_", "(_", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "option", "\\u", "la_", "(_", "nd", "\\u", "option_", ")_", ":_", "\\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 ", " _", "length_", "=_", "self_", "._", "\\u", "MIN", "\\u", "LEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "data_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "length_", "+=_", "len_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "nd", "\\u", "neighbor_", "._", "register", "\\u", "nd", "\\u", "option", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "nd", "\\u", "router", "\\u", "solicit", "_", "._", "register", "\\u", "nd", "\\u", "option", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "@_", "nd", "\\u", "router", "\\u", "adver", "t_", "._", "register", "\\u", "nd", "\\u", "option", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "nd", "\\u", "option", "\\u", "sla", "_", "(_", "nd", "\\u", "option", "\\u", "la_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "ICM", "Pv6", " ", "sub", " ", "encode", "r", "/", "decode", "r", " ", "class", " ", "for", " ", "Neighbor", " ", "discove", "ry", "\\", "10", ";", " ", " ", " ", " ", "Sou", "rce", " ", "Link", "-", "Layer", " ", "Address", " ", "Optio", "n", ".", " ", "(", "RF", "C", " ", "486", "1", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "used", " ", "with", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "nd", "\\u", "neighbor", ",", "\\", "10", ";", " ", " ", " ", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "nd", "\\u", "router", "\\u", "solicit", " ", "or", "\\", "10", ";", " ", " ", " ", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "nd", "\\u", "router", "\\u", "adver", "t", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "instance", " ", "has", " ", "the", " ", "follow", "ing", " ", "attribute", "s", " ", "at", " ", "leas", "t", ".", "\\", "10", ";", " ", " ", " ", " ", "Mos", "t", " ", "of", " ", "them", " ", "are", " ", "same", " ", "to", " ", "the", " ", "on", "-", "wire", " ", "counter", "part", "s", " ", "but", " ", "in", " ", "host", " ", "byte", " ", "order", ".", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u", "init", "\\u\\u", " ", "take", "s", " ", "the", " ", "correspond", "ing", " ", "args", " ", "in", " ", "this", " ", "order", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "tabular", "column", "s", "::", " ", "|", "l", "|", "p", "{", "3", "5e", "m", "}|", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "Attribute", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "length", " ", " ", " ", " ", " ", "length", " ", "of", " ", "the", " ", "option", ".", " ", "\\\\", "\\", "10", ";", " ", "(", "0", " ", "means", " ", "automati", "call", "y", "-", "calcul", "ate", " ", "whe", "n", " ", "encoding", ")", "\\", "10", ";", " ", " ", " ", " ", "hw", "\\u", "src", " ", " ", " ", " ", " ", "Link", "-", "Layer", " ", "Address", ".", " ", "\\\\", "\\", "10", ";", " ", "NOTE", ":", " ", "If", " ", "the", " ", "address", " ", "is", " ", "long", "er", " ", "than", " ", "6", " ", "octets", " ", "this", " ", "contain", "s", " ", "\\\\", "\\", "10", ";", " ", "the", " ", "first", " ", "6", " ", "octets", " ", "in", " ", "the", " ", "address", ".", " ", "\\\\", "\\", "10", ";", " ", "Thi", "s", " ", "implementation", " ", "assume", "s", " ", "the", " ", "address", " ", "has", " ", "at", " ", "leas", "t", " ", "\\\\", "\\", "10", ";", " ", "6", " ", "octets", ".", "\\", "10", ";", " ", " ", " ", " ", "data", " ", " ", " ", "A", " ", "bytea", "rray", " ", "whi", "ch", " ", "contain", "s", " ", "the", " ", "rest", " ", "of", " ", "Link", "-", "Layer", " ", "Address", " ", "\\\\", "\\", "10", ";", " ", "and", " ", "padd", "ing", ".", " ", " ", "Whe", "n", " ", "encoding", " ", "a", " ", "packet", ",", " ", "it", "'", "s", " ", "user", "'", "s", " ", "\\\\", "\\", "10", ";", " ", "responsib", "ilit", "y", " ", "to", " ", "provide", " ", "necessar", "y", " ", "padd", "ing", " ", "for", " ", "8", "-", "octets", " ", "\\\\", "\\", "10", ";", " ", "alignme", "nt", " ", "require", "d", " ", "by", " ", "the", " ", "protoc", "ol", ".", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "option", "\\u", "sla", "_", "(_", "nd", "\\u", "option", "\\u", "la_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "option", "\\u", "type_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ND", "\\u", "OPTION", "\\u", "SLA", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "option", "\\u", "sla", "_", "(_", "nd", "\\u", "option", "\\u", "la_", ")_", ":_", "\\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_", ",_", "length_", "=_", "0_", ",_", "hw", "\\u", "src_", "=_", "'", "00", ":", "00", ":", "00", ":", "00", ":", "00", ":", "00", "'_", ",_", "data_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "nd", "\\u", "option", "\\u", "sla", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "length_", ",_", "hw", "\\u", "src_", ",_", "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_", "@_", "nd", "\\u", "neighbor_", "._", "register", "\\u", "nd", "\\u", "option", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "nd", "\\u", "option", "\\u", "tla", "_", "(_", "nd", "\\u", "option", "\\u", "la_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "ICM", "Pv6", " ", "sub", " ", "encode", "r", "/", "decode", "r", " ", "class", " ", "for", " ", "Neighbor", " ", "discove", "ry", "\\", "10", ";", " ", " ", " ", " ", "Target", " ", "Link", "-", "Layer", " ", "Address", " ", "Optio", "n", ".", " ", "(", "RF", "C", " ", "486", "1", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "used", " ", "with", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "nd", "\\u", "neighbor", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "instance", " ", "has", " ", "the", " ", "follow", "ing", " ", "attribute", "s", " ", "at", " ", "leas", "t", ".", "\\", "10", ";", " ", " ", " ", " ", "Mos", "t", " ", "of", " ", "them", " ", "are", " ", "same", " ", "to", " ", "the", " ", "on", "-", "wire", " ", "counter", "part", "s", " ", "but", " ", "in", " ", "host", " ", "byte", " ", "order", ".", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u", "init", "\\u\\u", " ", "take", "s", " ", "the", " ", "correspond", "ing", " ", "args", " ", "in", " ", "this", " ", "order", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "tabular", "column", "s", "::", " ", "|", "l", "|", "p", "{", "3", "5e", "m", "}|", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "Attribute", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "length", " ", " ", " ", " ", " ", "length", " ", "of", " ", "the", " ", "option", ".", " ", "\\\\", "\\", "10", ";", " ", "(", "0", " ", "means", " ", "automati", "call", "y", "-", "calcul", "ate", " ", "whe", "n", " ", "encoding", ")", "\\", "10", ";", " ", " ", " ", " ", "hw", "\\u", "src", " ", " ", " ", " ", " ", "Link", "-", "Layer", " ", "Address", ".", " ", "\\\\", "\\", "10", ";", " ", "NOTE", ":", " ", "If", " ", "the", " ", "address", " ", "is", " ", "long", "er", " ", "than", " ", "6", " ", "octets", " ", "this", " ", "contain", "s", " ", "\\\\", "\\", "10", ";", " ", "the", " ", "first", " ", "6", " ", "octets", " ", "in", " ", "the", " ", "address", ".", " ", "\\\\", "\\", "10", ";", " ", "Thi", "s", " ", "implementation", " ", "assume", "s", " ", "the", " ", "address", " ", "has", " ", "at", " ", "leas", "t", " ", "\\\\", "\\", "10", ";", " ", "6", " ", "octets", ".", "\\", "10", ";", " ", " ", " ", " ", "data", " ", " ", " ", "A", " ", "bytea", "rray", " ", "whi", "ch", " ", "contain", "s", " ", "the", " ", "rest", " ", "of", " ", "Link", "-", "Layer", " ", "Address", " ", "\\\\", "\\", "10", ";", " ", "and", " ", "padd", "ing", ".", " ", " ", "Whe", "n", " ", "encoding", " ", "a", " ", "packet", ",", " ", "it", "'", "s", " ", "user", "'", "s", " ", "\\\\", "\\", "10", ";", " ", "responsib", "ilit", "y", " ", "to", " ", "provide", " ", "necessar", "y", " ", "padd", "ing", " ", "for", " ", "8", "-", "octets", " ", "\\\\", "\\", "10", ";", " ", "alignme", "nt", " ", "require", "d", " ", "by", " ", "the", " ", "protoc", "ol", ".", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "option", "\\u", "tla", "_", "(_", "nd", "\\u", "option", "\\u", "la_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "option", "\\u", "type_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ND", "\\u", "OPTION", "\\u", "TL", "A_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "option", "\\u", "tla", "_", "(_", "nd", "\\u", "option", "\\u", "la_", ")_", ":_", "\\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_", ",_", "length_", "=_", "0_", ",_", "hw", "\\u", "src_", "=_", "'", "00", ":", "00", ":", "00", ":", "00", ":", "00", ":", "00", "'_", ",_", "data_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "nd", "\\u", "option", "\\u", "tla", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "length_", ",_", "hw", "\\u", "src_", ",_", "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_", "@_", "nd", "\\u", "router", "\\u", "adver", "t_", "._", "register", "\\u", "nd", "\\u", "option", "\\u", "type_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "nd", "\\u", "option", "\\u", "pi_", "(_", "nd", "\\u", "option_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "ICM", "Pv6", " ", "sub", " ", "encode", "r", "/", "decode", "r", " ", "class", " ", "for", " ", "Neighbor", " ", "discove", "ry", "\\", "10", ";", " ", " ", " ", " ", "Pref", "ix", " ", "Information", " ", "Optio", "n", ".", " ", "(", "RF", "C", " ", "486", "1", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "used", " ", "with", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "nd", "\\u", "router", "\\u", "adver", "t", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "instance", " ", "has", " ", "the", " ", "follow", "ing", " ", "attribute", "s", " ", "at", " ", "leas", "t", ".", "\\", "10", ";", " ", " ", " ", " ", "Mos", "t", " ", "of", " ", "them", " ", "are", " ", "same", " ", "to", " ", "the", " ", "on", "-", "wire", " ", "counter", "part", "s", " ", "but", " ", "in", " ", "host", " ", "byte", " ", "order", ".", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u", "init", "\\u\\u", " ", "take", "s", " ", "the", " ", "correspond", "ing", " ", "args", " ", "in", " ", "this", " ", "order", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "..", " ", "tabular", "column", "s", "::", " ", "|", "l", "|", "p", "{", "3", "5e", "m", "}|", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "Attribute", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "length", " ", " ", " ", " ", " ", "length", " ", "of", " ", "the", " ", "option", ".", " ", "\\\\", "\\", "10", ";", " ", "(", "0", " ", "means", " ", "automati", "call", "y", "-", "calcul", "ate", " ", "whe", "n", " ", "encoding", ")", "\\", "10", ";", " ", " ", " ", " ", "pl", " ", " ", " ", " ", " ", "Pref", "ix", " ", "Length", ".", "\\", "10", ";", " ", " ", " ", " ", "res", "1", " ", " ", " ", "L", ",", "A", ",", "R", "\\\\*", " ", "Fla", "gs", " ", "for", " ", "Pref", "ix", " ", "Information", ".", "\\", "10", ";", " ", " ", " ", " ", "val", "\\u", "l", " ", " ", "Valid", " ", "Life", "time", ".", "\\", "10", ";", " ", " ", " ", " ", "pre", "\\u", "l", " ", " ", "Prefe", "rre", "d", " ", "Life", "time", ".", "\\", "10", ";", " ", " ", " ", " ", "res", "2", " ", " ", " ", "Thi", "s", " ", "field", " ", "is", " ", "unu", "sed", ".", " ", "It", " ", "MUS", "T", " ", "be", " ", "initialize", "d", " ", "to", " ", "zero", ".", "\\", "10", ";", " ", " ", " ", " ", "prefix", " ", " ", " ", " ", " ", "An", " ", "IP", " ", "address", " ", "or", " ", "a", " ", "prefix", " ", "of", " ", "an", " ", "IP", " ", "address", ".", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "\\\\*", "R", " ", "flag", " ", "is", " ", "defin", "ed", " ", "in", " ", "(", "RF", "C", " ", "377", "5", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PACK", "\\u", "STR_", "=_", "'!", "BBBB", "III", "16", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "MIN", "\\u", "LEN_", "=_", "struct_", "._", "calcsize_", "(_", "\\u", "PACK", "\\u", "STR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "TYPE_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ascii", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "prefix", "'_", "\\u\\u\\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_", "[SEP]_", "class_", "nd", "\\u", "option", "\\u", "pi_", "(_", "nd", "\\u", "option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "classmethod_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "option", "\\u", "type_", "(_", "cls_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "ND", "\\u", "OPTION", "\\u", "PI_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "option", "\\u", "pi_", "(_", "nd", "\\u", "option_", ")_", ":_", "\\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_", ",_", "length_", "=_", "0_", ",_", "pl_", "=_", "0_", ",_", "res1_", "=_", "0_", ",_", "val", "\\u", "l_", "=_", "0_", ",_", "pre", "\\u", "l_", "=_", "0_", ",_", "res2_", "=_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "prefix_", "=_", "'::'", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "nd", "\\u", "option", "\\u", "pi_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", "._", "option", "\\u", "type_", "(_", ")_", ",_", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pl_", "=_", "pl_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "res1_", "=_", "res1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "val", "\\u", "l_", "=_", "val", "\\u", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pre", "\\u", "l_", "=_", "pre", "\\u", "l_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "res2_", "=_", "res2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "prefix_", "=_", "prefix_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "option", "\\u", "pi_", "(_", "nd", "\\u", "option_", ")_", ":_", "\\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_", "parser_", "(_", "cls_", ",_", "buf_", ",_", "offset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "\\u_", ",_", "length_", ",_", "pl_", ",_", "res1_", ",_", "val", "\\u", "l_", ",_", "pre", "\\u", "l_", ",_", "res2_", ",_", "prefix_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "=_", "struct_", "._", "unpack", "\\u", "from_", "(_", "cls_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "buf_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "cls_", "(_", "length_", ",_", "pl_", ",_", "res1_", ">>_", "5_", ",_", "val", "\\u", "l_", ",_", "pre", "\\u", "l_", ",_", "res2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "addr", "conv_", "._", "ipv6_", "._", "bin", "\\u", "to", "\\u", "text_", "(_", "prefix_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "nd", "\\u", "option", "\\u", "pi_", "(_", "nd", "\\u", "option_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "serialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "res1_", "=_", "self_", "._", "res1_", "<<_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hdr_", "=_", "bytearray_", "(_", "struct_", "._", "pack_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "self_", "._", "option", "\\u", "type_", "(_", ")_", ",_", "self_", "._", "length_", ",_", "self_", "._", "pl_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "res1_", ",_", "self_", "._", "val", "\\u", "l_", ",_", "self_", "._", "pre", "\\u", "l_", ",_", "self_", "._", "res2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "addr", "conv_", "._", "ipv6_", "._", "text", "\\u", "to", "\\u", "bin_", "(_", "self_", "._", "prefix_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "0_", "==_", "self_", "._", "length_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "length_", "=_", "len_", "(_", "hdr_", ")_", "//_", "8_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "struct_", "._", "pack", "\\u", "into_", "(_", "'!", "B", "'_", ",_", "hdr_", ",_", "1_", ",_", "self_", "._", "length_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "six_", "._", "binar", "y", "\\u", "type_", "(_", "hdr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "icmp", "v6_", "._", "register", "\\u", "icmp", "v6", "\\u", "type_", "(_", "ICM", "PV", "6", "\\u", "ECHO", "\\u", "REPLY_", ",_", "ICM", "PV", "6", "\\u", "ECHO", "\\u", "REQUEST_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "echo_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "ICM", "Pv6", " ", "sub", " ", "encode", "r", "/", "decode", "r", " ", "class", " ", "for", " ", "Ech", "o", " ", "Request", " ", "and", " ", "Ech", "o", " ", "Repl", "y", "\\", "10", ";", " ", " ", " ", " ", "message", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "used", " ", "with", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "icmp", "v6", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "ICM", "Pv6", " ", "Ech", "o", " ", "Request", " ", "and", " ", "Ech", "o", " ", "Repl", "y", " ", "message", "s", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "instance", " ", "has", " ", "the", " ", "follow", "ing", " ", "attribute", "s", " ", "at", " ", "leas", "t", ".", "\\", "10", ";", " ", " ", " ", " ", "Mos", "t", " ", "of", " ", "them", " ", "are", " ", "same", " ", "to", " ", "the", " ", "on", "-", "wire", " ", "counter", "part", "s", " ", "but", " ", "in", " ", "host", " ", "byte", " ", "order", ".", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u", "init", "\\u\\u", " ", "take", "s", " ", "the", " ", "correspond", "ing", " ", "args", " ", "in", " ", "this", " ", "order", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "Attribute", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "id", " ", " ", " ", " ", " ", "Identifie", "r", "\\", "10", ";", " ", " ", " ", " ", "seq", " ", " ", " ", " ", "Sequ", "ence", " ", "Number", "\\", "10", ";", " ", " ", " ", " ", "data", " ", " ", " ", "Data", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "=====", "=", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PACK", "\\u", "STR_", "=_", "'!", "HH", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "MIN", "\\u", "LEN_", "=_", "struct_", "._", "calcsize_", "(_", "\\u", "PACK", "\\u", "STR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "echo_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "id\\u_", "=_", "0_", ",_", "seq_", "=_", "0_", ",_", "data_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "id_", "=_", "id\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "seq_", "=_", "seq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "data_", "=_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "echo_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\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_", "parser_", "(_", "cls_", ",_", "buf_", ",_", "offset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "id\\u_", ",_", "seq_", ")_", "=_", "struct_", "._", "unpack", "\\u", "from_", "(_", "cls_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "buf_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "cls_", "(_", "id\\u_", ",_", "seq_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "+=_", "cls_", "._", "\\u", "MIN", "\\u", "LEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "len_", "(_", "buf_", ")_", ">_", "offset_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "._", "data_", "=_", "buf_", "[_", "offset_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "echo_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "serialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hdr_", "=_", "bytearray_", "(_", "struct_", "._", "pack_", "(_", "echo_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "self_", "._", "id_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "seq_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "data_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "hdr_", "+=_", "bytearray_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "hdr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "echo_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\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 ", " _", "length_", "=_", "self_", "._", "\\u", "MIN", "\\u", "LEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "data_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "length_", "+=_", "len_", "(_", "self_", "._", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "length_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "icmp", "v6_", "._", "register", "\\u", "icmp", "v6", "\\u", "type_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "ML", "D", "\\u", "LISTEN", "ER", "\\u", "QUERY_", ",_", "ML", "D", "\\u", "LISTEN", "ER", "\\u", "REPO", "R_", ",_", "ML", "D", "\\u", "LISTEN", "ER", "\\u", "DONE_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "mld", "_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "ICM", "Pv6", " ", "sub", " ", "encode", "r", "/", "decode", "r", " ", "class", " ", "for", " ", "ML", "D", " ", "Liste", "r", " ", "Query", ",", "\\", "10", ";", " ", " ", " ", " ", "ML", "D", " ", "Listen", "er", " ", "Report", ",", " ", "and", " ", "ML", "D", " ", "Listen", "er", " ", "Don", "e", " ", "message", "s", ".", " ", "(", "RF", "C", " ", "271", "0", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "www", ".", "iet", "f", ".", "org", "/", "rfc", "/", "rfc", "271", "0.", "txt", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "used", " ", "with", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "icmp", "v6", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "instance", " ", "has", " ", "the", " ", "follow", "ing", " ", "attribute", "s", " ", "at", " ", "leas", "t", ".", "\\", "10", ";", " ", " ", " ", " ", "Mos", "t", " ", "of", " ", "them", " ", "are", " ", "same", " ", "to", " ", "the", " ", "on", "-", "wire", " ", "counter", "part", "s", " ", "but", " ", "in", " ", "host", " ", "byte", " ", "order", ".", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u", "init", "\\u\\u", " ", "take", "s", " ", "the", " ", "correspond", "ing", " ", "args", " ", "in", " ", "this", " ", "order", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "==============", "============", "=", "\\", "10", ";", " ", " ", " ", " ", "Attribute", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "==============", "============", "=", "\\", "10", ";", " ", " ", " ", " ", "maxr", "esp", " ", " ", " ", " ", "max", " ", "response", " ", "time", " ", "in", " ", "millis", "econd", ".", " ", "it", " ", "is", "\\", "10", ";", " ", "meaning", "ful", " ", "only", " ", "in", " ", "Query", " ", "Messag", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "address", " ", " ", " ", " ", "a", " ", "group", " ", "address", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "==============", "============", "=", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PACK", "\\u", "STR_", "=_", "'!", "H2", "x1", "6", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "MIN", "\\u", "LEN_", "=_", "struct_", "._", "calcsize_", "(_", "\\u", "PACK", "\\u", "STR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "TYPE_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ascii", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "'_", "\\u\\u\\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_", "[SEP]_", "class_", "mld", "_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "maxr", "esp", "_", "=_", "0_", ",_", "address_", "=_", "'::'", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "maxr", "esp", "_", "=_", "maxr", "esp", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "address_", "=_", "address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "mld", "_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\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_", "parser_", "(_", "cls_", ",_", "buf_", ",_", "offset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "cls_", "._", "\\u", "MIN", "\\u", "LEN_", "<_", "len_", "(_", "buf_", "[_", "offset_", ":_", "]_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "msg_", "=_", "mld", "v2", "\\u", "query_", "._", "parser_", "(_", "buf_", "[_", "offset_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "maxr", "esp", "_", ",_", "address_", ")_", "=_", "struct_", "._", "unpack", "\\u", "from_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "cls_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "buf_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "msg_", "=_", "cls_", "(_", "maxr", "esp", "_", ",_", "addr", "conv_", "._", "ipv6_", "._", "bin", "\\u", "to", "\\u", "text_", "(_", "address_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "mld", "_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "serialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "=_", "struct_", "._", "pack_", "(_", "mld", "_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "self_", "._", "maxr", "esp", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "addr", "conv_", "._", "ipv6_", "._", "text", "\\u", "to", "\\u", "bin_", "(_", "self_", "._", "address_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "buf_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "mld", "_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\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_", "self_", "._", "\\u", "MIN", "\\u", "LEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "mld", "v2", "\\u", "query_", "(_", "mld", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "ICM", "Pv6", " ", "sub", " ", "encode", "r", "/", "decode", "r", " ", "class", " ", "for", " ", "ML", "D", " ", "v2", " ", "Liste", "r", " ", "Query", " ", "message", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "(", "RF", "C", " ", "381", "0", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "www", ".", "iet", "f", ".", "org", "/", "rfc", "/", "rfc", "381", "0.", "txt", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "used", " ", "with", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "icmp", "v6", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "instance", " ", "has", " ", "the", " ", "follow", "ing", " ", "attribute", "s", " ", "at", " ", "leas", "t", ".", "\\", "10", ";", " ", " ", " ", " ", "Mos", "t", " ", "of", " ", "them", " ", "are", " ", "same", " ", "to", " ", "the", " ", "on", "-", "wire", " ", "counter", "part", "s", " ", "but", " ", "in", " ", "host", " ", "byte", " ", "order", ".", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u", "init", "\\u\\u", " ", "take", "s", " ", "the", " ", "correspond", "ing", " ", "args", " ", "in", " ", "this", " ", "order", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "==============", "============", "=", "\\", "10", ";", " ", " ", " ", " ", "Attribute", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "==============", "============", "=", "\\", "10", ";", " ", " ", " ", " ", "maxr", "esp", " ", " ", " ", " ", "max", " ", "response", " ", "time", " ", "in", " ", "millis", "econd", ".", " ", "it", " ", "is", "\\", "10", ";", " ", "meaning", "ful", " ", "only", " ", "in", " ", "Query", " ", "Messag", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "address", " ", " ", " ", " ", "a", " ", "group", " ", "address", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "s", "\\u", "fl", "g", " ", " ", "whe", "n", " ", "set", " ", "to", " ", "1", ",", " ", "router", "s", " ", "suppress", " ", "the", " ", "timer", "\\", "10", ";", " ", "process", ".", "\\", "10", ";", " ", " ", " ", " ", "qr", "v", " ", " ", " ", " ", "robust", "ness", " ", "variab", "le", " ", "for", " ", "a", " ", "querie", "r", ".", "\\", "10", ";", " ", " ", " ", " ", "qq", "ic", " ", " ", " ", "an", " ", "interval", " ", "time", " ", "for", " ", "a", " ", "querie", "r", " ", "in", " ", "unit", " ", "of", "\\", "10", ";", " ", "second", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "num", " ", " ", " ", " ", "a", " ", "number", " ", "of", " ", "the", " ", "multica", "st", " ", "server", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "srcs", " ", " ", " ", "a", " ", "list", " ", "of", " ", "IP", "v6", " ", "addresse", "s", " ", "of", " ", "the", " ", "multica", "st", "\\", "10", ";", " ", "server", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "==============", "============", "=", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PACK", "\\u", "STR_", "=_", "'!", "H2", "x1", "6", "s", "BB", "H", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "MIN", "\\u", "LEN_", "=_", "struct_", "._", "calcsize_", "(_", "\\u", "PACK", "\\u", "STR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "TYPE_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ascii", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ascii", "list", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "srcs", "'_", "\\u\\u\\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_", "[SEP]_", "class_", "mld", "v2", "\\u", "query_", "(_", "mld", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "maxr", "esp", "_", "=_", "0_", ",_", "address_", "=_", "'::'", "_", ",_", "s", "\\u", "fl", "g_", "=_", "0_", ",_", "qr", "v_", "=_", "2_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "qq", "ic_", "=_", "0_", ",_", "num_", "=_", "0_", ",_", "srcs", "_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "mld", "v2", "\\u", "query_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "maxr", "esp", "_", ",_", "address_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "s", "\\u", "fl", "g_", "=_", "s", "\\u", "fl", "g_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "qr", "v_", "=_", "qr", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "qq", "ic_", "=_", "qq", "ic_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "num_", "=_", "num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srcs", "_", "=_", "srcs", "_", "or_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "srcs", "_", ",_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "src_", "in_", "srcs", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "src_", ",_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "srcs", "_", "=_", "srcs", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "mld", "v2", "\\u", "query_", "(_", "mld", "_", ")_", ":_", "\\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_", "parser_", "(_", "cls_", ",_", "buf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "maxr", "esp", "_", ",_", "address_", ",_", "s", "\\u", "qr", "v_", ",_", "qq", "ic_", ",_", "num_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "=_", "struct_", "._", "unpack", "\\u", "from_", "(_", "cls_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s", "\\u", "fl", "g_", "=_", "(_", "s", "\\u", "qr", "v_", ">>_", "3_", ")_", "&_", "0b1", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "qr", "v_", "=_", "s", "\\u", "qr", "v_", "&_", "0b111", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "=_", "cls_", "._", "\\u", "MIN", "\\u", "LEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srcs", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "0_", "<_", "len_", "(_", "buf_", "[_", "offset_", ":_", "]_", ")_", "and_", "num_", ">_", "len_", "(_", "srcs", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "16_", "<=_", "len_", "(_", "buf_", "[_", "offset_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "src_", ",_", ")_", "=_", "struct_", "._", "unpack", "\\u", "from_", "(_", "'", "16", "s", "'_", ",_", "buf_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srcs", "_", "._", "append_", "(_", "addr", "conv_", "._", "ipv6_", "._", "bin", "\\u", "to", "\\u", "text_", "(_", "src_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "+=_", "16_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "num_", "==_", "len_", "(_", "srcs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "(_", "maxr", "esp", "_", ",_", "addr", "conv_", "._", "ipv6_", "._", "bin", "\\u", "to", "\\u", "text_", "(_", "address_", ")_", ",_", "s", "\\u", "fl", "g_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "qr", "v_", ",_", "qq", "ic_", ",_", "num_", ",_", "srcs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "mld", "v2", "\\u", "query_", "(_", "mld", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "serialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s", "\\u", "qr", "v_", "=_", "self_", "._", "s", "\\u", "fl", "g_", "<<_", "3_", "|_", "self_", "._", "qr", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "buf_", "=_", "bytearray_", "(_", "struct_", "._", "pack_", "(_", "self_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "self_", "._", "maxr", "esp", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "addr", "conv_", "._", "ipv6_", "._", "text", "\\u", "to", "\\u", "bin_", "(_", "self_", "._", "address_", ")_", ",_", "s", "\\u", "qr", "v_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "qq", "ic_", ",_", "self_", "._", "num_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "src_", "in_", "self_", "._", "srcs", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "._", "extend_", "(_", "struct_", "._", "pack_", "(_", "'", "16", "s", "'_", ",_", "addr", "conv_", "._", "ipv6_", "._", "text", "\\u", "to", "\\u", "bin_", "(_", "src_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "0_", "==_", "self_", "._", "num_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "num_", "=_", "len_", "(_", "self_", "._", "srcs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "struct_", "._", "pack", "\\u", "into_", "(_", "'!", "H", "'_", ",_", "buf_", ",_", "22_", ",_", "self_", "._", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "six_", "._", "binar", "y", "\\u", "type_", "(_", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "mld", "v2", "\\u", "query_", "(_", "mld", "_", ")_", ":_", "\\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_", "self_", "._", "\\u", "MIN", "\\u", "LEN_", "+_", "len_", "(_", "self_", "._", "srcs", "_", ")_", "*_", "16_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "icmp", "v6_", "._", "register", "\\u", "icmp", "v6", "\\u", "type_", "(_", "ML", "DV", "2", "\\u", "LISTEN", "ER", "\\u", "REPORT", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "mld", "v2", "\\u", "report_", "(_", "mld", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "ICM", "Pv6", " ", "sub", " ", "encode", "r", "/", "decode", "r", " ", "class", " ", "for", " ", "ML", "D", " ", "v2", " ", "Liste", "r", " ", "Report", " ", "message", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "(", "RF", "C", " ", "381", "0", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "http", "://", "www", ".", "iet", "f", ".", "org", "/", "rfc", "/", "rfc", "381", "0.", "txt", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "used", " ", "with", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "icmp", "v6", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "instance", " ", "has", " ", "the", " ", "follow", "ing", " ", "attribute", "s", " ", "at", " ", "leas", "t", ".", "\\", "10", ";", " ", " ", " ", " ", "Mos", "t", " ", "of", " ", "them", " ", "are", " ", "same", " ", "to", " ", "the", " ", "on", "-", "wire", " ", "counter", "part", "s", " ", "but", " ", "in", " ", "host", " ", "byte", " ", "order", ".", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u", "init", "\\u\\u", " ", "take", "s", " ", "the", " ", "correspond", "ing", " ", "args", " ", "in", " ", "this", " ", "order", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "==============", "============", "=", "\\", "10", ";", " ", " ", " ", " ", "Attribute", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "==============", "============", "=", "\\", "10", ";", " ", " ", " ", " ", "record", "\\u", "num", " ", "a", " ", "number", " ", "of", " ", "the", " ", "group", " ", "record", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "record", "s", " ", " ", " ", " ", "a", " ", "list", " ", "of", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "mld", "v2", "\\u", "report", "\\u", "group", ".", "\\", "10", ";", " ", "Non", "e", " ", "if", " ", "no", " ", "record", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "==============", " ", "==============", "==============", "============", "=", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "PACK", "\\u", "STR_", "=_", "'!", "2x", "H", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "MIN", "\\u", "LEN_", "=_", "struct_", "._", "calcsize_", "(_", "\\u", "PACK", "\\u", "STR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "class", "\\u", "prefixes_", "=_", "[_", "'", "mld", "v2", "\\u", "report", "\\u", "group", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "mld", "v2", "\\u", "report_", "(_", "mld", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "record", "\\u", "num_", "=_", "0_", ",_", "records_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "record", "\\u", "num_", "=_", "record", "\\u", "num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "records_", "=_", "records_", "or_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "records_", ",_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "record_", "in_", "records_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "record_", ",_", "mld", "v2", "\\u", "report", "\\u", "group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "records_", "=_", "records_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "mld", "v2", "\\u", "report_", "(_", "mld", "_", ")_", ":_", "\\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_", "parser_", "(_", "cls_", ",_", "buf_", ",_", "offset_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "record", "\\u", "num_", ",_", ")_", "=_", "struct_", "._", "unpack", "\\u", "from_", "(_", "cls_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "buf_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "+=_", "cls_", "._", "\\u", "MIN", "\\u", "LEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "records_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "0_", "<_", "len_", "(_", "buf_", "[_", "offset_", ":_", "]_", ")_", "and_", "record", "\\u", "num_", ">_", "len_", "(_", "records_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record_", "=_", "mld", "v2", "\\u", "report", "\\u", "group_", "._", "parser_", "(_", "buf_", "[_", "offset_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "records_", "._", "append_", "(_", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "+=_", "len_", "(_", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "record", "\\u", "num_", "==_", "len_", "(_", "records_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "cls_", "(_", "record", "\\u", "num_", ",_", "records_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "mld", "v2", "\\u", "report_", "(_", "mld", "_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "serialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "=_", "bytearray_", "(_", "struct_", "._", "pack_", "(_", "self_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "self_", "._", "record", "\\u", "num_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "record_", "in_", "self_", "._", "records_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "._", "extend_", "(_", "record_", "._", "serialize_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "0_", "==_", "self_", "._", "record", "\\u", "num_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "record", "\\u", "num_", "=_", "len_", "(_", "self_", "._", "records_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "struct_", "._", "pack", "\\u", "into_", "(_", "'!", "H", "'_", ",_", "buf_", ",_", "2_", ",_", "self_", "._", "record", "\\u", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "six_", "._", "binar", "y", "\\u", "type_", "(_", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "mld", "v2", "\\u", "report_", "(_", "mld", "_", ")_", ":_", "\\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 ", " _", "record", "s", "\\u", "len_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "record_", "in_", "self_", "._", "records_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "record", "s", "\\u", "len_", "+=_", "len_", "(_", "record_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "MIN", "\\u", "LEN_", "+_", "record", "s", "\\u", "len_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "mld", "v2", "\\u", "report", "\\u", "group_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "ICM", "Pv6", " ", "sub", " ", "encode", "r", "/", "decode", "r", " ", "class", " ", "for", " ", "ML", "D", " ", "v2", " ", "Liste", "r", " ", "Report", " ", "Group", "\\", "10", ";", " ", " ", " ", " ", "Record", " ", "message", "s", ".", " ", "(", "RF", "C", " ", "381", "0", ")", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "is", " ", "used", " ", "with", " ", "ryu", ".", "lib", ".", "packet", ".", "icmp", "v6", ".", "mld", "v2", "\\u", "report", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "An", " ", "instance", " ", "has", " ", "the", " ", "follow", "ing", " ", "attribute", "s", " ", "at", " ", "leas", "t", ".", "\\", "10", ";", " ", " ", " ", " ", "Mos", "t", " ", "of", " ", "them", " ", "are", " ", "same", " ", "to", " ", "the", " ", "on", "-", "wire", " ", "counter", "part", "s", " ", "but", " ", "in", " ", "host", " ", "byte", "\\", "10", ";", " ", " ", " ", " ", "order", ".", "\\", "10", ";", " ", " ", " ", " ", "\\u\\u", "init", "\\u\\u", " ", "take", "s", " ", "the", " ", "correspond", "ing", " ", "args", " ", "in", " ", "this", " ", "order", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "==============", "=", " ", "==============", "==============", "==============", "=========", "=", "\\", "10", ";", " ", " ", " ", " ", "Attribute", " ", " ", " ", "Descripti", "on", "\\", "10", ";", " ", " ", " ", " ", "==============", "=", " ", "==============", "==============", "==============", "=========", "=", "\\", "10", ";", " ", " ", " ", " ", "type", "\\\\\\u", " ", " ", "a", " ", "group", " ", "record", " ", "type", " ", "for", " ", "v", "3", ".", "\\", "10", ";", " ", " ", " ", " ", "aux", "\\u", "len", " ", " ", " ", " ", " ", "the", " ", "length", " ", "of", " ", "the", " ", "auxiliary", " ", "data", " ", "in", " ", "32", "-", "bit", " ", "words", ".", "\\", "10", ";", " ", " ", " ", " ", "num", " ", " ", " ", " ", " ", "a", " ", "number", " ", "of", " ", "the", " ", "multica", "st", " ", "server", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "address", " ", " ", " ", " ", " ", "a", " ", "group", " ", "address", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "srcs", " ", " ", " ", " ", "a", " ", "list", " ", "of", " ", "IP", "v6", " ", "addresse", "s", " ", "of", " ", "the", " ", "multica", "st", " ", "server", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "aux", " ", " ", " ", " ", " ", "the", " ", "auxiliary", " ", "data", ".", "\\", "10", ";", " ", " ", " ", " ", "==============", "=", " ", "==============", "==============", "==============", "=========", "=", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "PACK", "\\u", "STR_", "=_", "'!", "BB", "H1", "6", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "MIN", "\\u", "LEN_", "=_", "struct_", "._", "calcsize_", "(_", "\\u", "PACK", "\\u", "STR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "TYPE_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ascii", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "address", "'_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "ascii", "list", "'_", ":_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "'", "srcs", "'_", "\\u\\u\\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_", "[SEP]_", "class_", "mld", "v2", "\\u", "report", "\\u", "group_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "type\\u_", "=_", "0_", ",_", "aux", "\\u", "len_", "=_", "0_", ",_", "num_", "=_", "0_", ",_", "address_", "=_", "'::'", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "srcs", "_", "=_", "None_", ",_", "aux_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "type\\u_", "=_", "type\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "aux", "\\u", "len_", "=_", "aux", "\\u", "len_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "num_", "=_", "num_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "address_", "=_", "address_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srcs", "_", "=_", "srcs", "_", "or_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "srcs", "_", ",_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "src_", "in_", "srcs", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "src_", ",_", "str_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "srcs", "_", "=_", "srcs", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "aux_", "=_", "aux_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "mld", "v2", "\\u", "report", "\\u", "group_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\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_", "parser_", "(_", "cls_", ",_", "buf_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "type\\u_", ",_", "aux", "\\u", "len_", ",_", "num_", ",_", "address_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "=_", "struct_", "._", "unpack", "\\u", "from_", "(_", "cls_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "=_", "cls_", "._", "\\u", "MIN", "\\u", "LEN_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srcs", "_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "0_", "<_", "len_", "(_", "buf_", "[_", "offset_", ":_", "]_", ")_", "and_", "num_", ">_", "len_", "(_", "srcs", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "16_", "<=_", "len_", "(_", "buf_", "[_", "offset_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "(_", "src_", ",_", ")_", "=_", "struct_", "._", "unpack", "\\u", "from_", "(_", "'", "16", "s", "'_", ",_", "buf_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srcs", "_", "._", "append_", "(_", "addr", "conv_", "._", "ipv6_", "._", "bin", "\\u", "to", "\\u", "text_", "(_", "src_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "offset_", "+=_", "16_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "num_", "==_", "len_", "(_", "srcs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "aux_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "aux", "\\u", "len_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "(_", "aux_", ",_", ")_", "=_", "struct_", "._", "unpack", "\\u", "from_", "(_", "'%", "ds", "'_", "%_", "(_", "aux", "\\u", "len_", "*_", "4_", ")_", ",_", "buf_", ",_", "offset_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "msg_", "=_", "cls_", "(_", "type\\u_", ",_", "aux", "\\u", "len_", ",_", "num_", ",_", "addr", "conv_", "._", "ipv6_", "._", "bin", "\\u", "to", "\\u", "text_", "(_", "address_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "srcs", "_", ",_", "aux_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "msg_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "mld", "v2", "\\u", "report", "\\u", "group_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "serialize_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "=_", "bytearray_", "(_", "struct_", "._", "pack_", "(_", "self_", "._", "\\u", "PACK", "\\u", "STR_", ",_", "self_", "._", "type\\u_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "aux", "\\u", "len_", ",_", "self_", "._", "num_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "addr", "conv_", "._", "ipv6_", "._", "text", "\\u", "to", "\\u", "bin_", "(_", "self_", "._", "address_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "src_", "in_", "self_", "._", "srcs", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "buf_", "._", "extend_", "(_", "struct_", "._", "pack_", "(_", "'", "16", "s", "'_", ",_", "addr", "conv_", "._", "ipv6_", "._", "text", "\\u", "to", "\\u", "bin_", "(_", "src_", ")_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "0_", "==_", "self_", "._", "num_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "num_", "=_", "len_", "(_", "self_", "._", "srcs", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "struct_", "._", "pack", "\\u", "into_", "(_", "'!", "H", "'_", ",_", "buf_", ",_", "2_", ",_", "self_", "._", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "aux_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mod_", "=_", "len_", "(_", "self_", "._", "aux_", ")_", "%_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "mod_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "aux_", "+=_", "bytearray_", "(_", "4_", "-_", "mod_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "aux_", "=_", "six_", "._", "binar", "y", "\\u", "type_", "(_", "self_", "._", "aux_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "buf_", "._", "extend_", "(_", "self_", "._", "aux_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "0_", "==_", "self_", "._", "aux", "\\u", "len_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "aux", "\\u", "len_", "=_", "len_", "(_", "self_", "._", "aux_", ")_", "//_", "4_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "struct_", "._", "pack", "\\u", "into_", "(_", "'!", "B", "'_", ",_", "buf_", ",_", "1_", ",_", "self_", "._", "aux", "\\u", "len_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "six_", "._", "binar", "y", "\\u", "type_", "(_", "buf_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "mld", "v2", "\\u", "report", "\\u", "group_", "(_", "stringify", "_", "._", "String", "if", "y", "Mixin_", ")_", ":_", "\\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_", "self_", "._", "\\u", "MIN", "\\u", "LEN_", "+_", "len_", "(_", "self_", "._", "srcs", "_", ")_", "*_", "16_", "+_", "self_", "._", "aux", "\\u", "len_", "*_", "4_", "\\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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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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unreachable code
ardekantur/pyglet/pyglet/gl/base.py
[ { "content": " def delete_buffer(self, buffer_id):\n '''Safely delete a buffer object belonging to this context.\n\n This method behaves similarly to `delete_texture`, though for\n ``glDeleteBuffers`` instead of ``glDeleteTextures``.\n\n :Parameters:\n `buffer_id` : int\n The OpenGL name of the buffer to delete.\n\n :since: pyglet 1.1\n '''\n if self.object_space is gl.current_context.object_space and False:\n id = gl.GLuint(buffer_id)\n gl.glDeleteBuffers(1, id)\n else:\n self.object_space._doomed_buffers.append(buffer_id)", "metadata": "root.Context.delete_buffer", "header": "['class', 'Context', '(', 'object', ')', ':', '___EOS___']", "index": 360 } ]
[ { "span": "id = gl.GLuint(buffer_id)", "start_line": 373, "start_column": 12, "end_line": 373, "end_column": 37 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "class_", "Context_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "delete", "\\u", "buffer_", "(_", "self_", ",_", "buffer", "\\u", "id_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "Safe", "ly", " ", "delete", " ", "a", " ", "buffer", " ", "object", " ", "belonging", " ", "to", " ", "this", " ", "context", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "method", " ", "behave", "s", " ", "similar", "ly", " ", "to", " ", "`", "delete", "\\u", "textu", "re", "`", ",", " ", "tho", "ugh", " ", "for", "\\", "10", ";", " ", " ", " ", " ", "``", "gl", "Delete", "Buffers", "``", " ", "inst", "ead", " ", "of", " ", "``", "gl", "Delete", "Textures", "``.", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "Parameter", "s", ":", "\\", "10", ";", " ", " ", " ", " ", "`", "buffer", "\\u", "id", "`", " ", ":", " ", "int", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "Open", "GL", " ", "name", " ", "of", " ", "the", " ", "buffer", " ", "to", " ", "delete", ".", "\\", "10", ";", "\\", "10", ";", " ", " ", " ", " ", ":", "sinc", "e", ":", " ", "pyg", "let", " ", "1.1", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "object\\u", "space_", "is_", "gl_", "._", "current", "\\u", "context_", "._", "object\\u", "space_", "and_", "False_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "id_", "=_", "gl_", "._", "GL", "uint_", "(_", "buffer", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gl_", "._", "gl", "Delete", "Buffers", "_", "(_", "1_", ",_", "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 ", " _", "self_", "._", "object\\u", "space_", "._", "\\u", "doo", "med", "\\u", "buffers_", "._", "append_", "(_", "buffer", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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
bitxbay/BitXBay/electru/build/lib/electrum/socks.py
[ { "content": "\"\"\"SocksiPy - Python SOCKS module.\nVersion 1.00\n\nCopyright 2006 Dan-Haim. All rights reserved.\n\nRedistribution and use in source and binary forms, with or without modification,\nare permitted provided that the following conditions are met:\n1. Redistributions of source code must retain the above copyright notice, this\n list of conditions and the following disclaimer.\n2. Redistributions in binary form must reproduce the above copyright notice,\n this list of conditions and the following disclaimer in the documentation\n and/or other materials provided with the distribution.\n3. Neither the name of Dan Haim nor the names of his contributors may be used\n to endorse or promote products derived from this software without specific\n prior written permission.\n \nTHIS SOFTWARE IS PROVIDED BY DAN HAIM \"AS IS\" AND ANY EXPRESS OR IMPLIED\nWARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO\nEVENT SHALL DAN HAIM OR HIS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\nINCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\nLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA\nOR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\nLIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT\nOF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMANGE.\n\n\nThis module provides a standard socket-like interface for Python\nfor tunneling connections through SOCKS proxies.\n\n\"\"\"\n\n\"\"\"\n\nMinor modifications made by Christopher Gilbert (http://motomastyle.com/)\nfor use in PyLoris (http://pyloris.sourceforge.net/)\n\nMinor modifications made by Mario Vilas (http://breakingcode.wordpress.com/)\nmainly to merge bug fixes found in Sourceforge\n\n\"\"\"\n\nimport socket\nimport struct\nimport sys\n\nPROXY_TYPE_SOCKS4 = 1\nPROXY_TYPE_SOCKS5 = 2\nPROXY_TYPE_HTTP = 3\n\n_defaultproxy = None\n_orgsocket = socket.socket\n\n\n_generalerrors = (\"success\",\n \"invalid data\",\n \"not connected\",\n \"not available\",\n \"bad proxy type\",\n \"bad input\")\n\n_socks5errors = (\"succeeded\",\n \"general SOCKS server failure\",\n \"connection not allowed by ruleset\",\n \"Network unreachable\",\n \"Host unreachable\",\n \"Connection refused\",\n \"TTL expired\",\n \"Command not supported\",\n \"Address type not supported\",\n \"Unknown error\")\n\n_socks5autherrors = (\"succeeded\",\n \"authentication is required\",\n \"all offered authentication methods were rejected\",\n \"unknown username or invalid password\",\n \"unknown error\")\n\n_socks4errors = (\"request granted\",\n \"request rejected or failed\",\n \"request rejected because SOCKS server cannot connect to identd on the client\",\n \"request rejected because the client program and identd report different user-ids\",\n \"unknown error\")\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ProxyError(Exception): pass", "metadata": "root.ProxyError", "header": "['module', '___EOS___']", "index": 53 }, { "content": "class GeneralProxyError(ProxyError): pass", "metadata": "root.GeneralProxyError", "header": "['module', '___EOS___']", "index": 54 }, { "content": "class Socks5AuthError(ProxyError): pass", "metadata": "root.Socks5AuthError", "header": "['module', '___EOS___']", "index": 55 }, { "content": "class Socks5Error(ProxyError): pass", "metadata": "root.Socks5Error", "header": "['module', '___EOS___']", "index": 56 }, { "content": "class Socks4Error(ProxyError): pass", "metadata": "root.Socks4Error", "header": "['module', '___EOS___']", "index": 57 }, { "content": "class HTTPError(ProxyError): pass", "metadata": "root.HTTPError", "header": "['module', '___EOS___']", "index": 58 }, { "content": "def setdefaultproxy(proxytype=None, addr=None, port=None, rdns=True, username=None, password=None):\n \"\"\"setdefaultproxy(proxytype, addr[, port[, rdns[, username[, password]]]])\n Sets a default proxy which all further socksocket objects will use,\n unless explicitly changed.\n \"\"\"\n global _defaultproxy\n _defaultproxy = (proxytype, addr, port, rdns, username, password)", "metadata": "root.setdefaultproxy", "header": "['module', '___EOS___']", "index": 90 }, { "content": "def wrapmodule(module):\n \"\"\"wrapmodule(module)\n Attempts to replace a module's socket library with a SOCKS socket. Must set\n a default proxy using setdefaultproxy(...) first.\n This will only work on modules that import socket directly into the namespace;\n most of the Python Standard Library falls into this category.\n \"\"\"\n if _defaultproxy != None:\n module.socket.socket = socksocket\n else:\n raise GeneralProxyError((4, \"no proxy specified\"))", "metadata": "root.wrapmodule", "header": "['module', '___EOS___']", "index": 98 }, { "content": "class socksocket(socket.socket):\n \"\"\"socksocket([family[, type[, proto]]]) -> socket object\n Open a SOCKS enabled socket. The parameters are the same as\n those of the standard socket init. In order for SOCKS to work,\n you must specify family=AF_INET, type=SOCK_STREAM and proto=0.\n \"\"\"\n\n\n\n\n\n\n\n\n\n", "metadata": "root.socksocket", "header": "['module', '___EOS___']", "index": 110 }, { "content": " def __init__(self, family=socket.AF_INET, type=socket.SOCK_STREAM, proto=0, _sock=None):\n _orgsocket.__init__(self, family, type, proto, _sock)\n if _defaultproxy != None:\n self.__proxy = _defaultproxy\n else:\n self.__proxy = (None, None, None, None, None, None)\n self.__proxysockname = None\n self.__proxypeername = None", "metadata": "root.socksocket.__init__", "header": "['class', 'socksocket', '(', 'socket', '.', 'socket', ')', ':', '___EOS___']", "index": 117 }, { "content": " def __recvall(self, count):\n \"\"\"__recvall(count) -> data\n Receive EXACTLY the number of bytes requested from the socket.\n Blocks until the required number of bytes have been received.\n \"\"\"\n data = self.recv(count)\n while len(data) < count:\n d = self.recv(count-len(data))\n if not d: raise GeneralProxyError((0, \"connection closed unexpectedly\"))\n data = data + d\n return data", "metadata": "root.socksocket.__recvall", "header": "['class', 'socksocket', '(', 'socket', '.', 'socket', ')', ':', '___EOS___']", "index": 126 }, { "content": " def setproxy(self, proxytype=None, addr=None, port=None, rdns=True, username=None, password=None):\n \"\"\"setproxy(proxytype, addr[, port[, rdns[, username[, password]]]])\n Sets the proxy to be used.\n proxytype - The type of the proxy to be used. Three types\n are supported: PROXY_TYPE_SOCKS4 (including socks4a),\n PROXY_TYPE_SOCKS5 and PROXY_TYPE_HTTP\n addr - The address of the server (IP or DNS).\n port - The port of the server. Defaults to 1080 for SOCKS\n servers and 8080 for HTTP proxy servers.\n rdns - Should DNS queries be preformed on the remote side\n (rather than the local side). The default is True.\n Note: This has no effect with SOCKS4 servers.\n username - Username to authenticate with to the server.\n The default is no authentication.\n password - Password to authenticate with to the server.\n Only relevant when username is also provided.\n \"\"\"\n self.__proxy = (proxytype, addr, port, rdns, username, password)", "metadata": "root.socksocket.setproxy", "header": "['class', 'socksocket', '(', 'socket', '.', 'socket', ')', ':', '___EOS___']", "index": 138 }, { "content": " def __negotiatesocks5(self, destaddr, destport):\n \"\"\"__negotiatesocks5(self,destaddr,destport)\n Negotiates a connection through a SOCKS5 server.\n \"\"\"\n # First we'll send the authentication packages we support.\n if (self.__proxy[4]!=None) and (self.__proxy[5]!=None):\n # The username/password details were supplied to the\n # setproxy method so we support the USERNAME/PASSWORD\n # authentication (in addition to the standard none).\n self.sendall(struct.pack('BBBB', 0x05, 0x02, 0x00, 0x02))\n else:\n # No username/password were entered, therefore we\n # only support connections with no authentication.\n self.sendall(struct.pack('BBB', 0x05, 0x01, 0x00))\n # We'll receive the server's response to determine which\n # method was selected\n chosenauth = self.__recvall(2)\n if chosenauth[0:1] != chr(0x05).encode():\n self.close()\n raise GeneralProxyError((1, _generalerrors[1]))\n # Check the chosen authentication method\n if chosenauth[1:2] == chr(0x00).encode():\n # No authentication is required\n pass\n elif chosenauth[1:2] == chr(0x02).encode():\n # Okay, we need to perform a basic username/password\n # authentication.\n self.sendall(chr(0x01).encode() + chr(len(self.__proxy[4])) + self.__proxy[4] + chr(len(self.__proxy[5])) + self.__proxy[5])\n authstat = self.__recvall(2)\n if authstat[0:1] != chr(0x01).encode():\n # Bad response\n self.close()\n raise GeneralProxyError((1, _generalerrors[1]))\n if authstat[1:2] != chr(0x00).encode():\n # Authentication failed\n self.close()\n raise Socks5AuthError((3, _socks5autherrors[3]))\n # Authentication succeeded\n else:\n # Reaching here is always bad\n self.close()\n if chosenauth[1] == chr(0xFF).encode():\n raise Socks5AuthError((2, _socks5autherrors[2]))\n else:\n raise GeneralProxyError((1, _generalerrors[1]))\n # Now we can request the actual connection\n req = struct.pack('BBB', 0x05, 0x01, 0x00)\n # If the given destination address is an IP address, we'll\n # use the IPv4 address request even if remote resolving was specified.\n try:\n ipaddr = socket.inet_aton(destaddr)\n req = req + chr(0x01).encode() + ipaddr\n except socket.error:\n # Well it's not an IP number, so it's probably a DNS name.\n if self.__proxy[3]:\n # Resolve remotely\n ipaddr = None\n req = req + chr(0x03).encode() + chr(len(destaddr)).encode() + destaddr\n else:\n # Resolve locally\n ipaddr = socket.inet_aton(socket.gethostbyname(destaddr))\n req = req + chr(0x01).encode() + ipaddr\n req = req + struct.pack(\">H\", destport)\n self.sendall(req)\n # Get the response\n resp = self.__recvall(4)\n if resp[0:1] != chr(0x05).encode():\n self.close()\n raise GeneralProxyError((1, _generalerrors[1]))\n elif resp[1:2] != chr(0x00).encode():\n # Connection failed\n self.close()\n if ord(resp[1:2])<=8:\n raise Socks5Error((ord(resp[1:2]), _socks5errors[ord(resp[1:2])]))\n else:\n raise Socks5Error((9, _socks5errors[9]))\n # Get the bound address/port\n elif resp[3:4] == chr(0x01).encode():\n boundaddr = self.__recvall(4)\n elif resp[3:4] == chr(0x03).encode():\n resp = resp + self.recv(1)\n boundaddr = self.__recvall(ord(resp[4:5]))\n else:\n self.close()\n raise GeneralProxyError((1,_generalerrors[1]))\n boundport = struct.unpack(\">H\", self.__recvall(2))[0]\n self.__proxysockname = (boundaddr, boundport)\n if ipaddr != None:\n self.__proxypeername = (socket.inet_ntoa(ipaddr), destport)\n else:\n self.__proxypeername = (destaddr, destport)", "metadata": "root.socksocket.__negotiatesocks5", "header": "['class', 'socksocket', '(', 'socket', '.', 'socket', ')', ':', '___EOS___']", "index": 157 }, { "content": " def getproxysockname(self):\n \"\"\"getsockname() -> address info\n Returns the bound IP address and port number at the proxy.\n \"\"\"\n return self.__proxysockname", "metadata": "root.socksocket.getproxysockname", "header": "['class', 'socksocket', '(', 'socket', '.', 'socket', ')', ':', '___EOS___']", "index": 249 }, { "content": " def getproxypeername(self):\n \"\"\"getproxypeername() -> address info\n Returns the IP and port number of the proxy.\n \"\"\"\n return _orgsocket.getpeername(self)", "metadata": "root.socksocket.getproxypeername", "header": "['class', 'socksocket', '(', 'socket', '.', 'socket', ')', ':', '___EOS___']", "index": 255 }, { "content": " def getpeername(self):\n \"\"\"getpeername() -> address info\n Returns the IP address and port number of the destination\n machine (note: getproxypeername returns the proxy)\n \"\"\"\n return self.__proxypeername", "metadata": "root.socksocket.getpeername", "header": "['class', 'socksocket', '(', 'socket', '.', 'socket', ')', ':', '___EOS___']", "index": 261 }, { "content": " def __negotiatesocks4(self,destaddr,destport):\n \"\"\"__negotiatesocks4(self,destaddr,destport)\n Negotiates a connection through a SOCKS4 server.\n \"\"\"\n # Check if the destination address provided is an IP address\n rmtrslv = False\n try:\n ipaddr = socket.inet_aton(destaddr)\n except socket.error:\n # It's a DNS name. Check where it should be resolved.\n if self.__proxy[3]:\n ipaddr = struct.pack(\"BBBB\", 0x00, 0x00, 0x00, 0x01)\n rmtrslv = True\n else:\n ipaddr = socket.inet_aton(socket.gethostbyname(destaddr))\n # Construct the request packet\n req = struct.pack(\">BBH\", 0x04, 0x01, destport) + ipaddr\n # The username parameter is considered userid for SOCKS4\n if self.__proxy[4] != None:\n req = req + self.__proxy[4]\n req = req + chr(0x00).encode()\n # DNS name if remote resolving is required\n # NOTE: This is actually an extension to the SOCKS4 protocol\n # called SOCKS4A and may not be supported in all cases.\n if rmtrslv:\n req = req + destaddr + chr(0x00).encode()\n self.sendall(req)\n # Get the response from the server\n resp = self.__recvall(8)\n if resp[0:1] != chr(0x00).encode():\n # Bad data\n self.close()\n raise GeneralProxyError((1,_generalerrors[1]))\n if resp[1:2] != chr(0x5A).encode():\n # Server returned an error\n self.close()\n if ord(resp[1:2]) in (91, 92, 93):\n self.close()\n raise Socks4Error((ord(resp[1:2]), _socks4errors[ord(resp[1:2]) - 90]))\n else:\n raise Socks4Error((94, _socks4errors[4]))\n # Get the bound address/port\n self.__proxysockname = (socket.inet_ntoa(resp[4:]), struct.unpack(\">H\", resp[2:4])[0])\n if rmtrslv != None:\n self.__proxypeername = (socket.inet_ntoa(ipaddr), destport)\n else:\n self.__proxypeername = (destaddr, destport)", "metadata": "root.socksocket.__negotiatesocks4", "header": "['class', 'socksocket', '(', 'socket', '.', 'socket', ')', ':', '___EOS___']", "index": 268 }, { "content": " def __negotiatehttp(self, destaddr, destport):\n \"\"\"__negotiatehttp(self,destaddr,destport)\n Negotiates a connection through an HTTP server.\n \"\"\"\n # If we need to resolve locally, we do this now\n if not self.__proxy[3]:\n addr = socket.gethostbyname(destaddr)\n else:\n addr = destaddr\n self.sendall((\"CONNECT \" + addr + \":\" + str(destport) + \" HTTP/1.1\\r\\n\" + \"Host: \" + destaddr + \"\\r\\n\\r\\n\").encode())\n # We read the response until we get the string \"\\r\\n\\r\\n\"\n resp = self.recv(1)\n while resp.find(\"\\r\\n\\r\\n\".encode()) == -1:\n resp = resp + self.recv(1)\n # We just need the first line to check if the connection\n # was successful\n statusline = resp.splitlines()[0].split(\" \".encode(), 2)\n if statusline[0] not in (\"HTTP/1.0\".encode(), \"HTTP/1.1\".encode()):\n self.close()\n raise GeneralProxyError((1, _generalerrors[1]))\n try:\n statuscode = int(statusline[1])\n except ValueError:\n self.close()\n raise GeneralProxyError((1, _generalerrors[1]))\n if statuscode != 200:\n self.close()\n raise HTTPError((statuscode, statusline[2]))\n self.__proxysockname = (\"0.0.0.0\", 0)\n self.__proxypeername = (addr, destport)", "metadata": "root.socksocket.__negotiatehttp", "header": "['class', 'socksocket', '(', 'socket', '.', 'socket', ')', ':', '___EOS___']", "index": 316 }, { "content": " def connect(self, destpair):\n \"\"\"connect(self, despair)\n Connects to the specified destination through a proxy.\n destpar - A tuple of the IP/DNS address and the port number.\n (identical to socket's connect).\n To select the proxy server use setproxy().\n \"\"\"\n # Do a minimal input check first\n if (not type(destpair) in (list,tuple)) or (len(destpair) < 2) or (type(destpair[0]) != type('')) or (type(destpair[1]) != int):\n raise GeneralProxyError((5, _generalerrors[5]))\n if self.__proxy[0] == PROXY_TYPE_SOCKS5:\n if self.__proxy[2] != None:\n portnum = self.__proxy[2]\n else:\n portnum = 1080\n _orgsocket.connect(self, (self.__proxy[1], portnum))\n self.__negotiatesocks5(destpair[0], destpair[1])\n elif self.__proxy[0] == PROXY_TYPE_SOCKS4:\n if self.__proxy[2] != None:\n portnum = self.__proxy[2]\n else:\n portnum = 1080\n _orgsocket.connect(self,(self.__proxy[1], portnum))\n self.__negotiatesocks4(destpair[0], destpair[1])\n elif self.__proxy[0] == PROXY_TYPE_HTTP:\n if self.__proxy[2] != None:\n portnum = self.__proxy[2]\n else:\n portnum = 8080\n _orgsocket.connect(self,(self.__proxy[1], portnum))\n self.__negotiatehttp(destpair[0], destpair[1])\n elif self.__proxy[0] == None:\n _orgsocket.connect(self, (destpair[0], destpair[1]))\n else:\n raise GeneralProxyError((4, _generalerrors[4]))", "metadata": "root.socksocket.connect", "header": "['class', 'socksocket', '(', 'socket', '.', 'socket', ')', ':', '___EOS___']", "index": 347 } ]
[ { "span": "import sys", "start_line": 44, "start_column": 0, "end_line": 44, "end_column": 10 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "Sock", "si", "Py", " ", "-", " ", "Pyth", "on", " ", "SOCK", "S", " ", "module", ".", "\\", "10", ";", "Version", " ", "1.00", "\\", "10", ";", "\\", "10", ";", "Copy", "right", " ", "2006", " ", "Dan", "-", "Hai", "m", ".", " ", "All", " ", "rights", " ", "reserve", "d", ".", "\\", "10", ";", "\\", "10", ";", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out", " ", "modification", ",", "\\", "10", ";", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":", "\\", "10", ";", "1", ".", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",", " ", "this", "\\", "10", ";", " ", " ", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", ".", "\\", "10", ";", "2", ".", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyr", "ight", " ", "notice", ",", "\\", "10", ";", " ", " ", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in", " ", "the", " ", "documentation", "\\", "10", ";", " ", " ", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the", " ", "distribu", "tion", ".", "\\", "10", ";", "3", ".", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "Dan", " ", "Hai", "m", " ", "nor", " ", "the", " ", "names", " ", "of", " ", "his", " ", "contributor", "s", " ", "may", " ", "be", " ", "used", "\\", "10", ";", " ", " ", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", "\\", "10", ";", " ", " ", " ", "prior", " ", "writt", "en", " ", "permissi", "on", ".", "\\", "10", ";", " ", " ", " ", "\\", "10", ";", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "DAN", " ", "HA", "IM", " ", "\"", "AS", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", "\\", "10", ";", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", "\\", "10", ";", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", "\\", "10", ";", "EVENT", " ", "SHA", "LL", " ", "DAN", " ", "HA", "IM", " ", "OR", " ", "HIS", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",", "\\", "10", ";", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", "\\", "10", ";", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", "\\", "10", ";", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", "\\", "10", ";", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN", " ", "ANY", " ", "WAY", " ", "OUT", "\\", "10", ";", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAN", "GE", ".", "\\", "10", ";", "\\", "10", ";", "\\", "10", ";", "Thi", "s", " ", "module", " ", "provide", "s", " ", "a", " ", "standard", " ", "socket", "-", "like", " ", "interface", " ", "for", " ", "Pyth", "on", "\\", "10", ";", "for", " ", "tunnel", "ing", " ", "connections", " ", "through", " ", "SOCK", "S", " ", "prox", "ies", ".", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "\\", "10", ";", "Min", "or", " ", "modification", "s", " ", "made", " ", "by", " ", "Christ", "oph", "er", " ", "Gi", "lb", "ert", " ", "(", "http", "://", "moto", "mas", "tyl", "e", ".", "com", "/)", "\\", "10", ";", "for", " ", "use", " ", "in", " ", "Py", "Lor", "is", " ", "(", "http", "://", "pyl", "ori", "s", ".", "sourcef", "org", "e", ".", "net", "/)", "\\", "10", ";", "\\", "10", ";", "Min", "or", " ", "modification", "s", " ", "made", " ", "by", " ", "Mari", "o", " ", "Vi", "las", " ", "(", "http", "://", "break", "ing", "code", ".", "wordpress", ".", "com", "/)", "\\", "10", ";", "mainl", "y", " ", "to", " ", "merge", " ", "bug", " ", "fixes", " ", "found", " ", "in", " ", "Sou", "rce", "forge", "\\", "10", ";", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "struct_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PROX", "Y", "\\u", "TYPE", "\\u", "SOCK", "S4", "_", "=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PROX", "Y", "\\u", "TYPE", "\\u", "SOCK", "S", "5_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PROX", "Y", "\\u", "TYPE", "\\u", "HTTP_", "=_", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "default", "proxy_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "orgs", "ocket", "_", "=_", "socket_", "._", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "genera", "ler", "ror", "s_", "=_", "(_", "\"", "success", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "invalid", " ", "data", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "not", " ", "connect", "ed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "not", " ", "avail", "able", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bad", " ", "proxy", " ", "type", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "bad", " ", "input", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "socks", "5e", "rror", "s_", "=_", "(_", "\"", "succe", "eded", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "genera", "l", " ", "SOCK", "S", " ", "server", " ", "fail", "ure", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "connecti", "on", " ", "not", " ", "allow", "ed", " ", "by", " ", "ruleset", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Network", " ", "unreachable", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Host", " ", "unreachable", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Connect", "ion", " ", "refuse", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "TTL", " ", "expir", "ed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Command", " ", "not", " ", "support", "ed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Address", " ", "type", " ", "not", " ", "support", "ed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Un", "know", "n", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "socks", "5a", "uth", "errors_", "=_", "(_", "\"", "succe", "eded", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "authenticat", "ion", " ", "is", " ", "require", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "all", " ", "offered", " ", "authenticat", "ion", " ", "method", "s", " ", "wer", "e", " ", "reject", "ed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "unknown", " ", "user", "name", " ", "or", " ", "invalid", " ", "password", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "unknown", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u", "socks", "4e", "rror", "s_", "=_", "(_", "\"", "request", " ", "grant", "ed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "request", " ", "reject", "ed", " ", "or", " ", "fail", "ed", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "request", " ", "reject", "ed", " ", "bec", "aus", "e", " ", "SOCK", "S", " ", "server", " ", "cann", "ot", " ", "connect", " ", "to", " ", "ident", "d", " ", "on", " ", "the", " ", "client", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "request", " ", "reject", "ed", " ", "bec", "aus", "e", " ", "the", " ", "client", " ", "program", " ", "and", " ", "ident", "d", " ", "report", " ", "different", " ", "user", "-", "ids", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "unknown", " ", "error", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Pro", "xy", "Error_", "(_", "Exception_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "General", "Pro", "xy", "Error_", "(_", "Pro", "xy", "Error_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Sock", "s5", "Auth", "Error_", "(_", "Pro", "xy", "Error_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Sock", "s5", "Error_", "(_", "Pro", "xy", "Error_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Sock", "s", "4", "Error_", "(_", "Pro", "xy", "Error_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "HTTP", "Error_", "(_", "Pro", "xy", "Error_", ")_", ":_", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "setdefault", "proxy_", "(_", "proxy", "type_", "=_", "None_", ",_", "addr_", "=_", "None_", ",_", "port_", "=_", "None_", ",_", "rd", "ns_", "=_", "True_", ",_", "username_", "=_", "None_", ",_", "password_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "setdefault", "proxy", "(", "proxy", "type", ",", " ", "addr", "[", ",", " ", "port", "[", ",", " ", "rd", "ns", "[", ",", " ", "user", "name", "[", ",", " ", "password", "]]]", "])", "\\", "10", ";", " ", " ", " ", " ", "Set", "s", " ", "a", " ", "default", " ", "proxy", " ", "whi", "ch", " ", "all", " ", "fur", "ther", " ", "socks", "ocket", " ", "object", "s", " ", "will", " ", "use", ",", "\\", "10", ";", " ", " ", " ", " ", "unl", "ess", " ", "explicit", "ly", " ", "change", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "global_", "\\u", "default", "proxy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "default", "proxy_", "=_", "(_", "proxy", "type_", ",_", "addr_", ",_", "port_", ",_", "rd", "ns_", ",_", "username_", ",_", "password_", ")_", "\\u\\u\\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_", "wrap", "module_", "(_", "module_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "wrap", "module", "(", "module", ")", "\\", "10", ";", " ", " ", " ", " ", "Attempts", " ", "to", " ", "replace", " ", "a", " ", "module", "'", "s", " ", "socket", " ", "librar", "y", " ", "with", " ", "a", " ", "SOCK", "S", " ", "socket", ".", " ", "Mus", "t", " ", "set", "\\", "10", ";", " ", " ", " ", " ", "a", " ", "default", " ", "proxy", " ", "usi", "ng", " ", "setdefault", "proxy", "(...)", " ", "first", ".", "\\", "10", ";", " ", " ", " ", " ", "Thi", "s", " ", "will", " ", "only", " ", "work", " ", "on", " ", "module", "s", " ", "tha", "t", " ", "import", " ", "socket", " ", "direct", "ly", " ", "int", "o", " ", "the", " ", "namespace", ";", "\\", "10", ";", " ", " ", " ", " ", "most", " ", "of", " ", "the", " ", "Pyth", "on", " ", "Standard", " ", "Libr", "ary", " ", "fall", "s", " ", "int", "o", " ", "this", " ", "category", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "default", "proxy_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "module_", "._", "socket_", "._", "socket_", "=_", "socks", "ocket", "_", "\\u\\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_", "General", "Pro", "xy", "Error_", "(_", "(_", "4_", ",_", "\"", "no", " ", "proxy", " ", "specified", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "socks", "ocket", "_", "(_", "socket_", "._", "socket_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "socks", "ocket", "([", "famil", "y", "[", ",", " ", "type", "[", ",", " ", "proto", "]]]", ")", " ", "->", " ", "socket", " ", "object", "\\", "10", ";", " ", " ", " ", " ", "Open", " ", "a", " ", "SOCK", "S", " ", "enable", "d", " ", "socket", ".", " ", "The", " ", "parameter", "s", " ", "are", " ", "the", " ", "same", " ", "as", "\\", "10", ";", " ", " ", " ", " ", "tho", "se", " ", "of", " ", "the", " ", "standard", " ", "socket", " ", "init", ".", " ", "In", " ", "order", " ", "for", " ", "SOCK", "S", " ", "to", " ", "work", ",", "\\", "10", ";", " ", " ", " ", " ", "you", " ", "must", " ", "speci", "fy", " ", "famil", "y", "=", "AF", "\\u", "INE", "T", ",", " ", "type", "=", "SOCK", "\\u", "STRE", "AM", " ", "and", " ", "proto", "=", "0.", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "socks", "ocket", "_", "(_", "socket_", "._", "socket_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "family_", "=_", "socket_", "._", "AF", "\\u", "INET_", ",_", "type_", "=_", "socket_", "._", "SOCK", "\\u", "STREAM_", ",_", "proto_", "=_", "0_", ",_", "\\u", "sock_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "orgs", "ocket", "_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "family_", ",_", "type_", ",_", "proto_", ",_", "\\u", "sock_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "\\u", "default", "proxy_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "proxy_", "=_", "\\u", "default", "proxy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "proxy_", "=_", "(_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u\\u", "proxy", "sock", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "proxy", "peer", "name_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "socks", "ocket", "_", "(_", "socket_", "._", "socket_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "recv", "all_", "(_", "self_", ",_", "count_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\u\\u", "recv", "all", "(", "count", ")", " ", "->", " ", "data", "\\", "10", ";", " ", " ", " ", " ", "Receive", " ", "EX", "ACT", "LY", " ", "the", " ", "number", " ", "of", " ", "bytes", " ", "request", "ed", " ", "from", " ", "the", " ", "socket", ".", "\\", "10", ";", " ", " ", " ", " ", "Block", "s", " ", "unti", "l", " ", "the", " ", "require", "d", " ", "number", " ", "of", " ", "bytes", " ", "have", " ", "bee", "n", " ", "receive", "d", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "self_", "._", "recv_", "(_", "count_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "data_", ")_", "<_", "count_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "d_", "=_", "self_", "._", "recv_", "(_", "count_", "-_", "len_", "(_", "data_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "d_", ":_", "raise_", "General", "Pro", "xy", "Error_", "(_", "(_", "0_", ",_", "\"", "connecti", "on", " ", "close", "d", " ", "unexpected", "ly", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "data_", "+_", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "data_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "socks", "ocket", "_", "(_", "socket_", "._", "socket_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setp", "roxy", "_", "(_", "self_", ",_", "proxy", "type_", "=_", "None_", ",_", "addr_", "=_", "None_", ",_", "port_", "=_", "None_", ",_", "rd", "ns_", "=_", "True_", ",_", "username_", "=_", "None_", ",_", "password_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "setp", "roxy", "(", "proxy", "type", ",", " ", "addr", "[", ",", " ", "port", "[", ",", " ", "rd", "ns", "[", ",", " ", "user", "name", "[", ",", " ", "password", "]]]", "])", "\\", "10", ";", " ", " ", " ", " ", "Set", "s", " ", "the", " ", "proxy", " ", "to", " ", "be", " ", "used", ".", "\\", "10", ";", " ", " ", " ", " ", "proxy", "type", " ", "-", " ", " ", " ", " ", "The", " ", "type", " ", "of", " ", "the", " ", "proxy", " ", "to", " ", "be", " ", "used", ".", " ", "Thre", "e", " ", "types", "\\", "10", ";", " ", " ", " ", " ", "are", " ", "support", "ed", ":", " ", "PROX", "Y", "\\u", "TYPE", "\\u", "SOCK", "S4", " ", "(", "inclu", "ding", " ", "socks", "4a", "),", "\\", "10", ";", " ", " ", " ", " ", "PROX", "Y", "\\u", "TYPE", "\\u", "SOCK", "S", "5", " ", "and", " ", "PROX", "Y", "\\u", "TYPE", "\\u", "HTTP", "\\", "10", ";", " ", " ", " ", " ", "addr", " ", "-", " ", " ", " ", " ", "The", " ", "address", " ", "of", " ", "the", " ", "server", " ", "(", "IP", " ", "or", " ", "DNS", ").", "\\", "10", ";", " ", " ", " ", " ", "port", " ", "-", " ", " ", " ", " ", "The", " ", "port", " ", "of", " ", "the", " ", "server", ".", " ", "Default", "s", " ", "to", " ", "1080", " ", "for", " ", "SOCK", "S", "\\", "10", ";", " ", " ", " ", " ", "server", "s", " ", "and", " ", "808", "0", " ", "for", " ", "HTTP", " ", "proxy", " ", "server", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "rd", "ns", " ", "-", " ", " ", " ", " ", "Sho", "ul", "d", " ", "DNS", " ", "querie", "s", " ", "be", " ", "pref", "orm", "ed", " ", "on", " ", "the", " ", "remote", " ", "side", "\\", "10", ";", " ", " ", " ", " ", "(", "rat", "her", " ", "than", " ", "the", " ", "local", " ", "side", ").", " ", "The", " ", "default", " ", "is", " ", "Tru", "e", ".", "\\", "10", ";", " ", " ", " ", " ", "Not", "e", ":", " ", "Thi", "s", " ", "has", " ", "no", " ", "effect", " ", "with", " ", "SOCK", "S4", " ", "server", "s", ".", "\\", "10", ";", " ", " ", " ", " ", "user", "name", " ", "-", " ", " ", " ", " ", "User", "name", " ", "to", " ", "authenticat", "e", " ", "with", " ", "to", " ", "the", " ", "server", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "default", " ", "is", " ", "no", " ", "authenticat", "ion", ".", "\\", "10", ";", " ", " ", " ", " ", "password", " ", "-", " ", " ", " ", " ", "Passw", "ord", " ", "to", " ", "authenticat", "e", " ", "with", " ", "to", " ", "the", " ", "server", ".", "\\", "10", ";", " ", " ", " ", " ", "On", "ly", " ", "rele", "van", "t", " ", "whe", "n", " ", "user", "name", " ", "is", " ", "als", "o", " ", "provided", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "proxy_", "=_", "(_", "proxy", "type_", ",_", "addr_", ",_", "port_", ",_", "rd", "ns_", ",_", "username_", ",_", "password_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "socks", "ocket", "_", "(_", "socket_", "._", "socket_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "negotiat", "eso", "cks", "5_", "(_", "self_", ",_", "dest", "addr_", ",_", "dest", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\u\\u", "negotiat", "eso", "cks", "5", "(", "self", ",", "dest", "addr", ",", "dest", "port", ")", "\\", "10", ";", " ", " ", " ", " ", "Nego", "tiat", "es", " ", "a", " ", "connecti", "on", " ", "through", " ", "a", " ", "SOCK", "S", "5", " ", "server", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Fi", "rst", " ", "we", "'", "ll", " ", "send", " ", "the", " ", "authenticat", "ion", " ", "package", "s", " ", "we", " ", "support", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "self_", "._", "\\u\\u", "proxy_", "[_", "4_", "]_", "!=_", "None_", ")_", "and_", "(_", "self_", "._", "\\u\\u", "proxy_", "[_", "5_", "]_", "!=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "user", "name", "/", "password", " ", "deta", "il", "s", " ", "wer", "e", " ", "supplie", "d", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "setp", "roxy", " ", "method", " ", "so", " ", "we", " ", "support", " ", "the", " ", "USER", "NAME", "/", "PASSWORD_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "authenticat", "ion", " ", "(", "in", " ", "addition", " ", "to", " ", "the", " ", "standard", " ", "none", ").", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sendall_", "(_", "struct_", "._", "pack_", "(_", "'", "BBBB", "'_", ",_", "0x05_", ",_", "0x02_", ",_", "0x00_", ",_", "0x02_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "user", "name", "/", "password", " ", "wer", "e", " ", "enter", "ed", ",", " ", "there", "fore", " ", "we", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "only", " ", "support", " ", "connections", " ", "with", " ", "no", " ", "authenticat", "ion", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sendall_", "(_", "struct_", "._", "pack_", "(_", "'", "BBB", "'_", ",_", "0x05_", ",_", "0x01_", ",_", "0x00_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", "'", "ll", " ", "receive", " ", "the", " ", "server", "'", "s", " ", "response", " ", "to", " ", "dete", "rmin", "e", " ", "which_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "method", " ", "was", " ", "selected_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "chosen", "auth_", "=_", "self_", "._", "\\u\\u", "recv", "all_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "chosen", "auth_", "[_", "0_", ":_", "1_", "]_", "!=_", "chr_", "(_", "0x05_", ")_", "._", "encode_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "General", "Pro", "xy", "Error_", "(_", "(_", "1_", ",_", "\\u", "genera", "ler", "ror", "s_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "the", " ", "chosen", " ", "authenticat", "ion", " ", "method_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "chosen", "auth_", "[_", "1_", ":_", "2_", "]_", "==_", "chr_", "(_", "0x00_", ")_", "._", "encode_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", " ", "authenticat", "ion", " ", "is", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "chosen", "auth_", "[_", "1_", ":_", "2_", "]_", "==_", "chr_", "(_", "0x02_", ")_", "._", "encode_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ok", "ay", ",", " ", "we", " ", "need", " ", "to", " ", "perform", " ", "a", " ", "basic", " ", "user", "name", "/", "password_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "authenticat", "ion", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "sendall_", "(_", "chr_", "(_", "0x01_", ")_", "._", "encode_", "(_", ")_", "+_", "chr_", "(_", "len_", "(_", "self_", "._", "\\u\\u", "proxy_", "[_", "4_", "]_", ")_", ")_", "+_", "self_", "._", "\\u\\u", "proxy_", "[_", "4_", "]_", "+_", "chr_", "(_", "len_", "(_", "self_", "._", "\\u\\u", "proxy_", "[_", "5_", "]_", ")_", ")_", "+_", "self_", "._", "\\u\\u", "proxy_", "[_", "5_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "auth", "stat_", "=_", "self_", "._", "\\u\\u", "recv", "all_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "auth", "stat_", "[_", "0_", ":_", "1_", "]_", "!=_", "chr_", "(_", "0x01_", ")_", "._", "encode_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ba", "d", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "General", "Pro", "xy", "Error_", "(_", "(_", "1_", ",_", "\\u", "genera", "ler", "ror", "s_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "auth", "stat_", "[_", "1_", ":_", "2_", "]_", "!=_", "chr_", "(_", "0x00_", ")_", "._", "encode_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Auth", "entica", "tion", " ", "failed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sock", "s5", "Auth", "Error_", "(_", "(_", "3_", ",_", "\\u", "socks", "5a", "uth", "errors_", "[_", "3_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Auth", "entica", "tion", " ", "succeeded_", "\\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_", "#", " ", "Reach", "ing", " ", "here", " ", "is", " ", "alw", "ay", "s", " ", "bad_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "chosen", "auth_", "[_", "1_", "]_", "==_", "chr_", "(_", "0xFF_", ")_", "._", "encode_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sock", "s5", "Auth", "Error_", "(_", "(_", "2_", ",_", "\\u", "socks", "5a", "uth", "errors_", "[_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "General", "Pro", "xy", "Error_", "(_", "(_", "1_", ",_", "\\u", "genera", "ler", "ror", "s_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "No", "w", " ", "we", " ", "can", " ", "request", " ", "the", " ", "actual", " ", "connection_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "req_", "=_", "struct_", "._", "pack_", "(_", "'", "BBB", "'_", ",_", "0x05_", ",_", "0x01_", ",_", "0x00_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "the", " ", "give", "n", " ", "destinat", "ion", " ", "address", " ", "is", " ", "an", " ", "IP", " ", "address", ",", " ", "we", "'", "ll_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", " ", "the", " ", "IP", "v", "4", " ", "address", " ", "request", " ", "even", " ", "if", " ", "remote", " ", "resolv", "ing", " ", "was", " ", "specified", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipaddr_", "=_", "socket_", "._", "inet", "\\u", "ato", "n_", "(_", "dest", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "req_", "+_", "chr_", "(_", "0x01_", ")_", "._", "encode_", "(_", ")_", "+_", "ipaddr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wel", "l", " ", "it", "'", "s", " ", "not", " ", "an", " ", "IP", " ", "number", ",", " ", " ", "so", " ", "it", "'", "s", " ", "probab", "ly", " ", "a", " ", "DNS", " ", "name", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u\\u", "proxy_", "[_", "3_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Resolv", "e", " ", "remote", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipaddr_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "req_", "+_", "chr_", "(_", "0x03_", ")_", "._", "encode_", "(_", ")_", "+_", "chr_", "(_", "len_", "(_", "dest", "addr_", ")_", ")_", "._", "encode_", "(_", ")_", "+_", "dest", "addr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Resolv", "e", " ", "local", "ly_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipaddr_", "=_", "socket_", "._", "inet", "\\u", "ato", "n_", "(_", "socket_", "._", "gethostbyname", "_", "(_", "dest", "addr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "req_", "=_", "req_", "+_", "chr_", "(_", "0x01_", ")_", "._", "encode_", "(_", ")_", "+_", "ipaddr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "req_", "=_", "req_", "+_", "struct_", "._", "pack_", "(_", "\">", "H", "\"_", ",_", "dest", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sendall_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "response_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "\\u\\u", "recv", "all_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "resp_", "[_", "0_", ":_", "1_", "]_", "!=_", "chr_", "(_", "0x05_", ")_", "._", "encode_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "General", "Pro", "xy", "Error_", "(_", "(_", "1_", ",_", "\\u", "genera", "ler", "ror", "s_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "resp_", "[_", "1_", ":_", "2_", "]_", "!=_", "chr_", "(_", "0x00_", ")_", "._", "encode_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Connect", "ion", " ", "failed_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ord_", "(_", "resp_", "[_", "1_", ":_", "2_", "]_", ")_", "<=_", "8_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sock", "s5", "Error_", "(_", "(_", "ord_", "(_", "resp_", "[_", "1_", ":_", "2_", "]_", ")_", ",_", "\\u", "socks", "5e", "rror", "s_", "[_", "ord_", "(_", "resp_", "[_", "1_", ":_", "2_", "]_", ")_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Sock", "s5", "Error_", "(_", "(_", "9_", ",_", "\\u", "socks", "5e", "rror", "s_", "[_", "9_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "bound", " ", "address", "/", "port_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "resp_", "[_", "3_", ":_", "4_", "]_", "==_", "chr_", "(_", "0x01_", ")_", "._", "encode_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "bound", "addr_", "=_", "self_", "._", "\\u\\u", "recv", "all_", "(_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "resp_", "[_", "3_", ":_", "4_", "]_", "==_", "chr_", "(_", "0x03_", ")_", "._", "encode_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "resp_", "+_", "self_", "._", "recv_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "bound", "addr_", "=_", "self_", "._", "\\u\\u", "recv", "all_", "(_", "ord_", "(_", "resp_", "[_", "4_", ":_", "5_", "]_", ")_", ")_", "\\u\\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_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "General", "Pro", "xy", "Error_", "(_", "(_", "1_", ",_", "\\u", "genera", "ler", "ror", "s_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "bound", "port_", "=_", "struct_", "._", "unpack_", "(_", "\">", "H", "\"_", ",_", "self_", "._", "\\u\\u", "recv", "all_", "(_", "2_", ")_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "proxy", "sock", "name_", "=_", "(_", "bound", "addr_", ",_", "bound", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ipaddr_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "proxy", "peer", "name_", "=_", "(_", "socket_", "._", "inet", "\\u", "nto", "a_", "(_", "ipaddr_", ")_", ",_", "dest", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "proxy", "peer", "name_", "=_", "(_", "dest", "addr_", ",_", "dest", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "socks", "ocket", "_", "(_", "socket_", "._", "socket_", ")_", ":_", "\\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_", "getpr", "oxy", "sock", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "getsockname", "()", " ", "->", " ", "address", " ", "info", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "bound", " ", "IP", " ", "address", " ", "and", " ", "port", " ", "number", " ", "at", " ", "the", " ", "proxy", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "proxy", "sock", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "socks", "ocket", "_", "(_", "socket_", "._", "socket_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getpr", "oxy", "peer", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "getpr", "oxy", "peer", "name", "()", " ", "->", " ", "address", " ", "info", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "IP", " ", "and", " ", "port", " ", "number", " ", "of", " ", "the", " ", "proxy", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u", "orgs", "ocket", "_", "._", "getp", "eer", "name_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "socks", "ocket", "_", "(_", "socket_", "._", "socket_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "getp", "eer", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "getp", "eer", "name", "()", " ", "->", " ", "address", " ", "info", "\\", "10", ";", " ", " ", " ", " ", "Return", "s", " ", "the", " ", "IP", " ", "address", " ", "and", " ", "port", " ", "number", " ", "of", " ", "the", " ", "destinat", "ion", "\\", "10", ";", " ", " ", " ", " ", "machine", " ", "(", "note", ":", " ", "getpr", "oxy", "peer", "name", " ", "return", "s", " ", "the", " ", "proxy", ")", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u\\u", "proxy", "peer", "name_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "socks", "ocket", "_", "(_", "socket_", "._", "socket_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "negotiat", "eso", "cks", "4_", "(_", "self_", ",_", "dest", "addr_", ",_", "dest", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\u\\u", "negotiat", "eso", "cks", "4", "(", "self", ",", "dest", "addr", ",", "dest", "port", ")", "\\", "10", ";", " ", " ", " ", " ", "Nego", "tiat", "es", " ", "a", " ", "connecti", "on", " ", "through", " ", "a", " ", "SOCK", "S4", " ", "server", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Check", " ", "if", " ", "the", " ", "destinat", "ion", " ", "address", " ", "provided", " ", "is", " ", "an", " ", "IP", " ", "address_", "\\u\\u\\uNL\\u\\u\\u_", "rm", "tr", "sl", "v_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipaddr_", "=_", "socket_", "._", "inet", "\\u", "ato", "n_", "(_", "dest", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "socket_", "._", "error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "It", "'", "s", " ", "a", " ", "DNS", " ", "name", ".", " ", "Check", " ", "where", " ", "it", " ", "shou", "ld", " ", "be", " ", "resolve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u\\u", "proxy_", "[_", "3_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "ipaddr_", "=_", "struct_", "._", "pack_", "(_", "\"", "BBBB", "\"_", ",_", "0x00_", ",_", "0x00_", ",_", "0x00_", ",_", "0x01_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rm", "tr", "sl", "v_", "=_", "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 ", " _", "ipaddr_", "=_", "socket_", "._", "inet", "\\u", "ato", "n_", "(_", "socket_", "._", "gethostbyname", "_", "(_", "dest", "addr_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Construct", " ", "the", " ", "request", " ", "packet_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "req_", "=_", "struct_", "._", "pack_", "(_", "\">", "BB", "H", "\"_", ",_", "0x04_", ",_", "0x01_", ",_", "dest", "port_", ")_", "+_", "ipaddr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "user", "name", " ", "parameter", " ", "is", " ", "consider", "ed", " ", "user", "id", " ", "for", " ", "SOCK", "S4", "_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "\\u\\u", "proxy_", "[_", "4_", "]_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "req_", "+_", "self_", "._", "\\u\\u", "proxy_", "[_", "4_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "req_", "=_", "req_", "+_", "chr_", "(_", "0x00_", ")_", "._", "encode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "DNS", " ", "name", " ", "if", " ", "remote", " ", "resolv", "ing", " ", "is", " ", "required_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "NOTE", ":", " ", "Thi", "s", " ", "is", " ", "actual", "ly", " ", "an", " ", "extensi", "on", " ", "to", " ", "the", " ", "SOCK", "S4", " ", "protocol_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "call", "ed", " ", "SOCK", "S4", "A", " ", "and", " ", "may", " ", "not", " ", "be", " ", "support", "ed", " ", "in", " ", "all", " ", "case", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "if_", "rm", "tr", "sl", "v_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "req_", "=_", "req_", "+_", "dest", "addr_", "+_", "chr_", "(_", "0x00_", ")_", "._", "encode_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sendall_", "(_", "req_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "response", " ", "from", " ", "the", " ", "server_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "\\u\\u", "recv", "all_", "(_", "8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "resp_", "[_", "0_", ":_", "1_", "]_", "!=_", "chr_", "(_", "0x00_", ")_", "._", "encode_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ba", "d", " ", "data_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "General", "Pro", "xy", "Error_", "(_", "(_", "1_", ",_", "\\u", "genera", "ler", "ror", "s_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "resp_", "[_", "1_", ":_", "2_", "]_", "!=_", "chr_", "(_", "0x5", "A_", ")_", "._", "encode_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Server", " ", "return", "ed", " ", "an", " ", "error_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ord_", "(_", "resp_", "[_", "1_", ":_", "2_", "]_", ")_", "in_", "(_", "91_", ",_", "92_", ",_", "93_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "Sock", "s", "4", "Error_", "(_", "(_", "ord_", "(_", "resp_", "[_", "1_", ":_", "2_", "]_", ")_", ",_", "\\u", "socks", "4e", "rror", "s_", "[_", "ord_", "(_", "resp_", "[_", "1_", ":_", "2_", "]_", ")_", "-_", "90_", "]_", ")_", ")_", "\\u\\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_", "Sock", "s", "4", "Error_", "(_", "(_", "94_", ",_", "\\u", "socks", "4e", "rror", "s_", "[_", "4_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Get", " ", "the", " ", "bound", " ", "address", "/", "port_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u\\u", "proxy", "sock", "name_", "=_", "(_", "socket_", "._", "inet", "\\u", "nto", "a_", "(_", "resp_", "[_", "4_", ":_", "]_", ")_", ",_", "struct_", "._", "unpack_", "(_", "\">", "H", "\"_", ",_", "resp_", "[_", "2_", ":_", "4_", "]_", ")_", "[_", "0_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "rm", "tr", "sl", "v_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "proxy", "peer", "name_", "=_", "(_", "socket_", "._", "inet", "\\u", "nto", "a_", "(_", "ipaddr_", ")_", ",_", "dest", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u\\u", "proxy", "peer", "name_", "=_", "(_", "dest", "addr_", ",_", "dest", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "socks", "ocket", "_", "(_", "socket_", "._", "socket_", ")_", ":_", "\\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", "negotiat", "eh", "ttp", "_", "(_", "self_", ",_", "dest", "addr_", ",_", "dest", "port_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\u\\u", "negotiat", "eh", "ttp", "(", "self", ",", "dest", "addr", ",", "dest", "port", ")", "\\", "10", ";", " ", " ", " ", " ", "Nego", "tiat", "es", " ", "a", " ", "connecti", "on", " ", "through", " ", "an", " ", "HTTP", " ", "server", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "If", " ", "we", " ", "need", " ", "to", " ", "resolve", " ", "local", "ly", ",", " ", "we", " ", "do", " ", "this", " ", "now_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "\\u\\u", "proxy_", "[_", "3_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr_", "=_", "socket_", "._", "gethostbyname", "_", "(_", "dest", "addr_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "addr_", "=_", "dest", "addr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "sendall_", "(_", "(_", "\"", "CONNECT", " ", "\"_", "+_", "addr_", "+_", "\":\"_", "+_", "str_", "(_", "dest", "port_", ")_", "+_", "\"", " ", "HTTP", "/", "1.1", "\\\\", "r", "\\\\", "n", "\"_", "+_", "\"", "Host", ":", " ", "\"_", "+_", "dest", "addr_", "+_", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "\"_", ")_", "._", "encode_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "read", " ", "the", " ", "response", " ", "unti", "l", " ", "we", " ", "get", " ", "the", " ", "string", " ", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "resp_", "=_", "self_", "._", "recv_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "resp_", "._", "find_", "(_", "\"\\\\", "r", "\\\\", "n", "\\\\", "r", "\\\\", "n", "\"_", "._", "encode_", "(_", ")_", ")_", "==_", "-_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "resp_", "=_", "resp_", "+_", "self_", "._", "recv_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", " ", "just", " ", "need", " ", "the", " ", "first", " ", "line", " ", "to", " ", "check", " ", "if", " ", "the", " ", "connection_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "was", " ", "successful_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "status", "line_", "=_", "resp_", "._", "splitlines_", "(_", ")_", "[_", "0_", "]_", "._", "split_", "(_", "\"", " ", "\"_", "._", "encode_", "(_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "status", "line_", "[_", "0_", "]_", "not_", "in_", "(_", "\"", "HTTP", "/", "1.0", "\"_", "._", "encode_", "(_", ")_", ",_", "\"", "HTTP", "/", "1.1", "\"_", "._", "encode_", "(_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "General", "Pro", "xy", "Error_", "(_", "(_", "1_", ",_", "\\u", "genera", "ler", "ror", "s_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "statusc", "ode_", "=_", "int_", "(_", "status", "line_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "General", "Pro", "xy", "Error_", "(_", "(_", "1_", ",_", "\\u", "genera", "ler", "ror", "s_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "statusc", "ode_", "!=_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "raise_", "HTTP", "Error_", "(_", "(_", "statusc", "ode_", ",_", "status", "line_", "[_", "2_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u\\u", "proxy", "sock", "name_", "=_", "(_", "\"", "0.", "0.", "0.", "0", "\"_", ",_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "proxy", "peer", "name_", "=_", "(_", "addr_", ",_", "dest", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "socks", "ocket", "_", "(_", "socket_", "._", "socket_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "connect_", "(_", "self_", ",_", "dest", "pair_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "connect", "(", "self", ",", " ", "desp", "air", ")", "\\", "10", ";", " ", " ", " ", " ", "Connect", "s", " ", "to", " ", "the", " ", "specified", " ", "destinat", "ion", " ", "through", " ", "a", " ", "proxy", ".", "\\", "10", ";", " ", " ", " ", " ", "dest", "par", " ", "-", " ", "A", " ", "tuple", " ", "of", " ", "the", " ", "IP", "/", "DNS", " ", "address", " ", "and", " ", "the", " ", "port", " ", "number", ".", "\\", "10", ";", " ", " ", " ", " ", "(", "identi", "cal", " ", "to", " ", "socket", "'", "s", " ", "connect", ").", "\\", "10", ";", " ", " ", " ", " ", "To", " ", "select", " ", "the", " ", "proxy", " ", "server", " ", "use", " ", "setp", "roxy", "()", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Do", " ", "a", " ", "minima", "l", " ", "input", " ", "check", " ", "first_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "(_", "not_", "type_", "(_", "dest", "pair_", ")_", "in_", "(_", "list_", ",_", "tuple_", ")_", ")_", "or_", "(_", "len_", "(_", "dest", "pair_", ")_", "<_", "2_", ")_", "or_", "(_", "type_", "(_", "dest", "pair_", "[_", "0_", "]_", ")_", "!=_", "type_", "(_", "''_", ")_", ")_", "or_", "(_", "type_", "(_", "dest", "pair_", "[_", "1_", "]_", ")_", "!=_", "int_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "General", "Pro", "xy", "Error_", "(_", "(_", "5_", ",_", "\\u", "genera", "ler", "ror", "s_", "[_", "5_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "\\u\\u", "proxy_", "[_", "0_", "]_", "==_", "PROX", "Y", "\\u", "TYPE", "\\u", "SOCK", "S", "5_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u\\u", "proxy_", "[_", "2_", "]_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port", "num_", "=_", "self_", "._", "\\u\\u", "proxy_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port", "num_", "=_", "1080", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "orgs", "ocket", "_", "._", "connect_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "proxy_", "[_", "1_", "]_", ",_", "port", "num_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "negotiat", "eso", "cks", "5_", "(_", "dest", "pair_", "[_", "0_", "]_", ",_", "dest", "pair_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u\\u", "proxy_", "[_", "0_", "]_", "==_", "PROX", "Y", "\\u", "TYPE", "\\u", "SOCK", "S4", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u\\u", "proxy_", "[_", "2_", "]_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port", "num_", "=_", "self_", "._", "\\u\\u", "proxy_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port", "num_", "=_", "1080", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "orgs", "ocket", "_", "._", "connect_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "proxy_", "[_", "1_", "]_", ",_", "port", "num_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "negotiat", "eso", "cks", "4_", "(_", "dest", "pair_", "[_", "0_", "]_", ",_", "dest", "pair_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u\\u", "proxy_", "[_", "0_", "]_", "==_", "PROX", "Y", "\\u", "TYPE", "\\u", "HTTP_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "\\u\\u", "proxy_", "[_", "2_", "]_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port", "num_", "=_", "self_", "._", "\\u\\u", "proxy_", "[_", "2_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "port", "num_", "=_", "8080_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "orgs", "ocket", "_", "._", "connect_", "(_", "self_", ",_", "(_", "self_", "._", "\\u\\u", "proxy_", "[_", "1_", "]_", ",_", "port", "num_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u\\u", "negotiat", "eh", "ttp", "_", "(_", "dest", "pair_", "[_", "0_", "]_", ",_", "dest", "pair_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "self_", "._", "\\u\\u", "proxy_", "[_", "0_", "]_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "orgs", "ocket", "_", "._", "connect_", "(_", "self_", ",_", "(_", "dest", "pair_", "[_", "0_", "]_", ",_", "dest", "pair_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "General", "Pro", "xy", "Error_", "(_", "(_", "4_", ",_", "\\u", "genera", "ler", "ror", "s_", "[_", "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, 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coding: utf-8 -*-\n# Open Source Initiative OSI - The MIT License (MIT):Licensing\n#\n# The MIT License (MIT)\n# Copyright (c) 2015 François-Xavier Bourlet ([email protected])\n#\n# Permission is hereby granted, free of charge, to any person obtaining a copy of\n# this software and associated documentation files (the \"Software\"), to deal in\n# the Software without restriction, including without limitation the rights to\n# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\n# of the Software, and to permit persons to whom the Software is furnished to do\n# so, subject to the following conditions:\n#\n# The above copyright notice and this permission notice shall be included in all\n# copies or substantial portions of the Software.\n#\n# THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n# SOFTWARE.\n\n\nfrom nose.tools import assert_raises\nimport gevent\nimport sys\n\nfrom zerorpc import zmq\nimport zerorpc\nfrom testutils import teardown, random_ipc_endpoint, TIME_FACTOR\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def test_client_server_client_timeout_with_async():\n endpoint = random_ipc_endpoint()\n\n class MySrv(zerorpc.Server):\n\n def lolita(self):\n return 42\n\n def add(self, a, b):\n gevent.sleep(TIME_FACTOR * 10)\n return a + b\n\n srv = MySrv()\n srv.bind(endpoint)\n gevent.spawn(srv.run)\n\n client = zerorpc.Client(timeout=TIME_FACTOR * 2)\n client.connect(endpoint)\n\n async_result = client.add(1, 4, async=True)\n\n if sys.version_info < (2, 7):\n def _do_with_assert_raises():\n print async_result.get()\n assert_raises(zerorpc.TimeoutExpired, _do_with_assert_raises)\n else:\n with assert_raises(zerorpc.TimeoutExpired):\n print async_result.get()\n client.close()\n srv.close()", "metadata": "root.test_client_server_client_timeout_with_async", "header": "['module', '___EOS___']", "index": 34 }, { "content": "def test_client_server_with_async():\n endpoint = random_ipc_endpoint()\n\n class MySrv(zerorpc.Server):\n\n def lolita(self):\n return 42\n\n def add(self, a, b):\n return a + b\n\n srv = MySrv()\n srv.bind(endpoint)\n gevent.spawn(srv.run)\n\n client = zerorpc.Client()\n client.connect(endpoint)\n\n async_result = client.lolita(async=True)\n assert async_result.get() == 42\n\n async_result = client.add(1, 4, async=True)\n assert async_result.get() == 5", "metadata": "root.test_client_server_with_async", "header": "['module', '___EOS___']", "index": 66 } ]
[ { "span": "from zerorpc import zmq", "start_line": 29, "start_column": 0, "end_line": 29, "end_column": 23 }, { "span": "from testutils import teardown, random_ipc_endpoint, TIME_FACTOR", "start_line": 31, "start_column": 0, "end_line": 31, "end_column": 64 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Open", " ", "Sou", "rce", " ", "Initiat", "ive", " ", "OSI", " ", "-", " ", "The", " ", "MIT", " ", "License", " ", "(", "MIT", "):", "Licen", "sing", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "MIT", " ", "License", " ", "(", "MIT", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "201", "5", " ", "Fran", "\\", "231", ";", "ois", "-", "Xa", "vie", "r", " ", "Bou", "rle", "t", " ", "(", "bomb", "ela", "+", "zero", "rpc", "@", "gma", "il", ".", "com", ")_", "\\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", " ", "of_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "this", " ", "software", " ", "and", " ", "associate", "d", " ", "documentation", " ", "files", " ", "(", "the", " ", "\"", "Sof", "twa", "re", "\")", ",", " ", "to", " ", "deal", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", " ", "Sof", "twa", "re", " ", "with", "out", " ", "restriction", ",", " ", "inclu", "ding", " ", "with", "out", " ", "limit", "ation", " ", "the", " ", "rights", " ", "to_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "use", ",", " ", "copy", ",", " ", "modif", "y", ",", " ", "merge", ",", " ", "publi", "sh", ",", " ", "distribute", ",", " ", "subli", "cens", "e", ",", " ", "and", "/", "or", " ", "sell", " ", "copie", "s_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "the", " ", "Sof", "twa", "re", ",", " ", "and", " ", "to", " ", "permit", " ", "person", "s", " ", "to", " ", "who", "m", " ", "the", " ", "Sof", "twa", "re", " ", "is", " ", "fur", "nish", "ed", " ", "to", " ", "do_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "so", ",", " ", "subject", " ", "to", " ", "the", " ", "follow", "ing", " ", "condition", "s", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "above", " ", "copyr", "ight", " ", "notice", " ", "and", " ", "this", " ", "permissi", "on", " ", "notice", " ", "sha", "ll", " ", "be", " ", "include", "d", " ", "in", " ", "all_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "copie", "s", " ", "or", " ", "substa", "nti", "al", " ", "porti", "ons", " ", "of", " ", "the", " ", "Sof", "twa", "re", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "THE", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "\"", "AS", " ", "IS", "\",", " ", "WITH", "OUT", " ", "WAR", "RAN", "TY", " ", "OF", " ", "ANY", " ", "KIND", ",", " ", "EXPR", "ESS", " ", "OR_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "IMPL", "IED", ",", " ", "INC", "LU", "DING", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", " ", "THE", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "FIT", "NESS", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "AND", " ", "NON", "INF", "RING", "EME", "NT", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "AUTHOR", "S", " ", "OR", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "CLA", "IM", ",", " ", "DA", "MAGE", "S", " ", "OR", " ", "OTHER", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "AN", " ", "ACTI", "ON", " ", "OF", " ", "CONTR", "ACT", ",", " ", "TOR", "T", " ", "OR", " ", "OTHER", "WI", "SE", ",", " ", "ARI", "SIN", "G", " ", "FROM", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "OUT", " ", "OF", " ", "OR", " ", "IN", " ", "CONNECTION", " ", "WITH", " ", "THE", " ", "SOFT", "WARE", " ", "OR", " ", "THE", " ", "USE", " ", "OR", " ", "OTHER", " ", "DEA", "LING", "S", " ", "IN", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "SOFT", "WARE", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "assert", "\\u", "raises_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "gevent_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "zero", "rpc_", "import_", "zmq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "zero", "rpc_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "testutils_", "import_", "teardown_", ",_", "random", "\\u", "ipc", "\\u", "endpoint_", ",_", "TIME", "\\u", "FACTOR", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "test\\u", "client", "\\u", "server", "\\u", "client", "\\u", "timeo", "ut", "\\u", "with", "\\u", "async_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "endpoint_", "=_", "random", "\\u", "ipc", "\\u", "endpoint_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "My", "Sr", "v_", "(_", "zero", "rpc_", "._", "Server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "lol", "ita", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "42_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add_", "(_", "self_", ",_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gevent_", "._", "sleep_", "(_", "TIME", "\\u", "FACTOR", "_", "*_", "10_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "a_", "+_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "srv_", "=_", "My", "Sr", "v_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srv_", "._", "bind_", "(_", "endpoint_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gevent_", "._", "spawn_", "(_", "srv_", "._", "run_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "=_", "zero", "rpc_", "._", "Client_", "(_", "timeout_", "=_", "TIME", "\\u", "FACTOR", "_", "*_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "connect_", "(_", "endpoint_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "async", "\\u", "result_", "=_", "client_", "._", "add_", "(_", "1_", ",_", "4_", ",_", "async_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", "<_", "(_", "2_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u", "do", "\\u", "with", "\\u", "assert", "\\u", "raises_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "async", "\\u", "result_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert", "\\u", "raises_", "(_", "zero", "rpc_", "._", "Time", "out", "Expire", "d_", ",_", "\\u", "do", "\\u", "with", "\\u", "assert", "\\u", "raises_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "assert", "\\u", "raises_", "(_", "zero", "rpc_", "._", "Time", "out", "Expire", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "async", "\\u", "result_", "._", "get_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "client_", "._", "close_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srv_", "._", "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_", "def_", "test\\u", "client", "\\u", "server", "\\u", "with", "\\u", "async_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "endpoint_", "=_", "random", "\\u", "ipc", "\\u", "endpoint_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "My", "Sr", "v_", "(_", "zero", "rpc_", "._", "Server_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "lol", "ita", "_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "42_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add_", "(_", "self_", ",_", "a_", ",_", "b_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "a_", "+_", "b_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "srv_", "=_", "My", "Sr", "v_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "srv_", "._", "bind_", "(_", "endpoint_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "gevent_", "._", "spawn_", "(_", "srv_", "._", "run_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "client_", "=_", "zero", "rpc_", "._", "Client_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "client_", "._", "connect_", "(_", "endpoint_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "async", "\\u", "result_", "=_", "client_", "._", "lol", "ita", "_", "(_", "async_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "async", "\\u", "result_", "._", "get_", "(_", ")_", "==_", "42_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "async", "\\u", "result_", "=_", "client_", "._", "add_", "(_", "1_", ",_", "4_", ",_", "async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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 ]
Unused import
pyjs/pyjs/pyjs/__init__.py
[ { "content": "import sys\nimport os\ntry:\n import lib2to3\nexcept ImportError:\n import pgen\n import lib2to3\n\npath = [os.path.abspath('')]\n\n\n# default to None indicates 'relative paths' so that as a self-contained\n# archive, pyjs can run its tests.\ntry:\n import pyjswidgets\n import pyjswaddons\n pyjspth = os.path.abspath(os.path.join(__file__,'../'))\n path += [os.path.dirname(pyjswidgets.__file__),\n os.path.dirname(pyjswaddons.__file__), ]\nexcept ImportError:\n pyjspth = None\n\nif 'PYJSPATH' in os.environ:\n for p in os.environ['PYJSPATH'].split(os.pathsep):\n p = os.path.abspath(p)\n if os.path.isdir(p):\n path.append(p)\n\nMOD_SUFFIX = '.js'\n\nPYTHON = os.path.realpath(sys.executable) if sys.executable else None\nif PYTHON is None or not os.access(PYTHON, os.X_OK):\n PYTHON = 'python'\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import lib2to3", "start_line": 3, "start_column": 4, "end_line": 3, "end_column": 18 }, { "span": "import pgen", "start_line": 5, "start_column": 4, "end_line": 5, "end_column": 15 }, { "span": "import lib2to3", "start_line": 6, "start_column": 4, "end_line": 6, "end_column": 18 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "lib", "2t", "o3", "_", "\\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_", "pge", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "lib", "2t", "o3", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "path_", "=_", "[_", "os_", "._", "path_", "._", "abspath_", "(_", "''_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "default", " ", "to", " ", "Non", "e", " ", "indicat", "es", " ", "'", "relative", " ", "path", "s", "'", " ", "so", " ", "tha", "t", " ", "as", " ", "a", " ", "self", "-", "contain", "ed_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "archive", ",", " ", "pyj", "s", " ", "can", " ", "run", " ", "its", " ", "tests", "._", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "pyj", "swi", "dget", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pyj", "swa", "ddo", "ns_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyj", "spt", "h_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u", "file\\u\\u_", ",_", "'../", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "path_", "+=_", "[_", "os_", "._", "path_", "._", "dirname_", "(_", "pyj", "swi", "dget", "s_", "._", "\\u\\u", "file\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "os_", "._", "path_", "._", "dirname_", "(_", "pyj", "swa", "ddo", "ns_", "._", "\\u\\u", "file\\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 ", " _", "pyj", "spt", "h_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "'", "PY", "JS", "PATH", "'_", "in_", "os_", "._", "environ_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "for_", "p_", "in_", "os_", "._", "environ_", "[_", "'", "PY", "JS", "PATH", "'_", "]_", "._", "split_", "(_", "os_", "._", "pathsep_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "p_", "=_", "os_", "._", "path_", "._", "abspath_", "(_", "p_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "os_", "._", "path_", "._", "isdir_", "(_", "p_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "path_", "._", "append_", "(_", "p_", ")_", "\\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_", "MOD", "\\u", "SUFFIX_", "=_", "'.", "js", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "PYTHON", "_", "=_", "os_", "._", "path_", "._", "realpath_", "(_", "sys_", "._", "executable_", ")_", "if_", "sys_", "._", "executable_", "else_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "PYTHON", "_", "is_", "None_", "or_", "not_", "os_", "._", "access_", "(_", "PYTHON", "_", ",_", "os_", "._", "X", "\\u", "OK_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "PYTHON", "_", "=_", "'", "python", "'_", "\\u\\u\\uDEDENT\\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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
tatanus/SPF/spf/core/mydb.py
[ { "content": " def getCursor(self):\n if (self.conn is None):\n #print self.sqlite_file\n try:\n self.conn = sqlite3.connect(self.sqlite_file)\n except sqlite3.OperationalError as e:\n print e\n except:\n print sys.exc_info()[0]\n return self.conn.cursor()", "metadata": "root.MyDB.getCursor", "header": "['class', 'MyDB', '(', ')', ':', '___EOS___']", "index": 17 }, { "content": " def checkDB(self):\n try:\n cursor = self.getCursor()\n except:\n print sys.exc_info()[0]\n cursor.execute(\"SELECT name FROM sqlite_master WHERE type='table' AND name='users'\")\n if cursor.fetchone() is None:\n return False\n\n cursor.execute(\"SELECT name FROM sqlite_master WHERE type='table' AND name='hosts'\")\n if cursor.fetchone() is None:\n return False\n\n cursor.execute(\"SELECT name FROM sqlite_master WHERE type='table' AND name='web_templates'\")\n if cursor.fetchone() is None:\n return False\n\n cursor.execute(\"SELECT name FROM sqlite_master WHERE type='table' AND name='ports'\")\n if cursor.fetchone() is None:\n return False\n\n return True", "metadata": "root.MyDB.checkDB", "header": "['class', 'MyDB', '(', ')', ':', '___EOS___']", "index": 28 } ]
[ { "span": "except:", "start_line": 24, "start_column": 12, "end_line": 24, "end_column": 19 }, { "span": "except:", "start_line": 31, "start_column": 8, "end_line": 31, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "My", "DB_", "(_", ")_", ":_", "\\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", "Cursor_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "self_", "._", "conn_", "is_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "print", " ", "self", ".", "sql", "ite", "\\u", "file_", "\\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_", "._", "conn_", "=_", "sqlite3_", "._", "connect_", "(_", "self_", "._", "sql", "ite", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "sqlite3_", "._", "Opera", "tion", "al", "Error_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "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 ", " _", "print_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "conn_", "._", "cursor_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "My", "DB_", "(_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "check", "DB_", "(_", "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 ", " _", "cursor_", "=_", "self_", "._", "get", "Cursor_", "(_", ")_", "\\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_", "sys_", "._", "exc", "\\u", "info_", "(_", ")_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "cursor_", "._", "execute_", "(_", "\"", "SELECT", " ", "name", " ", "FROM", " ", "sql", "ite", "\\u", "master", " ", "WHE", "RE", " ", "type", "='", "table", "'", " ", "AND", " ", "name", "='", "users", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cursor_", "._", "fetchone_", "(_", ")_", "is_", "None_", ":_", "\\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_", "cursor_", "._", "execute_", "(_", "\"", "SELECT", " ", "name", " ", "FROM", " ", "sql", "ite", "\\u", "master", " ", "WHE", "RE", " ", "type", "='", "table", "'", " ", "AND", " ", "name", "='", "host", "s", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cursor_", "._", "fetchone_", "(_", ")_", "is_", "None_", ":_", "\\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_", "cursor_", "._", "execute_", "(_", "\"", "SELECT", " ", "name", " ", "FROM", " ", "sql", "ite", "\\u", "master", " ", "WHE", "RE", " ", "type", "='", "table", "'", " ", "AND", " ", "name", "='", "web", "\\u", "template", "s", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cursor_", "._", "fetchone_", "(_", ")_", "is_", "None_", ":_", "\\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_", "cursor_", "._", "execute_", "(_", "\"", "SELECT", " ", "name", " ", "FROM", " ", "sql", "ite", "\\u", "master", " ", "WHE", "RE", " ", "type", "='", "table", "'", " ", "AND", " ", "name", "='", "port", "s", "'\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "cursor_", "._", "fetchone_", "(_", ")_", "is_", "None_", ":_", "\\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_", "return_", "True_", "\\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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
hatRiot/clusterd/src/platform/jboss/deployers/http_management.py
[ { "content": "def deploy(fingerengine, fingerprint):\n \"\"\" Deploying WARs to JBoss 7.x is a three stage process. The first stage\n is a POST request with the file data to /management/add-content. This places\n the data on the server and passes back a hash to reference it. The second\n stage is an association of this data with a WAR file name, i.e. cmd.war.\n The final stage is to enable the WAR, which is a simple JSON request with the\n deploy operation.\n \"\"\"\n\n war_file = abspath(fingerengine.options.deploy)\n war_name = parse_war_path(war_file)\n war_raw = parse_war_path(war_file, True)\n utility.Msg(\"Preparing to deploy {0}...\".format(war_file))\n\n base = \"http://{0}:{1}/management\".format(fingerengine.options.ip,\n fingerprint.port)\n add_content = \"/add-content\"\n association = '{{\"address\":[{{\"deployment\":\"{0}\"}}],\"operation\":\"add\",'\\\n '\"runtime-name\":\"{2}\",\"content\":[{{\"hash\":{{\"BYTES_VALUE\"'\\\n ':\"{1}\"}}}}],\"name\":\"{0}\"}}'\n deploy = '{{\"operation\":\"deploy\", \"address\":{{\"deployment\":\"{0}\"}}}}'\n headers = {\"Content-Type\":\"application/json\"}\n\n try:\n fwar = {war_file : open(war_file, \"r\").read()}\n except:\n utility.Msg(\"Failed to open WAR (%s)\" % war_file, LOG.ERROR)\n return\n\n # first we POST the WAR to add-content\n response = utility.requests_post(base + add_content, files=fwar)\n if response.status_code == 401:\n response = redo_auth(fingerengine, fingerprint, base + add_content, \n files=fwar)\n\n if response.status_code != 200:\n utility.Msg(\"Failed to POST data (HTTP %d)\" % response.status_code, LOG.ERROR)\n return\n\n # fetch our BYTES_VALUE\n if response.json()['outcome'] != 'success':\n utility.Msg(\"Failed to POST data\", LOG.ERROR)\n utility.Msg(response.json(), LOG.DEBUG)\n return\n\n BYTES_VALUE = response.json()['result']['BYTES_VALUE']\n\n # now we need to associate the bytes with a name\n response = utility.requests_post(base, \n data=association.format(war_name, BYTES_VALUE, war_raw),\n headers=headers)\n\n if response.status_code == 401:\n response = redo_auth(fingerengine, fingerprint, base,\n data=association.format(war_name, BYTES_VALUE, war_raw),\n headers=headers)\n\n if response.status_code != 200:\n utility.Msg(\"Failed to associate content (HTTP %d)\" % response.status_code, LOG.ERROR)\n utility.Msg(response.content, LOG.DEBUG)\n return\n\n # now enable the WAR\n deploy = deploy.format(war_name)\n\n response = utility.requests_post(base, data=deploy, headers=headers)\n if response.status_code == 401:\n response = redo_auth(fingerengine, fingerprint, base, data=deploy,\n headers=headers)\n \n if response.status_code != 200:\n utility.Msg(\"Failed to enable WAR (HTTP %d)\" % response.status_code, LOG.ERROR)\n utility.Msg(response.content, LOG.DEBUG)\n return\n\n utility.Msg(\"%s deployed to %s.\" % (war_file, fingerengine.options.ip), \n LOG.SUCCESS)", "metadata": "root.deploy", "header": "['module', '___EOS___']", "index": 9 } ]
[ { "span": "except:", "start_line": 34, "start_column": 4, "end_line": 34, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "deploy_", "(_", "finger", "engine_", ",_", "fingerprint_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", " ", "Deploy", "ing", " ", "WAR", "s", " ", "to", " ", "JB", "oss", " ", "7", ".", "x", " ", "is", " ", "a", " ", "three", " ", "stage", " ", "process", ".", " ", " ", "The", " ", "first", " ", "stage", "\\", "10", ";", " ", " ", " ", " ", "is", " ", "a", " ", "POST", " ", "request", " ", "with", " ", "the", " ", "file", " ", "data", " ", "to", " ", "/", "manage", "ment", "/", "add", "-", "content", ".", " ", " ", "Thi", "s", " ", "place", "s", "\\", "10", ";", " ", " ", " ", " ", "the", " ", "data", " ", "on", " ", "the", " ", "server", " ", "and", " ", "pass", "es", " ", "back", " ", "a", " ", "hash", " ", "to", " ", "reference", " ", "it", ".", " ", " ", "The", " ", "second", "\\", "10", ";", " ", " ", " ", " ", "stage", " ", "is", " ", "an", " ", "associ", "ation", " ", "of", " ", "this", " ", "data", " ", "with", " ", "a", " ", "WAR", " ", "file", " ", "name", ",", " ", "i", ".", "e", ".", " ", "cmd", ".", "war", ".", "\\", "10", ";", " ", " ", " ", " ", "The", " ", "final", " ", "stage", " ", "is", " ", "to", " ", "enable", " ", "the", " ", "WAR", ",", " ", "whi", "ch", " ", "is", " ", "a", " ", "simple", " ", "JSO", "N", " ", "request", " ", "with", " ", "the", "\\", "10", ";", " ", " ", " ", " ", "deploy", " ", "operati", "on", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "war", "\\u", "file_", "=_", "abspath_", "(_", "finger", "engine_", "._", "options_", "._", "deploy_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "war", "\\u", "name_", "=_", "parse", "\\u", "war", "\\u", "path_", "(_", "war", "\\u", "file_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "war", "\\u", "raw_", "=_", "parse", "\\u", "war", "\\u", "path_", "(_", "war", "\\u", "file_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utility_", "._", "Msg_", "(_", "\"", "Prepar", "ing", " ", "to", " ", "deploy", " ", "{", "0", "}.", "..\"_", "._", "format_", "(_", "war", "\\u", "file_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "base_", "=_", "\"", "http", "://", "{", "0", "}:", "{", "1", "}/", "manage", "ment", "\"_", "._", "format_", "(_", "finger", "engine_", "._", "options_", "._", "ip_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "fingerprint_", "._", "port_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "add", "\\u", "content_", "=_", "\"/", "add", "-", "content", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "association_", "=_", "'{{", "\"", "address", "\":[", "{{", "\"", "deploy", "ment", "\":\"", "{", "0", "}\"", "}}", "],", "\"", "operati", "on", "\":\"", "add", "\",'_", "'\"", "runt", "ime", "-", "name", "\":\"", "{", "2", "}\"", ",\"", "content", "\":[", "{{", "\"", "hash", "\":{", "{", "\"", "BYTES", "\\u", "VALU", "E", "\"'_", "':", "\"{", "1", "}\"", "}}}", "}]", ",\"", "name", "\":\"", "{", "0", "}\"", "}}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "deploy_", "=_", "'{{", "\"", "operati", "on", "\":\"", "deploy", "\",", " ", "\"", "address", "\":{", "{", "\"", "deploy", "ment", "\":\"", "{", "0", "}\"", "}}}", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "headers_", "=_", "{_", "\"", "Conten", "t", "-", "Type", "\"_", ":_", "\"", "applica", "tion", "/", "json", "\"_", "}_", "\\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 ", " _", "fw", "ar_", "=_", "{_", "war", "\\u", "file_", ":_", "open_", "(_", "war", "\\u", "file_", ",_", "\"", "r", "\"_", ")_", "._", "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 ", " _", "utility_", "._", "Msg_", "(_", "\"", "Fail", "ed", " ", "to", " ", "open", " ", "WAR", " ", "(%", "s", ")\"_", "%_", "war", "\\u", "file_", ",_", "LOG_", "._", "ERROR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "first", " ", "we", " ", "POST", " ", "the", " ", "WAR", " ", "to", " ", "add", "-", "content_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "response_", "=_", "utility_", "._", "request", "s", "\\u", "post_", "(_", "base_", "+_", "add", "\\u", "content_", ",_", "files_", "=_", "fw", "ar_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "==_", "401_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "redo", "\\u", "auth_", "(_", "finger", "engine_", ",_", "fingerprint_", ",_", "base_", "+_", "add", "\\u", "content_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "files_", "=_", "fw", "ar_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "!=_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utility_", "._", "Msg_", "(_", "\"", "Fail", "ed", " ", "to", " ", "POST", " ", "data", " ", "(", "HTTP", " ", "%", "d", ")\"_", "%_", "response_", "._", "status", "\\u", "code_", ",_", "LOG_", "._", "ERROR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fetch", " ", "our", " ", "BYTES", "\\u", "VALUE_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "json_", "(_", ")_", "[_", "'", "outco", "me", "'_", "]_", "!=_", "'", "success", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utility_", "._", "Msg_", "(_", "\"", "Fail", "ed", " ", "to", " ", "POST", " ", "data", "\"_", ",_", "LOG_", "._", "ERROR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utility_", "._", "Msg_", "(_", "response_", "._", "json_", "(_", ")_", ",_", "LOG_", "._", "DEBUG_", ")_", "\\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_", "BYTES", "\\u", "VALUE_", "=_", "response_", "._", "json_", "(_", ")_", "[_", "'", "result", "'_", "]_", "[_", "'", "BYTES", "\\u", "VALU", "E", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "we", " ", "need", " ", "to", " ", "associate", " ", "the", " ", "bytes", " ", "with", " ", "a", " ", "name_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "utility_", "._", "request", "s", "\\u", "post_", "(_", "base_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "association_", "._", "format_", "(_", "war", "\\u", "name_", ",_", "BYTES", "\\u", "VALUE_", ",_", "war", "\\u", "raw_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "==_", "401_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "redo", "\\u", "auth_", "(_", "finger", "engine_", ",_", "fingerprint_", ",_", "base_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "association_", "._", "format_", "(_", "war", "\\u", "name_", ",_", "BYTES", "\\u", "VALUE_", ",_", "war", "\\u", "raw_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "!=_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utility_", "._", "Msg_", "(_", "\"", "Fail", "ed", " ", "to", " ", "associate", " ", "content", " ", "(", "HTTP", " ", "%", "d", ")\"_", "%_", "response_", "._", "status", "\\u", "code_", ",_", "LOG_", "._", "ERROR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utility_", "._", "Msg_", "(_", "response_", "._", "content_", ",_", "LOG_", "._", "DEBUG_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "now", " ", "enable", " ", "the", " ", "WAR", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "deploy_", "=_", "deploy_", "._", "format_", "(_", "war", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "response_", "=_", "utility_", "._", "request", "s", "\\u", "post_", "(_", "base_", ",_", "data_", "=_", "deploy_", ",_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "==_", "401_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "response_", "=_", "redo", "\\u", "auth_", "(_", "finger", "engine_", ",_", "fingerprint_", ",_", "base_", ",_", "data_", "=_", "deploy_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "headers_", "=_", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "response_", "._", "status", "\\u", "code_", "!=_", "200_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "utility_", "._", "Msg_", "(_", "\"", "Fail", "ed", " ", "to", " ", "enable", " ", "WAR", " ", "(", "HTTP", " ", "%", "d", ")\"_", "%_", "response_", "._", "status", "\\u", "code_", ",_", "LOG_", "._", "ERROR_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "utility_", "._", "Msg_", "(_", "response_", "._", "content_", ",_", "LOG_", "._", "DEBUG_", ")_", "\\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_", "utility_", "._", "Msg_", "(_", "\"%", "s", " ", "deploye", "d", " ", "to", " ", "%", "s", ".\"_", "%_", "(_", "war", "\\u", "file_", ",_", "finger", "engine_", "._", "options_", "._", "ip_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "LOG_", "._", "SUCCESS_", ")_", "\\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,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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
daeilkim/refinery/refinery/bnpy/bnpy-dev/tests/allocmodel/admix/TestHDPBetaOptimizer.py
[ { "content": "'''\nUnit tests for HDPBetaOptimizer.py\n\nTest Strategy:\nWe examine models with K=2\nWe start with a known v / beta, and \ngenerate the \"observed data\": group-level probs Pi\n\nFor each model we verify that both,\n\n1) the objectiveFunc objective function provided by HDPBetaOptimizer.py\n has (more or less) a minimum at the known value of v\n2) the estimate_v function provided by HDPBetaOptimizer.py\n can recover that true minimum, or something slightly better.\n'''\n\nimport sys\nimport unittest\nimport numpy as np\nfrom scipy.special import gammaln, digamma, polygamma\nsys.path.append('../../../bnpy/allocmodel/admix/')\nimport HDPBetaOptimizer as HBO\n\nEPS = 1e-9\n \n \n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TestHBOK2(unittest.TestCase):\n\n \n\n # Used only if we actually calculate the variational expectations\n\n\n", "metadata": "root.TestHBOK2", "header": "['module', '___EOS___']", "index": 25 }, { "content": " def shortDescription(self):\n return None", "metadata": "root.TestHBOK2.shortDescription", "header": "['class', 'TestHBOK2', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 26 }, { "content": " def setUp(self):\n '''\n Create a simple case for making sure we're calculating things correctly\n '''\n self.MakeModel()\n self.MakeData()\n assert self.sumLogPi.shape[1] == self.K + 1", "metadata": "root.TestHBOK2.setUp", "header": "['class', 'TestHBOK2', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 29 }, { "content": " def MakeModel(self):\n self.alpha = .5\n self.gamma = 5\n self.K = 2\n self.truebeta = np.asarray([0.5, 0.5, 1e-2])\n self.truebeta /= np.sum(self.truebeta)", "metadata": "root.TestHBOK2.MakeModel", "header": "['class', 'TestHBOK2', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 37 }, { "content": " def calcExpPI(self, Pi):\n ELogPi = np.zeros((self.G, self.K+1))\n for i in xrange(self.G):\n ELogPi[i] = digamma(Pi[i,:]) - digamma(np.sum(Pi[i,:]))\n return ELogPi", "metadata": "root.TestHBOK2.calcExpPI", "header": "['class', 'TestHBOK2', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 45 }, { "content": " def MakeData(self):\n self.G = 1000\n PRNG = np.random.RandomState(0)\n Pi = np.zeros( (self.G, self.K+1) )\n Pi = PRNG.dirichlet(self.gamma * self.truebeta, self.G)\n Pi = np.maximum(Pi, EPS)\n self.sumLogPi = np.log(Pi)\n #ElogPi = self.calcExpPI(Pi)\n #self.sumLogPi = np.asarray(np.sum(ElogPi, axis=0))\n self.PRNG = PRNG", "metadata": "root.TestHBOK2.MakeData", "header": "['class', 'TestHBOK2', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 51 }, { "content": " def test_estimate_is_near_truth(self, nTrial=2):\n vopt = HBO.beta2v(self.truebeta)\n objfunc = lambda v: HBO.objectiveFunc(v, self.alpha, self.gamma, self.G, self.sumLogPi)\n success = 0\n print vopt, '*optimal*'\n\n for trial in range(nTrial):\n initV = np.random.rand(self.K)\n v = HBO.estimate_v(self.gamma, self.alpha, self.G, self.K, self.sumLogPi, initV )\n if np.all( np.abs(v - vopt) < .01 ):\n success += 1\n elif objfunc(v) < objfunc(vopt):\n success += 1\n else:\n print v\n print \"%d/%d suceeded.\" % (success, nTrial)\n assert success == nTrial", "metadata": "root.TestHBOK2.test_estimate_is_near_truth", "header": "['class', 'TestHBOK2', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 62 }, { "content": " def test_truth_is_minimum_of_objfunc(self, nTrial=2):\n vopt = HBO.beta2v(self.truebeta)\n objfunc = lambda v: HBO.objectiveFunc(v, self.alpha, self.gamma, self.G, self.sumLogPi)\n success = 0\n fopt = objfunc(vopt)\n print vopt, fopt, '**'\n\n for trial in range(nTrial):\n v = vopt + 0.01 * self.PRNG.rand(self.K)\n v = np.minimum(v, 1.0 - 1e-8)\n fv = objfunc(v)\n if fopt < fv:\n success += 1\n else:\n print v, fv\n assert success > 0.98 * nTrial", "metadata": "root.TestHBOK2.test_truth_is_minimum_of_objfunc", "header": "['class', 'TestHBOK2', '(', 'unittest', '.', 'TestCase', ')', ':', '___EOS___']", "index": 80 } ]
[ { "span": "from scipy.special import gammaln, digamma, polygamma", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 53 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "'''", "\\", "10", ";", "Unit", " ", "tests", " ", "for", " ", "HD", "PB", "eta", "Optimize", "r", ".", "py", "\\", "10", ";", "\\", "10", ";", "Test", " ", "Strat", "eg", "y", ":", "\\", "10", ";", "We", " ", "examine", " ", "model", "s", " ", "with", " ", "K", "=", "2", "\\", "10", ";", "We", " ", "start", " ", "with", " ", "a", " ", "know", "n", " ", "v", " ", "/", " ", "beta", ",", " ", "and", " ", "\\", "10", ";", "generat", "e", " ", "the", " ", "\"", "observe", "d", " ", "data", "\":", " ", "group", "-", "level", " ", "probs", " ", "Pi", "\\", "10", ";", "\\", "10", ";", "For", " ", "each", " ", "model", " ", "we", " ", "verify", " ", "tha", "t", " ", "bot", "h", ",", "\\", "10", ";", "\\", "10", ";", "1", ")", " ", "the", " ", "objecti", "ve", "Func", " ", "objecti", "ve", " ", "function", " ", "provided", " ", "by", " ", "HD", "PB", "eta", "Optimize", "r", ".", "py", "\\", "10", ";", " ", " ", " ", " ", "has", " ", "(", "more", " ", "or", " ", "less", ")", " ", "a", " ", "minim", "um", " ", "at", " ", "the", " ", "know", "n", " ", "value", " ", "of", " ", "v", "\\", "10", ";", "2", ")", " ", "the", " ", "estimate", "\\u", "v", " ", "function", " ", "provided", " ", "by", " ", "HD", "PB", "eta", "Optimize", "r", ".", "py", "\\", "10", ";", " ", " ", " ", " ", "can", " ", "recover", " ", "tha", "t", " ", "true", " ", "minim", "um", ",", " ", "or", " ", "somet", "hing", " ", "slight", "ly", " ", "bett", "er", ".", "\\", "10", ";'", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "unittest_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "numpy_", "as_", "np_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scipy_", "._", "special_", "import_", "gamma", "ln_", ",_", "dig", "amma", "_", ",_", "poly", "gamma_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "path_", "._", "append_", "(_", "'../../", "..", "/", "bn", "py", "/", "allo", "cmo", "del", "/", "admi", "x", "/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "HD", "PB", "eta", "Optimizer_", "as_", "HB", "O_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "EPS", "_", "=_", "1e-", "9_", "\\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_", "Test", "HB", "OK", "2_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Us", "ed", " ", "only", " ", "if", " ", "we", " ", "actual", "ly", " ", "calcul", "ate", " ", "the", " ", "variatio", "nal", " ", "expectations", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "HB", "OK", "2_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "short", "Description_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "HB", "OK", "2_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set", "Up_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "'''", "\\", "10", ";", " ", " ", " ", " ", "Creat", "e", " ", "a", " ", " ", "simple", " ", "case", " ", "for", " ", "mak", "ing", " ", "sure", " ", "we", "'", "re", " ", "calculati", "ng", " ", "thing", "s", " ", "correct", "ly", "\\", "10", ";", " ", " ", " ", " ", "'''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Make", "Model_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "Make", "Data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "self_", "._", "sum", "Log", "Pi_", "._", "shape_", "[_", "1_", "]_", "==_", "self_", "._", "K_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "HB", "OK", "2_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Make", "Model_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "alpha_", "=_", ".5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "gamma_", "=_", "5_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "K_", "=_", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "true", "beta_", "=_", "np_", "._", "asarray_", "(_", "[_", "0.5_", ",_", "0.5_", ",_", "1e-2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "true", "beta_", "/=_", "np_", "._", "sum_", "(_", "self_", "._", "true", "beta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "HB", "OK", "2_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "calc", "Exp", "PI_", "(_", "self_", ",_", "Pi_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "EL", "og", "Pi_", "=_", "np_", "._", "zeros_", "(_", "(_", "self_", "._", "G_", ",_", "self_", "._", "K_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "xrange_", "(_", "self_", "._", "G_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "EL", "og", "Pi_", "[_", "i_", "]_", "=_", "dig", "amma", "_", "(_", "Pi_", "[_", "i_", ",_", ":_", "]_", ")_", "-_", "dig", "amma", "_", "(_", "np_", "._", "sum_", "(_", "Pi_", "[_", "i_", ",_", ":_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "EL", "og", "Pi_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "HB", "OK", "2_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "Make", "Data_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "G_", "=_", "1000_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "PR", "NG_", "=_", "np_", "._", "random_", "._", "Random", "State_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Pi_", "=_", "np_", "._", "zeros_", "(_", "(_", "self_", "._", "G_", ",_", "self_", "._", "K_", "+_", "1_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Pi_", "=_", "PR", "NG_", "._", "diri", "chl", "et_", "(_", "self_", "._", "gamma_", "*_", "self_", "._", "true", "beta_", ",_", "self_", "._", "G_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Pi_", "=_", "np_", "._", "maximum_", "(_", "Pi_", ",_", "EPS", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sum", "Log", "Pi_", "=_", "np_", "._", "log_", "(_", "Pi_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "El", "og", "Pi", " ", "=", " ", "self", ".", "calc", "Exp", "PI", "(", "Pi", ")_", "\\u\\u\\uNL\\u\\u\\u_", "#", "self", ".", "sum", "Log", "Pi", " ", "=", " ", "np", ".", "asa", "rray", "(", "np", ".", "sum", "(", "El", "og", "Pi", ",", " ", "axis", "=", "0", "))", "_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "PR", "NG_", "=_", "PR", "NG_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "HB", "OK", "2_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "estimate", "\\u", "is", "\\u", "near", "\\u", "truth_", "(_", "self_", ",_", "n", "Trial", "_", "=_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vo", "pt_", "=_", "HB", "O_", "._", "beta", "2v", "_", "(_", "self_", "._", "true", "beta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj", "func_", "=_", "lambda_", "v_", ":_", "HB", "O_", "._", "objecti", "ve", "Func_", "(_", "v_", ",_", "self_", "._", "alpha_", ",_", "self_", "._", "gamma_", ",_", "self_", "._", "G_", ",_", "self_", "._", "sum", "Log", "Pi_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "vo", "pt_", ",_", "'*", "optim", "al", "*'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "trial_", "in_", "range_", "(_", "n", "Trial", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "init", "V_", "=_", "np_", "._", "random_", "._", "rand_", "(_", "self_", "._", "K_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "HB", "O_", "._", "estimate", "\\u", "v_", "(_", "self_", "._", "gamma_", ",_", "self_", "._", "alpha_", ",_", "self_", "._", "G_", ",_", "self_", "._", "K_", ",_", "self_", "._", "sum", "Log", "Pi_", ",_", "init", "V_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "np_", "._", "all_", "(_", "np_", "._", "abs_", "(_", "v_", "-_", "vo", "pt_", ")_", "<_", ".01_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "+=_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "obj", "func_", "(_", "v_", ")_", "<_", "obj", "func_", "(_", "vo", "pt_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "+=_", "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 ", " _", "print_", "v_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "print_", "\"%", "d", "/", "%", "d", " ", "suce", "eded", ".\"_", "%_", "(_", "success_", ",_", "n", "Trial", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "success_", "==_", "n", "Trial", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "HB", "OK", "2_", "(_", "unittest_", "._", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "truth", "\\u", "is", "\\u", "minim", "um", "\\u", "of", "\\u", "obj", "func_", "(_", "self_", ",_", "n", "Trial", "_", "=_", "2_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vo", "pt_", "=_", "HB", "O_", "._", "beta", "2v", "_", "(_", "self_", "._", "true", "beta_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "obj", "func_", "=_", "lambda_", "v_", ":_", "HB", "O_", "._", "objecti", "ve", "Func_", "(_", "v_", ",_", "self_", "._", "alpha_", ",_", "self_", "._", "gamma_", ",_", "self_", "._", "G_", ",_", "self_", "._", "sum", "Log", "Pi_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "success_", "=_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fop", "t_", "=_", "obj", "func_", "(_", "vo", "pt_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "vo", "pt_", ",_", "fop", "t_", ",_", "'**", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "trial_", "in_", "range_", "(_", "n", "Trial", "_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "v_", "=_", "vo", "pt_", "+_", "0.01_", "*_", "self_", "._", "PR", "NG_", "._", "rand_", "(_", "self_", "._", "K_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "v_", "=_", "np_", "._", "minimum_", "(_", "v_", ",_", "1.0_", "-_", "1e-8_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fv_", "=_", "obj", "func_", "(_", "v_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "fop", "t_", "<_", "fv_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "success_", "+=_", "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 ", " _", "print_", "v_", ",_", "fv_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "assert_", "success_", ">_", "0.98", "_", "*_", "n", "Trial", "_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
hcook/gmm/examples/cluster.py
[ { "content": "def get_config_params(config):\n #read in filenames\n try:\n meeting_name = config.get('Diarizer', 'basename')\n except:\n print \"basename not specified in config file! exiting...\"\n sys.exit(2)\n try:\n f = config.get('Diarizer', 'mfcc_feats')\n except:\n print \"Feature file mfcc_feats not specified in config file! exiting...\"\n sys.exit(2)\n\n try:\n sp = config.get('Diarizer', 'spnsp_file')\n except:\n print \"Speech file spnsp_file not specified, continuing without it...\"\n sp = False\n\n try:\n outfile = config.get('Diarizer', 'output_cluster')\n except:\n print \"output_cluster file not specified in config file! exiting...\"\n sys.exit(2)\n\n try:\n gmmfile = config.get('Diarizer', 'gmm_output')\n except:\n print \"gmm_output file not specified in config file! exiting...\"\n sys.exit(2)\n \n #read GMM paramters\n try:\n num_gmms = int(config.get('Diarizer', 'initial_clusters'))\n except:\n print \"initial_clusters not specified in config file! exiting...\"\n sys.exit(2)\n\n try:\n num_comps = int(config.get('Diarizer', 'M_mfcc'))\n except:\n print \"M_mfcc not specified in config file! exiting...\"\n sys.exit(2)\n \n #read algorithm configuration\n try:\n kl_ntop = int(config.get('Diarizer', 'KL_ntop'))\n except:\n kl_ntop = 0\n try:\n num_seg_iters_init = int(config.get('Diarizer', 'num_seg_iters_init'))\n except:\n num_seg_iters_init = 2\n \n try:\n num_seg_iters = int(config.get('Diarizer', 'num_seg_iters'))\n except:\n num_seg_iters = 3\n\n try:\n num_em_iters = int(config.get('Diarizer', 'em_iterations'))\n except:\n num_em_iters = 3\n\n try:\n seg_length = int(config.get('Diarizer', 'seg_length'))\n except:\n seg_length = 250\n\n \n return meeting_name, f, sp, outfile, gmmfile, num_gmms, num_comps, num_em_iters, kl_ntop, num_seg_iters_init, num_seg_iters, seg_length", "metadata": "root.get_config_params", "header": "['module', '___EOS___']", "index": 434 } ]
[ { "span": "except:", "start_line": 438, "start_column": 4, "end_line": 438, "end_column": 11 }, { "span": "except:", "start_line": 443, "start_column": 4, "end_line": 443, "end_column": 11 }, { "span": "except:", "start_line": 449, "start_column": 4, "end_line": 449, "end_column": 11 }, { "span": "except:", "start_line": 455, "start_column": 4, "end_line": 455, "end_column": 11 }, { "span": "except:", "start_line": 461, "start_column": 4, "end_line": 461, "end_column": 11 }, { "span": "except:", "start_line": 468, "start_column": 4, "end_line": 468, "end_column": 11 }, { "span": "except:", "start_line": 474, "start_column": 4, "end_line": 474, "end_column": 11 }, { "span": "except:", "start_line": 481, "start_column": 4, "end_line": 481, "end_column": 11 }, { "span": "except:", "start_line": 485, "start_column": 4, "end_line": 485, "end_column": 11 }, { "span": "except:", "start_line": 490, "start_column": 4, "end_line": 490, "end_column": 11 }, { "span": "except:", "start_line": 495, "start_column": 4, "end_line": 495, "end_column": 11 }, { "span": "except:", "start_line": 500, "start_column": 4, "end_line": 500, "end_column": 11 } ]
[]
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_", "get", "\\u", "config", "\\u", "params_", "(_", "config_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", "read", " ", "in", " ", "filenames_", "\\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 ", " _", "meeting", "\\u", "name_", "=_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "basen", "ame", "'_", ")_", "\\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_", "\"", "basen", "ame", " ", "not", " ", "specified", " ", "in", " ", "config", " ", "file", "!", " ", "exit", "ing", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "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 ", " _", "f_", "=_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "mfc", "c\\u", "feats", "'_", ")_", "\\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_", "\"", "Feature", " ", "file", " ", "mfc", "c\\u", "feats", " ", "not", " ", "specified", " ", "in", " ", "config", " ", "file", "!", " ", "exit", "ing", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\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 ", " _", "sp_", "=_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "spn", "sp", "\\u", "file", "'_", ")_", "\\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_", "\"", "Spee", "ch", " ", "file", " ", "spn", "sp", "\\u", "file", " ", "not", " ", "specified", ",", " ", "continui", "ng", " ", "with", "out", " ", "it", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sp_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "outfile_", "=_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "output", "\\u", "cluster", "'_", ")_", "\\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_", "\"", "output", "\\u", "cluster", " ", "file", " ", "not", " ", "specified", " ", "in", " ", "config", " ", "file", "!", " ", "exit", "ing", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\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 ", " _", "gmm", "file_", "=_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "gmm", "\\u", "output", "'_", ")_", "\\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_", "\"", "gmm", "\\u", "output", " ", "file", " ", "not", " ", "specified", " ", "in", " ", "config", " ", "file", "!", " ", "exit", "ing", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "read", " ", "GM", "M", " ", "param", "ters_", "\\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 ", " _", "num", "\\u", "gmm", "s_", "=_", "int_", "(_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "initial", "\\u", "cluster", "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 ", " _", "print_", "\"", "initial", "\\u", "cluster", "s", " ", "not", " ", "specified", " ", "in", " ", "config", " ", "file", "!", " ", "exit", "ing", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\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 ", " _", "num", "\\u", "comps_", "=_", "int_", "(_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "M", "\\u", "mfc", "c", "'_", ")_", ")_", "\\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_", "\"", "M", "\\u", "mfc", "c", " ", "not", " ", "specified", " ", "in", " ", "config", " ", "file", "!", " ", "exit", "ing", "...\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", "read", " ", "algo", "rit", "hm", " ", "configuration_", "\\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 ", " _", "kl", "\\u", "nto", "p_", "=_", "int_", "(_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "KL", "\\u", "nto", "p", "'_", ")_", ")_", "\\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 ", " _", "kl", "\\u", "nto", "p_", "=_", "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 ", " _", "num", "\\u", "seg", "\\u", "iters", "\\u", "init_", "=_", "int_", "(_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "num", "\\u", "seg", "\\u", "iters", "\\u", "init", "'_", ")_", ")_", "\\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 ", " _", "num", "\\u", "seg", "\\u", "iters", "\\u", "init_", "=_", "2_", "\\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 ", " _", "num", "\\u", "seg", "\\u", "iters_", "=_", "int_", "(_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "num", "\\u", "seg", "\\u", "iters", "'_", ")_", ")_", "\\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 ", " _", "num", "\\u", "seg", "\\u", "iters_", "=_", "3_", "\\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 ", " _", "num", "\\u", "em", "\\u", "iters_", "=_", "int_", "(_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "em", "\\u", "iterati", "ons", "'_", ")_", ")_", "\\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 ", " _", "num", "\\u", "em", "\\u", "iters_", "=_", "3_", "\\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 ", " _", "seg", "\\u", "length_", "=_", "int_", "(_", "config_", "._", "get_", "(_", "'", "Dia", "rize", "r", "'_", ",_", "'", "seg", "\\u", "length", "'_", ")_", ")_", "\\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 ", " _", "seg", "\\u", "length_", "=_", "250_", "\\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_", "meeting", "\\u", "name_", ",_", "f_", ",_", "sp_", ",_", "outfile_", ",_", "gmm", "file_", ",_", "num", "\\u", "gmm", "s_", ",_", "num", "\\u", "comps_", ",_", "num", "\\u", "em", "\\u", "iters_", ",_", "kl", "\\u", "nto", "p_", ",_", "num", "\\u", "seg", "\\u", "iters", "\\u", "init_", ",_", "num", "\\u", "seg", "\\u", "iters_", ",_", "seg", "\\u", "length_", "\\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, 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, 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, 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,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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, 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, 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, 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 ]
Unused import
wangjeaf/CSSCheckStyle/tests/unit/check/FEDNoEmptyFile.py
[ { "content": "from asserts import ok, equal, notEqual, getResults\nfrom helper import doCssCheck, doCssTextCheck\nfrom ckstyle.reporter.helper import fill\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def doTest():\n logs, warns, errors = doCssTextCheck('/* @author: zhifu.wang**/ /* .test {width: 100px;}*/', 'test.css')\n equal(len(errors), 1, 'one error occur')\n equal(fill(errors[0]), 'empty css file \"test.css\"')\n\n logs, warns, errors = doCssTextCheck('/* @author: zhifu.wang**/ /* .test {width: 100px;}*/ \\n.test { width: 100px; }', 'test.css')\n equal(len(errors), 0, 'no error now')", "metadata": "root.doTest", "header": "['module', '___EOS___']", "index": 4 } ]
[ { "span": "from asserts import ok, equal, notEqual, getResults", "start_line": 0, "start_column": 0, "end_line": 0, "end_column": 51 }, { "span": "from helper import doCssCheck, doCssTextCheck", "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_", "from_", "asserts", "_", "import_", "ok_", ",_", "equal_", ",_", "not", "Equal_", ",_", "get", "Results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "helper_", "import_", "do", "Cs", "s", "Check_", ",_", "do", "Cs", "s", "Text", "Check_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "cks", "tyle_", "._", "reporter_", "._", "helper_", "import_", "fill_", "\\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_", "do", "Test_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "logs_", ",_", "warns", "_", ",_", "errors_", "=_", "do", "Cs", "s", "Text", "Check_", "(_", "'/*", " ", "@", "author", ":", " ", "zhi", "fu", ".", "wan", "g", "**", "/", " ", "/*", " ", ".", "test", " ", "{", "widt", "h", ":", " ", "100", "px", ";}", "*/", "'_", ",_", "'", "test", ".", "css", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "equal_", "(_", "len_", "(_", "errors_", ")_", ",_", "1_", ",_", "'", "one", " ", "error", " ", "occur", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "equal_", "(_", "fill_", "(_", "errors_", "[_", "0_", "]_", ")_", ",_", "'", "empty", " ", "css", " ", "file", " ", "\"", "test", ".", "css", "\"'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "logs_", ",_", "warns", "_", ",_", "errors_", "=_", "do", "Cs", "s", "Text", "Check_", "(_", "'/*", " ", "@", "author", ":", " ", "zhi", "fu", ".", "wan", "g", "**", "/", " ", "/*", " ", ".", "test", " ", "{", "widt", "h", ":", " ", "100", "px", ";}", "*/", " ", "\\\\", "n", ".", "test", " ", "{", " ", "widt", "h", ":", " ", "100", "px", ";", " ", "}'_", ",_", "'", "test", ".", "css", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "equal_", "(_", "len_", "(_", "errors_", ")_", ",_", "0_", ",_", "'", "no", " ", "error", " ", "now", "'_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 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, 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 ]
Variable defined multiple times
PyCQA/pycodestyle/testsuite/E30.py
[ { "content": "class X:\n", "metadata": "root.X", "header": "['module', '___EOS___']", "index": 1 }, { "content": "def a():\n pass", "metadata": "root.a", "header": "['module', '___EOS___']", "index": 21 }, { "content": "def a():\n pass", "metadata": "root.a", "header": "['module', '___EOS___']", "index": 32 }, { "content": "def b():\n pass", "metadata": "root.b", "header": "['module', '___EOS___']", "index": 35 }, { "content": "def a():\n pass", "metadata": "root.a", "header": "['module', '___EOS___']", "index": 38 } ]
[ { "span": "X:", "start_line": 1, "start_column": 6, "end_line": 1, "end_column": 7 }, { "span": "a(", "start_line": 21, "start_column": 4, "end_line": 21, "end_column": 5 }, { "span": "a(", "start_line": 32, "start_column": 4, "end_line": 32, "end_column": 5 }, { "span": "b(", "start_line": 35, "start_column": 4, "end_line": 35, "end_column": 5 }, { "span": "a(", "start_line": 38, "start_column": 4, "end_line": 38, "end_column": 5 } ]
[]
1
true
[ "[CLS]_", "Variable_", "defined_", "multiple_", "times_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "X_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "a_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "a_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "b_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "a_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 0, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2 ]
Testing equality to None
bt3gl/Python-and-Algorithms-and-Data-Structures/src/trees/simple_tree.py
[ { "content": " def __init__(self, value=None, children = None):\n self.value = value\n self.children = children\n if self.children == None:\n self.children = []", "metadata": "root.SimpleTree.__init__", "header": "['class', 'SimpleTree', '(', 'object', ')', ':', '___EOS___']", "index": 9 } ]
[ { "span": "self.children == None:", "start_line": 12, "start_column": 11, "end_line": 12, "end_column": 32 } ]
[]
1
true
[ "[CLS]_", "Test", "ing_", "equality", "_", "to_", "None_", "[SEP]_", "class_", "Simple", "Tree_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "value_", "=_", "None_", ",_", "children_", "=_", "None_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "value_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "children_", "=_", "children_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "children_", "==_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "children_", "=_", "[_", "]_", "\\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, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Except block handles 'BaseException'
grantjenks/sorted_containers/tests/test_stress_sortedlistwithkey.py
[ { "content": "# -*- coding: utf-8 -*-\n\nfrom __future__ import print_function\nfrom sys import hexversion\n\nimport copy\nimport bisect\nimport random\nfrom .context import sortedcontainers\nfrom sortedcontainers import SortedListWithKey\nfrom nose.tools import raises\nfrom functools import wraps\n\n\nif hexversion < 0x03000000:\n from itertools import izip as zip\n range = xrange\n\nrandom.seed(0)\nactions = []\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nif __name__ == '__main__':\n import sys\n from datetime import datetime\n\n start = datetime.now()\n\n print('Python', sys.version_info)\n\n try:\n num = int(sys.argv[1])\n print('Setting iterations to', num)\n except:\n print('Setting iterations to 1000 (default)')\n num = 1000\n\n try:\n pea = int(sys.argv[2])\n random.seed(pea)\n print('Setting seed to', pea)\n except:\n print('Setting seed to 0 (default)')\n random.seed(0)\n\n try:\n test_stress(num)\n except:\n raise\n finally:\n print('Exiting after', (datetime.now() - start))\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 351, "start_column": 4, "end_line": 351, "end_column": 11 }, { "span": "except:", "start_line": 359, "start_column": 4, "end_line": 359, "end_column": 11 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sys_", "import_", "hex", "version_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "copy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "bisect_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "context_", "import_", "sorte", "dco", "nta", "iner", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "sorte", "dco", "nta", "iner", "s_", "import_", "Sorte", "d", "List", "With", "Key_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "raises_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "functools_", "import_", "wraps_", "\\u\\u\\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_", "hex", "version_", "<_", "0x03", "000000_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "itertools_", "import_", "izip_", "as_", "zip_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "range_", "=_", "xrange_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "random_", "._", "seed_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "actions_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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 ", " _", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "datetime_", "import_", "datetime_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "start_", "=_", "datetime_", "._", "now_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "print_", "(_", "'", "Pyth", "on", "'_", ",_", "sys_", "._", "version", "\\u", "info_", ")_", "\\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 ", " _", "num_", "=_", "int_", "(_", "sys_", "._", "argv_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Sett", "ing", " ", "iterati", "ons", " ", "to", "'_", ",_", "num_", ")_", "\\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_", "(_", "'", "Sett", "ing", " ", "iterati", "ons", " ", "to", " ", "1000", " ", "(", "default", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "num_", "=_", "1000_", "\\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 ", " _", "pea", "_", "=_", "int_", "(_", "sys_", "._", "argv_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random_", "._", "seed_", "(_", "pea", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "Sett", "ing", " ", "seed", " ", "to", "'_", ",_", "pea", "_", ")_", "\\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_", "(_", "'", "Sett", "ing", " ", "seed", " ", "to", " ", "0", " ", "(", "default", ")'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "random_", "._", "seed_", "(_", "0_", ")_", "\\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 ", " _", "test\\u", "stress_", "(_", "num_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "finally_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "Exi", "ting", " ", "after", "'_", ",_", "(_", "datetime_", "._", "now_", "(_", ")_", "-_", "start_", ")_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\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, 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 ]
Unused local variable
statsmodels/statsmodels/statsmodels/regression/tests/test_regression.py
[ { "content": " def test_df_resid(self):\n df_resid = self.endog.shape[0] - self.exog.shape[1]\n assert_equal(self.ols_model.df_resid, long(9))", "metadata": "root.TestNonFit.test_df_resid", "header": "['class', 'TestNonFit', '(', 'object', ')', ':', '___EOS___']", "index": 675 }, { "content": " def test_regularized(self):\n\n import os\n from . import glmnet_r_results\n\n cur_dir = os.path.dirname(os.path.abspath(__file__))\n data = np.loadtxt(os.path.join(cur_dir, \"results\", \"lasso_data.csv\"),\n delimiter=\",\")\n\n tests = [x for x in dir(glmnet_r_results) if x.startswith(\"rslt_\")]\n\n for test in tests:\n\n vec = getattr(glmnet_r_results, test)\n\n n = vec[0]\n p = vec[1]\n L1_wt = float(vec[2])\n lam = float(vec[3])\n params = vec[4:].astype(np.float64)\n\n endog = data[0:int(n), 0]\n exog = data[0:int(n), 1:(int(p)+1)]\n\n endog = endog - endog.mean()\n endog /= endog.std(ddof=1)\n exog = exog - exog.mean(0)\n exog /= exog.std(0, ddof=1)\n\n mod = OLS(endog, exog)\n rslt = mod.fit_regularized(L1_wt=L1_wt, alpha=lam)\n assert_almost_equal(rslt.params, params, decimal=3)\n\n # Smoke test for summary\n smry = rslt.summary()", "metadata": "root.TestRegularizedFit.test_regularized", "header": "['class', 'TestRegularizedFit', '(', 'object', ')', ':', '___NEWLINE___', '___NL___', '# Make sure there are no issues when there are no selected', '___NL___', '# variables.', '___NL___', '___EOS___']", "index": 994 }, { "content": "def test_missing_formula_predict():\n # see 2171\n nsample = 30\n\n data = pandas.DataFrame({'x': np.linspace(0, 10, nsample)})\n null = pandas.DataFrame({'x': np.array([np.nan])})\n data = pandas.concat([data, null])\n beta = np.array([1, 0.1])\n e = np.random.normal(size=nsample+1)\n data['y'] = beta[0] + beta[1] * data['x'] + e\n model = OLS.from_formula('y ~ x', data=data)\n fit = model.fit()\n pred = fit.predict(exog=data[:-1])", "metadata": "root.test_missing_formula_predict", "header": "['module', '___EOS___']", "index": 1055 }, { "content": "def test_fvalue_implicit_constant():\n nobs = 100\n np.random.seed(2)\n x = np.random.randn(nobs, 1)\n x = ((x > 0) == [True, False]).astype(int)\n y = x.sum(1) + np.random.randn(nobs)\n w = 1 + 0.25 * np.random.rand(nobs)\n\n from statsmodels.regression.linear_model import OLS, WLS\n\n res = OLS(y, x).fit(cov_type='HC1')\n assert_(np.isnan(res.fvalue))\n assert_(np.isnan(res.f_pvalue))\n res.summary()\n\n res = WLS(y, x).fit(cov_type='HC1')\n assert_(np.isnan(res.fvalue))\n assert_(np.isnan(res.f_pvalue))\n res.summary()", "metadata": "root.test_fvalue_implicit_constant", "header": "['module', '___EOS___']", "index": 1070 } ]
[ { "span": "df_resid ", "start_line": 676, "start_column": 8, "end_line": 676, "end_column": 16 }, { "span": "smry ", "start_line": 1028, "start_column": 12, "end_line": 1028, "end_column": 16 }, { "span": "pred ", "start_line": 1067, "start_column": 4, "end_line": 1067, "end_column": 8 }, { "span": "w ", "start_line": 1076, "start_column": 4, "end_line": 1076, "end_column": 5 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "class_", "Test", "Non", "Fit_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "df", "\\u", "resid_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "df", "\\u", "resid_", "=_", "self_", "._", "endo", "g_", "._", "shape_", "[_", "0_", "]_", "-_", "self_", "._", "exo", "g_", "._", "shape_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "self_", "._", "ols", "\\u", "model_", "._", "df", "\\u", "resid_", ",_", "long_", "(_", "9_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Test", "Regula", "rize", "d", "Fit_", "(_", "object_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Make", " ", "sure", " ", "there", " ", "are", " ", "no", " ", "issue", "s", " ", "whe", "n", " ", "there", " ", "are", " ", "no", " ", "selected_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "variab", "les", "._", "\\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", "regulari", "zed_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "os_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "import_", "glm", "net", "\\u", "r", "\\u", "results_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "cur", "\\u", "dir_", "=_", "os_", "._", "path_", "._", "dirname_", "(_", "os_", "._", "path_", "._", "abspath_", "(_", "\\u\\u", "file\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "np_", "._", "loadtxt_", "(_", "os_", "._", "path_", "._", "join_", "(_", "cur", "\\u", "dir_", ",_", "\"", "results", "\"_", ",_", "\"", "lass", "o", "\\u", "data", ".", "csv", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "delimiter_", "=_", "\",\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "tests_", "=_", "[_", "x_", "for_", "x_", "in_", "dir_", "(_", "glm", "net", "\\u", "r", "\\u", "results_", ")_", "if_", "x_", "._", "startswith_", "(_", "\"", "rsl", "t", "\\u\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "test_", "in_", "tests_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "vec_", "=_", "getattr_", "(_", "glm", "net", "\\u", "r", "\\u", "results_", ",_", "test_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "n_", "=_", "vec_", "[_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", "=_", "vec_", "[_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "L1", "\\u", "wt_", "=_", "float_", "(_", "vec_", "[_", "2_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "lam_", "=_", "float_", "(_", "vec_", "[_", "3_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "params_", "=_", "vec_", "[_", "4_", ":_", "]_", "._", "astype_", "(_", "np_", "._", "float64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "endo", "g_", "=_", "data_", "[_", "0_", ":_", "int_", "(_", "n_", ")_", ",_", "0_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exo", "g_", "=_", "data_", "[_", "0_", ":_", "int_", "(_", "n_", ")_", ",_", "1_", ":_", "(_", "int_", "(_", "p_", ")_", "+_", "1_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "endo", "g_", "=_", "endo", "g_", "-_", "endo", "g_", "._", "mean_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "endo", "g_", "/=_", "endo", "g_", "._", "std_", "(_", "ddo", "f_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exo", "g_", "=_", "exo", "g_", "-_", "exo", "g_", "._", "mean_", "(_", "0_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "exo", "g_", "/=_", "exo", "g_", "._", "std_", "(_", "0_", ",_", "ddo", "f_", "=_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "mod_", "=_", "OL", "S_", "(_", "endo", "g_", ",_", "exo", "g_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "rsl", "t_", "=_", "mod_", "._", "fit", "\\u", "regulari", "zed_", "(_", "L1", "\\u", "wt_", "=_", "L1", "\\u", "wt_", ",_", "alpha_", "=_", "lam_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "alm", "ost", "\\u", "equal_", "(_", "rsl", "t_", "._", "params_", ",_", "params_", ",_", "decimal_", "=_", "3_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Smo", "ke", " ", "test", " ", "for", " ", "summary_", "\\u\\u\\uNL\\u\\u\\u_", "sm", "ry_", "=_", "rsl", "t_", "._", "summary_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "missi", "ng", "\\u", "formula", "\\u", "predict_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "see", " ", "217", "1_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nsa", "mple", "_", "=_", "30_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "pandas_", "._", "Data", "Frame_", "(_", "{_", "'", "x", "'_", ":_", "np_", "._", "linspace_", "(_", "0_", ",_", "10_", ",_", "nsa", "mple", "_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "null_", "=_", "pandas_", "._", "Data", "Frame_", "(_", "{_", "'", "x", "'_", ":_", "np_", "._", "array_", "(_", "[_", "np_", "._", "nan_", "]_", ")_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "pandas_", "._", "concat_", "(_", "[_", "data_", ",_", "null_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "beta_", "=_", "np_", "._", "array_", "(_", "[_", "1_", ",_", "0.1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "e_", "=_", "np_", "._", "random_", "._", "normal_", "(_", "size_", "=_", "nsa", "mple", "_", "+_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "[_", "'", "y", "'_", "]_", "=_", "beta_", "[_", "0_", "]_", "+_", "beta_", "[_", "1_", "]_", "*_", "data_", "[_", "'", "x", "'_", "]_", "+_", "e_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "model_", "=_", "OL", "S_", "._", "from", "\\u", "formula_", "(_", "'", "y", " ", "~", " ", "x", "'_", ",_", "data_", "=_", "data_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "fit_", "=_", "model_", "._", "fit_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pred_", "=_", "fit_", "._", "predict_", "(_", "exo", "g_", "=_", "data_", "[_", ":_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "fval", "ue", "\\u", "implicit", "\\u", "constant_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "nob", "s_", "=_", "100_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "np_", "._", "random_", "._", "seed_", "(_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "np_", "._", "random_", "._", "randn_", "(_", "nob", "s_", ",_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "x_", "=_", "(_", "(_", "x_", ">_", "0_", ")_", "==_", "[_", "True_", ",_", "False_", "]_", ")_", "._", "astype_", "(_", "int_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "y_", "=_", "x_", "._", "sum_", "(_", "1_", ")_", "+_", "np_", "._", "random_", "._", "randn_", "(_", "nob", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "w_", "=_", "1_", "+_", "0.25_", "*_", "np_", "._", "random_", "._", "rand_", "(_", "nob", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "stats", "models_", "._", "regression_", "._", "linear", "\\u", "model_", "import_", "OL", "S_", ",_", "WL", "S_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "OL", "S_", "(_", "y_", ",_", "x_", ")_", "._", "fit_", "(_", "cov", "\\u", "type_", "=_", "'", "HC", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert\\u_", "(_", "np_", "._", "isnan_", "(_", "res_", "._", "fval", "ue_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert\\u_", "(_", "np_", "._", "isnan_", "(_", "res_", "._", "f", "\\u", "pvalue_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "summary_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "res_", "=_", "WL", "S_", "(_", "y_", ",_", "x_", ")_", "._", "fit_", "(_", "cov", "\\u", "type_", "=_", "'", "HC", "1", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert\\u_", "(_", "np_", "._", "isnan_", "(_", "res_", "._", "fval", "ue_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert\\u_", "(_", "np_", "._", "isnan_", "(_", "res_", "._", "f", "\\u", "pvalue_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "res_", "._", "summary_", "(_", ")_", "\\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, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Except block handles 'BaseException'
kubernauts/kploy/kploycommon.py
[ { "content": "def _connect(api_server, debug):\n \"\"\"\n Tries to connect to cluster and ping it.\n If successful it returns the Pyk client.\n \"\"\"\n try:\n pyk_client = toolkit.KubeHTTPClient(kube_version=\"1.1\", api_server=api_server, debug=debug)\n pyk_client.execute_operation(method=\"GET\", ops_path=\"/api/v1\")\n except:\n print(\"\\nCan't connect to the Kubernetes cluster at %s\\nCheck the `apiserver` setting in your Kployfile, your Internet connection or maybe it's a VPN issue?\" %(api_server))\n sys.exit(1)\n return pyk_client", "metadata": "root._connect", "header": "['module', '___EOS___']", "index": 30 } ]
[ { "span": "except:", "start_line": 38, "start_column": 4, "end_line": 38, "end_column": 11 } ]
[]
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_", "\\u", "connect_", "(_", "api", "\\u", "server_", ",_", "debug_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Trie", "s", " ", "to", " ", "connect", " ", "to", " ", "cluster", " ", "and", " ", "ping", " ", "it", ".", "\\", "10", ";", " ", " ", " ", " ", "If", " ", "success", "ful", " ", "it", " ", "return", "s", " ", "the", " ", "Py", "k", " ", "client", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pyk", "\\u", "client_", "=_", "toolkit_", "._", "Ku", "be", "HTTP", "Client_", "(_", "kube", "\\u", "version_", "=_", "\"", "1.1", "\"_", ",_", "api", "\\u", "server_", "=_", "api", "\\u", "server_", ",_", "debug_", "=_", "debug_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "pyk", "\\u", "client_", "._", "execute", "\\u", "operation_", "(_", "method_", "=_", "\"", "GET", "\"_", ",_", "ops", "\\u", "path_", "=_", "\"/", "api", "/", "v1", "\"_", ")_", "\\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", "Can", "'", "t", " ", "connect", " ", "to", " ", "the", " ", "Ku", "bern", "ete", "s", " ", "cluster", " ", "at", " ", "%", "s", "\\\\", "n", "Check", " ", "the", " ", "`", "apis", "erver", "`", " ", "setti", "ng", " ", "in", " ", "your", " ", "Kp", "loy", "file", ",", " ", "your", " ", "Intern", "et", " ", "connecti", "on", " ", "or", " ", "may", "be", " ", "it", "'", "s", " ", "a", " ", "VP", "N", " ", "issue", "?\"_", "%_", "(_", "api", "\\u", "server_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "pyk", "\\u", "client_", "\\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, 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 ]
Except block handles 'BaseException'
snare/voltron/voltron/view.py
[ { "content": "from __future__ import print_function\n\nimport os\nimport sys\nimport logging\nimport pprint\nimport re\nimport signal\nimport time\nimport argparse\nimport traceback\nimport subprocess\nfrom requests import ConnectionError\nfrom blessed import Terminal\n\ntry:\n import pygments\n import pygments.lexers\n import pygments.formatters\n have_pygments = True\nexcept:\n have_pygments = False\n\ntry:\n import cursor\nexcept:\n cursor = None\n\nfrom collections import defaultdict\n\nfrom scruffy import Config\n\nfrom .core import *\nfrom .colour import *\nfrom .plugin import *\n\nlog = logging.getLogger(\"view\")\n\nADDR_FORMAT_128 = '0x{0:0=32X}'\nADDR_FORMAT_64 = '0x{0:0=16X}'\nADDR_FORMAT_32 = '0x{0:0=8X}'\nADDR_FORMAT_16 = '0x{0:0=4X}'\nSHORT_ADDR_FORMAT_128 = '{0:0=32X}'\nSHORT_ADDR_FORMAT_64 = '{0:0=16X}'\nSHORT_ADDR_FORMAT_32 = '{0:0=8X}'\nSHORT_ADDR_FORMAT_16 = '{0:0=4X}'\n\n\n# https://gist.github.com/sampsyo/471779\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": " def __init__(self, args={}, loaded_config={}):\n log.debug('Loading view: ' + self.__class__.__name__)\n self.client = Client(url=voltron.config.view.api_url)\n self.pm = None\n self.args = args\n self.loaded_config = loaded_config\n self.server_version = None\n\n # Commonly set by render method for header and footer formatting\n self.title = ''\n self.info = ''\n self.body = ''\n\n # Build configuration\n self.build_config()\n\n log.debug(\"View config: \" + pprint.pformat(self.config))\n log.debug(\"Args: \" + str(self.args))\n\n # Let subclass do any setup it needs to do\n self.setup()\n\n # Override settings from command line args\n if self.args.header != None:\n self.config.header.show = self.args.header\n if self.args.footer != None:\n self.config.footer.show = self.args.footer\n\n # Setup a SIGWINCH handler so we do reasonable things on resize\n try:\n signal.signal(signal.SIGWINCH, self.sigwinch_handler)\n except:\n pass", "metadata": "root.VoltronView.__init__", "header": "['class', 'VoltronView', '(', 'object', ')', ':', '___EOS___']", "index": 161 }, { "content": " def should_reconnect(self):\n try:\n return self.loaded_config.view.reconnect\n except:\n return True", "metadata": "root.VoltronView.should_reconnect", "header": "['class', 'VoltronView', '(', 'object', ')', ':', '___EOS___']", "index": 274 } ]
[ { "span": "except:", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 7 }, { "span": "except:", "start_line": 25, "start_column": 0, "end_line": 25, "end_column": 7 }, { "span": "except:", "start_line": 192, "start_column": 8, "end_line": 192, "end_column": 15 }, { "span": "except:", "start_line": 277, "start_column": 8, "end_line": 277, "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_", "print", "\\u", "function_", "\\u\\u\\uNEWLINE\\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_", "import_", "pprint_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "traceback_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "requests_", "import_", "Connect", "ion", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bles", "sed_", "import_", "Terminal_", "\\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_", "pygments_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pygments_", "._", "lexer", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "pygments_", "._", "formatters_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "have", "\\u", "pygments_", "=_", "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 ", " _", "have", "\\u", "pygments_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "cursor_", "\\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 ", " _", "cursor_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "collections_", "import_", "defaultdict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "scr", "uff", "y_", "import_", "Config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "core_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "colour_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "._", "plugin_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "=_", "logging_", "._", "get", "Logger_", "(_", "\"", "view", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ADDR", "\\u", "FORMAT", "\\u", "128_", "=_", "'", "0", "x", "{", "0", ":", "0", "=", "32", "X", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ADDR", "\\u", "FORMAT", "\\u", "64_", "=_", "'", "0", "x", "{", "0", ":", "0", "=", "16", "X", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ADDR", "\\u", "FORMAT", "\\u", "32_", "=_", "'", "0", "x", "{", "0", ":", "0", "=", "8", "X", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ADDR", "\\u", "FORMAT", "\\u", "16_", "=_", "'", "0", "x", "{", "0", ":", "0", "=", "4", "X", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SHORT", "\\u", "ADDR", "\\u", "FORMAT", "\\u", "128_", "=_", "'{", "0", ":", "0", "=", "32", "X", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SHORT", "\\u", "ADDR", "\\u", "FORMAT", "\\u", "64_", "=_", "'{", "0", ":", "0", "=", "16", "X", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SHORT", "\\u", "ADDR", "\\u", "FORMAT", "\\u", "32_", "=_", "'{", "0", ":", "0", "=", "8", "X", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SHORT", "\\u", "ADDR", "\\u", "FORMAT", "\\u", "16_", "=_", "'{", "0", ":", "0", "=", "4", "X", "}'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "https", "://", "gist", ".", "git", "hub", ".", "com", "/", "samp", "sy", "o", "/", "471", "779", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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]_", "class_", "Volt", "ron", "View_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "args_", "=_", "{_", "}_", ",_", "load", "ed", "\\u", "config_", "=_", "{_", "}_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "log_", "._", "debug_", "(_", "'", "Load", "ing", " ", "view", ":", " ", "'_", "+_", "self_", "._", "\\u\\u", "class\\u\\u_", "._", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "client_", "=_", "Client_", "(_", "url_", "=_", "volt", "ron", "_", "._", "config_", "._", "view_", "._", "api", "\\u", "url_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "pm_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "args_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "load", "ed", "\\u", "config_", "=_", "load", "ed", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "server", "\\u", "version_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Common", "ly", " ", "set", " ", "by", " ", "render", " ", "method", " ", "for", " ", "header", " ", "and", " ", "footer", " ", "formatting_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "title_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "info_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "body_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Build", " ", "configuration_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "build", "\\u", "config_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", "View", " ", "config", ":", " ", "\"_", "+_", "pprint_", "._", "pformat_", "(_", "self_", "._", "config_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "log_", "._", "debug_", "(_", "\"", "Arg", "s", ":", " ", "\"_", "+_", "str_", "(_", "self_", "._", "args_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Let", " ", "subclass", " ", "do", " ", "any", " ", "setup", " ", "it", " ", "need", "s", " ", "to", " ", "do_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "setup_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Override", " ", "settings", " ", "from", " ", "command", " ", "line", " ", "args_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "self_", "._", "args_", "._", "header_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "config_", "._", "header_", "._", "show_", "=_", "self_", "._", "args_", "._", "header_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "args_", "._", "footer_", "!=_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "config_", "._", "footer_", "._", "show_", "=_", "self_", "._", "args_", "._", "footer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Set", "up", " ", "a", " ", "SIG", "WIN", "CH", " ", "handler", " ", "so", " ", "we", " ", "do", " ", "reason", "able", " ", "thing", "s", " ", "on", " ", "resize_", "\\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 ", " _", "signal_", "._", "signal_", "(_", "signal_", "._", "SIG", "WIN", "CH_", ",_", "self_", "._", "sig", "win", "ch", "\\u", "handler_", ")_", "\\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_", "Volt", "ron", "View_", "(_", "object_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "shou", "ld", "\\u", "reconnect_", "(_", "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_", "._", "load", "ed", "\\u", "config_", "._", "view_", "._", "reconnect_", "\\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_", "True_", "\\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, 0, 1, 1, 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,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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, 0, 1, 1, 2, 2, 2, 2, 2, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 2, 2, 2, 2, 2, 2 ]
Unused import
mailgun/flanker/tests/addresslib/metrics_test.py
[ { "content": "# coding:utf-8\n\nfrom .. import *\nfrom mock import patch\nfrom nose.tools import assert_equal, assert_not_equal\nfrom nose.tools import nottest\n\nfrom flanker.addresslib import address, validate\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "@nottest\ndef mock_exchanger_lookup(arg, metrics=False):\n mtimes = {'mx_lookup': 10, 'dns_lookup': 20, 'mx_conn': 30}\n if metrics is True:\n if arg == 'ai' or arg == 'mailgun.org' or arg == 'fakecompany.mailgun.org':\n return ('', mtimes)\n else:\n return (None, mtimes)\n else:\n if arg == 'ai' or arg == 'mailgun.org' or arg == 'fakecompany.mailgun.org':\n return ''\n else:\n return None", "metadata": "root.mock_exchanger_lookup", "header": "['module', '___EOS___']", "index": 9 }, { "content": "def test_metrics_parse():\n # parse\n assert_equal(len(address.parse('[email protected]', metrics=True)), 2)\n p, m = address.parse('[email protected]', metrics=True)\n assert_equal('parsing' in m, True)\n assert_equal(isinstance(address.parse('[email protected]', metrics=False), address.EmailAddress), True)\n assert_equal(isinstance(address.parse('[email protected]'), address.EmailAddress), True)", "metadata": "root.test_metrics_parse", "header": "['module', '___EOS___']", "index": 24 }, { "content": "def test_metrics_parse_list():\n # parse_list\n assert_equal(len(address.parse_list('[email protected], [email protected]', metrics=True)), 2)\n p, m = address.parse_list('[email protected], [email protected]', metrics=True)\n assert_equal('parsing' in m, True)\n assert_equal(isinstance(address.parse_list('[email protected], [email protected]', metrics=False), address.AddressList), True)\n assert_equal(isinstance(address.parse_list('[email protected], [email protected]'), address.AddressList), True)", "metadata": "root.test_metrics_parse_list", "header": "['module', '___EOS___']", "index": 32 }, { "content": "def test_metrics_validate_address():\n # validate\n with patch.object(validate, 'mail_exchanger_lookup') as mock_method:\n mock_method.side_effect = mock_exchanger_lookup\n\n assert_equal(len(address.validate_address('[email protected]', metrics=True)), 2)\n p, m = address.validate_address('[email protected]', metrics=True)\n assert_equal('parsing' in m, True)\n assert_equal('mx_lookup' in m, True)\n assert_equal('dns_lookup' in m, True)\n assert_equal('mx_conn' in m, True)\n assert_equal('custom_grammar' in m, True)\n assert_equal(isinstance(address.validate_address('[email protected]', metrics=False), address.EmailAddress), True)\n assert_equal(isinstance(address.validate_address('[email protected]'), address.EmailAddress), True)", "metadata": "root.test_metrics_validate_address", "header": "['module', '___EOS___']", "index": 40 }, { "content": "def test_metrics_validate_list():\n # validate_list\n with patch.object(validate, 'mail_exchanger_lookup') as mock_method:\n mock_method.side_effect = mock_exchanger_lookup\n\n assert_equal(len(address.validate_list('[email protected], [email protected]', metrics=True)), 2)\n p, m = address.validate_list('[email protected], [email protected]', metrics=True)\n assert_equal('parsing' in m, True)\n assert_equal('mx_lookup' in m, True)\n assert_equal('dns_lookup' in m, True)\n assert_equal('mx_conn' in m, True)\n assert_equal('custom_grammar' in m, True)\n assert_equal(isinstance(address.validate_list('[email protected], [email protected]', metrics=False), address.AddressList), True)\n assert_equal(isinstance(address.validate_list('[email protected], [email protected]'), address.AddressList), True)", "metadata": "root.test_metrics_validate_list", "header": "['module', '___EOS___']", "index": 55 } ]
[ { "span": "from nose.tools import assert_equal, assert_not_equal", "start_line": 4, "start_column": 0, "end_line": 4, "end_column": 53 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "codi", "ng", ":", "utf", "-", "8_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "._", "._", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "mock_", "import_", "patch_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "assert", "\\u", "equal_", ",_", "assert", "\\u", "not", "\\u", "equal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "nose_", "._", "tools_", "import_", "not", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "flan", "ker_", "._", "address", "lib_", "import_", "address_", ",_", "validate_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "not", "test_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "mock", "\\u", "exchange", "r", "\\u", "lookup_", "(_", "arg_", ",_", "metrics_", "=_", "False_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mti", "mes_", "=_", "{_", "'", "mx", "\\u", "look", "up", "'_", ":_", "10_", ",_", "'", "dns", "\\u", "look", "up", "'_", ":_", "20_", ",_", "'", "mx", "\\u", "conn", "'_", ":_", "30_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "metrics_", "is_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "arg_", "==_", "'", "ai", "'_", "or_", "arg_", "==_", "'", "mail", "gun", ".", "org", "'_", "or_", "arg_", "==_", "'", "fake", "compan", "y", ".", "mail", "gun", ".", "org", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "''_", ",_", "mti", "mes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "None_", ",_", "mti", "mes_", ")_", "\\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_", "arg_", "==_", "'", "ai", "'_", "or_", "arg_", "==_", "'", "mail", "gun", ".", "org", "'_", "or_", "arg_", "==_", "'", "fake", "compan", "y", ".", "mail", "gun", ".", "org", "'_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "metric", "s", "\\u", "parse_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "parse_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "equal_", "(_", "len_", "(_", "address_", "._", "parse_", "(_", "'", "foo", "@", "example", ".", "com", "'_", ",_", "metrics_", "=_", "True_", ")_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", ",_", "m_", "=_", "address_", "._", "parse_", "(_", "'", "foo", "@", "example", ".", "com", "'_", ",_", "metrics_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "'", "pars", "ing", "'_", "in_", "m_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "isinstance_", "(_", "address_", "._", "parse_", "(_", "'", "foo", "@", "example", ".", "com", "'_", ",_", "metrics_", "=_", "False_", ")_", ",_", "address_", "._", "Ema", "il", "Address_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "isinstance_", "(_", "address_", "._", "parse_", "(_", "'", "foo", "@", "example", ".", "com", "'_", ")_", ",_", "address_", "._", "Ema", "il", "Address_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "metric", "s", "\\u", "parse", "\\u", "list_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "parse", "\\u", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert", "\\u", "equal_", "(_", "len_", "(_", "address_", "._", "parse", "\\u", "list_", "(_", "'", "foo", "@", "example", ".", "com", ",", " ", "bar", "@", "example", ".", "com", "'_", ",_", "metrics_", "=_", "True_", ")_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", ",_", "m_", "=_", "address_", "._", "parse", "\\u", "list_", "(_", "'", "foo", "@", "example", ".", "com", ",", " ", "bar", "@", "example", ".", "com", "'_", ",_", "metrics_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "'", "pars", "ing", "'_", "in_", "m_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "isinstance_", "(_", "address_", "._", "parse", "\\u", "list_", "(_", "'", "foo", "@", "example", ".", "com", ",", " ", "bar", "@", "example", ".", "com", "'_", ",_", "metrics_", "=_", "False_", ")_", ",_", "address_", "._", "Address", "List_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "isinstance_", "(_", "address_", "._", "parse", "\\u", "list_", "(_", "'", "foo", "@", "example", ".", "com", ",", " ", "bar", "@", "example", ".", "com", "'_", ")_", ",_", "address_", "._", "Address", "List_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "metric", "s", "\\u", "validat", "e\\u", "address_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "validate_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "patch_", "._", "object_", "(_", "validate_", ",_", "'", "mail", "\\u", "exchange", "r", "\\u", "look", "up", "'_", ")_", "as_", "mock", "\\u", "method_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "method_", "._", "side", "\\u", "effect_", "=_", "mock", "\\u", "exchange", "r", "\\u", "lookup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "len_", "(_", "address_", "._", "validat", "e\\u", "address_", "(_", "'", "foo", "@", "mail", "gun", ".", "net", "'_", ",_", "metrics_", "=_", "True_", ")_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", ",_", "m_", "=_", "address_", "._", "validat", "e\\u", "address_", "(_", "'", "foo", "@", "mail", "gun", ".", "net", "'_", ",_", "metrics_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "'", "pars", "ing", "'_", "in_", "m_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "'", "mx", "\\u", "look", "up", "'_", "in_", "m_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "'", "dns", "\\u", "look", "up", "'_", "in_", "m_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "'", "mx", "\\u", "conn", "'_", "in_", "m_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "'", "custom", "\\u", "grammar", "'_", "in_", "m_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "isinstance_", "(_", "address_", "._", "validat", "e\\u", "address_", "(_", "'", "foo", "@", "mail", "gun", ".", "org", "'_", ",_", "metrics_", "=_", "False_", ")_", ",_", "address_", "._", "Ema", "il", "Address_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "isinstance_", "(_", "address_", "._", "validat", "e\\u", "address_", "(_", "'", "foo", "@", "mail", "gun", ".", "org", "'_", ")_", ",_", "address_", "._", "Ema", "il", "Address_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "test\\u", "metric", "s", "\\u", "validat", "e\\u", "list_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "validat", "e\\u", "list_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "with_", "patch_", "._", "object_", "(_", "validate_", ",_", "'", "mail", "\\u", "exchange", "r", "\\u", "look", "up", "'_", ")_", "as_", "mock", "\\u", "method_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "mock", "\\u", "method_", "._", "side", "\\u", "effect_", "=_", "mock", "\\u", "exchange", "r", "\\u", "lookup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "len_", "(_", "address_", "._", "validat", "e\\u", "list_", "(_", "'", "foo", "@", "mail", "gun", ".", "org", ",", " ", "bar", "@", "mail", "gun", ".", "org", "'_", ",_", "metrics_", "=_", "True_", ")_", ")_", ",_", "2_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "p_", ",_", "m_", "=_", "address_", "._", "validat", "e\\u", "list_", "(_", "'", "foo", "@", "mail", "gun", ".", "org", ",", " ", "bar", "@", "mail", "gun", ".", "org", "'_", ",_", "metrics_", "=_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "'", "pars", "ing", "'_", "in_", "m_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "'", "mx", "\\u", "look", "up", "'_", "in_", "m_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "'", "dns", "\\u", "look", "up", "'_", "in_", "m_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "'", "mx", "\\u", "conn", "'_", "in_", "m_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "'", "custom", "\\u", "grammar", "'_", "in_", "m_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "isinstance_", "(_", "address_", "._", "validat", "e\\u", "list_", "(_", "'", "foo", "@", "mail", "gun", ".", "org", ",", " ", "bar", "@", "mail", "gun", ".", "org", "'_", ",_", "metrics_", "=_", "False_", ")_", ",_", "address_", "._", "Address", "List_", ")_", ",_", "True_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert", "\\u", "equal_", "(_", "isinstance_", "(_", "address_", "._", "validat", "e\\u", "list_", "(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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 ]
Unreachable code
kuri65536/python-for-android/python-modules/twisted/twisted/python/test/test_syslog.py
[ { "content": "# Copyright (c) 2009 Twisted Matrix Laboratories.\n# See LICENSE for details.\n\nfrom twisted.trial.unittest import TestCase\nfrom twisted.python.failure import Failure\n\ntry:\n import syslog as stdsyslog\nexcept ImportError:\n stdsyslog = None\nelse:\n from twisted.python import syslog\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except ImportError:", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 19 } ]
[]
1
true
[ "[CLS]_", "Unrea", "chab", "le_", "code_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "200", "9", " ", "Twi", "sted", " ", "Matrix", " ", "Labo", "rator", "ies", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "See", " ", "LICENSE", " ", "for", " ", "deta", "il", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "twisted_", "._", "trial_", "._", "unittest_", "import_", "Test", "Case_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "twisted_", "._", "python_", "._", "failure_", "import_", "Failure_", "\\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_", "syslog_", "as_", "stds", "ys", "log_", "\\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 ", " _", "stds", "ys", "log_", "=_", "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 ", " _", "from_", "twisted_", "._", "python_", "import_", "syslog_", "\\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_" ]
[ 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, 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 ]
Imprecise assert
scrapy/scrapy/tests/test_proxy_connect.py
[ { "content": " @defer.inlineCallbacks\n def test_https_tunnel_without_leak_proxy_authorization_header(self):\n request = Request(\"https://localhost:8999/echo\")\n crawler = get_crawler(SingleRequestSpider)\n with LogCapture() as l:\n yield crawler.crawl(seed=request)\n self._assert_got_response_code(200, l)\n echo = json.loads(crawler.spider.meta['responses'][0].body)\n self.assertTrue('Proxy-Authorization' not in echo['headers'])", "metadata": "root.ProxyConnectTestCase.test_https_tunnel_without_leak_proxy_authorization_header", "header": "['class', 'ProxyConnectTestCase', '(', 'TestCase', ')', ':', '___EOS___']", "index": 84 } ]
[ { "span": "self.assertTrue('Proxy-Authorization' not in echo['headers'])", "start_line": 92, "start_column": 8, "end_line": 92, "end_column": 69 } ]
[]
1
true
[ "[CLS]_", "Imp", "reci", "se_", "assert_", "[SEP]_", "class_", "Pro", "xy", "Connect", "Test", "Case_", "(_", "Test", "Case_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "defer_", "._", "inline", "Callbacks_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "test\\u", "https", "\\u", "tunnel", "\\u", "with", "out", "\\u", "leak", "\\u", "proxy", "\\u", "authoriz", "ation", "\\u", "header_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "request_", "=_", "Request_", "(_", "\"", "https", "://", "local", "host", ":", "899", "9", "/", "echo", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "crawler_", "=_", "get", "\\u", "crawler_", "(_", "Sing", "le", "Request", "Spider_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "Log", "Capture_", "(_", ")_", "as_", "l_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "yield_", "crawler_", "._", "crawl", "_", "(_", "seed_", "=_", "request_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "\\u", "assert", "\\u", "got", "\\u", "response", "\\u", "code_", "(_", "200_", ",_", "l_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "echo_", "=_", "json_", "._", "loads_", "(_", "crawler_", "._", "spider_", "._", "meta_", "[_", "'", "response", "s", "'_", "]_", "[_", "0_", "]_", "._", "body_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "assert", "True_", "(_", "'", "Pro", "xy", "-", "Authoriz", "ation", "'_", "not_", "in_", "echo_", "[_", "'", "header", "s", "'_", "]_", ")_", "\\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, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2 ]
Unused import
chromaway/ngcccbase/chromanode.py
[ { "content": "#!/usr/bin/env python\nimport os, sys\nimport json\nimport hashlib\nimport httplib\nimport threading, time\nfrom socket import error as SocketError\nfrom bitcoin.rpc import JSONRPCException\n\n\nimport web\n\nfrom coloredcoinlib import BlockchainState, ColorDefinition\n\n\nurls = (\n '/tx', 'Tx',\n '/publish_tx', 'PublishTx',\n '/tx_blockhash', 'TxBlockhash',\n '/prefetch', 'Prefetch',\n '/blockcount', 'BlockCount',\n '/header', 'Header',\n '/chunk', 'Chunk',\n '/merkle', 'Merkle'\n)\n\ntestnet = False\nif (len(sys.argv) > 2) and (sys.argv[2] == 'testnet'):\n testnet = True\n\nHEADERS_FILE = 'headers.testnet' if testnet else 'headers.mainnet'\nif (len(sys.argv) > 3):\n HEADERS_FILE = sys.argv[3]\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nchunkThread = ChunkThread()\n\n\n\n\n\n\nif __name__ == \"__main__\":\n import signal\n signal.signal(signal.SIGINT, sigint_handler)\n\n chunkThread.start()\n\n app = web.application(urls, globals())\n app.run()\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ErrorThrowingRequestProcessor:", "metadata": "root.ErrorThrowingRequestProcessor", "header": "['module', '___EOS___']", "index": 35 }, { "content": " def require(self, data, key, message):\n value = data.get(key, None)\n if value is None:\n raise web.HTTPError(\"400 Bad request!\", \n {\"content-type\": \"text/plain\"},\n message)", "metadata": "root.ErrorThrowingRequestProcessor.require", "header": "['class', 'ErrorThrowingRequestProcessor', ':', '___EOS___']", "index": 36 }, { "content": "class Tx(ErrorThrowingRequestProcessor):", "metadata": "root.Tx", "header": "['module', '___EOS___']", "index": 44 }, { "content": " def POST(self):\n # data is sent in as json\n data = json.loads(web.data())\n self.require(data, 'txhash', \"TX requires txhash\")\n txhash = data.get('txhash')\n print txhash\n blockchainstate = BlockchainState.from_url(None, testnet)\n return blockchainstate.get_raw(txhash)", "metadata": "root.Tx.POST", "header": "['class', 'Tx', '(', 'ErrorThrowingRequestProcessor', ')', ':', '___EOS___']", "index": 45 }, { "content": "class PublishTx(ErrorThrowingRequestProcessor):", "metadata": "root.PublishTx", "header": "['module', '___EOS___']", "index": 55 }, { "content": " def POST(self):\n txdata = web.data()\n reply = None\n try:\n blockchainstate = BlockchainState.from_url(None, testnet)\n reply = blockchainstate.bitcoind.sendrawtransaction(txdata)\n except Exception as e:\n reply = (\"Error: \" + str(e))\n return reply", "metadata": "root.PublishTx.POST", "header": "['class', 'PublishTx', '(', 'ErrorThrowingRequestProcessor', ')', ':', '___EOS___']", "index": 56 }, { "content": "class TxBlockhash(ErrorThrowingRequestProcessor):", "metadata": "root.TxBlockhash", "header": "['module', '___EOS___']", "index": 67 }, { "content": " def POST(self):\n # data is sent in as json\n data = json.loads(web.data())\n self.require(data, 'txhash', \"TX requires txhash\")\n txhash = data.get('txhash')\n print txhash\n blockchainstate = BlockchainState.from_url(None, testnet)\n blockhash, in_mempool = blockchainstate.get_tx_blockhash(txhash)\n return json.dumps([blockhash, in_mempool])", "metadata": "root.TxBlockhash.POST", "header": "['class', 'TxBlockhash', '(', 'ErrorThrowingRequestProcessor', ')', ':', '___EOS___']", "index": 68 }, { "content": "class Prefetch(ErrorThrowingRequestProcessor):", "metadata": "root.Prefetch", "header": "['module', '___EOS___']", "index": 79 }, { "content": " def POST(self):\n blockchainstate = BlockchainState.from_url(None, testnet)\n # data is sent in as json\n data = json.loads(web.data())\n self.require(data, 'txhash', \"Prefetch requires txhash\")\n self.require(data, 'output_set', \"Prefetch requires output_set\")\n self.require(data, 'color_desc', \"Prefetch requires color_desc\")\n txhash = data.get('txhash')\n output_set = data.get('output_set')\n color_desc = data.get('color_desc')\n limit = data.get('limit')\n\n # note the id doesn't actually matter we need to add it so\n # we have a valid color definition\n color_def = ColorDefinition.from_color_desc(9999, color_desc)\n\n # gather all the transactions and return them\n tx_lookup = {}\n\n def process(current_txhash, current_outindex):\n \"\"\"For any tx out, process the colorvalues of the affecting\n inputs first and then scan that tx.\n \"\"\"\n if limit and len(tx_lookup) > limit:\n return\n if tx_lookup.get(current_txhash):\n return\n current_tx = blockchainstate.get_tx(current_txhash)\n if not current_tx:\n return\n tx_lookup[current_txhash] = blockchainstate.get_raw(current_txhash)\n\n # note a genesis tx will simply have 0 affecting inputs\n inputs = set()\n inputs = inputs.union(\n color_def.get_affecting_inputs(current_tx,\n [current_outindex]))\n for i in inputs:\n process(i.prevout.hash, i.prevout.n)\n\n for oi in output_set:\n process(txhash, oi)\n return tx_lookup", "metadata": "root.Prefetch.POST", "header": "['class', 'Prefetch', '(', 'ErrorThrowingRequestProcessor', ')', ':', '___EOS___']", "index": 80 }, { "content": "class BlockCount(ErrorThrowingRequestProcessor):", "metadata": "root.BlockCount", "header": "['module', '___EOS___']", "index": 125 }, { "content": " def GET(self):\n blockchainstate = BlockchainState.from_url(None, testnet)\n return str(blockchainstate.get_block_count())", "metadata": "root.BlockCount.GET", "header": "['class', 'BlockCount', '(', 'ErrorThrowingRequestProcessor', ')', ':', '___EOS___']", "index": 126 }, { "content": "class DecimalEncoder(json.JSONEncoder):", "metadata": "root.DecimalEncoder", "header": "['module', '___EOS___']", "index": 131 }, { "content": " def default(self, o):\n import decimal\n if isinstance(o, decimal.Decimal):\n return str(o)\n return super(DecimalEncoder, self).default(o)", "metadata": "root.DecimalEncoder.default", "header": "['class', 'DecimalEncoder', '(', 'json', '.', 'JSONEncoder', ')', ':', '___EOS___']", "index": 132 }, { "content": "class Header(ErrorThrowingRequestProcessor):", "metadata": "root.Header", "header": "['module', '___EOS___']", "index": 139 }, { "content": " def POST(self):\n blockchainstate = BlockchainState.from_url(None, testnet)\n data = json.loads(web.data())\n block_hash = data.get('block_hash')\n if not block_hash:\n self.require(data, 'height', \"block_hash or height required\")\n height = data.get('height')\n block_hash = blockchainstate.get_block_hash(height)\n block = blockchainstate.get_block(block_hash)\n return json.dumps({\n 'block_height': block['height'],\n 'version': block['version'],\n 'prev_block_hash': block['previousblockhash'],\n 'merkle_root': block['merkleroot'],\n 'timestamp': block['time'],\n 'bits': int(block['bits'], 16),\n 'nonce': block['nonce'],\n }, cls=DecimalEncoder)", "metadata": "root.Header.POST", "header": "['class', 'Header', '(', 'ErrorThrowingRequestProcessor', ')', ':', '___EOS___']", "index": 140 }, { "content": "class ChunkThread(threading.Thread):\n\n\n\n\n\n\n\n", "metadata": "root.ChunkThread", "header": "['module', '___EOS___']", "index": 160 }, { "content": " def __init__(self, *args, **kwargs):\n threading.Thread.__init__(self, *args, **kwargs)\n self.running = False\n self.lock = threading.Lock()\n self.headers = ''", "metadata": "root.ChunkThread.__init__", "header": "['class', 'ChunkThread', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 161 }, { "content": " def is_running(self):\n with self.lock:\n return self.running", "metadata": "root.ChunkThread.is_running", "header": "['class', 'ChunkThread', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 167 }, { "content": " def stop(self):\n with self.lock:\n self.running = False", "metadata": "root.ChunkThread.stop", "header": "['class', 'ChunkThread', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 171 }, { "content": " def run(self):\n self.headers = open(HEADERS_FILE, 'ab+').read()\n\n with self.lock:\n self.running = True\n\n run_time = time.time()\n while self.is_running():\n if run_time > time.time():\n time.sleep(0.05)\n continue\n run_time = time.time() + 1\n \n try:\n blockchainstate = BlockchainState.from_url(None, testnet)\n height = blockchainstate.get_block_count()\n if height == self.height:\n continue\n if height < self.height:\n self.headers = self.headers[:height*80]\n while height > self.height:\n if not self.is_running():\n break\n block_height = self.height + 1\n blockhash = blockchainstate.get_block_hash(block_height)\n block = blockchainstate.get_block(blockhash)\n\n if block_height == 0:\n self.headers = self._header_to_string(block)\n else:\n prev_hash = self._hash_header(self.headers[-80:])\n if prev_hash == block['previousblockhash']:\n self.headers += self._header_to_string(block)\n else:\n self.headers = self.headers[:-80]\n open(HEADERS_FILE, 'wb').write(self.headers)\n except httplib.BadStatusLine:\n pass # bad connection, try again later\n except SocketError:\n pass # bad connection, try again later\n except JSONRPCException as e:\n if e.error[\"code\"] != -28:\n raise # Not error we are looking for\n pass # Loading block index... , try again later", "metadata": "root.ChunkThread.run", "header": "['class', 'ChunkThread', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 175 }, { "content": " @property\n def height(self):\n return len(self.headers)/80 - 1", "metadata": "root.ChunkThread.height", "header": "['class', 'ChunkThread', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 220 }, { "content": " def _rev_hex(self, s):\n return s.decode('hex')[::-1].encode('hex')", "metadata": "root.ChunkThread._rev_hex", "header": "['class', 'ChunkThread', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 224 }, { "content": " def _int_to_hex(self, i, length=1):\n s = hex(i)[2:].rstrip('L')\n s = \"0\"*(2*length - len(s)) + s\n return self._rev_hex(s)", "metadata": "root.ChunkThread._int_to_hex", "header": "['class', 'ChunkThread', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 227 }, { "content": " def _header_to_string(self, h):\n s = self._int_to_hex(h.get('version'),4) \\\n + self._rev_hex(h.get('previousblockhash', \"0\"*64)) \\\n + self._rev_hex(h.get('merkleroot')) \\\n + self._int_to_hex(h.get('time'),4) \\\n + self._rev_hex(h.get('bits')) \\\n + self._int_to_hex(h.get('nonce'),4)\n return s.decode('hex')", "metadata": "root.ChunkThread._header_to_string", "header": "['class', 'ChunkThread', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 232 }, { "content": " def _hash_header(self, raw_header):\n return hashlib.sha256(hashlib.sha256(raw_header).digest()).digest()[::-1].encode('hex_codec')", "metadata": "root.ChunkThread._hash_header", "header": "['class', 'ChunkThread', '(', 'threading', '.', 'Thread', ')', ':', '___EOS___']", "index": 241 }, { "content": "class Chunk(ErrorThrowingRequestProcessor):", "metadata": "root.Chunk", "header": "['module', '___EOS___']", "index": 247 }, { "content": " def POST(self):\n data = json.loads(web.data())\n self.require(data, 'index', \"Chunk requires index\")\n index = data.get('index')\n with open(HEADERS_FILE, 'rb') as headers:\n headers.seek(index*2016*80)\n return headers.read(2016*80)", "metadata": "root.Chunk.POST", "header": "['class', 'Chunk', '(', 'ErrorThrowingRequestProcessor', ')', ':', '___EOS___']", "index": 248 }, { "content": "class Merkle(ErrorThrowingRequestProcessor):", "metadata": "root.Merkle", "header": "['module', '___EOS___']", "index": 257 }, { "content": " def POST(self):\n data = json.loads(web.data())\n self.require(data, 'txhash', \"Merkle requires txhash\")\n self.require(data, 'blockhash', \"Merkle requires blockhash\")\n txhash = data.get('txhash')\n blockhash = data.get('blockhash')\n\n hash_decode = lambda x: x.decode('hex')[::-1]\n hash_encode = lambda x: x[::-1].encode('hex')\n Hash = lambda x: hashlib.sha256(hashlib.sha256(x).digest()).digest()\n\n blockchainstate = BlockchainState.from_url(None, testnet)\n b = blockchainstate.get_block(blockhash)\n tx_list = b.get('tx')\n tx_pos = tx_list.index(txhash)\n\n merkle = map(hash_decode, tx_list)\n target_hash = hash_decode(txhash)\n s = []\n while len(merkle) != 1:\n if len(merkle) % 2:\n merkle.append(merkle[-1])\n n = []\n while merkle:\n new_hash = Hash(merkle[0] + merkle[1])\n if merkle[0] == target_hash:\n s.append(hash_encode(merkle[1]))\n target_hash = new_hash\n elif merkle[1] == target_hash:\n s.append(hash_encode(merkle[0]))\n target_hash = new_hash\n n.append(new_hash)\n merkle = merkle[2:]\n merkle = n\n\n return json.dumps({\"block_height\": b.get('height'), \"merkle\": s, \"pos\": tx_pos})", "metadata": "root.Merkle.POST", "header": "['class', 'Merkle', '(', 'ErrorThrowingRequestProcessor', ')', ':', '___EOS___']", "index": 258 }, { "content": " def sigint_handler(signum, frame):\n print ('exit chunk thread')\n chunkThread.stop()\n print ('done')\n sys.exit(1)", "metadata": "root.sigint_handler", "header": "['module', '___EOS___']", "index": 298 } ]
[ { "span": "import os, sys", "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_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "os_", ",_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "hashlib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "httplib_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "threading_", ",_", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "socket_", "import_", "error_", "as_", "Sock", "et", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "bitcoin", "_", "._", "rpc_", "import_", "JSONR", "PC", "Exception_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "web_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "colore", "dco", "inli", "b_", "import_", "Block", "chain", "State_", ",_", "Color", "Definition_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "urls_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "tx", "'_", ",_", "'", "Tx", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "publi", "sh", "\\u", "tx", "'_", ",_", "'", "Publish", "Tx", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "tx", "\\u", "block", "hash", "'_", ",_", "'", "Tx", "Block", "hash", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "prefetch", "'_", ",_", "'", "Prefe", "tch", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "block", "count", "'_", ",_", "'", "Block", "Count", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "header", "'_", ",_", "'", "Head", "er", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "chunk", "'_", ",_", "'", "Chunk", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'/", "merk", "le", "'_", ",_", "'", "Mer", "kle", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "testn", "et_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "len_", "(_", "sys_", "._", "argv_", ")_", ">_", "2_", ")_", "and_", "(_", "sys_", "._", "argv_", "[_", "2_", "]_", "==_", "'", "testn", "et", "'_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "testn", "et_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "HEAD", "ERS", "\\u", "FILE_", "=_", "'", "header", "s", ".", "testn", "et", "'_", "if_", "testn", "et_", "else_", "'", "header", "s", ".", "main", "net", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "(_", "len_", "(_", "sys_", "._", "argv_", ")_", ">_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "HEAD", "ERS", "\\u", "FILE_", "=_", "sys_", "._", "argv_", "[_", "3_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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_", "chunk", "Thread_", "=_", "Chunk", "Thread_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "\\u\\u", "name\\u\\u_", "==_", "\"\\u\\u", "main", "\\u\\u\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "signal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "signal_", "._", "signal_", "(_", "signal_", "._", "SIGINT_", ",_", "sig", "int\\u", "handler_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "chunk", "Thread_", "._", "start_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app_", "=_", "web_", "._", "application_", "(_", "urls_", ",_", "globals_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "run_", "(_", ")_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Error", "Throw", "ing", "Request", "Processor_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Error", "Throw", "ing", "Request", "Processor_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "require_", "(_", "self_", ",_", "data_", ",_", "key_", ",_", "message_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "data_", "._", "get_", "(_", "key_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "web_", "._", "HTTP", "Error_", "(_", "\"", "400", " ", "Ba", "d", " ", "request", "!\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "{_", "\"", "content", "-", "type", "\"_", ":_", "\"", "text", "/", "plain", "\"_", "}_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "message_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Tx_", "(_", "Error", "Throw", "ing", "Request", "Processor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tx_", "(_", "Error", "Throw", "ing", "Request", "Processor_", ")_", ":_", "\\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_", "#", " ", "data", " ", "is", " ", "sent", " ", "in", " ", "as", " ", "json_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "json_", "._", "loads_", "(_", "web_", "._", "data_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "require_", "(_", "data_", ",_", "'", "tx", "hash", "'_", ",_", "\"", "TX", " ", "require", "s", " ", "tx", "hash", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "hash_", "=_", "data_", "._", "get_", "(_", "'", "tx", "hash", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "tx", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blockchain", "state_", "=_", "Block", "chain", "State_", "._", "from", "\\u", "url_", "(_", "None_", ",_", "testn", "et_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "blockchain", "state_", "._", "get", "\\u", "raw_", "(_", "tx", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Publish", "Tx_", "(_", "Error", "Throw", "ing", "Request", "Processor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Publish", "Tx_", "(_", "Error", "Throw", "ing", "Request", "Processor_", ")_", ":_", "\\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 ", " _", "tx", "data_", "=_", "web_", "._", "data_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reply_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "blockchain", "state_", "=_", "Block", "chain", "State_", "._", "from", "\\u", "url_", "(_", "None_", ",_", "testn", "et_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "reply_", "=_", "blockchain", "state_", "._", "bitcoin", "d_", "._", "send", "rawt", "ransact", "ion_", "(_", "tx", "data_", ")_", "\\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 ", " _", "reply_", "=_", "(_", "\"", "Error", ":", " ", "\"_", "+_", "str_", "(_", "e_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "reply_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Tx", "Block", "hash_", "(_", "Error", "Throw", "ing", "Request", "Processor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Tx", "Block", "hash_", "(_", "Error", "Throw", "ing", "Request", "Processor_", ")_", ":_", "\\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_", "#", " ", "data", " ", "is", " ", "sent", " ", "in", " ", "as", " ", "json_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "data_", "=_", "json_", "._", "loads_", "(_", "web_", "._", "data_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "require_", "(_", "data_", ",_", "'", "tx", "hash", "'_", ",_", "\"", "TX", " ", "require", "s", " ", "tx", "hash", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "hash_", "=_", "data_", "._", "get_", "(_", "'", "tx", "hash", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "tx", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "blockchain", "state_", "=_", "Block", "chain", "State_", "._", "from", "\\u", "url_", "(_", "None_", ",_", "testn", "et_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block", "hash_", ",_", "in", "\\u", "memp", "ool_", "=_", "blockchain", "state_", "._", "get", "\\u", "tx", "\\u", "block", "hash_", "(_", "tx", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json_", "._", "dumps_", "(_", "[_", "block", "hash_", ",_", "in", "\\u", "memp", "ool_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Prefe", "tch_", "(_", "Error", "Throw", "ing", "Request", "Processor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Prefe", "tch_", "(_", "Error", "Throw", "ing", "Request", "Processor_", ")_", ":_", "\\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 ", " _", "blockchain", "state_", "=_", "Block", "chain", "State_", "._", "from", "\\u", "url_", "(_", "None_", ",_", "testn", "et_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "data", " ", "is", " ", "sent", " ", "in", " ", "as", " ", "json_", "\\u\\u\\uNL\\u\\u\\u_", "data_", "=_", "json_", "._", "loads_", "(_", "web_", "._", "data_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "require_", "(_", "data_", ",_", "'", "tx", "hash", "'_", ",_", "\"", "Prefe", "tch", " ", "require", "s", " ", "tx", "hash", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "require_", "(_", "data_", ",_", "'", "output", "\\u", "set", "'_", ",_", "\"", "Prefe", "tch", " ", "require", "s", " ", "output", "\\u", "set", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "require_", "(_", "data_", ",_", "'", "color", "\\u", "desc", "'_", ",_", "\"", "Prefe", "tch", " ", "require", "s", " ", "color", "\\u", "desc", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "hash_", "=_", "data_", "._", "get_", "(_", "'", "tx", "hash", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "output", "\\u", "set_", "=_", "data_", "._", "get_", "(_", "'", "output", "\\u", "set", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "color", "\\u", "desc_", "=_", "data_", "._", "get_", "(_", "'", "color", "\\u", "desc", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "limit_", "=_", "data_", "._", "get_", "(_", "'", "limit", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "note", " ", "the", " ", "id", " ", "doe", "sn", "'", "t", " ", "actual", "ly", " ", "matte", "r", " ", "we", " ", "need", " ", "to", " ", "add", " ", "it", " ", "so_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", "we", " ", "have", " ", "a", " ", "valid", " ", "color", " ", "definition_", "\\u\\u\\uNL\\u\\u\\u_", "color", "\\u", "def_", "=_", "Color", "Definition_", "._", "from", "\\u", "color", "\\u", "desc_", "(_", "9999_", ",_", "color", "\\u", "desc_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "gather", " ", "all", " ", "the", " ", "transaction", "s", " ", "and", " ", "return", " ", "them", "_", "\\u\\u\\uNL\\u\\u\\u_", "tx", "\\u", "lookup_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "process_", "(_", "current", "\\u", "tx", "hash_", ",_", "current", "\\u", "outin", "dex_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "For", " ", "any", " ", "tx", " ", "out", ",", " ", "process", " ", "the", " ", "color", "values", " ", "of", " ", "the", " ", "affect", "ing", "\\", "10", ";", " ", " ", " ", " ", "inputs", " ", "first", " ", "and", " ", "then", " ", "scan", " ", "tha", "t", " ", "tx", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "limit_", "and_", "len_", "(_", "tx", "\\u", "lookup_", ")_", ">_", "limit_", ":_", "\\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_", "tx", "\\u", "lookup_", "._", "get_", "(_", "current", "\\u", "tx", "hash_", ")_", ":_", "\\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_", "current", "\\u", "tx_", "=_", "blockchain", "state_", "._", "get", "\\u", "tx_", "(_", "current", "\\u", "tx", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "current", "\\u", "tx_", ":_", "\\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_", "tx", "\\u", "lookup_", "[_", "current", "\\u", "tx", "hash_", "]_", "=_", "blockchain", "state_", "._", "get", "\\u", "raw_", "(_", "current", "\\u", "tx", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "note", " ", "a", " ", "genesi", "s", " ", "tx", " ", "will", " ", "simp", "ly", " ", "have", " ", "0", " ", "affect", "ing", " ", "inputs_", "\\u\\u\\uNL\\u\\u\\u_", "inputs_", "=_", "set_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "inputs_", "=_", "inputs_", "._", "union_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "color", "\\u", "def_", "._", "get", "\\u", "affect", "ing", "\\u", "inputs_", "(_", "current", "\\u", "tx_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "current", "\\u", "outin", "dex_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "i_", "in_", "inputs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "process_", "(_", "i_", "._", "prev", "out_", "._", "hash_", ",_", "i_", "._", "prev", "out_", "._", "n_", ")_", "\\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_", "oi_", "in_", "output", "\\u", "set_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "process_", "(_", "tx", "hash_", ",_", "oi_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "tx", "\\u", "lookup_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Block", "Count_", "(_", "Error", "Throw", "ing", "Request", "Processor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Block", "Count_", "(_", "Error", "Throw", "ing", "Request", "Processor_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "GET_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "blockchain", "state_", "=_", "Block", "chain", "State_", "._", "from", "\\u", "url_", "(_", "None_", ",_", "testn", "et_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "str_", "(_", "blockchain", "state_", "._", "get", "\\u", "block", "\\u", "count_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Deci", "mal", "Encoder_", "(_", "json_", "._", "JSO", "NE", "ncode", "r_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Deci", "mal", "Encoder_", "(_", "json_", "._", "JSO", "NE", "ncode", "r_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "default_", "(_", "self_", ",_", "o_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "import_", "decimal_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "o_", ",_", "decimal_", "._", "Decimal_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "str_", "(_", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Deci", "mal", "Encoder_", ",_", "self_", ")_", "._", "default_", "(_", "o_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Header_", "(_", "Error", "Throw", "ing", "Request", "Processor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Header_", "(_", "Error", "Throw", "ing", "Request", "Processor_", ")_", ":_", "\\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 ", " _", "blockchain", "state_", "=_", "Block", "chain", "State_", "._", "from", "\\u", "url_", "(_", "None_", ",_", "testn", "et_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "data_", "=_", "json_", "._", "loads_", "(_", "web_", "._", "data_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block", "\\u", "hash_", "=_", "data_", "._", "get_", "(_", "'", "block", "\\u", "hash", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "block", "\\u", "hash_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "require_", "(_", "data_", ",_", "'", "height", "'_", ",_", "\"", "block", "\\u", "hash", " ", "or", " ", "height", " ", "require", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "data_", "._", "get_", "(_", "'", "height", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block", "\\u", "hash_", "=_", "blockchain", "state_", "._", "get", "\\u", "block", "\\u", "hash_", "(_", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "block_", "=_", "blockchain", "state_", "._", "get", "\\u", "block_", "(_", "block", "\\u", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "json_", "._", "dumps_", "(_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "block", "\\u", "height", "'_", ":_", "block_", "[_", "'", "height", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "version", "'_", ":_", "block_", "[_", "'", "version", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "prev", "\\u", "block", "\\u", "hash", "'_", ":_", "block_", "[_", "'", "previ", "ous", "block", "hash", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "merk", "le", "\\u", "root", "'_", ":_", "block_", "[_", "'", "merk", "ler", "oot", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "timestamp", "'_", ":_", "block_", "[_", "'", "time", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "bits", "'_", ":_", "int_", "(_", "block_", "[_", "'", "bits", "'_", "]_", ",_", "16_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "nonc", "e", "'_", ":_", "block_", "[_", "'", "nonc", "e", "'_", "]_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", ",_", "cls_", "=_", "Deci", "mal", "Encoder_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Chunk", "Thread_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\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_", "[SEP]_", "class_", "Chunk", "Thread_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\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_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "threading_", "._", "Thread_", "._", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "running_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "lock_", "=_", "threading_", "._", "Lock_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "headers_", "=_", "''_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Chunk", "Thread_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "is", "\\u", "running_", "(_", "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_", "._", "running_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Chunk", "Thread_", "(_", "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_", "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 ", " _", "self_", "._", "running_", "=_", "False_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Chunk", "Thread_", "(_", "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_", "run_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "headers_", "=_", "open_", "(_", "HEAD", "ERS", "\\u", "FILE_", ",_", "'", "ab", "+'_", ")_", "._", "read_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "with_", "self_", "._", "lock_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "running_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "run", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "self_", "._", "is", "\\u", "running_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "run", "\\u", "time_", ">_", "time_", "._", "time_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time_", "._", "sleep_", "(_", "0.05_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "continue_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "run", "\\u", "time_", "=_", "time_", "._", "time_", "(_", ")_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "blockchain", "state_", "=_", "Block", "chain", "State_", "._", "from", "\\u", "url_", "(_", "None_", ",_", "testn", "et_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "height_", "=_", "blockchain", "state_", "._", "get", "\\u", "block", "\\u", "count_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "height_", "==_", "self_", "._", "height_", ":_", "\\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_", "height_", "<_", "self_", "._", "height_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "self_", "._", "headers_", "=_", "self_", "._", "headers_", "[_", ":_", "height_", "*_", "80_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "while_", "height_", ">_", "self_", "._", "height_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "if_", "not_", "self_", "._", "is", "\\u", "running_", "(_", ")_", ":_", "\\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_", "block", "\\u", "height_", "=_", "self_", "._", "height_", "+_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block", "hash_", "=_", "blockchain", "state_", "._", "get", "\\u", "block", "\\u", "hash_", "(_", "block", "\\u", "height_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block_", "=_", "blockchain", "state_", "._", "get", "\\u", "block_", "(_", "block", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "block", "\\u", "height_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "headers_", "=_", "self_", "._", "\\u", "header", "\\u", "to", "\\u", "string_", "(_", "block_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "prev", "\\u", "hash_", "=_", "self_", "._", "\\u", "hash", "\\u", "header_", "(_", "self_", "._", "headers_", "[_", "-_", "80_", ":_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prev", "\\u", "hash_", "==_", "block_", "[_", "'", "previ", "ous", "block", "hash", "'_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", " _", "self_", "._", "headers_", "+=_", "self_", "._", "\\u", "header", "\\u", "to", "\\u", "string_", "(_", "block_", ")_", "\\u\\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_", "._", "headers_", "=_", "self_", "._", "headers_", "[_", ":_", "-_", "80_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "open_", "(_", "HEAD", "ERS", "\\u", "FILE_", ",_", "'", "wb", "'_", ")_", "._", "write_", "(_", "self_", "._", "headers_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "httplib_", "._", "Ba", "d", "Status", "Line_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "bad", " ", "connecti", "on", ",", " ", "try", " ", "again", " ", "later_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Sock", "et", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "#", " ", "bad", " ", "connecti", "on", ",", " ", "try", " ", "again", " ", "later_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "JSONR", "PC", "Exception_", "as_", "e_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "e_", "._", "error_", "[_", "\"", "code", "\"_", "]_", "!=_", "-_", "28_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "#", " ", "Not", " ", "error", " ", "we", " ", "are", " ", "look", "ing", " ", "for_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "pass_", "#", " ", "Load", "ing", " ", "block", " ", "index", "...", " ", ",", " ", "try", " ", "again", " ", "later_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Chunk", "Thread_", "(_", "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_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "height_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "len_", "(_", "self_", "._", "headers_", ")_", "/_", "80_", "-_", "1_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Chunk", "Thread_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "rev", "\\u", "hex_", "(_", "self_", ",_", "s_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "s_", "._", "decode_", "(_", "'", "hex", "'_", ")_", "[_", ":_", ":_", "-_", "1_", "]_", "._", "encode_", "(_", "'", "hex", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Chunk", "Thread_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "int\\u", "to", "\\u", "hex_", "(_", "self_", ",_", "i_", ",_", "length_", "=_", "1_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "hex_", "(_", "i_", ")_", "[_", "2_", ":_", "]_", "._", "rstrip_", "(_", "'", "L", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "\"", "0", "\"_", "*_", "(_", "2_", "*_", "length_", "-_", "len_", "(_", "s_", ")_", ")_", "+_", "s_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "self_", "._", "\\u", "rev", "\\u", "hex_", "(_", "s_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Chunk", "Thread_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "header", "\\u", "to", "\\u", "string_", "(_", "self_", ",_", "h_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "self_", "._", "\\u", "int\\u", "to", "\\u", "hex_", "(_", "h_", "._", "get_", "(_", "'", "version", "'_", ")_", ",_", "4_", ")_", "+_", "self_", "._", "\\u", "rev", "\\u", "hex_", "(_", "h_", "._", "get_", "(_", "'", "previ", "ous", "block", "hash", "'_", ",_", "\"", "0", "\"_", "*_", "64_", ")_", ")_", "+_", "self_", "._", "\\u", "rev", "\\u", "hex_", "(_", "h_", "._", "get_", "(_", "'", "merk", "ler", "oot", "'_", ")_", ")_", "+_", "self_", "._", "\\u", "int\\u", "to", "\\u", "hex_", "(_", "h_", "._", "get_", "(_", "'", "time", "'_", ")_", ",_", "4_", ")_", "+_", "self_", "._", "\\u", "rev", "\\u", "hex_", "(_", "h_", "._", "get_", "(_", "'", "bits", "'_", ")_", ")_", "+_", "self_", "._", "\\u", "int\\u", "to", "\\u", "hex_", "(_", "h_", "._", "get_", "(_", "'", "nonc", "e", "'_", ")_", ",_", "4_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "s_", "._", "decode_", "(_", "'", "hex", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Chunk", "Thread_", "(_", "threading_", "._", "Thread_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "hash", "\\u", "header_", "(_", "self_", ",_", "raw", "\\u", "header_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "hashlib_", "._", "sha256_", "(_", "hashlib_", "._", "sha256_", "(_", "raw", "\\u", "header_", ")_", "._", "digest_", "(_", ")_", ")_", "._", "digest_", "(_", ")_", "[_", ":_", ":_", "-_", "1_", "]_", "._", "encode_", "(_", "'", "hex", "\\u", "codec", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Chunk_", "(_", "Error", "Throw", "ing", "Request", "Processor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Chunk_", "(_", "Error", "Throw", "ing", "Request", "Processor_", ")_", ":_", "\\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 ", " _", "data_", "=_", "json_", "._", "loads_", "(_", "web_", "._", "data_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "require_", "(_", "data_", ",_", "'", "index", "'_", ",_", "\"", "Chunk", " ", "require", "s", " ", "index", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "index_", "=_", "data_", "._", "get_", "(_", "'", "index", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "with_", "open_", "(_", "HEAD", "ERS", "\\u", "FILE_", ",_", "'", "rb", "'_", ")_", "as_", "headers_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "headers_", "._", "seek_", "(_", "index_", "*_", "2016_", "*_", "80_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "headers_", "._", "read_", "(_", "2016_", "*_", "80_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Mer", "kle", "_", "(_", "Error", "Throw", "ing", "Request", "Processor_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Mer", "kle", "_", "(_", "Error", "Throw", "ing", "Request", "Processor_", ")_", ":_", "\\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 ", " _", "data_", "=_", "json_", "._", "loads_", "(_", "web_", "._", "data_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "require_", "(_", "data_", ",_", "'", "tx", "hash", "'_", ",_", "\"", "Mer", "kle", " ", "require", "s", " ", "tx", "hash", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "require_", "(_", "data_", ",_", "'", "block", "hash", "'_", ",_", "\"", "Mer", "kle", " ", "require", "s", " ", "block", "hash", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "hash_", "=_", "data_", "._", "get_", "(_", "'", "tx", "hash", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "block", "hash_", "=_", "data_", "._", "get_", "(_", "'", "block", "hash", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "hash", "\\u", "decode_", "=_", "lambda_", "x_", ":_", "x_", "._", "decode_", "(_", "'", "hex", "'_", ")_", "[_", ":_", ":_", "-_", "1_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hash", "\\u", "encode_", "=_", "lambda_", "x_", ":_", "x_", "[_", ":_", ":_", "-_", "1_", "]_", "._", "encode_", "(_", "'", "hex", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "Hash_", "=_", "lambda_", "x_", ":_", "hashlib_", "._", "sha256_", "(_", "hashlib_", "._", "sha256_", "(_", "x_", ")_", "._", "digest_", "(_", ")_", ")_", "._", "digest_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "blockchain", "state_", "=_", "Block", "chain", "State_", "._", "from", "\\u", "url_", "(_", "None_", ",_", "testn", "et_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "b_", "=_", "blockchain", "state_", "._", "get", "\\u", "block_", "(_", "block", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "\\u", "list_", "=_", "b_", "._", "get_", "(_", "'", "tx", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "tx", "\\u", "pos_", "=_", "tx", "\\u", "list_", "._", "index_", "(_", "tx", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "merk", "le_", "=_", "map_", "(_", "hash", "\\u", "decode_", ",_", "tx", "\\u", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "hash_", "=_", "hash", "\\u", "decode_", "(_", "tx", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "s_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "len_", "(_", "merk", "le_", ")_", "!=_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "merk", "le_", ")_", "%_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "merk", "le_", "._", "append_", "(_", "merk", "le_", "[_", "-_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "n_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "while_", "merk", "le_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "new", "\\u", "hash_", "=_", "Hash_", "(_", "merk", "le_", "[_", "0_", "]_", "+_", "merk", "le_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "merk", "le_", "[_", "0_", "]_", "==_", "target", "\\u", "hash_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "s_", "._", "append_", "(_", "hash", "\\u", "encode_", "(_", "merk", "le_", "[_", "1_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "hash_", "=_", "new", "\\u", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "merk", "le_", "[_", "1_", "]_", "==_", "target", "\\u", "hash_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "s_", "._", "append_", "(_", "hash", "\\u", "encode_", "(_", "merk", "le_", "[_", "0_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "target", "\\u", "hash_", "=_", "new", "\\u", "hash_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "n_", "._", "append_", "(_", "new", "\\u", "hash_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "merk", "le_", "=_", "merk", "le_", "[_", "2_", ":_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "merk", "le_", "=_", "n_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "json_", "._", "dumps_", "(_", "{_", "\"", "block", "\\u", "height", "\"_", ":_", "b_", "._", "get_", "(_", "'", "height", "'_", ")_", ",_", "\"", "merk", "le", "\"_", ":_", "s_", ",_", "\"", "pos", "\"_", ":_", "tx", "\\u", "pos_", "}_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "sig", "int\\u", "handler_", "(_", "signum_", ",_", "frame_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "(_", "'", "exit", " ", "chunk", " ", "thread", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "chunk", "Thread_", "._", "stop_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "(_", "'", "don", "e", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sys_", "._", "exit_", "(_", "1_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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'
kuri65536/python-for-android/python-modules/twisted/twisted/spread/flavors.py
[ { "content": " def __del__(self):\n \"\"\"Do distributed reference counting on finalize.\n \"\"\"\n try:\n # log.msg( ' --- decache: %s %s' % (self, self.luid) )\n if self.broker:\n self.broker.decCacheRef(self.luid)\n except:\n log.deferr()", "metadata": "root.RemoteCache.__del__", "header": "['class', 'RemoteCache', '(', 'RemoteCopy', ',', 'Serializable', ')', ':', '___EOS___']", "index": 480 } ]
[ { "span": "except:", "start_line": 487, "start_column": 8, "end_line": 487, "end_column": 15 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "class_", "Remo", "te", "Cache_", "(_", "Remo", "te", "Copy_", ",_", "Serializa", "ble_", ")_", ":_", "\\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 ", " _", "\"\"\"", "Do", " ", "distributed", " ", "reference", " ", "counti", "ng", " ", "on", " ", "finalize", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "log", ".", "msg", "(", " ", "'", " ", "---", " ", "deca", "che", ":", " ", "%", "s", " ", "%", "s", "'", " ", "%", " ", "(", "self", ",", " ", "self", ".", "lui", "d", ")", " ", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "broker_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "broker_", "._", "dec", "Cache", "Ref_", "(_", "self_", "._", "lui", "d_", ")_", "\\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 ", " _", "log_", "._", "defer", "r_", "(_", ")_", "\\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, 0, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused local variable
amccloud/django-stripe/example/profiles/receivers.py
[ { "content": "@receiver(post_save, sender=User, \\\n dispatch_uid='profiles.receivers.create_user_profile')\ndef create_user_profile(sender, instance, created, **kwargs):\n if created:\n profile, new = UserProfile.objects.get_or_create(user=instance)", "metadata": "root.create_user_profile", "header": "['module', '___EOS___']", "index": 14 } ]
[ { "span": "profile,", "start_line": 18, "start_column": 8, "end_line": 18, "end_column": 15 }, { "span": "new ", "start_line": 18, "start_column": 17, "end_line": 18, "end_column": 20 } ]
[]
1
true
[ "[CLS]_", "Un", "used_", "local_", "variable_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "receiver_", "(_", "post", "\\u", "save_", ",_", "sender_", "=_", "User_", ",_", "dispatch", "\\u", "uid_", "=_", "'", "profile", "s", ".", "receive", "rs", ".", "create", "\\u", "user", "\\u", "profile", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "create", "\\u", "user", "\\u", "profile_", "(_", "sender_", ",_", "instance_", ",_", "created_", ",_", "**_", "kwargs_", ")_", ":_", "\\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 ", " _", "profile_", ",_", "new_", "=_", "User", "Profile_", "._", "objects_", "._", "get", "\\u", "or", "\\u", "create_", "(_", "user_", "=_", "instance_", ")_", "\\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, 0, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
dimagi/commcare-hq/corehq/apps/sms/forms.py
[ { "content": "import re\nimport json\nfrom crispy_forms.bootstrap import StrictButton, InlineField, FormActions\nfrom crispy_forms.helper import FormHelper\nfrom crispy_forms.layout import Div\nfrom django import forms\nfrom django.core.urlresolvers import reverse\nfrom django.forms.forms import Form\nfrom django.forms.fields import *\nfrom crispy_forms import layout as crispy\nfrom crispy_forms import bootstrap as twbscrispy\nfrom django.utils.safestring import mark_safe\nfrom corehq.apps.hqwebapp.crispy import (BootstrapMultiField, HiddenFieldWithErrors, FieldsetAccordionGroup)\nfrom corehq.apps.style.crispy import FieldWithHelpBubble\nfrom corehq.apps.style import crispy as hqcrispy\nfrom corehq.apps.app_manager.dbaccessors import get_built_app_ids\nfrom corehq.apps.app_manager.models import Application\nfrom corehq.apps.sms.models import FORWARD_ALL, FORWARD_BY_KEYWORD, SQLMobileBackend\nfrom django.core.exceptions import ValidationError\nfrom corehq.apps.reminders.forms import RecordListField, validate_time\nfrom django.utils.translation import ugettext as _, ugettext_noop, ugettext_lazy\nfrom corehq.apps.sms.util import (validate_phone_number, strip_plus,\n get_sms_backend_classes)\nfrom corehq.apps.domain.models import DayTimeWindow\nfrom corehq.apps.users.models import CommCareUser\nfrom corehq.apps.groups.models import Group\nfrom corehq.apps.hqwebapp.crispy import ErrorsOnlyField\nfrom dimagi.utils.django.fields import TrimmedCharField\nfrom dimagi.utils.couch.database import iter_docs\nfrom django.conf import settings\n\nFORWARDING_CHOICES = (\n (FORWARD_ALL, ugettext_noop(\"All messages\")),\n (FORWARD_BY_KEYWORD, ugettext_noop(\"All messages starting with a keyword\")),\n)\n\nENABLED = \"ENABLED\"\nDISABLED = \"DISABLED\"\n\nENABLED_DISABLED_CHOICES = (\n (DISABLED, ugettext_noop(\"Disabled\")),\n (ENABLED, ugettext_noop(\"Enabled\")),\n)\n\nDEFAULT = \"DEFAULT\"\nCUSTOM = \"CUSTOM\"\n\nDEFAULT_CUSTOM_CHOICES = (\n (DEFAULT, ugettext_noop(\"Default\")),\n (CUSTOM, ugettext_noop(\"Specify:\")),\n)\n\nMESSAGE_COUNTER_CHOICES = (\n (DEFAULT, ugettext_noop(\"Don't use counter\")),\n (CUSTOM, ugettext_noop(\"Use counter with threshold:\")),\n)\n\nSMS_CONVERSATION_LENGTH_CHOICES = (\n (5, 5),\n (10, 10),\n (15, 15),\n (20, 20),\n (25, 25),\n (30, 30),\n)\n\nSHOW_ALL = \"SHOW_ALL\"\nSHOW_INVALID = \"SHOW_INVALID\"\nHIDE_ALL = \"HIDE_ALL\"\n\nTIME_BEFORE = \"BEFORE\"\nTIME_AFTER = \"AFTER\"\nTIME_BETWEEN = \"BETWEEN\"\n\nWELCOME_RECIPIENT_NONE = 'NONE'\nWELCOME_RECIPIENT_CASE = 'CASE'\nWELCOME_RECIPIENT_MOBILE_WORKER = 'MOBILE_WORKER'\nWELCOME_RECIPIENT_ALL = 'ALL'\n\nWELCOME_RECIPIENT_CHOICES = (\n (WELCOME_RECIPIENT_NONE, ugettext_lazy('Nobody')),\n (WELCOME_RECIPIENT_CASE, ugettext_lazy('Cases only')),\n (WELCOME_RECIPIENT_MOBILE_WORKER, ugettext_lazy('Mobile Workers only')),\n (WELCOME_RECIPIENT_ALL, ugettext_lazy('Cases and Mobile Workers')),\n)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class ForwardingRuleForm(Form):\n forward_type = ChoiceField(choices=FORWARDING_CHOICES)\n keyword = CharField(required=False)\n backend_id = CharField()\n ", "metadata": "root.ForwardingRuleForm", "header": "['module', '___EOS___']", "index": 87 }, { "content": " def clean_keyword(self):\n forward_type = self.cleaned_data.get(\"forward_type\")\n keyword = self.cleaned_data.get(\"keyword\", \"\").strip()\n if forward_type == FORWARD_BY_KEYWORD:\n if keyword == \"\":\n raise ValidationError(_(\"This field is required.\"))\n return keyword\n else:\n return None", "metadata": "root.ForwardingRuleForm.clean_keyword", "header": "['class', 'ForwardingRuleForm', '(', 'Form', ')', ':', '___EOS___']", "index": 92 }, { "content": "class LoadBalancingBackendFormMixin(Form):\n phone_numbers = CharField(required=False)\n", "metadata": "root.LoadBalancingBackendFormMixin", "header": "['module', '___EOS___']", "index": 103 }, { "content": " def clean_phone_numbers(self):\n \"\"\"\n Expects a list of [{\"phone_number\": <phone number>}] as the value.\n \"\"\"\n value = self.cleaned_data.get(\"phone_numbers\")\n result = []\n try:\n value = json.loads(value)\n assert isinstance(value, list)\n for item in value:\n assert isinstance(item, dict)\n assert \"phone_number\" in item\n result.append(item[\"phone_number\"])\n except (AssertionError, ValueError):\n raise ValidationError(_(\"Something went wrong. Please reload the \"\n \"page and try again.\"))\n\n if len(result) == 0:\n raise ValidationError(_(\"You must specify at least one phone\"\n \"number.\"))\n\n for phone_number in result:\n validate_phone_number(phone_number)\n\n return result", "metadata": "root.LoadBalancingBackendFormMixin.clean_phone_numbers", "header": "['class', 'LoadBalancingBackendFormMixin', '(', 'Form', ')', ':', '___EOS___']", "index": 106 }, { "content": "class SettingsForm(Form):\n # General Settings\n use_default_sms_response = ChoiceField(\n required=False,\n label=ugettext_noop(\"Default SMS Response\"),\n choices=ENABLED_DISABLED_CHOICES,\n )\n default_sms_response = TrimmedCharField(\n required=False,\n label=\"\",\n )\n use_restricted_sms_times = ChoiceField(\n required=False,\n label=ugettext_noop(\"Send SMS on...\"),\n choices=(\n (DISABLED, ugettext_noop(\"any day, at any time\")),\n (ENABLED, ugettext_noop(\"only specific days and times\")),\n ),\n )\n restricted_sms_times_json = CharField(\n required=False,\n widget=forms.HiddenInput,\n )\n send_to_duplicated_case_numbers = ChoiceField(\n required=False,\n label=ugettext_noop(\"Send Messages to Non-Unique Phone Numbers\"),\n choices=ENABLED_DISABLED_CHOICES,\n )\n\n # Chat Settings\n use_custom_case_username = ChoiceField(\n required=False,\n choices=DEFAULT_CUSTOM_CHOICES,\n )\n custom_case_username = TrimmedCharField(\n required=False,\n label=ugettext_noop(\"Enter a Case Property\"),\n )\n use_custom_message_count_threshold = ChoiceField(\n required=False,\n choices=MESSAGE_COUNTER_CHOICES,\n )\n custom_message_count_threshold = IntegerField(\n required=False,\n label=ugettext_noop(\"Enter a Number\"),\n )\n use_sms_conversation_times = ChoiceField(\n required=False,\n label=ugettext_noop(\"Delay Automated SMS\"),\n choices=ENABLED_DISABLED_CHOICES,\n )\n sms_conversation_times_json = CharField(\n required=False,\n widget=forms.HiddenInput,\n )\n sms_conversation_length = ChoiceField(\n required=False,\n label=ugettext_noop(\"Conversation Duration\"),\n choices=SMS_CONVERSATION_LENGTH_CHOICES,\n )\n survey_traffic_option = ChoiceField(\n required=False,\n label=ugettext_noop(\"Survey Traffic\"),\n choices=(\n (SHOW_ALL, ugettext_noop(\"Show all survey traffic\")),\n (SHOW_INVALID, ugettext_noop(\"Hide all survey traffic except \"\n \"invalid responses\")),\n (HIDE_ALL, ugettext_noop(\"Hide all survey traffic\")),\n ),\n )\n count_messages_as_read_by_anyone = ChoiceField(\n required=False,\n label=ugettext_noop(\"A Message is Read...\"),\n choices=(\n (ENABLED, ugettext_noop(\"when it is read by anyone\")),\n (DISABLED, ugettext_noop(\"only for the user that reads it\")),\n ),\n )\n use_custom_chat_template = ChoiceField(\n required=False,\n choices=DEFAULT_CUSTOM_CHOICES,\n )\n custom_chat_template = TrimmedCharField(\n required=False,\n label=ugettext_noop(\"Enter Chat Template Identifier\"),\n )\n sms_case_registration_enabled = ChoiceField(\n required=False,\n choices=ENABLED_DISABLED_CHOICES,\n label=ugettext_noop(\"Case Self-Registration\"),\n )\n sms_case_registration_type = TrimmedCharField(\n required=False,\n label=ugettext_noop(\"Default Case Type\"),\n )\n sms_case_registration_owner_id = ChoiceField(\n required=False,\n label=ugettext_noop(\"Default Case Owner\"),\n )\n sms_case_registration_user_id = ChoiceField(\n required=False,\n label=ugettext_noop(\"Registration Submitter\"),\n )\n sms_mobile_worker_registration_enabled = ChoiceField(\n required=False,\n choices=ENABLED_DISABLED_CHOICES,\n label=ugettext_noop(\"SMS Mobile Worker Registration\"),\n )\n registration_welcome_message = ChoiceField(\n choices=WELCOME_RECIPIENT_CHOICES,\n label=ugettext_lazy(\"Send registration welcome message to\"),\n )\n\n\n\n\n\n\n\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.SettingsForm", "header": "['module', '___EOS___']", "index": 133 }, { "content": " @property\n def section_general(self):\n fields = [\n hqcrispy.B3MultiField(\n _(\"Default SMS Response\"),\n crispy.Div(\n InlineField(\n \"use_default_sms_response\",\n data_bind=\"value: use_default_sms_response\",\n ),\n css_class='col-sm-4'\n ),\n crispy.Div(\n InlineField(\n \"default_sms_response\",\n css_class=\"input-xxlarge\",\n placeholder=_(\"Enter Default Response\"),\n data_bind=\"visible: showDefaultSMSResponse\",\n ),\n css_class='col-sm-8'\n ),\n help_bubble_text=_(\"Enable this option to provide a \"\n \"default response when a user's incoming SMS does not \"\n \"answer an open survey or match a known keyword.\"),\n css_id=\"default-sms-response-group\",\n field_class='col-sm-6 col-md-9 col-lg-9'\n ),\n FieldWithHelpBubble(\n \"use_restricted_sms_times\",\n data_bind=\"value: use_restricted_sms_times\",\n help_bubble_text=_(\"Use this option to limit the times \"\n \"that SMS messages can be sent to users. Messages that \"\n \"are sent outside these windows will remained queued \"\n \"and will go out as soon as another window opens up.\"),\n ),\n hqcrispy.B3MultiField(\n \"\",\n HiddenFieldWithErrors(\"restricted_sms_times_json\",\n data_bind=\"value: restricted_sms_times_json\"),\n crispy.Div(\n data_bind=\"template: {\"\n \" name: 'ko-template-restricted-sms-times', \"\n \" data: $data\"\n \"}\",\n ),\n data_bind=\"visible: showRestrictedSMSTimes\",\n field_class='col-md-10 col-lg-10'\n ),\n FieldWithHelpBubble(\n \"send_to_duplicated_case_numbers\",\n help_bubble_text=_(\"Enabling this option will send \"\n \"outgoing-only messages to phone numbers registered \"\n \"with more than one mobile worker or case. SMS surveys \"\n \"and keywords will still only work for unique phone \"\n \"numbers in your project.\"),\n ),\n ]\n return crispy.Fieldset(\n _(\"General Settings\"),\n *fields\n )", "metadata": "root.SettingsForm.section_general", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 246 }, { "content": " @property\n def section_registration(self):\n fields = [\n FieldWithHelpBubble(\n \"sms_case_registration_enabled\",\n help_bubble_text=_(\"When this option is enabled, a person \"\n \"can send an SMS into the system saying 'join \"\n \"[project]', where [project] is your project \"\n \"space name, and the system will automatically \"\n \"create a case tied to that person's phone number.\"),\n data_bind=\"value: sms_case_registration_enabled\",\n ),\n crispy.Div(\n FieldWithHelpBubble(\n \"sms_case_registration_type\",\n placeholder=_(\"Enter a Case Type\"),\n help_bubble_text=_(\"Cases that self-register over SMS \"\n \"will be given this case type.\"),\n ),\n FieldWithHelpBubble(\n \"sms_case_registration_owner_id\",\n help_bubble_text=_(\"Cases that self-register over SMS \"\n \"will be owned by this user or user group.\"),\n ),\n FieldWithHelpBubble(\n \"sms_case_registration_user_id\",\n help_bubble_text=_(\"The form submission for a \"\n \"self-registration will belong to this user.\"),\n ),\n data_bind=\"visible: showRegistrationOptions\",\n ),\n FieldWithHelpBubble(\n \"sms_mobile_worker_registration_enabled\",\n help_bubble_text=_(\"When this option is enabled, a person \"\n \"can send an SMS into the system saying 'join \"\n \"[project] worker [username]' (where [project] is your \"\n \" project space and [username] is an optional username)\"\n \", and the system will add them as a mobile worker.\"),\n ),\n FieldWithHelpBubble(\n 'registration_welcome_message',\n help_bubble_text=_(\"Choose whether to send an automatic \"\n \"welcome message to cases, mobile workers, or both, \"\n \"after they self-register. The welcome message can be \"\n \"configured in the SMS languages and translations page \"\n \"(Messaging -> Languages -> Messaging Translations).\"),\n ),\n ]\n return crispy.Fieldset(\n _(\"Registration Settings\"),\n *fields\n )", "metadata": "root.SettingsForm.section_registration", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 308 }, { "content": " @property\n def section_chat(self):\n fields = [\n hqcrispy.B3MultiField(\n _(\"Case Name Display\"),\n crispy.Div(\n InlineField(\n \"use_custom_case_username\",\n data_bind=\"value: use_custom_case_username\",\n ),\n css_class='col-sm-4'\n ),\n crispy.Div(\n InlineField(\n \"custom_case_username\",\n css_class=\"input-large\",\n data_bind=\"visible: showCustomCaseUsername\",\n ),\n css_class='col-sm-8'\n ),\n help_bubble_text=_(\"By default, when chatting with a case, \"\n \"the chat window will use the case's \\\"name\\\" case \"\n \"property when displaying the case's name. To use a \"\n \"different case property, specify it here.\"),\n css_id=\"custom-case-username-group\",\n field_class='col-sm-6 col-md-9 col-lg-9'\n ),\n hqcrispy.B3MultiField(\n _(\"Message Counter\"),\n crispy.Div(\n InlineField(\n \"use_custom_message_count_threshold\",\n data_bind=\"value: use_custom_message_count_threshold\",\n ),\n css_class='col-sm-4'\n ),\n crispy.Div(\n InlineField(\n \"custom_message_count_threshold\",\n css_class=\"input-large\",\n data_bind=\"visible: showCustomMessageCountThreshold\",\n ),\n css_class='col-sm-8'\n ),\n\n\n help_bubble_text=_(\"The chat window can use a counter to keep \"\n \"track of how many messages are being sent and received \"\n \"and highlight that number after a certain threshold is \"\n \"reached. By default, the counter is disabled. To enable \"\n \"it, enter the desired threshold here.\"),\n css_id=\"custom-message-count-threshold-group\",\n field_class='col-sm-6 col-md-9 col-lg-9'\n ),\n FieldWithHelpBubble(\n \"use_sms_conversation_times\",\n data_bind=\"value: use_sms_conversation_times\",\n help_bubble_text=_(\"When this option is enabled, the system \"\n \"will not send automated SMS to chat recipients when \"\n \"those recipients are in the middle of a conversation.\"),\n ),\n hqcrispy.B3MultiField(\n \"\",\n HiddenFieldWithErrors(\"sms_conversation_times_json\",\n data_bind=\"value: sms_conversation_times_json\"),\n crispy.Div(\n data_bind=\"template: {\"\n \" name: 'ko-template-sms-conversation-times', \"\n \" data: $data\"\n \"}\",\n ),\n data_bind=\"visible: showSMSConversationTimes\",\n label_class='hide',\n field_class='col-md-12 col-lg-10'\n ),\n crispy.Div(\n FieldWithHelpBubble(\n \"sms_conversation_length\",\n help_bubble_text=_(\"The number of minutes to wait \"\n \"after receiving an incoming SMS from a chat \"\n \"recipient before resuming automated SMS to that \"\n \"recipient.\"),\n ),\n data_bind=\"visible: showSMSConversationTimes\",\n ),\n FieldWithHelpBubble(\n \"survey_traffic_option\",\n help_bubble_text=_(\"This option allows you to hide a chat \"\n \"recipient's survey questions and responses from chat \"\n \"windows. There is also the option to show only invalid \"\n \"responses to questions in the chat window, which could \"\n \"be attempts to converse.\"),\n ),\n FieldWithHelpBubble(\n \"count_messages_as_read_by_anyone\",\n help_bubble_text=_(\"The chat window will mark unread \"\n \"messages to the user viewing them. Use this option to \"\n \"control whether a message counts as being read if it \"\n \"is read by anyone, or if it counts as being read only \"\n \"to the user who reads it.\"),\n ),\n ]\n if self._cchq_is_previewer:\n fields.append(\n hqcrispy.B3MultiField(\n _(\"Chat Template\"),\n crispy.Div(\n InlineField(\n \"use_custom_chat_template\",\n data_bind=\"value: use_custom_chat_template\",\n ),\n css_class='col-sm-4'\n ),\n crispy.Div(\n InlineField(\n \"custom_chat_template\",\n data_bind=\"visible: showCustomChatTemplate\",\n ),\n css_class='col-sm-8'\n ),\n help_bubble_text=_(\"To use a custom template to render the \"\n \"chat window, enter it here.\"),\n css_id=\"custom-chat-template-group\",\n field_class='col-sm-6 col-md-9 col-lg-9'\n )\n )\n return crispy.Fieldset(\n _(\"Chat Settings\"),\n *fields\n )", "metadata": "root.SettingsForm.section_chat", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 361 }, { "content": " def __init__(self, data=None, cchq_domain=None, cchq_is_previewer=False,\n *args, **kwargs):\n self._cchq_domain = cchq_domain\n self._cchq_is_previewer = cchq_is_previewer\n super(SettingsForm, self).__init__(data, *args, **kwargs)\n self.populate_dynamic_choices()\n\n self.helper = FormHelper()\n self.helper.form_class = \"form form-horizontal\"\n self.helper.label_class = 'col-sm-2 col-md-2 col-lg-2'\n self.helper.field_class = 'col-sm-2 col-md-3 col-lg-3'\n self.helper.layout = crispy.Layout(\n self.section_general,\n self.section_registration,\n self.section_chat,\n hqcrispy.FormActions(\n twbscrispy.StrictButton(\n _(\"Save\"),\n type=\"submit\",\n css_class=\"btn-primary\",\n ),\n ),\n )\n self.restricted_sms_times_widget_context = {\n \"template_name\": \"ko-template-restricted-sms-times\",\n \"explanation_text\": _(\"SMS will only be sent when any of the following is true:\"),\n \"ko_array_name\": \"restricted_sms_times\",\n \"remove_window_method\": \"$parent.removeRestrictedSMSTime\",\n \"add_window_method\": \"addRestrictedSMSTime\",\n }\n self.sms_conversation_times_widget_context = {\n \"template_name\": \"ko-template-sms-conversation-times\",\n \"explanation_text\": _(\"Automated SMS will be suppressed during \"\n \"chat conversations when any of the following \"\n \"is true:\"),\n \"ko_array_name\": \"sms_conversation_times\",\n \"remove_window_method\": \"$parent.removeSMSConversationTime\",\n \"add_window_method\": \"addSMSConversationTime\",\n }", "metadata": "root.SettingsForm.__init__", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 492 }, { "content": " @property\n def enable_registration_welcome_sms_for_case(self):\n return (self.cleaned_data.get('registration_welcome_message') in\n (WELCOME_RECIPIENT_CASE, WELCOME_RECIPIENT_ALL))", "metadata": "root.SettingsForm.enable_registration_welcome_sms_for_case", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 532 }, { "content": " @property\n def enable_registration_welcome_sms_for_mobile_worker(self):\n return (self.cleaned_data.get('registration_welcome_message') in\n (WELCOME_RECIPIENT_MOBILE_WORKER, WELCOME_RECIPIENT_ALL))", "metadata": "root.SettingsForm.enable_registration_welcome_sms_for_mobile_worker", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 537 }, { "content": " @property\n def current_values(self):\n current_values = {}\n for field_name in self.fields.keys():\n value = self[field_name].value()\n if field_name in [\"restricted_sms_times_json\",\n \"sms_conversation_times_json\"]:\n if isinstance(value, basestring):\n current_values[field_name] = json.loads(value)\n else:\n current_values[field_name] = value\n else:\n current_values[field_name] = value\n return current_values", "metadata": "root.SettingsForm.current_values", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 542 }, { "content": " def populate_dynamic_choices(self):\n groups = Group.get_case_sharing_groups(self._cchq_domain)\n users = CommCareUser.by_domain(self._cchq_domain)\n\n domain_group_choices = [(group._id, group.name) for group in groups]\n domain_user_choices = [(user._id, user.raw_username) for user in users]\n domain_owner_choices = domain_group_choices + domain_user_choices\n\n choose = [(\"\", _(\"(Choose)\"))]\n self.fields[\"sms_case_registration_owner_id\"].choices = (\n choose + domain_owner_choices)\n self.fields[\"sms_case_registration_user_id\"].choices = (\n choose + domain_user_choices)", "metadata": "root.SettingsForm.populate_dynamic_choices", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 557 }, { "content": " def _clean_dependent_field(self, bool_field, field):\n if self.cleaned_data.get(bool_field):\n value = self.cleaned_data.get(field, None)\n if not value:\n raise ValidationError(_(\"This field is required.\"))\n return value\n else:\n return None", "metadata": "root.SettingsForm._clean_dependent_field", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 571 }, { "content": " def clean_use_default_sms_response(self):\n return self.cleaned_data.get(\"use_default_sms_response\") == ENABLED", "metadata": "root.SettingsForm.clean_use_default_sms_response", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 580 }, { "content": " def clean_default_sms_response(self):\n return self._clean_dependent_field(\"use_default_sms_response\",\n \"default_sms_response\")", "metadata": "root.SettingsForm.clean_default_sms_response", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 583 }, { "content": " def clean_use_custom_case_username(self):\n return self.cleaned_data.get(\"use_custom_case_username\") == CUSTOM", "metadata": "root.SettingsForm.clean_use_custom_case_username", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 587 }, { "content": " def clean_custom_case_username(self):\n return self._clean_dependent_field(\"use_custom_case_username\",\n \"custom_case_username\")", "metadata": "root.SettingsForm.clean_custom_case_username", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 590 }, { "content": " def clean_use_custom_message_count_threshold(self):\n return (self.cleaned_data.get(\"use_custom_message_count_threshold\")\n == CUSTOM)", "metadata": "root.SettingsForm.clean_use_custom_message_count_threshold", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 594 }, { "content": " def clean_custom_message_count_threshold(self):\n value = self._clean_dependent_field(\"use_custom_message_count_threshold\",\n \"custom_message_count_threshold\")\n if value is not None and value <= 0:\n raise ValidationError(_(\"Please enter a positive number\"))\n return value", "metadata": "root.SettingsForm.clean_custom_message_count_threshold", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 598 }, { "content": " def clean_use_custom_chat_template(self):\n if not self._cchq_is_previewer:\n return None\n return self.cleaned_data.get(\"use_custom_chat_template\") == CUSTOM", "metadata": "root.SettingsForm.clean_use_custom_chat_template", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 605 }, { "content": " def clean_custom_chat_template(self):\n if not self._cchq_is_previewer:\n return None\n value = self._clean_dependent_field(\"use_custom_chat_template\",\n \"custom_chat_template\")\n if value is not None and value not in settings.CUSTOM_CHAT_TEMPLATES:\n raise ValidationError(_(\"Unknown custom template identifier.\"))\n return value", "metadata": "root.SettingsForm.clean_custom_chat_template", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 610 }, { "content": " def _clean_time_window_json(self, field_name):\n try:\n time_window_json = json.loads(self.cleaned_data.get(field_name))\n except ValueError:\n raise ValidationError(_(\"An error has occurred. Please try again, \"\n \"and if the problem persists, please report an issue.\"))\n result = []\n for window in time_window_json:\n day = window.get(\"day\")\n start_time = window.get(\"start_time\")\n end_time = window.get(\"end_time\")\n time_input_relationship = window.get(\"time_input_relationship\")\n\n try:\n day = int(day)\n assert day >= -1 and day <= 6\n except (ValueError, AssertionError):\n raise ValidationError(_(\"Invalid day chosen.\"))\n\n if time_input_relationship == TIME_BEFORE:\n end_time = validate_time(end_time)\n result.append(DayTimeWindow(\n day=day,\n start_time=None,\n end_time=end_time,\n ))\n elif time_input_relationship == TIME_AFTER:\n start_time = validate_time(start_time)\n result.append(DayTimeWindow(\n day=day,\n start_time=start_time,\n end_time=None,\n ))\n else:\n start_time = validate_time(start_time)\n end_time = validate_time(end_time)\n if start_time >= end_time:\n raise ValidationError(_(\"End time must come after start \"\n \"time.\"))\n result.append(DayTimeWindow(\n day=day,\n start_time=start_time,\n end_time=end_time,\n ))\n return result", "metadata": "root.SettingsForm._clean_time_window_json", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 619 }, { "content": " def clean_use_restricted_sms_times(self):\n return self.cleaned_data.get(\"use_restricted_sms_times\") == ENABLED", "metadata": "root.SettingsForm.clean_use_restricted_sms_times", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 665 }, { "content": " def clean_restricted_sms_times_json(self):\n if self.cleaned_data.get(\"use_restricted_sms_times\"):\n return self._clean_time_window_json(\"restricted_sms_times_json\")\n else:\n return []", "metadata": "root.SettingsForm.clean_restricted_sms_times_json", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 668 }, { "content": " def clean_use_sms_conversation_times(self):\n return self.cleaned_data.get(\"use_sms_conversation_times\") == ENABLED", "metadata": "root.SettingsForm.clean_use_sms_conversation_times", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 674 }, { "content": " def clean_sms_conversation_times_json(self):\n if self.cleaned_data.get(\"use_sms_conversation_times\"):\n return self._clean_time_window_json(\"sms_conversation_times_json\")\n else:\n return []", "metadata": "root.SettingsForm.clean_sms_conversation_times_json", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 677 }, { "content": " def clean_send_to_duplicated_case_numbers(self):\n return (self.cleaned_data.get(\"send_to_duplicated_case_numbers\")\n == ENABLED)", "metadata": "root.SettingsForm.clean_send_to_duplicated_case_numbers", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 683 }, { "content": " def clean_count_messages_as_read_by_anyone(self):\n return (self.cleaned_data.get(\"count_messages_as_read_by_anyone\")\n == ENABLED)", "metadata": "root.SettingsForm.clean_count_messages_as_read_by_anyone", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 687 }, { "content": " def clean_sms_case_registration_enabled(self):\n return (self.cleaned_data.get(\"sms_case_registration_enabled\")\n == ENABLED)", "metadata": "root.SettingsForm.clean_sms_case_registration_enabled", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 691 }, { "content": " def clean_sms_case_registration_type(self):\n return self._clean_dependent_field(\"sms_case_registration_enabled\",\n \"sms_case_registration_type\")", "metadata": "root.SettingsForm.clean_sms_case_registration_type", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 695 }, { "content": " def _clean_registration_id_field(self, field_name):\n if self.cleaned_data.get(\"sms_case_registration_enabled\"):\n value = self.cleaned_data.get(field_name)\n if not value:\n raise ValidationError(_(\"This field is required.\"))\n # Otherwise, the ChoiceField automatically validates that it is\n # in the list that is dynamically populated in __init__\n return value\n else:\n return None", "metadata": "root.SettingsForm._clean_registration_id_field", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 699 }, { "content": " def clean_sms_case_registration_owner_id(self):\n return self._clean_registration_id_field(\"sms_case_registration_owner_id\")", "metadata": "root.SettingsForm.clean_sms_case_registration_owner_id", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 710 }, { "content": " def clean_sms_case_registration_user_id(self):\n return self._clean_registration_id_field(\"sms_case_registration_user_id\")", "metadata": "root.SettingsForm.clean_sms_case_registration_user_id", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 713 }, { "content": " def clean_sms_mobile_worker_registration_enabled(self):\n return (self.cleaned_data.get(\"sms_mobile_worker_registration_enabled\")\n == ENABLED)", "metadata": "root.SettingsForm.clean_sms_mobile_worker_registration_enabled", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 716 }, { "content": " def clean_sms_conversation_length(self):\n # Just cast to int, the ChoiceField will validate that it is an integer\n return int(self.cleaned_data.get(\"sms_conversation_length\"))", "metadata": "root.SettingsForm.clean_sms_conversation_length", "header": "['class', 'SettingsForm', '(', 'Form', ')', ':', '___NEWLINE___', '# General Settings', '___NL___', '___EOS___']", "index": 720 }, { "content": "class BackendForm(Form):\n _cchq_domain = None\n _cchq_backend_id = None\n name = CharField(\n label=ugettext_noop(\"Name\")\n )\n description = CharField(\n label=ugettext_noop(\"Description\"),\n widget=forms.Textarea,\n required=False,\n )\n give_other_domains_access = BooleanField(\n required=False,\n label=ugettext_noop(\"Give other domains access.\")\n )\n authorized_domains = CharField(\n required=False,\n label=ugettext_noop(\"List of authorized domains\")\n )\n reply_to_phone_number = CharField(\n required=False,\n label=ugettext_noop(\"Reply-To Phone Number\"),\n )\n\n\n\n\n\n\n", "metadata": "root.BackendForm", "header": "['module', '___EOS___']", "index": 724 }, { "content": " @property\n def is_global_backend(self):\n return self._cchq_domain is None", "metadata": "root.BackendForm.is_global_backend", "header": "['class', 'BackendForm', '(', 'Form', ')', ':', '___EOS___']", "index": 748 }, { "content": " @property\n def general_fields(self):\n fields = [\n crispy.Field('name', css_class='input-xxlarge'),\n crispy.Field('description', css_class='input-xxlarge', rows=\"3\"),\n crispy.Field('reply_to_phone_number', css_class='input-xxlarge'),\n ]\n\n if not self.is_global_backend:\n fields.extend([\n crispy.Field(\n twbscrispy.PrependedText(\n 'give_other_domains_access', '', data_bind=\"checked: share_backend\"\n )\n ),\n crispy.Div(\n 'authorized_domains',\n data_bind=\"visible: showAuthorizedDomains\",\n ),\n ])\n\n return fields", "metadata": "root.BackendForm.general_fields", "header": "['class', 'BackendForm', '(', 'Form', ')', ':', '___EOS___']", "index": 752 }, { "content": " def __init__(self, *args, **kwargs):\n button_text = kwargs.pop('button_text', _(\"Create SMS Gateway\"))\n self._cchq_domain = kwargs.pop('domain')\n self._cchq_backend_id = kwargs.pop('backend_id')\n super(BackendForm, self).__init__(*args, **kwargs)\n self.helper = FormHelper()\n self.helper.form_class = 'form form-horizontal'\n self.helper.label_class = 'col-sm-3 col-md-4 col-lg-2'\n self.helper.field_class = 'col-sm-9 col-md-8 col-lg-6'\n self.helper.form_method = 'POST'\n self.helper.layout = crispy.Layout(\n crispy.Fieldset(\n _('General Settings'),\n *self.general_fields\n ),\n self.gateway_specific_fields,\n crispy.Fieldset(\n _(\"Phone Numbers\"),\n crispy.Div(\n data_bind=\"template: {\"\n \" name: 'ko-load-balancing-template', \"\n \" data: $data\"\n \"}\",\n ),\n data_bind=\"visible: use_load_balancing\",\n ),\n hqcrispy.FormActions(\n StrictButton(\n button_text,\n type=\"submit\",\n css_class='btn-primary'\n ),\n ),\n )", "metadata": "root.BackendForm.__init__", "header": "['class', 'BackendForm', '(', 'Form', ')', ':', '___EOS___']", "index": 775 }, { "content": " @property\n def gateway_specific_fields(self):\n return crispy.Div()", "metadata": "root.BackendForm.gateway_specific_fields", "header": "['class', 'BackendForm', '(', 'Form', ')', ':', '___EOS___']", "index": 810 }, { "content": " def clean_name(self):\n value = self.cleaned_data.get(\"name\")\n if value is not None:\n value = value.strip().upper()\n if value is None or value == \"\":\n raise ValidationError(_(\"This field is required.\"))\n if re.compile(\"\\s\").search(value) is not None:\n raise ValidationError(_(\"Name may not contain any spaces.\"))\n\n if self.is_global_backend:\n # We're using the form to create a global backend, so\n # ensure name is not duplicated among other global backends\n is_unique = SQLMobileBackend.name_is_unique(\n value,\n backend_id=self._cchq_backend_id\n )\n else:\n # We're using the form to create a domain-level backend, so\n # ensure name is not duplicated among other backends owned by this domain\n is_unique = SQLMobileBackend.name_is_unique(\n value,\n domain=self._cchq_domain,\n backend_id=self._cchq_backend_id\n )\n\n if not is_unique:\n raise ValidationError(_(\"Name is already in use.\"))\n\n return value", "metadata": "root.BackendForm.clean_name", "header": "['class', 'BackendForm', '(', 'Form', ')', ':', '___EOS___']", "index": 814 }, { "content": " def clean_authorized_domains(self):\n if not self.cleaned_data.get(\"give_other_domains_access\"):\n return []\n else:\n value = self.cleaned_data.get(\"authorized_domains\")\n if value is None or value.strip() == \"\":\n return []\n else:\n return [domain.strip() for domain in value.split(\",\")]", "metadata": "root.BackendForm.clean_authorized_domains", "header": "['class', 'BackendForm', '(', 'Form', ')', ':', '___EOS___']", "index": 844 }, { "content": " def clean_reply_to_phone_number(self):\n value = self.cleaned_data.get(\"reply_to_phone_number\")\n if value is None:\n return None\n else:\n value = value.strip()\n if value == \"\":\n return None\n else:\n return value", "metadata": "root.BackendForm.clean_reply_to_phone_number", "header": "['class', 'BackendForm', '(', 'Form', ')', ':', '___EOS___']", "index": 854 }, { "content": "class BackendMapForm(Form):\n catchall_backend_id = ChoiceField(\n label=ugettext_lazy(\"Catch-All Gateway\"),\n required=False\n )\n backend_map = CharField(required=False)\n\n\n\n\n\n\n", "metadata": "root.BackendMapForm", "header": "['module', '___EOS___']", "index": 866 }, { "content": " def __init__(self, *args, **kwargs):\n backends = kwargs.pop('backends')\n super(BackendMapForm, self).__init__(*args, **kwargs)\n self.set_catchall_choices(backends)\n self.setup_crispy()", "metadata": "root.BackendMapForm.__init__", "header": "['class', 'BackendMapForm', '(', 'Form', ')', ':', '___EOS___']", "index": 873 }, { "content": " def set_catchall_choices(self, backends):\n backend_choices = [('', _(\"(none)\"))]\n backend_choices.extend([\n (backend.pk, backend.name) for backend in backends\n ])\n self.fields['catchall_backend_id'].choices = backend_choices", "metadata": "root.BackendMapForm.set_catchall_choices", "header": "['class', 'BackendMapForm', '(', 'Form', ')', ':', '___EOS___']", "index": 879 }, { "content": " def setup_crispy(self):\n self.helper = FormHelper()\n self.helper.form_class = 'form form-horizontal'\n self.helper.label_class = 'col-sm-2 col-md-2'\n self.helper.field_class = 'col-sm-5 col-md-5'\n self.helper.form_method = 'POST'\n self.helper.layout = crispy.Layout(\n crispy.Fieldset(\n _(\"Default Gateways\"),\n hqcrispy.B3MultiField(\n _(\"Default Gateway by Prefix\"),\n ErrorsOnlyField('backend_map'),\n crispy.Div(\n data_bind=\"template: {\"\n \" name: 'ko-template-backend-map', \"\n \" data: $data\"\n \"}\"\n ),\n ),\n 'catchall_backend_id',\n ),\n hqcrispy.FormActions(\n StrictButton(\n _(\"Save\"),\n type=\"submit\",\n css_class='btn-primary'\n ),\n ),\n )", "metadata": "root.BackendMapForm.setup_crispy", "header": "['class', 'BackendMapForm', '(', 'Form', ')', ':', '___EOS___']", "index": 886 }, { "content": " def _clean_prefix(self, prefix):\n try:\n prefix = int(prefix)\n if prefix <= 0:\n raise ValueError()\n except (ValueError, TypeError):\n raise ValidationError(_(\"Please enter a positive number for the prefix.\"))\n\n return str(prefix)", "metadata": "root.BackendMapForm._clean_prefix", "header": "['class', 'BackendMapForm', '(', 'Form', ')', ':', '___EOS___']", "index": 916 }, { "content": " def _clean_backend_id(self, backend_id):\n try:\n backend_id = int(backend_id)\n except (ValueError, TypeError):\n raise ValidationError(_(\"Invalid Backend Specified.\"))\n\n try:\n backend = SQLMobileBackend.load(backend_id)\n except:\n raise ValidationError(_(\"Invalid Backend Specified.\"))\n\n if (\n backend.deleted or\n not backend.is_global or\n backend.backend_type != SQLMobileBackend.SMS\n ):\n raise ValidationError(_(\"Invalid Backend Specified.\"))\n\n return backend_id", "metadata": "root.BackendMapForm._clean_backend_id", "header": "['class', 'BackendMapForm', '(', 'Form', ')', ':', '___EOS___']", "index": 926 }, { "content": " def clean_backend_map(self):\n value = self.cleaned_data.get('backend_map')\n try:\n value = json.loads(value)\n except:\n raise ValidationError(_(\"An unexpected error occurred. Please reload and try again\"))\n\n cleaned_value = {}\n for mapping in value:\n prefix = self._clean_prefix(mapping.get('prefix'))\n if prefix in cleaned_value:\n raise ValidationError(_(\"Prefix is specified twice: %s\") % prefix)\n\n cleaned_value[prefix] = self._clean_backend_id(mapping.get('backend_id'))\n return cleaned_value", "metadata": "root.BackendMapForm.clean_backend_map", "header": "['class', 'BackendMapForm', '(', 'Form', ')', ':', '___EOS___']", "index": 946 }, { "content": " def clean_catchall_backend_id(self):\n value = self.cleaned_data.get('catchall_backend_id')\n if not value:\n return None\n\n return self._clean_backend_id(value)", "metadata": "root.BackendMapForm.clean_catchall_backend_id", "header": "['class', 'BackendMapForm', '(', 'Form', ')', ':', '___EOS___']", "index": 962 }, { "content": "class SendRegistrationInviationsForm(Form):\n phone_numbers = TrimmedCharField(\n label=ugettext_lazy(\"Phone Number(s)\"),\n required=True,\n widget=forms.Textarea,\n )\n\n app_id = ChoiceField(\n label=ugettext_lazy(\"Application\"),\n required=True,\n )\n\n action = CharField(\n initial='invite',\n widget=forms.HiddenInput(),\n )\n\n\n", "metadata": "root.SendRegistrationInviationsForm", "header": "['module', '___EOS___']", "index": 970 }, { "content": " def set_app_id_choices(self):\n app_ids = get_built_app_ids(self.domain)\n choices = []\n for app_doc in iter_docs(Application.get_db(), app_ids):\n # This will return both Application and RemoteApp docs, but\n # they both have a name attribute\n choices.append((app_doc['_id'], app_doc['name']))\n choices.sort(key=lambda x: x[1])\n self.fields['app_id'].choices = choices", "metadata": "root.SendRegistrationInviationsForm.set_app_id_choices", "header": "['class', 'SendRegistrationInviationsForm', '(', 'Form', ')', ':', '___EOS___']", "index": 987 }, { "content": " def __init__(self, *args, **kwargs):\n if 'domain' not in kwargs:\n raise Exception('Expected kwargs: domain')\n self.domain = kwargs.pop('domain')\n\n super(SendRegistrationInviationsForm, self).__init__(*args, **kwargs)\n self.set_app_id_choices()\n\n self.helper = FormHelper()\n self.helper.form_class = \"form form-horizontal\"\n self.helper.layout = crispy.Layout(\n FieldsetAccordionGroup(\n _(\"Send Registration Invitation\"),\n crispy.Field('app_id'),\n crispy.Field(\n 'phone_numbers',\n placeholder=_(\"Enter phone number(s) in international \"\n \"format. Example: +27..., +91...,\"),\n ),\n InlineField('action'),\n FormActions(\n StrictButton(\n _(\"Send Invitation\"),\n type=\"submit\",\n css_class=\"btn-primary\",\n ),\n ),\n active=len(args) > 0,\n )\n )", "metadata": "root.SendRegistrationInviationsForm.__init__", "header": "['class', 'SendRegistrationInviationsForm', '(', 'Form', ')', ':', '___EOS___']", "index": 997 }, { "content": " def clean_phone_numbers(self):\n value = self.cleaned_data.get('phone_numbers', '')\n phone_list = [strip_plus(s.strip()) for s in value.split(',')]\n phone_list = [phone for phone in phone_list if phone]\n if len(phone_list) == 0:\n raise ValidationError(_(\"This field is required.\"))\n for phone_number in phone_list:\n validate_phone_number(phone_number)\n return list(set(phone_list))", "metadata": "root.SendRegistrationInviationsForm.clean_phone_numbers", "header": "['class', 'SendRegistrationInviationsForm', '(', 'Form', ')', ':', '___EOS___']", "index": 1028 }, { "content": "class InitiateAddSMSBackendForm(Form):\n action = CharField(\n initial='new_backend',\n widget=forms.HiddenInput(),\n )\n hq_api_id = ChoiceField(\n required=False,\n label=\"Gateway Type\",\n )\n", "metadata": "root.InitiateAddSMSBackendForm", "header": "['module', '___EOS___']", "index": 1039 }, { "content": " def __init__(self, is_superuser=False, *args, **kwargs):\n super(InitiateAddSMSBackendForm, self).__init__(*args, **kwargs)\n\n from corehq.messaging.smsbackends.telerivet.models import SQLTelerivetBackend\n backend_classes = get_sms_backend_classes()\n backend_choices = []\n for api_id, klass in backend_classes.items():\n if is_superuser or api_id == SQLTelerivetBackend.get_api_id():\n friendly_name = klass.get_generic_name()\n backend_choices.append((api_id, friendly_name))\n self.fields['hq_api_id'].choices = backend_choices\n\n self.helper = FormHelper()\n self.helper.label_class = 'col-sm-3 col-md-4 col-lg-2'\n self.helper.field_class = 'col-sm-9 col-md-8 col-lg-6'\n self.helper.form_class = \"form form-horizontal\"\n self.helper.layout = crispy.Layout(\n hqcrispy.B3MultiField(\n _(\"Create Another Gateway\"),\n InlineField('action'),\n Div(InlineField('hq_api_id'), css_class='col-sm-6 col-md-6 col-lg-4'),\n Div(StrictButton(\n mark_safe('<i class=\"fa fa-plus\"></i> Add Another Gateway'),\n css_class='btn-success',\n type='submit',\n style=\"margin-left:5px;\"\n ), css_class='col-sm-3 col-md-2 col-lg-2'),\n ),\n )", "metadata": "root.InitiateAddSMSBackendForm.__init__", "header": "['class', 'InitiateAddSMSBackendForm', '(', 'Form', ')', ':', '___EOS___']", "index": 1049 }, { "content": "class SubscribeSMSForm(Form):\n stock_out_facilities = BooleanField(\n label=ugettext_lazy(\"Receive stockout facilities SMS alert\"),\n required=False,\n help_text=ugettext_lazy(\n \"This will alert you with specific users/facilities that are \"\n \"stocked out of your commodities\"\n )\n )\n stock_out_commodities = BooleanField(\n label=ugettext_lazy(\"Receive stockout commodities SMS alert\"),\n required=False,\n help_text=ugettext_lazy(\n \"This will alert you with specific commodities that are stocked \"\n \"out by your users/facilities\"\n )\n )\n stock_out_rates = BooleanField(\n label=ugettext_lazy(\"Receive stockout SMS alert\"),\n required=False,\n help_text=ugettext_lazy(\n \"This will alert you with the percent of facilities that are \"\n \"stocked out of a specific commodity\"\n )\n )\n non_report = BooleanField(\n label=ugettext_lazy(\"Receive non-reporting SMS alert\"),\n required=False,\n help_text=ugettext_lazy(\n \"This alert highlight users/facilities which have not submitted \"\n \"their CommCare Supply stock report.\"\n )\n )\n\n", "metadata": "root.SubscribeSMSForm", "header": "['module', '___EOS___']", "index": 1080 }, { "content": " def __init__(self, *args, **kwargs):\n super(SubscribeSMSForm, self).__init__(*args, **kwargs)\n self.helper = FormHelper()\n self.helper.form_class = 'form form-horizontal'\n self.helper.label_class = 'col-sm-2 col-md-2 col-lg-2'\n self.helper.field_class = 'col-sm-2 col-md-2 col-lg-2'\n self.helper.layout = crispy.Layout(\n crispy.Fieldset(\n _('Subscribe settings'),\n twbscrispy.PrependedText('stock_out_facilities', ''),\n twbscrispy.PrependedText('stock_out_commodities', ''),\n twbscrispy.PrependedText('stock_out_rates', ''),\n twbscrispy.PrependedText('non_report', '')\n ),\n hqcrispy.FormActions(\n twbscrispy.StrictButton(\n _(\"Update settings\"),\n type=\"submit\",\n css_class=\"btn-primary\",\n ),\n )\n )", "metadata": "root.SubscribeSMSForm.__init__", "header": "['class', 'SubscribeSMSForm', '(', 'Form', ')', ':', '___EOS___']", "index": 1114 }, { "content": " def save(self, commtrack_settings):\n alert_config = commtrack_settings.alert_config\n alert_config.stock_out_facilities = self.cleaned_data.get(\"stock_out_facilities\", False)\n alert_config.stock_out_commodities = self.cleaned_data.get(\"stock_out_commodities\", False)\n alert_config.stock_out_rates = self.cleaned_data.get(\"stock_out_rates\", False)\n alert_config.non_report = self.cleaned_data.get(\"non_report\", False)\n\n commtrack_settings.save()", "metadata": "root.SubscribeSMSForm.save", "header": "['class', 'SubscribeSMSForm', '(', 'Form', ')', ':', '___EOS___']", "index": 1137 }, { "content": "class ComposeMessageForm(forms.Form):\n\n recipients = forms.CharField(widget=forms.Textarea,\n help_text=ugettext_lazy(\"Type a username, group name or 'send to all'\"))\n message = forms.CharField(widget=forms.Textarea, help_text=ugettext_lazy('0 characters (160 max)'))\n", "metadata": "root.ComposeMessageForm", "header": "['module', '___EOS___']", "index": 1147 }, { "content": " def __init__(self, *args, **kwargs):\n domain = kwargs.pop('domain')\n super(ComposeMessageForm, self).__init__(*args, **kwargs)\n self.helper = FormHelper()\n self.helper.form_action = reverse('send_to_recipients', args=[domain])\n self.helper.form_class = \"form form-horizontal\"\n self.helper.label_class = 'col-sm-3 col-md-4 col-lg-2'\n self.helper.field_class = 'col-sm-10 col-md-10 col-lg-10'\n self.helper.layout = crispy.Layout(\n crispy.Field('recipients', rows=2, css_class='sms-typeahead'),\n crispy.Field('message', rows=2),\n hqcrispy.FormActions(\n twbscrispy.StrictButton(\n _(\"Send Message\"),\n type=\"submit\",\n css_class=\"btn-primary\",\n ),\n ),\n )", "metadata": "root.ComposeMessageForm.__init__", "header": "['class', 'ComposeMessageForm', '(', 'forms', '.', 'Form', ')', ':', '___EOS___']", "index": 1153 } ]
[ { "span": "from corehq.apps.hqwebapp.crispy import (BootstrapMultiField, HiddenFieldWithErrors, FieldsetAccordionGroup)", "start_line": 12, "start_column": 0, "end_line": 12, "end_column": 108 }, { "span": "from corehq.apps.reminders.forms import RecordListField, validate_time", "start_line": 19, "start_column": 0, "end_line": 19, "end_column": 70 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "crisp", "y", "\\u", "forms_", "._", "bootstrap_", "import_", "Stri", "ct", "Button_", ",_", "In", "line", "Field_", ",_", "Form", "Actions_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "crisp", "y", "\\u", "forms_", "._", "helper_", "import_", "Form", "Helper_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "crisp", "y", "\\u", "forms_", "._", "layout_", "import_", "Div_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "import_", "forms_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "urlresolvers_", "import_", "reverse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "forms_", "._", "forms_", "import_", "Form_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "forms_", "._", "fields_", "import_", "*_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "crisp", "y", "\\u", "forms_", "import_", "layout_", "as_", "crisp", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "crisp", "y", "\\u", "forms_", "import_", "bootstrap_", "as_", "tw", "bsc", "ris", "py_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "safe", "string_", "import_", "mark", "\\u", "safe_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "hq", "webapp_", "._", "crisp", "y_", "import_", "(_", "Boots", "trap", "Multi", "Field_", ",_", "Hi", "dde", "n", "Field", "With", "Errors_", ",_", "Field", "set", "Acco", "rdi", "on", "Group_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "style_", "._", "crisp", "y_", "import_", "Field", "With", "Help", "Bu", "bble", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "style_", "import_", "crisp", "y_", "as_", "hq", "crisp", "y_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "app", "\\u", "manager_", "._", "dba", "ccess", "ors_", "import_", "get", "\\u", "bui", "lt", "\\u", "app", "\\u", "ids_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "app", "\\u", "manager_", "._", "models_", "import_", "Application_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "sms_", "._", "models_", "import_", "FORWARD", "\\u", "ALL_", ",_", "FORWARD", "\\u", "BY", "\\u", "KEYWORD", "_", ",_", "SQL", "Mob", "ile", "Backend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "core_", "._", "exceptions_", "import_", "Validat", "ion", "Error_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "reminder", "s_", "._", "forms_", "import_", "Record", "List", "Field_", ",_", "validat", "e\\u", "time_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "utils_", "._", "translation_", "import_", "ugettext_", "as_", "\\u_", ",_", "uge", "ttext", "\\u", "noop_", ",_", "uge", "ttext", "\\u", "lazy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "sms_", "._", "util_", "import_", "(_", "validat", "e\\u", "phone", "\\u", "number_", ",_", "strip", "\\u", "plus_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "get", "\\u", "sms", "\\u", "back", "end", "\\u", "classes_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "domain_", "._", "models_", "import_", "Day", "Time", "Window_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "users_", "._", "models_", "import_", "Comm", "Care", "User_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "groups_", "._", "models_", "import_", "Group_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "core", "hq", "_", "._", "apps_", "._", "hq", "webapp_", "._", "crisp", "y_", "import_", "Error", "s", "On", "ly", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "utils_", "._", "django_", "._", "fields_", "import_", "Trim", "med", "Char", "Field_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "dim", "agi", "_", "._", "utils_", "._", "couch", "_", "._", "database_", "import_", "iter", "\\u", "docs_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "django_", "._", "conf_", "import_", "settings_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "FORWARD", "ING", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "FORWARD", "\\u", "ALL_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "All", " ", "message", "s", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "FORWARD", "\\u", "BY", "\\u", "KEYWORD", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "All", " ", "message", "s", " ", "startin", "g", " ", "with", " ", "a", " ", "keyw", "ord", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ENABLED_", "=_", "\"", "ENABLE", "D", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "DISABLED_", "=_", "\"", "DISABLED", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "ENABLE", "D", "\\u", "DISABLED", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "DISABLED_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Disa", "ble", "d", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "ENABLED_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Enable", "d", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEFAULT_", "=_", "\"", "DEF", "AUL", "T", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "CUSTOM", "_", "=_", "\"", "CUSTOM", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "DEF", "AUL", "T", "\\u", "CUSTOM", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "DEFAULT_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Default", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "CUSTOM", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Speci", "fy", ":\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "MESSAGE", "\\u", "COUNTER", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "DEFAULT_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Don", "'", "t", " ", "use", " ", "counter", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "CUSTOM", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Us", "e", " ", "counter", " ", "with", " ", "threshol", "d", ":\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SMS", "\\u", "CONVE", "RSA", "TIO", "N", "\\u", "LENGTH", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "5_", ",_", "5_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "10_", ",_", "10_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "15_", ",_", "15_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "20_", ",_", "20_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "25_", ",_", "25_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "30_", ",_", "30_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "SHOW", "\\u", "ALL_", "=_", "\"", "SHOW", "\\u", "ALL", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "SHOW", "\\u", "INVALID", "_", "=_", "\"", "SHOW", "\\u", "INVALID", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "HID", "E", "\\u", "ALL_", "=_", "\"", "HID", "E", "\\u", "ALL", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "TIME", "\\u", "BEFORE", "_", "=_", "\"", "BEFORE", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TIME", "\\u", "AFTER", "_", "=_", "\"", "AFTER", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "TIME", "\\u", "BETWEEN", "_", "=_", "\"", "BETWEEN", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "WEL", "COM", "E", "\\u", "RECIP", "IENT", "\\u", "NONE_", "=_", "'", "NON", "E", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WEL", "COM", "E", "\\u", "RECIP", "IENT", "\\u", "CASE", "_", "=_", "'", "CASE", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WEL", "COM", "E", "\\u", "RECIP", "IENT", "\\u", "MOB", "ILE", "\\u", "WORKER", "_", "=_", "'", "MOB", "ILE", "\\u", "WORKER", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "WEL", "COM", "E", "\\u", "RECIP", "IENT", "\\u", "ALL_", "=_", "'", "ALL", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "WEL", "COM", "E", "\\u", "RECIP", "IENT", "\\u", "CHOICES_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "WEL", "COM", "E", "\\u", "RECIP", "IENT", "\\u", "NONE_", ",_", "uge", "ttext", "\\u", "lazy_", "(_", "'", "No", "body", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "WEL", "COM", "E", "\\u", "RECIP", "IENT", "\\u", "CASE", "_", ",_", "uge", "ttext", "\\u", "lazy_", "(_", "'", "Case", "s", " ", "only", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "WEL", "COM", "E", "\\u", "RECIP", "IENT", "\\u", "MOB", "ILE", "\\u", "WORKER", "_", ",_", "uge", "ttext", "\\u", "lazy_", "(_", "'", "Mob", "ile", " ", "Worke", "rs", " ", "only", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "WEL", "COM", "E", "\\u", "RECIP", "IENT", "\\u", "ALL_", ",_", "uge", "ttext", "\\u", "lazy_", "(_", "'", "Case", "s", " ", "and", " ", "Mob", "ile", " ", "Worke", "rs", "'_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "Forward", "ing", "Rule", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "forward", "\\u", "type_", "=_", "Choi", "ce", "Field_", "(_", "choices_", "=_", "FORWARD", "ING", "\\u", "CHOICES_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyword_", "=_", "Char", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "back", "end", "\\u", "id_", "=_", "Char", "Field_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Forward", "ing", "Rule", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "clean", "\\u", "keyword_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "forward", "\\u", "type_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "forward", "\\u", "type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "keyword_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "keyw", "ord", "\"_", ",_", "\"\"_", ")_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "forward", "\\u", "type_", "==_", "FORWARD", "\\u", "BY", "\\u", "KEYWORD", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "keyword_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "Thi", "s", " ", "field", " ", "is", " ", "require", "d", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "keyword_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Load", "Bal", "anci", "ng", "Back", "end", "Form", "Mixin_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "phone", "\\u", "numbers_", "=_", "Char", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Load", "Bal", "anci", "ng", "Back", "end", "Form", "Mixin_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "clean", "\\u", "phone", "\\u", "numbers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "Expect", "s", " ", "a", " ", "list", " ", "of", " ", "[{", "\"", "phone", "\\u", "number", "\":", " ", "<", "phone", " ", "number", ">}", "]", " ", "as", " ", "the", " ", "value", ".", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "value_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "phone", "\\u", "numbers", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "json_", "._", "loads_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "isinstance_", "(_", "value_", ",_", "list_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "item_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "assert_", "isinstance_", "(_", "item_", ",_", "dict_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "\"", "phone", "\\u", "number", "\"_", "in_", "item_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "item_", "[_", "\"", "phone", "\\u", "number", "\"_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Assert", "ion", "Error_", ",_", "Value", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "Some", "thing", " ", "wen", "t", " ", "wrong", ".", " ", "Ple", "ase", " ", "relo", "ad", " ", "the", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "page", " ", "and", " ", "try", " ", "again", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "len_", "(_", "result_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "You", " ", "must", " ", "speci", "fy", " ", "at", " ", "leas", "t", " ", "one", " ", "phone", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "number", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "phone", "\\u", "number_", "in_", "result_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "validat", "e\\u", "phone", "\\u", "number_", "(_", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "use", "\\u", "default", "\\u", "sms", "\\u", "response_", "=_", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Default", " ", "SMS", " ", "Respons", "e", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "ENABLE", "D", "\\u", "DISABLED", "\\u", "CHOICES_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "default", "\\u", "sms", "\\u", "response_", "=_", "Trim", "med", "Char", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "restrict", "ed", "\\u", "sms", "\\u", "times_", "=_", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Sen", "d", " ", "SMS", " ", "on", "...\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "DISABLED_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "any", " ", "day", ",", " ", "at", " ", "any", " ", "time", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "ENABLED_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "only", " ", "specific", " ", "day", "s", " ", "and", " ", "times", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "restrict", "ed", "\\u", "sms", "\\u", "times", "\\u", "json_", "=_", "Char", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "forms_", "._", "Hi", "dde", "n", "Input_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "send", "\\u", "to", "\\u", "duplicated", "\\u", "case", "\\u", "numbers_", "=_", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Sen", "d", " ", "Messag", "es", " ", "to", " ", "Non", "-", "Unique", " ", "Phone", " ", "Number", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "ENABLE", "D", "\\u", "DISABLED", "\\u", "CHOICES_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Cha", "t", " ", "Settings_", "\\u\\u\\uNL\\u\\u\\u_", "use", "\\u", "custom", "\\u", "case", "\\u", "username_", "=_", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "DEF", "AUL", "T", "\\u", "CUSTOM", "\\u", "CHOICES_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "custom", "\\u", "case", "\\u", "username_", "=_", "Trim", "med", "Char", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Enter", " ", "a", " ", "Case", " ", "Proper", "ty", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "custom", "\\u", "message", "\\u", "count", "\\u", "threshold_", "=_", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "MESSAGE", "\\u", "COUNTER", "\\u", "CHOICES_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "custom", "\\u", "message", "\\u", "count", "\\u", "threshold_", "=_", "Integer", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Enter", " ", "a", " ", "Number", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "sms", "\\u", "conversation", "\\u", "times_", "=_", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Delay", " ", "Automat", "ed", " ", "SMS", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "ENABLE", "D", "\\u", "DISABLED", "\\u", "CHOICES_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sms", "\\u", "conversation", "\\u", "times", "\\u", "json_", "=_", "Char", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "forms_", "._", "Hi", "dde", "n", "Input_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sms", "\\u", "conversation", "\\u", "length_", "=_", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Conversation", " ", "Dur", "ation", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "SMS", "\\u", "CONVE", "RSA", "TIO", "N", "\\u", "LENGTH", "\\u", "CHOICES_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "survey", "\\u", "traffic", "\\u", "option_", "=_", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Surv", "ey", " ", "Tra", "ffic", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "SHOW", "\\u", "ALL_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Show", " ", "all", " ", "survey", " ", "traffic", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "SHOW", "\\u", "INVALID", "_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Hi", "de", " ", "all", " ", "survey", " ", "traffic", " ", "except", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "invalid", " ", "response", "s", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "HID", "E", "\\u", "ALL_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Hi", "de", " ", "all", " ", "survey", " ", "traffic", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "count", "\\u", "message", "s", "\\u", "as", "\\u", "read", "\\u", "by", "\\u", "any", "one_", "=_", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "A", " ", "Messag", "e", " ", "is", " ", "Read", "...\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "ENABLED_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "whe", "n", " ", "it", " ", "is", " ", "read", " ", "by", " ", "any", "one", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "DISABLED_", ",_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "only", " ", "for", " ", "the", " ", "user", " ", "tha", "t", " ", "reads", " ", "it", "\"_", ")_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "use", "\\u", "custom", "\\u", "chat", "\\u", "template_", "=_", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "DEF", "AUL", "T", "\\u", "CUSTOM", "\\u", "CHOICES_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "custom", "\\u", "chat", "\\u", "template_", "=_", "Trim", "med", "Char", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Enter", " ", "Cha", "t", " ", "Templa", "te", " ", "Identifie", "r", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sms", "\\u", "case", "\\u", "registration", "\\u", "enabled_", "=_", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "ENABLE", "D", "\\u", "DISABLED", "\\u", "CHOICES_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Case", " ", "Self", "-", "Registration", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sms", "\\u", "case", "\\u", "registration", "\\u", "type_", "=_", "Trim", "med", "Char", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Default", " ", "Case", " ", "Type", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sms", "\\u", "case", "\\u", "registration", "\\u", "owner", "\\u", "id_", "=_", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Default", " ", "Case", " ", "Owne", "r", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sms", "\\u", "case", "\\u", "registration", "\\u", "user", "\\u", "id_", "=_", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Registration", " ", "Submitte", "r", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sms", "\\u", "mobile", "\\u", "worker", "\\u", "registration", "\\u", "enabled_", "=_", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "ENABLE", "D", "\\u", "DISABLED", "\\u", "CHOICES_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "SMS", " ", "Mob", "ile", " ", "Worke", "r", " ", "Registration", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "registration", "\\u", "welcome", "\\u", "message_", "=_", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "choices_", "=_", "WEL", "COM", "E", "\\u", "RECIP", "IENT", "\\u", "CHOICES_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "lazy_", "(_", "\"", "Sen", "d", " ", "registration", " ", "welcome", " ", "message", " ", "to", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\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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_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "section", "\\u", "general_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "hq", "crisp", "y_", "._", "B3", "Multi", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Default", " ", "SMS", " ", "Respons", "e", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Div_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "In", "line", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "use", "\\u", "default", "\\u", "sms", "\\u", "response", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "value", ":", " ", "use", "\\u", "default", "\\u", "sms", "\\u", "response", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "4", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Div_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "In", "line", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "default", "\\u", "sms", "\\u", "response", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "class_", "=_", "\"", "input", "-", "xx", "large", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "placeholder_", "=_", "\\u_", "(_", "\"", "Enter", " ", "Default", " ", "Respons", "e", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "visi", "ble", ":", " ", "show", "Default", "SMS", "Respons", "e", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "8", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "bubble", "\\u", "text_", "=_", "\\u_", "(_", "\"", "Enable", " ", "this", " ", "option", " ", "to", " ", "provide", " ", "a", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "default", " ", "response", " ", "whe", "n", " ", "a", " ", "user", "'", "s", " ", "inco", "ming", " ", "SMS", " ", "doe", "s", " ", "not", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "answer", " ", "an", " ", "open", " ", "survey", " ", "or", " ", "match", " ", "a", " ", "know", "n", " ", "keyw", "ord", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "id_", "=_", "\"", "default", "-", "sms", "-", "response", "-", "group", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "6", " ", "col", "-", "md", "-", "9", " ", "col", "-", "lg", "-", "9", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "With", "Help", "Bu", "bble", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "use", "\\u", "restrict", "ed", "\\u", "sms", "\\u", "times", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "value", ":", " ", "use", "\\u", "restrict", "ed", "\\u", "sms", "\\u", "times", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "bubble", "\\u", "text_", "=_", "\\u_", "(_", "\"", "Us", "e", " ", "this", " ", "option", " ", "to", " ", "limit", " ", "the", " ", "times", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tha", "t", " ", "SMS", " ", "message", "s", " ", "can", " ", "be", " ", "sent", " ", "to", " ", "users", ".", " ", "Messag", "es", " ", "tha", "t", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "are", " ", "sent", " ", "outsi", "de", " ", "these", " ", "windows", " ", "will", " ", "rema", "ine", "d", " ", "queue", "d", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "and", " ", "will", " ", "go", " ", "out", " ", "as", " ", "soo", "n", " ", "as", " ", "anot", "her", " ", "window", " ", "opens", " ", "up", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hq", "crisp", "y_", "._", "B3", "Multi", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Hi", "dde", "n", "Field", "With", "Errors_", "(_", "\"", "restrict", "ed", "\\u", "sms", "\\u", "times", "\\u", "json", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "value", ":", " ", "restrict", "ed", "\\u", "sms", "\\u", "times", "\\u", "json", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Div_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "template", ":", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "name", ":", " ", "'", "ko", "-", "template", "-", "restrict", "ed", "-", "sms", "-", "times", "',", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "data", ":", " ", "$", "data", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"}\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "visi", "ble", ":", " ", "show", "Restrict", "ed", "SMS", "Times", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field", "\\u", "class_", "=_", "'", "col", "-", "md", "-1", "0", " ", "col", "-", "lg", "-1", "0", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "With", "Help", "Bu", "bble", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "send", "\\u", "to", "\\u", "duplicated", "\\u", "case", "\\u", "numbers", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "bubble", "\\u", "text_", "=_", "\\u_", "(_", "\"", "En", "abl", "ing", " ", "this", " ", "option", " ", "will", " ", "send", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "outgoing", "-", "only", " ", "message", "s", " ", "to", " ", "phone", " ", "numbers", " ", "register", "ed", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "with", " ", "more", " ", "than", " ", "one", " ", "mobile", " ", "worker", " ", "or", " ", "case", ".", " ", "SMS", " ", "survey", "s", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "and", " ", "keywords", " ", "will", " ", "still", " ", "only", " ", "work", " ", "for", " ", "unique", " ", "phone", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "numbers", " ", "in", " ", "your", " ", "project", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "crisp", "y_", "._", "Field", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "General", " ", "Sett", "ings", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "fields_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "section", "\\u", "registration_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "With", "Help", "Bu", "bble", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sms", "\\u", "case", "\\u", "registration", "\\u", "enable", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "bubble", "\\u", "text_", "=_", "\\u_", "(_", "\"", "Whe", "n", " ", "this", " ", "option", " ", "is", " ", "enable", "d", ",", " ", "a", " ", "person", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "can", " ", "send", " ", "an", " ", "SMS", " ", "int", "o", " ", "the", " ", "system", " ", "say", "ing", " ", "'", "join", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "project", "]'", ",", " ", "where", " ", "[", "project", "]", " ", "is", " ", "your", " ", "project", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "space", " ", "name", ",", " ", "and", " ", "the", " ", "system", " ", "will", " ", "automati", "call", "y", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "create", " ", "a", " ", "case", " ", "tied", " ", "to", " ", "tha", "t", " ", "person", "'", "s", " ", "phone", " ", "number", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "value", ":", " ", "sms", "\\u", "case", "\\u", "registration", "\\u", "enable", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Div_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "With", "Help", "Bu", "bble", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sms", "\\u", "case", "\\u", "registration", "\\u", "type", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "placeholder_", "=_", "\\u_", "(_", "\"", "Enter", " ", "a", " ", "Case", " ", "Type", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "bubble", "\\u", "text_", "=_", "\\u_", "(_", "\"", "Case", "s", " ", "tha", "t", " ", "self", "-", "register", " ", "over", " ", "SMS", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "will", " ", "be", " ", "give", "n", " ", "this", " ", "case", " ", "type", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "With", "Help", "Bu", "bble", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sms", "\\u", "case", "\\u", "registration", "\\u", "owner", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "bubble", "\\u", "text_", "=_", "\\u_", "(_", "\"", "Case", "s", " ", "tha", "t", " ", "self", "-", "register", " ", "over", " ", "SMS", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "will", " ", "be", " ", "owned", " ", "by", " ", "this", " ", "user", " ", "or", " ", "user", " ", "group", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "With", "Help", "Bu", "bble", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sms", "\\u", "case", "\\u", "registration", "\\u", "user", "\\u", "id", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "bubble", "\\u", "text_", "=_", "\\u_", "(_", "\"", "The", " ", "form", " ", "subm", "ission", " ", "for", " ", "a", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "self", "-", "registration", " ", "will", " ", "belo", "ng", " ", "to", " ", "this", " ", "user", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "visi", "ble", ":", " ", "show", "Registration", "Optio", "ns", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "With", "Help", "Bu", "bble", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sms", "\\u", "mobile", "\\u", "worker", "\\u", "registration", "\\u", "enable", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "bubble", "\\u", "text_", "=_", "\\u_", "(_", "\"", "Whe", "n", " ", "this", " ", "option", " ", "is", " ", "enable", "d", ",", " ", "a", " ", "person", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "can", " ", "send", " ", "an", " ", "SMS", " ", "int", "o", " ", "the", " ", "system", " ", "say", "ing", " ", "'", "join", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"[", "project", "]", " ", "worker", " ", "[", "user", "name", "]'", " ", "(", "where", " ", "[", "project", "]", " ", "is", " ", "your", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "project", " ", "space", " ", "and", " ", "[", "user", "name", "]", " ", "is", " ", "an", " ", "option", "al", " ", "user", "name", ")\"_", "\\u\\u\\uNL\\u\\u\\u_", "\",", " ", "and", " ", "the", " ", "system", " ", "will", " ", "add", " ", "them", " ", "as", " ", "a", " ", "mobile", " ", "worker", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "With", "Help", "Bu", "bble", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "registration", "\\u", "welcome", "\\u", "message", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "bubble", "\\u", "text_", "=_", "\\u_", "(_", "\"", "Choose", " ", "whe", "ther", " ", "to", " ", "send", " ", "an", " ", "automati", "c", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "welcome", " ", "message", " ", "to", " ", "case", "s", ",", " ", "mobile", " ", "worker", "s", ",", " ", "or", " ", "bot", "h", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "after", " ", "the", "y", " ", "self", "-", "register", ".", " ", "The", " ", "welcome", " ", "message", " ", "can", " ", "be", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "configur", "ed", " ", "in", " ", "the", " ", "SMS", " ", "language", "s", " ", "and", " ", "translatio", "ns", " ", "page", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"(", "Messag", "ing", " ", "->", " ", "Languages", " ", "->", " ", "Messag", "ing", " ", "Translat", "ion", "s", ").\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "crisp", "y_", "._", "Field", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Registration", " ", "Sett", "ings", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "fields_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "section", "\\u", "chat_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "hq", "crisp", "y_", "._", "B3", "Multi", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Case", " ", "Name", " ", "Display", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Div_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "In", "line", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "use", "\\u", "custom", "\\u", "case", "\\u", "user", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "value", ":", " ", "use", "\\u", "custom", "\\u", "case", "\\u", "user", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "4", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Div_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "In", "line", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "custom", "\\u", "case", "\\u", "user", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "class_", "=_", "\"", "input", "-", "large", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "visi", "ble", ":", " ", "show", "Custom", "Case", "User", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "8", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "bubble", "\\u", "text_", "=_", "\\u_", "(_", "\"", "By", " ", "default", ",", " ", "whe", "n", " ", "chat", "ting", " ", "with", " ", "a", " ", "case", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "the", " ", "chat", " ", "window", " ", "will", " ", "use", " ", "the", " ", "case", "'", "s", " ", "\\\\\"", "name", "\\\\\"", " ", "case", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "property", " ", "whe", "n", " ", "display", "ing", " ", "the", " ", "case", "'", "s", " ", "name", ".", " ", "To", " ", "use", " ", "a", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "different", " ", "case", " ", "property", ",", " ", "speci", "fy", " ", "it", " ", "here", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "id_", "=_", "\"", "custom", "-", "case", "-", "user", "name", "-", "group", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "6", " ", "col", "-", "md", "-", "9", " ", "col", "-", "lg", "-", "9", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hq", "crisp", "y_", "._", "B3", "Multi", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Messag", "e", " ", "Counter", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Div_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "In", "line", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "use", "\\u", "custom", "\\u", "message", "\\u", "count", "\\u", "threshol", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "value", ":", " ", "use", "\\u", "custom", "\\u", "message", "\\u", "count", "\\u", "threshol", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "4", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Div_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "In", "line", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "custom", "\\u", "message", "\\u", "count", "\\u", "threshol", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "class_", "=_", "\"", "input", "-", "large", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "visi", "ble", ":", " ", "show", "Custom", "Messag", "e", "Count", "Thresh", "old", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "8", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "bubble", "\\u", "text_", "=_", "\\u_", "(_", "\"", "The", " ", "chat", " ", "window", " ", "can", " ", "use", " ", "a", " ", "counter", " ", "to", " ", "keep", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "track", " ", "of", " ", "how", " ", "many", " ", "message", "s", " ", "are", " ", "bei", "ng", " ", "sent", " ", "and", " ", "receive", "d", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "and", " ", "highlight", " ", "tha", "t", " ", "number", " ", "after", " ", "a", " ", "cert", "ain", " ", "threshol", "d", " ", "is", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "reache", "d", ".", " ", "By", " ", "default", ",", " ", "the", " ", "counter", " ", "is", " ", "disable", "d", ".", " ", "To", " ", "enable", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "it", ",", " ", "enter", " ", "the", " ", "desi", "red", " ", "threshol", "d", " ", "here", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "id_", "=_", "\"", "custom", "-", "message", "-", "count", "-", "threshol", "d", "-", "group", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "6", " ", "col", "-", "md", "-", "9", " ", "col", "-", "lg", "-", "9", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "With", "Help", "Bu", "bble", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "use", "\\u", "sms", "\\u", "conversation", "\\u", "times", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "value", ":", " ", "use", "\\u", "sms", "\\u", "conversation", "\\u", "times", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "bubble", "\\u", "text_", "=_", "\\u_", "(_", "\"", "Whe", "n", " ", "this", " ", "option", " ", "is", " ", "enable", "d", ",", " ", "the", " ", "system", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "will", " ", "not", " ", "send", " ", "automat", "ed", " ", "SMS", " ", "to", " ", "chat", " ", "recip", "ients", " ", "whe", "n", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "tho", "se", " ", "recip", "ients", " ", "are", " ", "in", " ", "the", " ", "middle", " ", "of", " ", "a", " ", "conversation", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hq", "crisp", "y_", "._", "B3", "Multi", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Hi", "dde", "n", "Field", "With", "Errors_", "(_", "\"", "sms", "\\u", "conversation", "\\u", "times", "\\u", "json", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "value", ":", " ", "sms", "\\u", "conversation", "\\u", "times", "\\u", "json", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Div_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "template", ":", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "name", ":", " ", "'", "ko", "-", "template", "-", "sms", "-", "conversation", "-", "times", "',", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "data", ":", " ", "$", "data", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"}\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "visi", "ble", ":", " ", "show", "SMS", "Conversation", "Times", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label", "\\u", "class_", "=_", "'", "hide", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field", "\\u", "class_", "=_", "'", "col", "-", "md", "-1", "2", " ", "col", "-", "lg", "-1", "0", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Div_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "With", "Help", "Bu", "bble", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sms", "\\u", "conversation", "\\u", "length", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "bubble", "\\u", "text_", "=_", "\\u_", "(_", "\"", "The", " ", "number", " ", "of", " ", "minute", "s", " ", "to", " ", "wait", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "after", " ", "receiv", "ing", " ", "an", " ", "inco", "ming", " ", "SMS", " ", "from", " ", "a", " ", "chat", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "recip", "ient", " ", "bef", "ore", " ", "resum", "ing", " ", "automat", "ed", " ", "SMS", " ", "to", " ", "tha", "t", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "recip", "ient", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "visi", "ble", ":", " ", "show", "SMS", "Conversation", "Times", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "With", "Help", "Bu", "bble", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "survey", "\\u", "traffic", "\\u", "option", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "bubble", "\\u", "text_", "=_", "\\u_", "(_", "\"", "Thi", "s", " ", "option", " ", "allow", "s", " ", "you", " ", "to", " ", "hide", " ", "a", " ", "chat", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "recip", "ient", "'", "s", " ", "survey", " ", "question", "s", " ", "and", " ", "response", "s", " ", "from", " ", "chat", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "windows", ".", " ", "There", " ", "is", " ", "als", "o", " ", "the", " ", "option", " ", "to", " ", "show", " ", "only", " ", "invalid", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "response", "s", " ", "to", " ", "question", "s", " ", "in", " ", "the", " ", "chat", " ", "window", ",", " ", "whi", "ch", " ", "coul", "d", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "be", " ", "atte", "mpt", "s", " ", "to", " ", "conve", "rse", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "With", "Help", "Bu", "bble", "_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "count", "\\u", "message", "s", "\\u", "as", "\\u", "read", "\\u", "by", "\\u", "any", "one", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "bubble", "\\u", "text_", "=_", "\\u_", "(_", "\"", "The", " ", "chat", " ", "window", " ", "will", " ", "mark", " ", "unread", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "message", "s", " ", "to", " ", "the", " ", "user", " ", "viewin", "g", " ", "them", ".", " ", "Us", "e", " ", "this", " ", "option", " ", "to", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "control", " ", "whe", "ther", " ", "a", " ", "message", " ", "count", "s", " ", "as", " ", "bei", "ng", " ", "read", " ", "if", " ", "it", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "is", " ", "read", " ", "by", " ", "any", "one", ",", " ", "or", " ", "if", " ", "it", " ", "count", "s", " ", "as", " ", "bei", "ng", " ", "read", " ", "only", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "to", " ", "the", " ", "user", " ", "who", " ", "reads", " ", "it", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "self_", "._", "\\u", "cch", "q", "\\u", "is", "\\u", "previe", "wer", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "._", "append_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "hq", "crisp", "y_", "._", "B3", "Multi", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Cha", "t", " ", "Templa", "te", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Div_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "In", "line", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "use", "\\u", "custom", "\\u", "chat", "\\u", "template", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "value", ":", " ", "use", "\\u", "custom", "\\u", "chat", "\\u", "template", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "4", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Div_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "In", "line", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "custom", "\\u", "chat", "\\u", "template", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "visi", "ble", ":", " ", "show", "Custom", "Cha", "t", "Templa", "te", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "8", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "bubble", "\\u", "text_", "=_", "\\u_", "(_", "\"", "To", " ", "use", " ", "a", " ", "custom", " ", "template", " ", "to", " ", "render", " ", "the", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "chat", " ", "window", ",", " ", "enter", " ", "it", " ", "here", ".\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "id_", "=_", "\"", "custom", "-", "chat", "-", "template", "-", "group", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "field", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "6", " ", "col", "-", "md", "-", "9", " ", "col", "-", "lg", "-", "9", "'_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "crisp", "y_", "._", "Field", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Cha", "t", " ", "Sett", "ings", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "fields_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "data_", "=_", "None_", ",_", "cch", "q", "\\u", "domain_", "=_", "None_", ",_", "cch", "q", "\\u", "is", "\\u", "previe", "wer", "_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "\\u", "cch", "q", "\\u", "domain_", "=_", "cch", "q", "\\u", "domain_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cch", "q", "\\u", "is", "\\u", "previe", "wer", "_", "=_", "cch", "q", "\\u", "is", "\\u", "previe", "wer", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Sett", "ings", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "data_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "populate", "\\u", "dynami", "c\\u", "choices_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "helper_", "=_", "Form", "Helper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "form", "\\u", "class_", "=_", "\"", "form", " ", "form", "-", "horizon", "tal", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "label", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "2", " ", "col", "-", "md", "-", "2", " ", "col", "-", "lg", "-", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "field", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "2", " ", "col", "-", "md", "-", "3", " ", "col", "-", "lg", "-", "3", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "layout_", "=_", "crisp", "y_", "._", "Layout_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "section", "\\u", "general_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "section", "\\u", "registration_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "section", "\\u", "chat_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hq", "crisp", "y_", "._", "Form", "Actions_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tw", "bsc", "ris", "py_", "._", "Stri", "ct", "Button_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Save", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "submit", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "class_", "=_", "\"", "btn", "-", "primary", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "restrict", "ed", "\\u", "sms", "\\u", "times", "\\u", "widget", "\\u", "context_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "template", "\\u", "name", "\"_", ":_", "\"", "ko", "-", "template", "-", "restrict", "ed", "-", "sms", "-", "times", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "expl", "anat", "ion", "\\u", "text", "\"_", ":_", "\\u_", "(_", "\"", "SMS", " ", "will", " ", "only", " ", "be", " ", "sent", " ", "whe", "n", " ", "any", " ", "of", " ", "the", " ", "follow", "ing", " ", "is", " ", "true", ":\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ko", "\\u", "array", "\\u", "name", "\"_", ":_", "\"", "restrict", "ed", "\\u", "sms", "\\u", "times", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "remove", "\\u", "window", "\\u", "method", "\"_", ":_", "\"$", "parent", ".", "remove", "Restrict", "ed", "SMS", "Time", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "add", "\\u", "window", "\\u", "method", "\"_", ":_", "\"", "add", "Restrict", "ed", "SMS", "Time", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sms", "\\u", "conversation", "\\u", "times", "\\u", "widget", "\\u", "context_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "template", "\\u", "name", "\"_", ":_", "\"", "ko", "-", "template", "-", "sms", "-", "conversation", "-", "times", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "expl", "anat", "ion", "\\u", "text", "\"_", ":_", "\\u_", "(_", "\"", "Automat", "ed", " ", "SMS", " ", "will", " ", "be", " ", "suppress", "ed", " ", "dur", "ing", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "chat", " ", "conversations", " ", "whe", "n", " ", "any", " ", "of", " ", "the", " ", "follow", "ing", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "is", " ", "true", ":\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "ko", "\\u", "array", "\\u", "name", "\"_", ":_", "\"", "sms", "\\u", "conversation", "\\u", "times", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "remove", "\\u", "window", "\\u", "method", "\"_", ":_", "\"$", "parent", ".", "remove", "SMS", "Conversation", "Time", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "add", "\\u", "window", "\\u", "method", "\"_", ":_", "\"", "add", "SMS", "Conversation", "Time", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "enable", "\\u", "registration", "\\u", "welcome", "\\u", "sms", "\\u", "for", "\\u", "case_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "'", "registration", "\\u", "welcome", "\\u", "message", "'_", ")_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "WEL", "COM", "E", "\\u", "RECIP", "IENT", "\\u", "CASE", "_", ",_", "WEL", "COM", "E", "\\u", "RECIP", "IENT", "\\u", "ALL_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "enable", "\\u", "registration", "\\u", "welcome", "\\u", "sms", "\\u", "for", "\\u", "mobile", "\\u", "worker_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "'", "registration", "\\u", "welcome", "\\u", "message", "'_", ")_", "in_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "WEL", "COM", "E", "\\u", "RECIP", "IENT", "\\u", "MOB", "ILE", "\\u", "WORKER", "_", ",_", "WEL", "COM", "E", "\\u", "RECIP", "IENT", "\\u", "ALL_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\u\\u\\uNL\\u\\u\\u_", "\\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", "values_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "current", "\\u", "values_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "field", "\\u", "name_", "in_", "self_", "._", "fields_", "._", "keys_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "[_", "field", "\\u", "name_", "]_", "._", "value_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "field", "\\u", "name_", "in_", "[_", "\"", "restrict", "ed", "\\u", "sms", "\\u", "times", "\\u", "json", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sms", "\\u", "conversation", "\\u", "times", "\\u", "json", "\"_", "]_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "value_", ",_", "basestring_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "current", "\\u", "values_", "[_", "field", "\\u", "name_", "]_", "=_", "json_", "._", "loads_", "(_", "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 ", " ", "_", "current", "\\u", "values_", "[_", "field", "\\u", "name_", "]_", "=_", "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 ", " _", "current", "\\u", "values_", "[_", "field", "\\u", "name_", "]_", "=_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "current", "\\u", "values_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "populate", "\\u", "dynami", "c\\u", "choices_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "groups_", "=_", "Group_", "._", "get", "\\u", "case", "\\u", "shar", "ing", "\\u", "groups_", "(_", "self_", "._", "\\u", "cch", "q", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "users_", "=_", "Comm", "Care", "User_", "._", "by", "\\u", "domain_", "(_", "self_", "._", "\\u", "cch", "q", "\\u", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "domain", "\\u", "group", "\\u", "choices_", "=_", "[_", "(_", "group_", "._", "\\u", "id_", ",_", "group_", "._", "name_", ")_", "for_", "group_", "in_", "groups_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain", "\\u", "user", "\\u", "choices_", "=_", "[_", "(_", "user_", "._", "\\u", "id_", ",_", "user_", "._", "raw", "\\u", "username_", ")_", "for_", "user_", "in_", "users_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "domain", "\\u", "owner", "\\u", "choices_", "=_", "domain", "\\u", "group", "\\u", "choices_", "+_", "domain", "\\u", "user", "\\u", "choices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "choose_", "=_", "[_", "(_", "\"\"_", ",_", "\\u_", "(_", "\"(", "Choose", ")\"_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "\"", "sms", "\\u", "case", "\\u", "registration", "\\u", "owner", "\\u", "id", "\"_", "]_", "._", "choices_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "choose_", "+_", "domain", "\\u", "owner", "\\u", "choices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "\"", "sms", "\\u", "case", "\\u", "registration", "\\u", "user", "\\u", "id", "\"_", "]_", "._", "choices_", "=_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "choose_", "+_", "domain", "\\u", "user", "\\u", "choices_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "\\u", "clean", "\\u", "dependent", "\\u", "field_", "(_", "self_", ",_", "bool\\u", "field_", ",_", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "bool\\u", "field_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "field_", ",_", "None_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "Thi", "s", " ", "field", " ", "is", " ", "require", "d", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "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_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "def_", "clean", "\\u", "use", "\\u", "default", "\\u", "sms", "\\u", "response_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "use", "\\u", "default", "\\u", "sms", "\\u", "response", "\"_", ")_", "==_", "ENABLED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "clean", "\\u", "default", "\\u", "sms", "\\u", "response_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "clean", "\\u", "dependent", "\\u", "field_", "(_", "\"", "use", "\\u", "default", "\\u", "sms", "\\u", "response", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "default", "\\u", "sms", "\\u", "response", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "clean", "\\u", "use", "\\u", "custom", "\\u", "case", "\\u", "username_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "use", "\\u", "custom", "\\u", "case", "\\u", "user", "name", "\"_", ")_", "==_", "CUSTOM", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "clean", "\\u", "custom", "\\u", "case", "\\u", "username_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "clean", "\\u", "dependent", "\\u", "field_", "(_", "\"", "use", "\\u", "custom", "\\u", "case", "\\u", "user", "name", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "custom", "\\u", "case", "\\u", "user", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "clean", "\\u", "use", "\\u", "custom", "\\u", "message", "\\u", "count", "\\u", "threshold_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "use", "\\u", "custom", "\\u", "message", "\\u", "count", "\\u", "threshol", "d", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "==_", "CUSTOM", "_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "clean", "\\u", "custom", "\\u", "message", "\\u", "count", "\\u", "threshold_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "\\u", "clean", "\\u", "dependent", "\\u", "field_", "(_", "\"", "use", "\\u", "custom", "\\u", "message", "\\u", "count", "\\u", "threshol", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "custom", "\\u", "message", "\\u", "count", "\\u", "threshol", "d", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", "and_", "value_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "Ple", "ase", " ", "enter", " ", "a", " ", "posit", "ive", " ", "number", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "clean", "\\u", "use", "\\u", "custom", "\\u", "chat", "\\u", "template_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "cch", "q", "\\u", "is", "\\u", "previe", "wer", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "use", "\\u", "custom", "\\u", "chat", "\\u", "template", "\"_", ")_", "==_", "CUSTOM", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "clean", "\\u", "custom", "\\u", "chat", "\\u", "template_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "\\u", "cch", "q", "\\u", "is", "\\u", "previe", "wer", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "value_", "=_", "self_", "._", "\\u", "clean", "\\u", "dependent", "\\u", "field_", "(_", "\"", "use", "\\u", "custom", "\\u", "chat", "\\u", "template", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "custom", "\\u", "chat", "\\u", "template", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", "and_", "value_", "not_", "in_", "settings_", "._", "CUSTOM", "\\u", "CHAT", "\\u", "TEMPLATES_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "Un", "know", "n", " ", "custom", " ", "template", " ", "identifi", "er", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "\\u", "clean", "\\u", "time", "\\u", "window", "\\u", "json_", "(_", "self_", ",_", "field", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "time", "\\u", "window", "\\u", "json_", "=_", "json_", "._", "loads_", "(_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "field", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Value", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "An", " ", "error", " ", "has", " ", "occur", "red", ".", " ", "Ple", "ase", " ", "try", " ", "again", ",", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "and", " ", "if", " ", "the", " ", "problem", " ", "persist", "s", ",", " ", "plea", "se", " ", "report", " ", "an", " ", "issue", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "window_", "in_", "time", "\\u", "window", "\\u", "json_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "day_", "=_", "window_", "._", "get_", "(_", "\"", "day", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "start", "\\u", "time_", "=_", "window_", "._", "get_", "(_", "\"", "start", "\\u", "time", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "time_", "=_", "window_", "._", "get_", "(_", "\"", "end", "\\u", "time", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "time", "\\u", "input", "\\u", "relationship_", "=_", "window_", "._", "get_", "(_", "\"", "time", "\\u", "input", "\\u", "relation", "ship", "\"_", ")_", "\\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 ", " _", "day_", "=_", "int_", "(_", "day_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "assert_", "day_", ">=_", "-_", "1_", "and_", "day_", "<=_", "6_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Assert", "ion", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "Inva", "lid", " ", "day", " ", "chosen", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "time", "\\u", "input", "\\u", "relationship_", "==_", "TIME", "\\u", "BEFORE", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "end", "\\u", "time_", "=_", "validat", "e\\u", "time_", "(_", "end", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "Day", "Time", "Window_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "day_", "=_", "day_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "time_", "=_", "None_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "\\u", "time_", "=_", "end", "\\u", "time_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "time", "\\u", "input", "\\u", "relationship_", "==_", "TIME", "\\u", "AFTER", "_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "start", "\\u", "time_", "=_", "validat", "e\\u", "time_", "(_", "start", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "result_", "._", "append_", "(_", "Day", "Time", "Window_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "day_", "=_", "day_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "time_", "=_", "start", "\\u", "time_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "\\u", "time_", "=_", "None_", ",_", "\\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 ", " _", "start", "\\u", "time_", "=_", "validat", "e\\u", "time_", "(_", "start", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "end", "\\u", "time_", "=_", "validat", "e\\u", "time_", "(_", "end", "\\u", "time_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "start", "\\u", "time_", ">=_", "end", "\\u", "time_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " ", "_", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "End", " ", "time", " ", "must", " ", "come", " ", "after", " ", "start", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "time", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "result_", "._", "append_", "(_", "Day", "Time", "Window_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "day_", "=_", "day_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "start", "\\u", "time_", "=_", "start", "\\u", "time_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "end", "\\u", "time_", "=_", "end", "\\u", "time_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "result_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "clean", "\\u", "use", "\\u", "restrict", "ed", "\\u", "sms", "\\u", "times_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "use", "\\u", "restrict", "ed", "\\u", "sms", "\\u", "times", "\"_", ")_", "==_", "ENABLED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "clean", "\\u", "restrict", "ed", "\\u", "sms", "\\u", "times", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "use", "\\u", "restrict", "ed", "\\u", "sms", "\\u", "times", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "clean", "\\u", "time", "\\u", "window", "\\u", "json_", "(_", "\"", "restrict", "ed", "\\u", "sms", "\\u", "times", "\\u", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "def_", "clean", "\\u", "use", "\\u", "sms", "\\u", "conversation", "\\u", "times_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "use", "\\u", "sms", "\\u", "conversation", "\\u", "times", "\"_", ")_", "==_", "ENABLED_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "clean", "\\u", "sms", "\\u", "conversation", "\\u", "times", "\\u", "json_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "use", "\\u", "sms", "\\u", "conversation", "\\u", "times", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "clean", "\\u", "time", "\\u", "window", "\\u", "json_", "(_", "\"", "sms", "\\u", "conversation", "\\u", "times", "\\u", "json", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "def_", "clean", "\\u", "send", "\\u", "to", "\\u", "duplicated", "\\u", "case", "\\u", "numbers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "send", "\\u", "to", "\\u", "duplicated", "\\u", "case", "\\u", "numbers", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "==_", "ENABLED_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "clean", "\\u", "count", "\\u", "message", "s", "\\u", "as", "\\u", "read", "\\u", "by", "\\u", "any", "one_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "count", "\\u", "message", "s", "\\u", "as", "\\u", "read", "\\u", "by", "\\u", "any", "one", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "==_", "ENABLED_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "clean", "\\u", "sms", "\\u", "case", "\\u", "registration", "\\u", "enabled_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "sms", "\\u", "case", "\\u", "registration", "\\u", "enable", "d", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "==_", "ENABLED_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "clean", "\\u", "sms", "\\u", "case", "\\u", "registration", "\\u", "type_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "clean", "\\u", "dependent", "\\u", "field_", "(_", "\"", "sms", "\\u", "case", "\\u", "registration", "\\u", "enable", "d", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "sms", "\\u", "case", "\\u", "registration", "\\u", "type", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "\\u", "clean", "\\u", "registration", "\\u", "id", "\\u", "field_", "(_", "self_", ",_", "field", "\\u", "name_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "sms", "\\u", "case", "\\u", "registration", "\\u", "enable", "d", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "field", "\\u", "name_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "Thi", "s", " ", "field", " ", "is", " ", "require", "d", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ot", "her", "wis", "e", ",", " ", "the", " ", "Choi", "ce", "Field", " ", "automati", "call", "y", " ", "validates", " ", "tha", "t", " ", "it", " ", "is_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "in", " ", "the", " ", "list", " ", "tha", "t", " ", "is", " ", "dynami", "call", "y", " ", "populate", "d", " ", "in", " ", "\\u\\u", "init\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "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_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "def_", "clean", "\\u", "sms", "\\u", "case", "\\u", "registration", "\\u", "owner", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "clean", "\\u", "registration", "\\u", "id", "\\u", "field_", "(_", "\"", "sms", "\\u", "case", "\\u", "registration", "\\u", "owner", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "clean", "\\u", "sms", "\\u", "case", "\\u", "registration", "\\u", "user", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "clean", "\\u", "registration", "\\u", "id", "\\u", "field_", "(_", "\"", "sms", "\\u", "case", "\\u", "registration", "\\u", "user", "\\u", "id", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "clean", "\\u", "sms", "\\u", "mobile", "\\u", "worker", "\\u", "registration", "\\u", "enabled_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "(_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "sms", "\\u", "mobile", "\\u", "worker", "\\u", "registration", "\\u", "enable", "d", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "==_", "ENABLED_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sett", "ings", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "General", " ", "Settings_", "\\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_", "clean", "\\u", "sms", "\\u", "conversation", "\\u", "length_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Ju", "st", " ", "cast", " ", "to", " ", "int", ",", " ", "the", " ", "Choi", "ce", "Field", " ", "will", " ", "validat", "e", " ", "tha", "t", " ", "it", " ", "is", " ", "an", " ", "integer_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "int_", "(_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "sms", "\\u", "conversation", "\\u", "length", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Back", "end", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u", "cch", "q", "\\u", "domain_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "cch", "q", "\\u", "back", "end", "\\u", "id_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "name_", "=_", "Char", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Name", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "description_", "=_", "Char", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Descripti", "on", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "forms_", "._", "Textarea_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "give", "\\u", "other", "\\u", "domains", "\\u", "access_", "=_", "Boo", "lean", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Give", " ", "other", " ", "domains", " ", "access", ".\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "authoriz", "ed", "\\u", "domains_", "=_", "Char", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "List", " ", "of", " ", "authoriz", "ed", " ", "domains", "\"_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "repl", "y", "\\u", "to", "\\u", "phone", "\\u", "number_", "=_", "Char", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "noop_", "(_", "\"", "Repl", "y", "-", "To", " ", "Phone", " ", "Number", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Back", "end", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "property_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "is", "\\u", "global", "\\u", "backend_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "self_", "._", "\\u", "cch", "q", "\\u", "domain_", "is_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Form_", "(_", "Form_", ")_", ":_", "\\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_", "genera", "l\\u", "fields_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "=_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Field_", "(_", "'", "name", "'_", ",_", "css", "\\u", "class_", "=_", "'", "input", "-", "xx", "large", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Field_", "(_", "'", "description", "'_", ",_", "css", "\\u", "class_", "=_", "'", "input", "-", "xx", "large", "'_", ",_", "rows_", "=_", "\"", "3", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Field_", "(_", "'", "repl", "y", "\\u", "to", "\\u", "phone", "\\u", "number", "'_", ",_", "css", "\\u", "class_", "=_", "'", "input", "-", "xx", "large", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "not_", "self_", "._", "is", "\\u", "global", "\\u", "backend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "fields_", "._", "extend_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tw", "bsc", "ris", "py_", "._", "Prep", "ende", "d", "Text_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "give", "\\u", "other", "\\u", "domains", "\\u", "access", "'_", ",_", "''_", ",_", "data\\u", "bind_", "=_", "\"", "checke", "d", ":", " ", "share", "\\u", "back", "end", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Div_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "authoriz", "ed", "\\u", "domains", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "visi", "ble", ":", " ", "show", "Authorized", "Doma", "ins", "\"_", ",_", "\\u\\u\\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_", "return_", "fields_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "button", "\\u", "text_", "=_", "kwargs_", "._", "pop_", "(_", "'", "button", "\\u", "text", "'_", ",_", "\\u_", "(_", "\"", "Creat", "e", " ", "SMS", " ", "Gat", "ewa", "y", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cch", "q", "\\u", "domain_", "=_", "kwargs_", "._", "pop_", "(_", "'", "domain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "\\u", "cch", "q", "\\u", "back", "end", "\\u", "id_", "=_", "kwargs_", "._", "pop_", "(_", "'", "back", "end", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Back", "end", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "=_", "Form", "Helper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "form", "\\u", "class_", "=_", "'", "form", " ", "form", "-", "horizon", "tal", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "label", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "3", " ", "col", "-", "md", "-", "4", " ", "col", "-", "lg", "-", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "field", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "9", " ", "col", "-", "md", "-", "8", " ", "col", "-", "lg", "-", "6", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "form", "\\u", "method_", "=_", "'", "POST", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "layout_", "=_", "crisp", "y_", "._", "Layout_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Field", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "General", " ", "Sett", "ings", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "*_", "self_", "._", "genera", "l\\u", "fields_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "gateway", "\\u", "specific", "\\u", "fields_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Field", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Phone", " ", "Number", "s", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Div_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "template", ":", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "name", ":", " ", "'", "ko", "-", "load", "-", "balancing", "-", "template", "',", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "data", ":", " ", "$", "data", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"}\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "visi", "ble", ":", " ", "use", "\\u", "load", "\\u", "balancing", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hq", "crisp", "y_", "._", "Form", "Actions_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Stri", "ct", "Button_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "button", "\\u", "text_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "submit", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "class_", "=_", "'", "btn", "-", "primary", "'_", "\\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_", "Back", "end", "Form_", "(_", "Form_", ")_", ":_", "\\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_", "gateway", "\\u", "specific", "\\u", "fields_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "crisp", "y_", "._", "Div_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean", "\\u", "name_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "name", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "._", "strip_", "(_", ")_", "._", "upper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "value_", "is_", "None_", "or_", "value_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "Thi", "s", " ", "field", " ", "is", " ", "require", "d", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "re_", "._", "compile_", "(_", "\"\\\\", "s", "\"_", ")_", "._", "search_", "(_", "value_", ")_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "Name", " ", "may", " ", "not", " ", "contain", " ", "any", " ", "space", "s", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "self_", "._", "is", "\\u", "global", "\\u", "backend_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", "'", "re", " ", "usi", "ng", " ", "the", " ", "form", " ", "to", " ", "create", " ", "a", " ", "global", " ", "back", "end", ",", " ", "so_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ensure", " ", "name", " ", "is", " ", "not", " ", "duplicated", " ", "amo", "ng", " ", "other", " ", "global", " ", "backends_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "unique_", "=_", "SQL", "Mob", "ile", "Backend_", "._", "name", "\\u", "is", "\\u", "unique_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "back", "end", "\\u", "id_", "=_", "self_", "._", "\\u", "cch", "q", "\\u", "back", "end", "\\u", "id_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "We", "'", "re", " ", "usi", "ng", " ", "the", " ", "form", " ", "to", " ", "create", " ", "a", " ", "domain", "-", "level", " ", "back", "end", ",", " ", "so_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "ensure", " ", "name", " ", "is", " ", "not", " ", "duplicated", " ", "amo", "ng", " ", "other", " ", "back", "ends", " ", "owned", " ", "by", " ", "this", " ", "domain_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "is", "\\u", "unique_", "=_", "SQL", "Mob", "ile", "Backend_", "._", "name", "\\u", "is", "\\u", "unique_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "value_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "domain_", "=_", "self_", "._", "\\u", "cch", "q", "\\u", "domain_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "back", "end", "\\u", "id_", "=_", "self_", "._", "\\u", "cch", "q", "\\u", "back", "end", "\\u", "id_", "\\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_", "not_", "is", "\\u", "unique_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "Name", " ", "is", " ", "alr", "ead", "y", " ", "in", " ", "use", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean", "\\u", "authoriz", "ed", "\\u", "domains_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "not_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "give", "\\u", "other", "\\u", "domains", "\\u", "access", "\"_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "authoriz", "ed", "\\u", "domains", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", "or_", "value_", "._", "strip_", "(_", ")_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "[_", "domain_", "._", "strip_", "(_", ")_", "for_", "domain_", "in_", "value_", "._", "split_", "(_", "\",\"_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Form_", "(_", "Form_", ")_", ":_", "\\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_", "clean", "\\u", "repl", "y", "\\u", "to", "\\u", "phone", "\\u", "number_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "repl", "y", "\\u", "to", "\\u", "phone", "\\u", "number", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "is_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "value_", "._", "strip_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "value_", "==_", "\"\"_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Back", "end", "Map", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "catch", "all", "\\u", "back", "end", "\\u", "id_", "=_", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "lazy_", "(_", "\"", "Catch", "-", "All", " ", "Gat", "ewa", "y", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "back", "end", "\\u", "map_", "=_", "Char", "Field_", "(_", "required_", "=_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\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_", "Back", "end", "Map", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "backends_", "=_", "kwargs_", "._", "pop_", "(_", "'", "back", "ends", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Back", "end", "Map", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "catch", "all", "\\u", "choices_", "(_", "backends_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "setup", "\\u", "crisp", "y_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Map", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "set\\u", "catch", "all", "\\u", "choices_", "(_", "self_", ",_", "backends_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "back", "end", "\\u", "choices_", "=_", "[_", "(_", "''_", ",_", "\\u_", "(_", "\"(", "none", ")\"_", ")_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "back", "end", "\\u", "choices_", "._", "extend_", "(_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "(_", "backend_", "._", "pk_", ",_", "backend_", "._", "name_", ")_", "for_", "backend_", "in_", "backends_", "\\u\\u\\uNL\\u\\u\\u_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "catch", "all", "\\u", "back", "end", "\\u", "id", "'_", "]_", "._", "choices_", "=_", "back", "end", "\\u", "choices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Map", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "setup", "\\u", "crisp", "y_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "helper_", "=_", "Form", "Helper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "form", "\\u", "class_", "=_", "'", "form", " ", "form", "-", "horizon", "tal", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "label", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "2", " ", "col", "-", "md", "-", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "field", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "5", " ", "col", "-", "md", "-", "5", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "form", "\\u", "method_", "=_", "'", "POST", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "layout_", "=_", "crisp", "y_", "._", "Layout_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Field", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Default", " ", "Gat", "ewa", "ys", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hq", "crisp", "y_", "._", "B3", "Multi", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Default", " ", "Gat", "ewa", "y", " ", "by", " ", "Pref", "ix", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Error", "s", "On", "ly", "Field_", "(_", "'", "back", "end", "\\u", "map", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Div_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "data\\u", "bind_", "=_", "\"", "template", ":", " ", "{\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "name", ":", " ", "'", "ko", "-", "template", "-", "back", "end", "-", "map", "',", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", " ", "data", ":", " ", "$", "data", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"}\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "catch", "all", "\\u", "back", "end", "\\u", "id", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hq", "crisp", "y_", "._", "Form", "Actions_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Stri", "ct", "Button_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Save", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "submit", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "class_", "=_", "'", "btn", "-", "primary", "'_", "\\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_", "Back", "end", "Map", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "clean", "\\u", "prefix_", "(_", "self_", ",_", "prefix_", ")_", ":_", "\\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 ", " _", "prefix_", "=_", "int_", "(_", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prefix_", "<=_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Value", "Error_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "Ple", "ase", " ", "enter", " ", "a", " ", "posit", "ive", " ", "number", " ", "for", " ", "the", " ", "prefix", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "str_", "(_", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Map", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "clean", "\\u", "back", "end", "\\u", "id_", "(_", "self_", ",_", "back", "end", "\\u", "id_", ")_", ":_", "\\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 ", " _", "back", "end", "\\u", "id_", "=_", "int_", "(_", "back", "end", "\\u", "id_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "(_", "Value", "Error_", ",_", "Type", "Error_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "Inva", "lid", " ", "Back", "end", " ", "Specifie", "d", ".\"_", ")_", ")_", "\\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 ", " _", "backend_", "=_", "SQL", "Mob", "ile", "Backend_", "._", "load_", "(_", "back", "end", "\\u", "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 ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "Inva", "lid", " ", "Back", "end", " ", "Specifie", "d", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "backend_", "._", "deleted_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "not_", "backend_", "._", "is", "\\u", "global_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "backend_", "._", "back", "end", "\\u", "type_", "!=_", "SQL", "Mob", "ile", "Backend_", "._", "SMS", "_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "Inva", "lid", " ", "Back", "end", " ", "Specifie", "d", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "back", "end", "\\u", "id_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Map", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean", "\\u", "back", "end", "\\u", "map_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "'", "back", "end", "\\u", "map", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "json_", "._", "loads_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "An", " ", "unexpected", " ", "error", " ", "occur", "red", ".", " ", "Ple", "ase", " ", "relo", "ad", " ", "and", " ", "try", " ", "again", "\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "clean", "ed", "\\u", "value_", "=_", "{_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "mapping_", "in_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "prefix_", "=_", "self_", "._", "\\u", "clean", "\\u", "prefix_", "(_", "mapping_", "._", "get_", "(_", "'", "prefix", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "prefix_", "in_", "clean", "ed", "\\u", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "Pref", "ix", " ", "is", " ", "specified", " ", "twi", "ce", ":", " ", "%", "s", "\"_", ")_", "%_", "prefix_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "clean", "ed", "\\u", "value_", "[_", "prefix_", "]_", "=_", "self_", "._", "\\u", "clean", "\\u", "back", "end", "\\u", "id_", "(_", "mapping_", "._", "get_", "(_", "'", "back", "end", "\\u", "id", "'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "clean", "ed", "\\u", "value_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Back", "end", "Map", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean", "\\u", "catch", "all", "\\u", "back", "end", "\\u", "id_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "'", "catch", "all", "\\u", "back", "end", "\\u", "id", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "value_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "self_", "._", "\\u", "clean", "\\u", "back", "end", "\\u", "id_", "(_", "value_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Sen", "d", "Registration", "Inv", "iation", "s", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "phone", "\\u", "numbers_", "=_", "Trim", "med", "Char", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "lazy_", "(_", "\"", "Phone", " ", "Number", "(", "s", ")\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "forms_", "._", "Textarea_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "app", "\\u", "id_", "=_", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "lazy_", "(_", "\"", "Applica", "tion", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "True_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "action_", "=_", "Char", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "initial_", "=_", "'", "invite", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "forms_", "._", "Hi", "dde", "n", "Input_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Sen", "d", "Registration", "Inv", "iation", "s", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "set\\u", "app", "\\u", "id", "\\u", "choices_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "app", "\\u", "ids_", "=_", "get", "\\u", "bui", "lt", "\\u", "app", "\\u", "ids_", "(_", "self_", "._", "domain_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "choices_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "app", "\\u", "doc_", "in_", "iter", "\\u", "docs_", "(_", "Application_", "._", "get", "\\u", "db_", "(_", ")_", ",_", "app", "\\u", "ids_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Thi", "s", " ", "will", " ", "return", " ", "bot", "h", " ", "Applica", "tion", " ", "and", " ", "Remo", "te", "App", " ", "docs", ",", " ", "but", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "the", "y", " ", "bot", "h", " ", "have", " ", "a", " ", "name", " ", "attribute_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "choices_", "._", "append_", "(_", "(_", "app", "\\u", "doc_", "[_", "'\\u", "id", "'_", "]_", ",_", "app", "\\u", "doc_", "[_", "'", "name", "'_", "]_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "choices_", "._", "sort_", "(_", "key_", "=_", "lambda_", "x_", ":_", "x_", "[_", "1_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "app", "\\u", "id", "'_", "]_", "._", "choices_", "=_", "choices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sen", "d", "Registration", "Inv", "iation", "s", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "'", "domain", "'_", "not_", "in_", "kwargs_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Exception_", "(_", "'", "Expect", "ed", " ", "kwarg", "s", ":", " ", "domain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "domain_", "=_", "kwargs_", "._", "pop_", "(_", "'", "domain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "super_", "(_", "Sen", "d", "Registration", "Inv", "iation", "s", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set\\u", "app", "\\u", "id", "\\u", "choices_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "helper_", "=_", "Form", "Helper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "form", "\\u", "class_", "=_", "\"", "form", " ", "form", "-", "horizon", "tal", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "layout_", "=_", "crisp", "y_", "._", "Layout_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Field", "set", "Acco", "rdi", "on", "Group_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Sen", "d", " ", "Registration", " ", "Invitation", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Field_", "(_", "'", "app", "\\u", "id", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "'", "phone", "\\u", "numbers", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "placeholder_", "=_", "\\u_", "(_", "\"", "Enter", " ", "phone", " ", "number", "(", "s", ")", " ", "in", " ", "international", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "format", ".", " ", "Exam", "ple", ":", " ", "+", "27.", "..", ",", " ", "+", "91.", "..", ",\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "In", "line", "Field_", "(_", "'", "action", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Form", "Actions_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "Stri", "ct", "Button_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Sen", "d", " ", "Invitation", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "submit", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "class_", "=_", "\"", "btn", "-", "primary", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "active_", "=_", "len_", "(_", "args_", ")_", ">_", "0_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Sen", "d", "Registration", "Inv", "iation", "s", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "clean", "\\u", "phone", "\\u", "numbers_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "value_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "'", "phone", "\\u", "numbers", "'_", ",_", "''_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phone", "\\u", "list_", "=_", "[_", "strip", "\\u", "plus_", "(_", "s_", "._", "strip_", "(_", ")_", ")_", "for_", "s_", "in_", "value_", "._", "split_", "(_", "','_", ")_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "phone", "\\u", "list_", "=_", "[_", "phone_", "for_", "phone_", "in_", "phone", "\\u", "list_", "if_", "phone_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "len_", "(_", "phone", "\\u", "list_", ")_", "==_", "0_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "raise_", "Validat", "ion", "Error_", "(_", "\\u_", "(_", "\"", "Thi", "s", " ", "field", " ", "is", " ", "require", "d", ".\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "for_", "phone", "\\u", "number_", "in_", "phone", "\\u", "list_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "validat", "e\\u", "phone", "\\u", "number_", "(_", "phone", "\\u", "number_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "list_", "(_", "set_", "(_", "phone", "\\u", "list_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Initiat", "e", "Add", "SMS", "Back", "end", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "action_", "=_", "Char", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "initial_", "=_", "'", "new", "\\u", "back", "end", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "widget_", "=_", "forms_", "._", "Hi", "dde", "n", "Input_", "(_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "hq", "\\u", "api", "\\u", "id_", "=_", "Choi", "ce", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "\"", "Gat", "ewa", "y", " ", "Type", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Initiat", "e", "Add", "SMS", "Back", "end", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "is", "\\u", "superuser_", "=_", "False_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Initiat", "e", "Add", "SMS", "Back", "end", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "core", "hq", "_", "._", "messaging_", "._", "sms", "backends_", "._", "tele", "rive", "t_", "._", "models_", "import_", "SQL", "Tele", "rive", "t", "Backend_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "back", "end", "\\u", "classes_", "=_", "get", "\\u", "sms", "\\u", "back", "end", "\\u", "classes_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "back", "end", "\\u", "choices_", "=_", "[_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "for_", "api", "\\u", "id_", ",_", "klass_", "in_", "back", "end", "\\u", "classes_", "._", "items_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "is", "\\u", "superuser_", "or_", "api", "\\u", "id_", "==_", "SQL", "Tele", "rive", "t", "Backend_", "._", "get", "\\u", "api", "\\u", "id_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "frie", "ndl", "y", "\\u", "name_", "=_", "klass_", "._", "get", "\\u", "gener", "ic", "\\u", "name_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "back", "end", "\\u", "choices_", "._", "append_", "(_", "(_", "api", "\\u", "id_", ",_", "frie", "ndl", "y", "\\u", "name_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "self_", "._", "fields_", "[_", "'", "hq", "\\u", "api", "\\u", "id", "'_", "]_", "._", "choices_", "=_", "back", "end", "\\u", "choices_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "helper_", "=_", "Form", "Helper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "label", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "3", " ", "col", "-", "md", "-", "4", " ", "col", "-", "lg", "-", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "field", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "9", " ", "col", "-", "md", "-", "8", " ", "col", "-", "lg", "-", "6", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "form", "\\u", "class_", "=_", "\"", "form", " ", "form", "-", "horizon", "tal", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "layout_", "=_", "crisp", "y_", "._", "Layout_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "hq", "crisp", "y_", "._", "B3", "Multi", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Creat", "e", " ", "Ano", "ther", " ", "Gat", "ewa", "y", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "In", "line", "Field_", "(_", "'", "action", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Div_", "(_", "In", "line", "Field_", "(_", "'", "hq", "\\u", "api", "\\u", "id", "'_", ")_", ",_", "css", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "6", " ", "col", "-", "md", "-", "6", " ", "col", "-", "lg", "-", "4", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Div_", "(_", "Stri", "ct", "Button_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "mark", "\\u", "safe_", "(_", "'<", "i", " ", "class", "=\"", "fa", " ", "fa", "-", "plus", "\">", "</", "i", ">", " ", "Add", " ", "Ano", "ther", " ", "Gat", "ewa", "y", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "class_", "=_", "'", "btn", "-", "success", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "'", "submit", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "style_", "=_", "\"", "marg", "in", "-", "left", ":", "5", "px", ";\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "css", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "3", " ", "col", "-", "md", "-", "2", " ", "col", "-", "lg", "-", "2", "'_", ")_", ",_", "\\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_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Subscrib", "e", "SMS", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "stock", "\\u", "out", "\\u", "facilit", "ies_", "=_", "Boo", "lean", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "lazy_", "(_", "\"", "Receive", " ", "stock", "out", " ", "facilit", "ies", " ", "SMS", " ", "alert", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "text_", "=_", "uge", "ttext", "\\u", "lazy_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Thi", "s", " ", "will", " ", "alert", " ", "you", " ", "with", " ", "specific", " ", "users", "/", "facilit", "ies", " ", "tha", "t", " ", "are", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stock", "ed", " ", "out", " ", "of", " ", "your", " ", "commod", "iti", "es", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stock", "\\u", "out", "\\u", "commod", "ities_", "=_", "Boo", "lean", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "lazy_", "(_", "\"", "Receive", " ", "stock", "out", " ", "commod", "iti", "es", " ", "SMS", " ", "alert", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "text_", "=_", "uge", "ttext", "\\u", "lazy_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Thi", "s", " ", "will", " ", "alert", " ", "you", " ", "with", " ", "specific", " ", "commod", "iti", "es", " ", "tha", "t", " ", "are", " ", "stock", "ed", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "out", " ", "by", " ", "your", " ", "users", "/", "facilit", "ies", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "stock", "\\u", "out", "\\u", "rates_", "=_", "Boo", "lean", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "lazy_", "(_", "\"", "Receive", " ", "stock", "out", " ", "SMS", " ", "alert", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "text_", "=_", "uge", "ttext", "\\u", "lazy_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Thi", "s", " ", "will", " ", "alert", " ", "you", " ", "with", " ", "the", " ", "percent", " ", "of", " ", "facilit", "ies", " ", "tha", "t", " ", "are", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "stock", "ed", " ", "out", " ", "of", " ", "a", " ", "specific", " ", "commod", "it", "y", "\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "non", "\\u", "report_", "=_", "Boo", "lean", "Field_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "label_", "=_", "uge", "ttext", "\\u", "lazy_", "(_", "\"", "Receive", " ", "non", "-", "reporting", " ", "SMS", " ", "alert", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "required_", "=_", "False_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "text_", "=_", "uge", "ttext", "\\u", "lazy_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "Thi", "s", " ", "alert", " ", "highlight", " ", "users", "/", "facilit", "ies", " ", "whi", "ch", " ", "have", " ", "not", " ", "submitted", " ", "\"_", "\\u\\u\\uNL\\u\\u\\u_", "\"", "thei", "r", " ", "Comm", "Care", " ", "Suppl", "y", " ", "stock", " ", "report", ".\"_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Subscrib", "e", "SMS", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Subscrib", "e", "SMS", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "=_", "Form", "Helper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "form", "\\u", "class_", "=_", "'", "form", " ", "form", "-", "horizon", "tal", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "label", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "2", " ", "col", "-", "md", "-", "2", " ", "col", "-", "lg", "-", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "field", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "2", " ", "col", "-", "md", "-", "2", " ", "col", "-", "lg", "-", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "layout_", "=_", "crisp", "y_", "._", "Layout_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Field", "set_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "'", "Subscrib", "e", " ", "settings", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tw", "bsc", "ris", "py_", "._", "Prep", "ende", "d", "Text_", "(_", "'", "stock", "\\u", "out", "\\u", "facilit", "ies", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tw", "bsc", "ris", "py_", "._", "Prep", "ende", "d", "Text_", "(_", "'", "stock", "\\u", "out", "\\u", "commod", "iti", "es", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tw", "bsc", "ris", "py_", "._", "Prep", "ende", "d", "Text_", "(_", "'", "stock", "\\u", "out", "\\u", "rate", "s", "'_", ",_", "''_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "tw", "bsc", "ris", "py_", "._", "Prep", "ende", "d", "Text_", "(_", "'", "non", "\\u", "report", "'_", ",_", "''_", ")_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hq", "crisp", "y_", "._", "Form", "Actions_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tw", "bsc", "ris", "py_", "._", "Stri", "ct", "Button_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Update", " ", "settings", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "submit", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "class_", "=_", "\"", "btn", "-", "primary", "\"_", ",_", "\\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_", "Subscrib", "e", "SMS", "Form_", "(_", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "save_", "(_", "self_", ",_", "comm", "track", "\\u", "settings_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "alert", "\\u", "config_", "=_", "comm", "track", "\\u", "settings_", "._", "alert", "\\u", "config_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alert", "\\u", "config_", "._", "stock", "\\u", "out", "\\u", "facilit", "ies_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "stock", "\\u", "out", "\\u", "facilit", "ies", "\"_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alert", "\\u", "config_", "._", "stock", "\\u", "out", "\\u", "commod", "ities_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "stock", "\\u", "out", "\\u", "commod", "iti", "es", "\"_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alert", "\\u", "config_", "._", "stock", "\\u", "out", "\\u", "rates_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "stock", "\\u", "out", "\\u", "rate", "s", "\"_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "alert", "\\u", "config_", "._", "non", "\\u", "report_", "=_", "self_", "._", "clean", "ed", "\\u", "data_", "._", "get_", "(_", "\"", "non", "\\u", "report", "\"_", ",_", "False_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "comm", "track", "\\u", "settings_", "._", "save_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Compose", "Messag", "e", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "recipients_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Textarea_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "help", "\\u", "text_", "=_", "uge", "ttext", "\\u", "lazy_", "(_", "\"", "Type", " ", "a", " ", "user", "name", ",", " ", "group", " ", "name", " ", "or", " ", "'", "send", " ", "to", " ", "all", "'\"_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "message_", "=_", "forms_", "._", "Char", "Field_", "(_", "widget_", "=_", "forms_", "._", "Textarea_", ",_", "help", "\\u", "text_", "=_", "uge", "ttext", "\\u", "lazy_", "(_", "'", "0", " ", "character", "s", " ", "(", "160", " ", "max", ")'_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Compose", "Messag", "e", "Form_", "(_", "forms_", "._", "Form_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "domain_", "=_", "kwargs_", "._", "pop_", "(_", "'", "domain", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "super_", "(_", "Compose", "Messag", "e", "Form_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "=_", "Form", "Helper_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "form", "\\u", "action_", "=_", "reverse_", "(_", "'", "send", "\\u", "to", "\\u", "recip", "ients", "'_", ",_", "args_", "=_", "[_", "domain_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "form", "\\u", "class_", "=_", "\"", "form", " ", "form", "-", "horizon", "tal", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "label", "\\u", "class_", "=_", "'", "col", "-", "sm", "-", "3", " ", "col", "-", "md", "-", "4", " ", "col", "-", "lg", "-", "2", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "field", "\\u", "class_", "=_", "'", "col", "-", "sm", "-1", "0", " ", "col", "-", "md", "-1", "0", " ", "col", "-", "lg", "-1", "0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "helper_", "._", "layout_", "=_", "crisp", "y_", "._", "Layout_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Field_", "(_", "'", "recip", "ients", "'_", ",_", "rows_", "=_", "2_", ",_", "css", "\\u", "class_", "=_", "'", "sms", "-", "type", "ahe", "ad", "'_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "crisp", "y_", "._", "Field_", "(_", "'", "message", "'_", ",_", "rows_", "=_", "2_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "hq", "crisp", "y_", "._", "Form", "Actions_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "tw", "bsc", "ris", "py_", "._", "Stri", "ct", "Button_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "\\u_", "(_", "\"", "Sen", "d", " ", "Messag", "e", "\"_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "type_", "=_", "\"", "submit", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "css", "\\u", "class_", "=_", "\"", "btn", "-", "primary", "\"_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_", ",_", "\\u\\u\\uNL\\u\\u\\u_", ")_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 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, 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 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2 ]
Unused import
mosesschwartz/scrypture/scrypture/demo_scripts/Demos/api_demo.py
[ { "content": "#!/usr/bin/env python\n# table_test.py\n\"\"\"\nMake a random table\n\"\"\"\n\nimport argparse\nimport sys\nimport re\nimport json\nimport random\nfrom scrypture import scrypture_api\n\n### WebAPI ###\nfrom scrypture import webapi\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class WebAPI(webapi.WebAPI):\n submit_button = webapi.submit_button('Tabulate!')\n", "metadata": "root.WebAPI", "header": "['module', '___EOS___']", "index": 15 }, { "content": " def run(self, form_input):\n s = scrypture_api.ScryptureAPI()\n silly1 = s.silly_demo()\n silly1_data = silly1['output']\n silly1_headers = silly1['headers']\n silly2 = s.silly_demo()\n silly2_data = silly2['output']\n silly2_headers = silly2['headers']\n\n return {'output_type' : 'table',\n 'output' : silly2_data+silly1_data,\n 'headers' : silly1_headers+silly2_headers}", "metadata": "root.WebAPI.run", "header": "['class', 'WebAPI', '(', 'webapi', '.', 'WebAPI', ')', ':', '___EOS___']", "index": 18 } ]
[ { "span": "import argparse", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 15 }, { "span": "import sys", "start_line": 7, "start_column": 0, "end_line": 7, "end_column": 10 }, { "span": "import re", "start_line": 8, "start_column": 0, "end_line": 8, "end_column": 9 }, { "span": "import json", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 11 }, { "span": "import random", "start_line": 10, "start_column": 0, "end_line": 10, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#!", "/", "usr", "/", "bin", "/", "env", " ", "python_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "table", "\\u", "test", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Make", " ", "a", " ", "random", " ", "table", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "argparse_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "re_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "random_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "scr", "ypt", "ure_", "import_", "scr", "ypt", "ure", "\\u", "api_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "Web", "API", " ", "###", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "scr", "ypt", "ure_", "import_", "webapi", "_", "\\u\\u\\uNEWLINE\\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\\uNEWLINE\\u\\u\\u_", "class_", "Web", "API_", "(_", "webapi", "_", "._", "Web", "API_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "submit", "\\u", "button_", "=_", "webapi", "_", "._", "submit", "\\u", "button_", "(_", "'", "Tab", "ulate", "!'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Web", "API_", "(_", "webapi", "_", "._", "Web", "API_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "run_", "(_", "self_", ",_", "form", "\\u", "input_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "s_", "=_", "scr", "ypt", "ure", "\\u", "api_", "._", "Scr", "ypt", "ure", "API_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sil", "ly", "1_", "=_", "s_", "._", "sil", "ly", "\\u", "demo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sil", "ly", "1", "\\u", "data_", "=_", "sil", "ly", "1_", "[_", "'", "output", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sil", "ly", "1", "\\u", "headers_", "=_", "sil", "ly", "1_", "[_", "'", "header", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sil", "ly", "2_", "=_", "s_", "._", "sil", "ly", "\\u", "demo_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sil", "ly", "2", "\\u", "data_", "=_", "sil", "ly", "2_", "[_", "'", "output", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sil", "ly", "2", "\\u", "headers_", "=_", "sil", "ly", "2_", "[_", "'", "header", "s", "'_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "return_", "{_", "'", "output", "\\u", "type", "'_", ":_", "'", "table", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "output", "'_", ":_", "sil", "ly", "2", "\\u", "data_", "+_", "sil", "ly", "1", "\\u", "data_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "header", "s", "'_", ":_", "sil", "ly", "1", "\\u", "headers_", "+_", "sil", "ly", "2", "\\u", "headers_", "}_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 1, 2, 0, 1, 2, 0, 1, 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, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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 ]
Unused import
zmap/ztag/ztag/transforms/sslv2.py
[ { "content": "from ztag.transform import ZGrabTransform, ZMapTransformOutput\nfrom ztag import protocols, errors\nfrom ztag.transform import Transformable\nfrom ztag.errors import IgnoreObject\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class SSLv2Transform(ZGrabTransform):\n\n name = \"*/sslv2\"\n port = None\n protocol = {\n protocols.HTTPS,\n protocols.SMTP,\n protocols.SMTPS,\n protocols.IMAP,\n protocols.IMAPS,\n protocols.POP3,\n protocols.POP3S,\n }\n subprotocol = protocols.HTTPS.SSL_2\n\n\n", "metadata": "root.SSLv2Transform", "header": "['module', '___EOS___']", "index": 6 }, { "content": " def __init__(self, *args, **kwargs):\n super(SSLv2Transform, self).__init__(*args, **kwargs)", "metadata": "root.SSLv2Transform.__init__", "header": "['class', 'SSLv2Transform', '(', 'ZGrabTransform', ')', ':', '___EOS___']", "index": 22 }, { "content": " def _transform_object(self, obj):\n wrapped = Transformable(obj['data'])\n ciphers = wrapped['sslv2']['server_hello']['ciphers'].resolve()\n certificate = wrapped['sslv2']['server_hello']['certificate'].resolve()\n sslv2_support = bool(wrapped['sslv2']['server_verify'].resolve())\n sslv2_export = bool(wrapped['sslv2_export']['server_verify'].resolve())\n sslv2_extra_clear = bool(wrapped['sslv2_extra_clear']['server_verify']\n ['extra_clear'].resolve())\n out = {\n 'support': sslv2_support,\n 'export': sslv2_export,\n 'extra_clear': sslv2_extra_clear,\n }\n if ciphers is not None:\n out['ciphers'] = ciphers\n if certificate is not None:\n out['certificate'] = {\n 'parsed': certificate['parsed']\n }\n certificates = [certificate]\n else:\n certificates = list()\n\n zout = ZMapTransformOutput()\n zout.transformed = out\n zout.certificates = certificates\n return zout", "metadata": "root.SSLv2Transform._transform_object", "header": "['class', 'SSLv2Transform', '(', 'ZGrabTransform', ')', ':', '___EOS___']", "index": 25 } ]
[ { "span": "from ztag import protocols, errors", "start_line": 1, "start_column": 0, "end_line": 1, "end_column": 34 }, { "span": "from ztag.errors import IgnoreObject", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 36 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "zt", "ag_", "._", "transform_", "import_", "ZG", "rab", "Transform_", ",_", "ZM", "ap", "Transform", "Output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zt", "ag_", "import_", "protocols_", ",_", "errors_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zt", "ag_", "._", "transform_", "import_", "Transform", "able_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "zt", "ag_", "._", "errors_", "import_", "Ignor", "e", "Object_", "\\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_", "SS", "Lv", "2", "Transform_", "(_", "ZG", "rab", "Transform_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "name_", "=_", "\"*", "/", "ssl", "v2", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "port_", "=_", "None_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "protocol_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "protocols_", "._", "HTTP", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "protocols_", "._", "SMTP_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "protocols_", "._", "SMT", "PS_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "protocols_", "._", "IMAP", "_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "protocols_", "._", "IMAP", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "protocols_", "._", "POP", "3_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "protocols_", "._", "POP", "3", "S_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "subpro", "toco", "l_", "=_", "protocols_", "._", "HTTP", "S_", "._", "SS", "L", "\\u", "2_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "SS", "Lv", "2", "Transform_", "(_", "ZG", "rab", "Transform_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ",_", "*_", "args_", ",_", "**_", "kwargs_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "SS", "Lv", "2", "Transform_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", "*_", "args_", ",_", "**_", "kwargs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "SS", "Lv", "2", "Transform_", "(_", "ZG", "rab", "Transform_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "\\u", "transform", "\\u", "object_", "(_", "self_", ",_", "obj_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "wrapped_", "=_", "Transform", "able_", "(_", "obj_", "[_", "'", "data", "'_", "]_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ciphers", "_", "=_", "wrapped_", "[_", "'", "ssl", "v2", "'_", "]_", "[_", "'", "server", "\\u", "hell", "o", "'_", "]_", "[_", "'", "ciphers", "'_", "]_", "._", "resolve_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "certificate_", "=_", "wrapped_", "[_", "'", "ssl", "v2", "'_", "]_", "[_", "'", "server", "\\u", "hell", "o", "'_", "]_", "[_", "'", "certifica", "te", "'_", "]_", "._", "resolve_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssl", "v2", "\\u", "support_", "=_", "bool_", "(_", "wrapped_", "[_", "'", "ssl", "v2", "'_", "]_", "[_", "'", "server", "\\u", "verify", "'_", "]_", "._", "resolve_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssl", "v2", "\\u", "export_", "=_", "bool_", "(_", "wrapped_", "[_", "'", "ssl", "v2", "\\u", "export", "'_", "]_", "[_", "'", "server", "\\u", "verify", "'_", "]_", "._", "resolve_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "ssl", "v2", "\\u", "extra", "\\u", "clear_", "=_", "bool_", "(_", "wrapped_", "[_", "'", "ssl", "v2", "\\u", "extra", "\\u", "clear", "'_", "]_", "[_", "'", "server", "\\u", "verify", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "[_", "'", "extra", "\\u", "clear", "'_", "]_", "._", "resolve_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "out_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "support", "'_", ":_", "ssl", "v2", "\\u", "support_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "export", "'_", ":_", "ssl", "v2", "\\u", "export_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "'", "extra", "\\u", "clear", "'_", ":_", "ssl", "v2", "\\u", "extra", "\\u", "clear_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "ciphers", "_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "[_", "'", "ciphers", "'_", "]_", "=_", "ciphers", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "certificate_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "out_", "[_", "'", "certifica", "te", "'_", "]_", "=_", "{_", "\\u\\u\\uNL\\u\\u\\u_", "'", "parsed", "'_", ":_", "certificate_", "[_", "'", "parsed", "'_", "]_", "\\u\\u\\uNL\\u\\u\\u_", "}_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "certificates", "_", "=_", "[_", "certificate_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "certificates", "_", "=_", "list_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "zo", "ut_", "=_", "ZM", "ap", "Transform", "Output_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zo", "ut_", "._", "transformed_", "=_", "out_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "zo", "ut_", "._", "certificates", "_", "=_", "certificates", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "zo", "ut_" ]
[ 4, 4, 4, 4, 4, 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 ]
Except block handles 'BaseException'
markuskiller/textblob-de/textblob_de/ext/_pattern/__init__.py
[ { "content": "# -*- coding: utf-8 -*-\nfrom __future__ import absolute_import\n#### PATTERN #######################################################################################\n\n# Authors: Tom De Smedt <[email protected]>, Walter Daelemans <[email protected]>\n# License: BSD License, see LICENSE.txt\n\n# Source: https://github.com/clips/pattern/pattern/__init__.py\n# git-commit: 2013-10-26 (2f44c5a)\n\n# Modified: 2014-08-04 Markus Killer <[email protected]>\n\n\n#### BSD LICENSE ###################################################################################\n\n# Copyright (c) 2010 University of Antwerp, Belgium\n# All rights reserved.\n#\n# Redistribution and use in source and binary forms, with or without\n# modification, are permitted provided that the following conditions are met:\n# \n# * Redistributions of source code must retain the above copyright\n# notice, this list of conditions and the following disclaimer.\n# * Redistributions in binary form must reproduce the above copyright \n# notice, this list of conditions and the following disclaimer in\n# the documentation and/or other materials provided with the\n# distribution.\n# * Neither the name of Pattern nor the names of its\n# contributors may be used to endorse or promote products\n# derived from this software without specific prior written\n# permission.\n#\n# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n# \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n# POSSIBILITY OF SUCH DAMAGE.\n#\n# CLiPS Computational Linguistics Group, University of Antwerp, Belgium\n# http://www.clips.ua.ac.be/pages/pattern\n\n### CREDITS ########################################################################################\n\n# Minor modifications to integrate pattern into 'textblob-de' without losing \n# compatibility with pattern2.6 on Python2, providing a working interface\n# to pattern.text.de on Python3 (pattern2.6 does not yet\n# install on Python3) \n__maintainer__ = \"Markus Killer <[email protected]>\"\n\n__author__ = \"Tom De Smedt\"\n__credits__ = \"Tom De Smedt, Walter Daelemans\"\n__version__ = \"2.6 for textblob-de\"\n__copyright__ = \"Copyright (c) 2010 University of Antwerp (BE)\"\n__license__ = \"BSD\"\n\n####################################################################################################\nimport os\nimport sys\n\nimport _pattern.text\n\nfrom _pattern.text import de\nfrom _pattern.text import tree\nfrom _pattern.text import search\n\n# Shortcut to _pattern.de\n# (instead of _pattern.text.de)\ntry: \n __path__.append(os.path.join(__path__[0], \"text\"))\nexcept:\n pass", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "except:", "start_line": 76, "start_column": 0, "end_line": 76, "end_column": 7 } ]
[]
1
true
[ "[CLS]_", "Except", "_", "block_", "handles_", "'", "Base", "Except", "ion", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "#", " ", "-*-", " ", "codi", "ng", ":", " ", "utf", "-", "8", " ", "-*-", "_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "###", "#", " ", "PATTERN", " ", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "#########", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Author", "s", ":", " ", "Tom", " ", "De", " ", "Sm", "edt", " ", "<", "tom", "@", "organism", "s", ".", "be", ">", ",", " ", "Wal", "ter", " ", "Da", "elem", "ans", " ", "<", "wal", "ter", ".", "dae", "lema", "ns", "@", "ua", ".", "ac", ".", "be", ">_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "License", ":", " ", "BS", "D", " ", "License", ",", " ", "see", " ", "LICENSE", ".", "txt_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sou", "rce", ":", " ", "https", "://", "git", "hub", ".", "com", "/", "clips", "/", "pattern", "/", "pattern", "/\\u", "\\u", "init", "\\u\\u", ".", "py_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "git", "-", "commit", ":", " ", "2013", "-1", "0", "-", "2", "6", " ", "(", "2f", "4", "4c", "5a", ")_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Modifie", "d", ":", " ", "2014", "-0", "8", "-0", "4", " ", "Mark", "us", " ", "Kill", "er", " ", "<", "m", ".", "kille", "r", "@", "lang", "ui", ".", "ch", ">_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", "#", " ", "BS", "D", " ", "LICENSE", " ", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "######", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Copy", "right", " ", "(", "c", ")", " ", "2010", " ", "Univers", "it", "y", " ", "of", " ", "Ant", "wer", "p", ",", " ", "Bel", "gi", "um_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "rights", " ", "reserve", "d", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "Redistributi", "on", " ", "and", " ", "use", " ", "in", " ", "source", " ", "and", " ", "binar", "y", " ", "forms", ",", " ", "with", " ", "or", " ", "with", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "modification", ",", " ", "are", " ", "permit", "ted", " ", "provided", " ", "tha", "t", " ", "the", " ", "follow", "ing", " ", "condition", "s", " ", "are", " ", "met", ":_", "\\u\\u\\uNL\\u\\u\\u_", "#", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Redistributi", "ons", " ", "of", " ", "source", " ", "code", " ", "must", " ", "retain", " ", "the", " ", "above", " ", "copyright_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Redistributi", "ons", " ", "in", " ", "binar", "y", " ", "form", " ", "must", " ", "reproduce", " ", "the", " ", "above", " ", "copyr", "ight", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "notice", ",", " ", "this", " ", "list", " ", "of", " ", "condition", "s", " ", "and", " ", "the", " ", "follow", "ing", " ", "discl", "aime", "r", " ", "in_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "the", " ", "documentation", " ", "and", "/", "or", " ", "other", " ", "material", "s", " ", "provided", " ", "with", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "distribu", "tion", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "*", " ", "Nei", "ther", " ", "the", " ", "name", " ", "of", " ", "Pat", "tern", " ", "nor", " ", "the", " ", "names", " ", "of", " ", "its_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "contributor", "s", " ", "may", " ", "be", " ", "used", " ", "to", " ", "endo", "rse", " ", "or", " ", "promote", " ", "products_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "derive", "d", " ", "from", " ", "this", " ", "software", " ", "with", "out", " ", "specific", " ", "prior", " ", "written_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "permissi", "on", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "THIS", " ", "SOFT", "WARE", " ", "IS", " ", "PROVI", "DED", " ", "BY", " ", "THE", " ", "COPY", "RIG", "HT", " ", "HOLD", "ERS", " ", "AND", " ", "CONTRIB", "UTO", "RS_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "\"", "AS", " ", "IS", "\"", " ", "AND", " ", "ANY", " ", "EXPR", "ESS", " ", "OR", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", ",", " ", "INC", "LU", "DING", ",", " ", "BUT", " ", "NOT", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "LIMIT", "ED", " ", "TO", ",", " ", "THE", " ", "IMPL", "IED", " ", "WAR", "RAN", "TIES", " ", "OF", " ", "MER", "CHAN", "TAB", "ILI", "TY", " ", "AND", " ", "FIT", "NESS", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "FOR", " ", "A", " ", "PARTI", "CUL", "AR", " ", "PUR", "POS", "E", " ", "ARE", " ", "DISC", "LAI", "MED", ".", " ", "IN", " ", "NO", " ", "EVENT", " ", "SHA", "LL", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "COPY", "RIG", "HT", " ", "OWNER", " ", "OR", " ", "CONTRIB", "UTO", "RS", " ", "BE", " ", "LI", "AB", "LE", " ", "FOR", " ", "ANY", " ", "DIRECT", ",", " ", "INDI", "RECT", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "INC", "IDENT", "AL", ",", " ", "SPECIAL", ",", " ", "EXE", "MPL", "ARY", ",", " ", "OR", " ", "CONS", "EQU", "ENTI", "AL", " ", "DA", "MAGE", "S", " ", "(", "INC", "LU", "DING", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "BUT", " ", "NOT", " ", "LIMIT", "ED", " ", "TO", ",", " ", "PROC", "URE", "MENT", " ", "OF", " ", "SUBST", "ITU", "TE", " ", "GOOD", "S", " ", "OR", " ", "SERVICES", ";_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "LOSS", " ", "OF", " ", "USE", ",", " ", "DATA", ",", " ", "OR", " ", "PROF", "IT", "S", ";", " ", "OR", " ", "BUS", "INE", "SS", " ", "INTER", "RU", "PTION", ")", " ", "HO", "WE", "VER_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "CAU", "SED", " ", "AND", " ", "ON", " ", "ANY", " ", "THE", "ORY", " ", "OF", " ", "LI", "ABI", "LIT", "Y", ",", " ", "WHE", "THER", " ", "IN", " ", "CONTR", "ACT", ",", " ", "STRI", "CT_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "LI", "ABI", "LIT", "Y", ",", " ", "OR", " ", "TOR", "T", " ", "(", "INC", "LU", "DING", " ", "NEG", "LIG", "ENCE", " ", "OR", " ", "OTHER", "WI", "SE", ")", " ", "ARI", "SIN", "G", " ", "IN_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "ANY", " ", "WAY", " ", "OUT", " ", "OF", " ", "THE", " ", "USE", " ", "OF", " ", "THIS", " ", "SOFT", "WARE", ",", " ", "EVE", "N", " ", "IF", " ", "ADV", "ISE", "D", " ", "OF", " ", "THE", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", " ", " ", "POS", "SIB", "ILI", "TY", " ", "OF", " ", "SUC", "H", " ", "DA", "MAGE", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "CL", "i", "PS", " ", "Computation", "al", " ", "Lin", "gui", "stic", "s", " ", "Group", ",", " ", "Univers", "it", "y", " ", "of", " ", "Ant", "wer", "p", ",", " ", "Bel", "gi", "um_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "http", "://", "www", ".", "clips", ".", "ua", ".", "ac", ".", "be", "/", "page", "s", "/", "pattern_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", "CRED", "IT", "S", " ", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "###########", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Min", "or", " ", "modification", "s", " ", "to", " ", "integrate", " ", "pattern", " ", "int", "o", " ", "'", "textb", "lob", "-", "de", "'", " ", "with", "out", " ", "los", "ing", " _", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "compatibility", " ", "with", " ", "pattern", "2.6", " ", "on", " ", "Pyth", "on2", ",", " ", "provi", "ding", " ", "a", " ", "working", " ", "interface_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "to", " ", "pattern", ".", "text", ".", "de", " ", "on", " ", "Pyth", "on", "3", " ", "(", "pattern", "2.6", " ", "doe", "s", " ", "not", " ", "ye", "t_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "install", " ", "on", " ", "Pyth", "on", "3", ")", " _", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "maintainer\\u\\u_", "=_", "\"", "Mark", "us", " ", "Kill", "er", " ", "<", "m", ".", "kille", "r", "@", "lang", "ui", ".", "ch", ">\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u", "author\\u\\u_", "=_", "\"", "Tom", " ", "De", " ", "Sm", "edt", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "credits\\u\\u_", "=_", "\"", "Tom", " ", "De", " ", "Sm", "edt", ",", " ", "Wal", "ter", " ", "Da", "elem", "ans", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "version\\u\\u_", "=_", "\"", "2.6", " ", "for", " ", "textb", "lob", "-", "de", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "copyright\\u\\u_", "=_", "\"", "Copy", "right", " ", "(", "c", ")", " ", "2010", " ", "Univers", "it", "y", " ", "of", " ", "Ant", "wer", "p", " ", "(", "BE", ")\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "license\\u\\u_", "=_", "\"", "BS", "D", "\"_", "\\u\\u\\uNEWLINE\\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_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "\\u", "pattern_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u", "pattern_", "._", "text_", "import_", "de_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u", "pattern_", "._", "text_", "import_", "tree_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u", "pattern_", "._", "text_", "import_", "search_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Short", "cut", " ", "to", " ", "\\u", "pattern", ".", "de_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "(", "inst", "ead", " ", "of", " ", "\\u", "pattern", ".", "text", ".", "de", ")_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\\u\\u", "path\\u\\u_", "._", "append_", "(_", "os_", "._", "path_", "._", "join_", "(_", "\\u\\u", "path\\u\\u_", "[_", "0_", "]_", ",_", "\"", "text", "\"_", ")_", ")_", "\\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_" ]
[ 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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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, 0, 1, 1, 2, 2, 2, 2 ]
Unused import
nowells/django-activitystreams/docs/conf.py
[ { "content": "# -*- coding: utf-8 -*-\n#\n# django-activitystreams documentation build configuration file, created by\n# sphinx-quickstart on Mon Aug 3 23:53:21 2009.\n#\n# This file is execfile()d with the current directory set to its containing dir.\n#\n# Note that not all possible configuration values are present in this\n# autogenerated file.\n#\n# All configuration values have a default; values that are commented out\n# serve to show the default.\n\nimport sys, os\n\n# If extensions (or modules to document with autodoc) are in another directory,\n# add these directories to sys.path here. If the directory is relative to the\n# documentation root, use os.path.abspath to make it absolute, like shown here.\n#sys.path.append(os.path.abspath('.'))\n\n# -- General configuration -----------------------------------------------------\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 = ['sphinx.ext.autodoc']\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 encoding of source files.\n#source_encoding = 'utf-8'\n\n# The master toctree document.\nmaster_doc = 'index'\n\n# General information about the project.\nproject = u'django-activitystreams'\ncopyright = u'2009, Nowell Strite, Shawn Rider'\n\n# The version info for the project you're documenting, acts as replacement for\n# |version| and |release|, also used in various other places throughout the\n# built documents.\n#\n# The short X.Y version.\nversion = '0.1.0'\n# The full version, including alpha/beta/rc tags.\nrelease = '0.1.0'\n\n# The language for content autogenerated by Sphinx. Refer to documentation\n# for a list of supported languages.\n#language = None\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.\n#today_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 directory, that shouldn't be searched\n# for source files.\nexclude_trees = ['_build']\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# A list of ignored prefixes for module index sorting.\n#modindex_common_prefix = []\n\n\n# -- Options for HTML output ---------------------------------------------------\n\n# The theme to use for HTML and HTML Help pages. Major themes that come with\n# Sphinx are currently 'default' and 'sphinxdoc'.\nhtml_theme = 'default'\n\n# Theme options are theme-specific and customize the look and feel of a theme\n# further. For a list of options available for each theme, see the\n# documentation.\n#html_theme_options = {}\n\n# Add any paths that contain custom themes here, relative to this directory.\n#html_theme_path = []\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 (relative to this directory) to place at the top\n# of 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.\n#html_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.\n#html_use_modindex = True\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, links to the reST sources are added to the pages.\n#html_show_sourcelink = 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 = 'django-activitystreamsdoc'\n\n\n# -- Options for LaTeX output --------------------------------------------------\n\n# The paper size ('letter' or 'a4').\n#latex_paper_size = 'letter'\n\n# The font size ('10pt', '11pt' or '12pt').\n#latex_font_size = '10pt'\n\n# Grouping the document tree into LaTeX files. List of tuples\n# (source start file, target name, title, author, documentclass [howto/manual]).\nlatex_documents = [\n ('index', 'django-activitystreams.tex', u'django-activitystreams Documentation',\n u'Nowell Strite, Shawn Rider', '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.\n#latex_use_modindex = True\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_", "#", " ", "django", "-", "activit", "yst", "ream", "s", " ", "documentation", " ", "build", " ", "configura", "tion", " ", "file", ",", " ", "created", " ", "by_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sphinx", "-", "quicks", "tart", " ", "on", " ", "Mon", " ", "Au", "g", " ", " ", "3", " ", "23", ":", "5", "3", ":", "21", " ", "200", "9._", "\\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_", "#", " ", "Not", "e", " ", "tha", "t", " ", "not", " ", "all", " ", "possib", "le", " ", "configura", "tion", " ", "values", " ", "are", " ", "presen", "t", " ", "in", " ", "this_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "autogen", "erate", "d", " ", "file", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "All", " ", "configura", "tion", " ", "values", " ", "have", " ", "a", " ", "default", ";", " ", "values", " ", "tha", "t", " ", "are", " ", "commente", "d", " ", "out_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "serve", " ", "to", " ", "show", " ", "the", " ", "default", "._", "\\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", " ", "extensi", "ons", " ", "(", "or", " ", "module", "s", " ", "to", " ", "document", " ", "with", " ", "autod", "oc", ")", " ", "are", " ", "in", " ", "anot", "her", " ", "director", "y", ",_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "add", " ", "these", " ", "director", "ies", " ", "to", " ", "sys", ".", "path", " ", "here", ".", " ", "If", " ", "the", " ", "director", "y", " ", "is", " ", "relative", " ", "to", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", " ", "root", ",", " ", "use", " ", "os", ".", "path", ".", "abs", "path", " ", "to", " ", "make", " ", "it", " ", "abs", "olute", ",", " ", "like", " ", "shown", " ", "here", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "sys", ".", "path", ".", "append", "(", "os", ".", "path", ".", "abs", "path", "('.", "'))", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "--", " ", "General", " ", "configura", "tion", " ", "--------------", "--------------", "--------------", "-----------", "_", "\\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_", "=_", "[_", "'", "sphinx", ".", "ext", ".", "autod", "oc", "'_", "]_", "\\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", " ", "encoding", " ", "of", " ", "source", " ", "files", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "source", "\\u", "encoding", " ", "=", " ", "'", "utf", "-", "8", "'_", "\\u\\u\\uNL\\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", " ", "informati", "on", " ", "abo", "ut", " ", "the", " ", "project", "._", "\\u\\u\\uNL\\u\\u\\u_", "project_", "=_", "u", "'", "django", "-", "activit", "yst", "ream", "s", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "copyright_", "=_", "u", "'", "200", "9", ",", " ", "No", "well", " ", "Stri", "te", ",", " ", "Sha", "wn", " ", "Rid", "er", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "version", " ", "info", " ", "for", " ", "the", " ", "project", " ", "you", "'", "re", " ", "document", "ing", ",", " ", "acts", " ", "as", " ", "replace", "ment", " ", "for_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "|", "version", "|", " ", "and", " ", "|", "release", "|", ",", " ", "als", "o", " ", "used", " ", "in", " ", "vari", "ous", " ", "other", " ", "place", "s", " ", "through", "out", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "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_", "=_", "'", "0.", "1.0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "The", " ", "full", " ", "version", ",", " ", "inclu", "ding", " ", "alpha", "/", "beta", "/", "rc", " ", "tags", "._", "\\u\\u\\uNL\\u\\u\\u_", "release_", "=_", "'", "0.", "1.0", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "The", " ", "language", " ", "for", " ", "content", " ", "autogen", "erate", "d", " ", "by", " ", "Sph", "inx", ".", " ", "Refer", " ", "to", " ", "documentation", "_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "for", " ", "a", " ", "list", " ", "of", " ", "support", "ed", " ", "language", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "language", " ", "=", " ", "None_", "\\u\\u\\uNL\\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\\uNL\\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", "y", ",", " ", "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", "trees_", "=_", "[_", "'\\u", "build", "'_", "]_", "\\u\\u\\uNEWLINE\\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_", "#", " ", "A", " ", "list", " ", "of", " ", "ignore", "d", " ", "prefix", "es", " ", "for", " ", "module", " ", "index", " ", "sorting", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "modi", "nde", "x", "\\u", "common", "\\u", "prefix", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\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_", "#", " ", "The", " ", "them", "e", " ", "to", " ", "use", " ", "for", " ", "HTM", "L", " ", "and", " ", "HTM", "L", " ", "Help", " ", "page", "s", ".", " ", " ", "Maj", "or", " ", "themes", " ", "tha", "t", " ", "come", " ", "with_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Sph", "inx", " ", "are", " ", "currentl", "y", " ", "'", "default", "'", " ", "and", " ", "'", "sphinx", "doc", "'.", "_", "\\u\\u\\uNL\\u\\u\\u_", "html", "\\u", "theme_", "=_", "'", "default", "'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Them", "e", " ", "options", " ", "are", " ", "them", "e-", "specific", " ", "and", " ", "customize", " ", "the", " ", "look", " ", "and", " ", "feel", " ", "of", " ", "a", " ", "theme_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "fur", "ther", ".", " ", " ", "For", " ", "a", " ", "list", " ", "of", " ", "options", " ", "avail", "able", " ", "for", " ", "each", " ", "them", "e", ",", " ", "see", " ", "the_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "documentation", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "options", " ", "=", " ", "{}", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Add", " ", "any", " ", "path", "s", " ", "tha", "t", " ", "contain", " ", "custom", " ", "themes", " ", "here", ",", " ", "relative", " ", "to", " ", "this", " ", "director", "y", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "them", "e\\u", "path", " ", "=", " ", "[]", "_", "\\u\\u\\uNL\\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", " ", "(", "relative", " ", "to", " ", "this", " ", "director", "y", ")", " ", "to", " ", "place", " ", "at", " ", "the", " ", "top_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "of", " ", "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\\uNL\\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", "nde", "x", " ", "=", " ", "True_", "\\u\\u\\uNL\\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", ",", " ", "link", "s", " ", "to", " ", "the", " ", "re", "ST", " ", "source", "s", " ", "are", " ", "adde", "d", " ", "to", " ", "the", " ", "page", "s", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "html", "\\u", "show", "\\u", "source", "link", " ", "=", " ", "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_", "=_", "'", "django", "-", "activit", "yst", "ream", "sdo", "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_", "#", " ", "The", " ", "pape", "r", " ", "size", " ", "('", "letter", "'", " ", "or", " ", "'", "a4", "')", "._", "\\u\\u\\uNL\\u\\u\\u_", "#", "late", "x", "\\u", "pape", "r", "\\u", "size", " ", "=", " ", "'", "letter", "'_", "\\u\\u\\uNL\\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", " ", "=", " ", "'", "10", "pt", "'_", "\\u\\u\\uNL\\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", "'_", ",_", "'", "django", "-", "activit", "yst", "ream", "s", ".", "tex", "'_", ",_", "u", "'", "django", "-", "activit", "yst", "ream", "s", " ", "Document", "ation", "'_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "u", "'", "No", "well", " ", "Stri", "te", ",", " ", "Sha", "wn", " ", "Rid", "er", "'_", ",_", "'", "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", "\\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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 ]
Unused import
fordham-css/ptp/vis-site/vis-site-server.py
[ { "content": "from flask import Flask, render_template\n\nimport json\nimport plotly\n\nimport requests\n\npath = 'http://127.0.0.1:5000/'\n\n\n\napp = Flask(__name__)\napp.debug = True\n\n\nif __name__ == '__main__':\n\tapp.run(debug=True,port=4000)", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "def get_data(url):\n r = requests.get(url+'api/last_row')\n return r.text", "metadata": "root.get_data", "header": "['module', '___EOS___']", "index": 9 }, { "content": "def loop_get():\n while True:\n get_data(path)", "metadata": "root.loop_get", "header": "['module', '___EOS___']", "index": 13 }, { "content": "@app.route('/')\ndef index():\n\n return render_template('index.html')", "metadata": "root.index", "header": "['module', '___EOS___']", "index": 20 } ]
[ { "span": "import json", "start_line": 2, "start_column": 0, "end_line": 2, "end_column": 11 }, { "span": "import plotly", "start_line": 3, "start_column": 0, "end_line": 3, "end_column": 13 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "from_", "flask_", "import_", "Flask_", ",_", "render", "\\u", "template_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "json_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "plotly", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "import_", "requests_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "path_", "=_", "'", "http", "://", "127", ".0", ".0", ".1", ":", "5000", "/'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "app_", "=_", "Flask_", "(_", "\\u\\u", "name\\u\\u_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "app_", "._", "debug_", "=_", "True_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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", "_", "app_", "._", "run_", "(_", "debug_", "=_", "True_", ",_", "port_", "=_", "4000_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "get", "\\u", "data_", "(_", "url_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "r_", "=_", "requests_", "._", "get_", "(_", "url_", "+_", "'", "api", "/", "last", "\\u", "row", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "r_", "._", "text_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "loop", "\\u", "get_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "while_", "True_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "get", "\\u", "data_", "(_", "path_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "@_", "app_", "._", "route_", "(_", "'/'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "def_", "index_", "(_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "render", "\\u", "template_", "(_", "'", "index", ".", "html", "'_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 0, 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, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 2, 2, 2, 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 ]
First parameter of a method is not named 'self'
IvanMalison/okcupyd/okcupyd/json_search.py
[ { "content": " def transform(gentation):\n if isinstance(gentation, six.string_types):\n gentations = [gentation]\n else:\n gentations = gentation\n return [\n magicnumbers.gentation_to_number.get(\n a_gentation.strip().lower(), gentation\n )\n for a_gentation in gentations\n ]", "metadata": "root.GentationFilter.transform", "header": "['class', 'GentationFilter', '(', 'search_filters', '.', 'filter_class', ')', ':', '___EOS___']", "index": 137 }, { "content": " def transform(radius):\n return radius", "metadata": "root.RadiusFilter.transform", "header": "['class', 'RadiusFilter', '(', 'search_filters', '.', 'filter_class', ')', ':', '___EOS___']", "index": 176 }, { "content": " def transform(radius):\n return 1 if radius is None else 0", "metadata": "root.LocationActivationFilter.transform", "header": "['class', 'LocationActivationFilter', '(', 'search_filters', '.', 'filter_class', ')', ':', '___EOS___']", "index": 185 }, { "content": " def transform(locid):\n return locid", "metadata": "root.LocIdFilter.transform", "header": "['class', 'LocIdFilter', '(', 'search_filters', '.', 'filter_class', ')', ':', '___EOS___']", "index": 193 }, { "content": " def transform(location, location_cache):\n return location_cache.get_locid(location)", "metadata": "root.LocationFilter.transform", "header": "['class', 'LocationFilter', '(', 'search_filters', '.', 'filter_class', ')', ':', '___EOS___']", "index": 208 } ]
[ { "span": "def transform(gentation):", "start_line": 137, "start_column": 4, "end_line": 137, "end_column": 29 }, { "span": "def transform(radius):", "start_line": 176, "start_column": 4, "end_line": 176, "end_column": 26 }, { "span": "def transform(radius):", "start_line": 185, "start_column": 4, "end_line": 185, "end_column": 26 }, { "span": "def transform(locid):", "start_line": 193, "start_column": 4, "end_line": 193, "end_column": 25 }, { "span": "def transform(location, location_cache):", "start_line": 208, "start_column": 4, "end_line": 208, "end_column": 44 } ]
[]
1
true
[ "[CLS]_", "First_", "parameter_", "of_", "a_", "method_", "is_", "not_", "named_", "'", "self", "'_", "[SEP]_", "class_", "Gen", "tation", "Filter_", "(_", "search", "\\u", "filters_", "._", "filter", "\\u", "class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "transform_", "(_", "gent", "ation_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "isinstance_", "(_", "gent", "ation_", ",_", "six_", "._", "string", "\\u", "types_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gent", "ations_", "=_", "[_", "gent", "ation_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "else_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "gent", "ations_", "=_", "gent", "ation_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "[_", "\\u\\u\\uNL\\u\\u\\u_", "magic", "numbers_", "._", "gent", "ation", "\\u", "to", "\\u", "number_", "._", "get_", "(_", "\\u\\u\\uNL\\u\\u\\u_", "a", "\\u", "gent", "ation_", "._", "strip_", "(_", ")_", "._", "lower_", "(_", ")_", ",_", "gent", "ation_", "\\u\\u\\uNL\\u\\u\\u_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "for_", "a", "\\u", "gent", "ation_", "in_", "gent", "ations_", "\\u\\u\\uNL\\u\\u\\u_", "]_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Rad", "ius", "Filter_", "(_", "search", "\\u", "filters_", "._", "filter", "\\u", "class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "transform_", "(_", "radius_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "radius_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Locat", "ion", "Activat", "ion", "Filter_", "(_", "search", "\\u", "filters_", "._", "filter", "\\u", "class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "transform_", "(_", "radius_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "1_", "if_", "radius_", "is_", "None_", "else_", "0_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Loc", "Id", "Filter_", "(_", "search", "\\u", "filters_", "._", "filter", "\\u", "class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "transform_", "(_", "loci", "d_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "loci", "d_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Locat", "ion", "Filter_", "(_", "search", "\\u", "filters_", "._", "filter", "\\u", "class_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "transform_", "(_", "location_", ",_", "location", "\\u", "cache_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "location", "\\u", "cache_", "._", "get", "\\u", "loci", "d_", "(_", "location_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 4, 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, 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, 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, 0, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 4, 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 ]
Module is imported with 'import' and 'import from'
OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/future/backports/misc.py
[ { "content": "\"\"\"\nMiscellaneous function (re)definitions from the Py3.4+ standard library\nfor Python 2.6/2.7.\n\n- math.ceil (for Python 2.7)\n- collections.OrderedDict (for Python 2.6)\n- collections.Counter (for Python 2.6)\n- collections.ChainMap (for all versions prior to Python 3.3)\n- itertools.count (for Python 2.6, with step parameter)\n- subprocess.check_output (for Python 2.6)\n- reprlib.recursive_repr (for Python 2.6+)\n\"\"\"\nfrom __future__ import absolute_import\n\nimport subprocess\nfrom math import ceil as oldceil\nfrom collections import Mapping, MutableMapping\n\nfrom operator import itemgetter as _itemgetter, eq as _eq\nimport sys\nimport heapq as _heapq\nfrom _weakref import proxy as _proxy\nfrom itertools import repeat as _repeat, chain as _chain, starmap as _starmap\nfrom socket import getaddrinfo, SOCK_STREAM, error, socket\n\nfrom future.utils import iteritems, itervalues, PY26, PY3\n\n\n\n\n########################################################################\n### reprlib.recursive_repr decorator from Py3.4\n########################################################################\n\nfrom itertools import islice\n\nif PY3:\n try:\n from _thread import get_ident\n except ImportError:\n from _dummy_thread import get_ident\nelse:\n try:\n from thread import get_ident\n except ImportError:\n from dummy_thread import get_ident\n\n\n\n\n################################################################################\n### OrderedDict\n################################################################################\n\n\n\n\n# {{{ http://code.activestate.com/recipes/576611/ (r11)\n\ntry:\n from operator import itemgetter\n from heapq import nlargest\nexcept ImportError:\n pass\n\n########################################################################\n### Counter\n########################################################################\n\n\n\n\n\n\n\n\n########################################################################\n### ChainMap (helper for configparser and string.Template)\n### From the Py3.4 source code. See also:\n### https://github.com/kkxue/Py2ChainMap/blob/master/py2chainmap.py\n########################################################################\n\n\n\n# Re-use the same sentinel as in the Python stdlib socket module:\nfrom socket import _GLOBAL_DEFAULT_TIMEOUT\n# Was: _GLOBAL_DEFAULT_TIMEOUT = object()\n\n\n\n\n# Back up our definitions above in case they're useful\n_OrderedDict = OrderedDict\n_Counter = Counter\n_check_output = check_output\n_count = count\n_ceil = ceil\n__count_elements = _count_elements\n_recursive_repr = recursive_repr\n_ChainMap = ChainMap\n_create_connection = create_connection\n\n# Overwrite the definitions above with the usual ones\n# from the standard library:\nif sys.version_info >= (2, 7):\n from collections import OrderedDict, Counter\n from subprocess import check_output\n from itertools import count\n from socket import create_connection\n\nif sys.version_info >= (3, 0):\n from math import ceil\n from collections import _count_elements\n\nif sys.version_info >= (3, 3):\n from reprlib import recursive_repr\n from collections import ChainMap\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 } ]
[ { "span": "import subprocess", "start_line": 14, "start_column": 0, "end_line": 14, "end_column": 17 }, { "span": "import heapq as _heapq", "start_line": 20, "start_column": 0, "end_line": 20, "end_column": 22 } ]
[]
1
true
[ "[CLS]_", "Module_", "is_", "imported_", "with_", "'", "import", "'_", "and_", "'", "import", " ", "from", "'_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Mis", "cell", "ane", "ous", " ", "function", " ", "(", "re", ")", "definit", "ion", "s", " ", "from", " ", "the", " ", "Py", "3.4", "+", " ", "standard", " ", "librar", "y", "\\", "10", ";", "for", " ", "Pyth", "on", " ", "2.6", "/", "2.7", ".", "\\", "10", ";", "\\", "10", ";", "-", " ", "math", ".", "ceil", " ", " ", " ", " ", "(", "for", " ", "Pyth", "on", " ", "2.7", ")", "\\", "10", ";", "-", " ", "collection", "s", ".", "Order", "ed", "Dict", " ", " ", "(", "for", " ", "Pyth", "on", " ", "2.6", ")", "\\", "10", ";", "-", " ", "collection", "s", ".", "Counter", " ", " ", "(", "for", " ", "Pyth", "on", " ", "2.6", ")", "\\", "10", ";", "-", " ", "collection", "s", ".", "Chain", "Map", " ", "(", "for", " ", "all", " ", "version", "s", " ", "prior", " ", "to", " ", "Pyth", "on", " ", "3.3", ")", "\\", "10", ";", "-", " ", "iter", "tool", "s", ".", "count", " ", " ", "(", "for", " ", "Pyth", "on", " ", "2.6", ",", " ", "with", " ", "step", " ", "parameter", ")", "\\", "10", ";", "-", " ", "subproc", "ess", ".", "check", "\\u", "output", " ", " ", "(", "for", " ", "Pyth", "on", " ", "2.6", ")", "\\", "10", ";", "-", " ", "repr", "lib", ".", "recurs", "ive", "\\u", "repr", " ", " ", " ", "(", "for", " ", "Pyth", "on", " ", "2.6", "+)", "\\", "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_", "subprocess_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "math_", "import_", "ceil_", "as_", "oldc", "eil", "_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "Mapping_", ",_", "Mut", "able", "Mapping_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "operator_", "import_", "itemgetter_", "as_", "\\u", "itemgetter_", ",_", "eq_", "as_", "\\u", "eq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "heapq_", "as_", "\\u", "heapq_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "\\u", "weakref_", "import_", "proxy_", "as_", "\\u", "proxy_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "itertools_", "import_", "repeat_", "as_", "\\u", "repeat_", ",_", "chain_", "as_", "\\u", "chain_", ",_", "star", "map_", "as_", "\\u", "star", "map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "socket_", "import_", "getadd", "rin", "fo_", ",_", "SOCK", "\\u", "STREAM_", ",_", "error_", ",_", "socket_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "future_", "._", "utils_", "import_", "iteritems_", ",_", "itervalues_", ",_", "PY", "26_", ",_", "PY", "3_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "###", " ", " ", "repr", "lib", ".", "recurs", "ive", "\\u", "repr", " ", "decorat", "or", " ", "from", " ", "Py", "3.4", "_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "itertools_", "import_", "islice_", "\\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 ", " _", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "\\u", "thread_", "import_", "get", "\\u", "ident_", "\\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_", "\\u", "dummy", "\\u", "thread_", "import_", "get", "\\u", "ident_", "\\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 ", " _", "from_", "thread_", "import_", "get", "\\u", "ident_", "\\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_", "dummy", "\\u", "thread_", "import_", "get", "\\u", "ident_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\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_", "###", " ", "Order", "ed", "Dict_", "\\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_", "#", " ", "{{", "{", " ", "http", "://", "code", ".", "active", "state", ".", "com", "/", "recip", "es", "/", "576", "611", "/", " ", "(", "r1", "1", ")_", "\\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 ", " _", "from_", "operator_", "import_", "itemgetter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "heapq_", "import_", "nla", "rge", "st_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "except_", "Import", "Error_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", " ", "Counter_", "\\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\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "###########", "###########", "###########", "###########", "###########", "###########", "######", "_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", " ", "Chain", "Map", " ", "(", "help", "er", " ", "for", " ", "config", "parser", " ", "and", " ", "string", ".", "Templa", "te", ")_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", " ", "Fro", "m", " ", "the", " ", "Py", "3.4", " ", "source", " ", "code", ".", " ", "See", " ", "als", "o", ":_", "\\u\\u\\uNL\\u\\u\\u_", "###", " ", " ", " ", " ", "https", "://", "git", "hub", ".", "com", "/", "kk", "xu", "e", "/", "Py", "2", "Chain", "Map", "/", "blob", "/", "master", "/", "py2", "chain", "map", ".", "py_", "\\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_", "#", " ", "Re", "-", "use", " ", "the", " ", "same", " ", "sentinel", " ", "as", " ", "in", " ", "the", " ", "Pyth", "on", " ", "stdlib", " ", "socket", " ", "module", ":_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "from_", "socket_", "import_", "\\u", "GLOB", "AL", "\\u", "DEF", "AUL", "T", "\\u", "TIMEOUT_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Wa", "s", ":", " ", "\\u", "GLOB", "AL", "\\u", "DEF", "AUL", "T", "\\u", "TIME", "OUT", " ", "=", " ", "object", "()", "_", "\\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_", "#", " ", "Back", " ", "up", " ", "our", " ", "definit", "ion", "s", " ", "above", " ", "in", " ", "case", " ", "the", "y", "'", "re", " ", "usef", "ul_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u", "Order", "ed", "Dict_", "=_", "Order", "ed", "Dict_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "Counter_", "=_", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "check", "\\u", "output_", "=_", "check", "\\u", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "count_", "=_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "ceil_", "=_", "ceil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u", "count", "\\u", "elements_", "=_", "\\u", "count", "\\u", "elements_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "recurs", "ive", "\\u", "repr_", "=_", "recurs", "ive", "\\u", "repr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "Chain", "Map_", "=_", "Chain", "Map_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u", "create", "\\u", "connection_", "=_", "create", "\\u", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "Over", "write", " ", "the", " ", "definit", "ion", "s", " ", "above", " ", "with", " ", "the", " ", "usual", " ", "ones_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "from", " ", "the", " ", "standard", " ", "librar", "y", ":_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", ">=_", "(_", "2_", ",_", "7_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "collections_", "import_", "Order", "ed", "Dict_", ",_", "Counter_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "subprocess_", "import_", "check", "\\u", "output_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "itertools_", "import_", "count_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "socket_", "import_", "create", "\\u", "connection_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", ">=_", "(_", "3_", ",_", "0_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "math_", "import_", "ceil_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "\\u", "count", "\\u", "elements_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "sys_", "._", "version", "\\u", "info_", ">=_", "(_", "3_", ",_", "3_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "repr", "lib_", "import_", "recurs", "ive", "\\u", "repr_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "collections_", "import_", "Chain", "Map_", "\\u\\u\\uDEDENT\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2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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 ]
Unused import
numba/numba/numba/typing/npdatetime.py
[ { "content": "\"\"\"\nTyping declarations for numpy.timedelta64.\n\"\"\"\n\nfrom __future__ import print_function, division, absolute_import\n\nfrom itertools import product\n\nfrom numba import npdatetime, types\nfrom numba.utils import PYVERSION\nfrom numba.typing.templates import (AttributeTemplate, ConcreteTemplate,\n AbstractTemplate, infer_global, infer,\n infer_getattr, signature)\n\n\n# timedelta64-only operations\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n# datetime64 operations\n\n\n\n\n\n\n\n\n\n\n\n\n", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class TimedeltaUnaryOp(AbstractTemplate):\n", "metadata": "root.TimedeltaUnaryOp", "header": "['module', '___EOS___']", "index": 17 }, { "content": " def generic(self, args, kws):\n if len(args) == 2:\n # Guard against binary + and -\n return\n op, = args\n if not isinstance(op, types.NPTimedelta):\n return\n return signature(op, op)", "metadata": "root.TimedeltaUnaryOp.generic", "header": "['class', 'TimedeltaUnaryOp', '(', 'AbstractTemplate', ')', ':', '___EOS___']", "index": 19 }, { "content": "class TimedeltaBinOp(AbstractTemplate):\n", "metadata": "root.TimedeltaBinOp", "header": "['module', '___EOS___']", "index": 29 }, { "content": " def generic(self, args, kws):\n if len(args) == 1:\n # Guard against unary + and -\n return\n left, right = args\n if not all(isinstance(tp, types.NPTimedelta) for tp in args):\n return\n if npdatetime.can_cast_timedelta_units(left.unit, right.unit):\n return signature(right, left, right)\n elif npdatetime.can_cast_timedelta_units(right.unit, left.unit):\n return signature(left, left, right)", "metadata": "root.TimedeltaBinOp.generic", "header": "['class', 'TimedeltaBinOp', '(', 'AbstractTemplate', ')', ':', '___EOS___']", "index": 31 }, { "content": "class TimedeltaCmpOp(AbstractTemplate):\n", "metadata": "root.TimedeltaCmpOp", "header": "['module', '___EOS___']", "index": 44 }, { "content": " def generic(self, args, kws):\n # For equality comparisons, all units are inter-comparable\n left, right = args\n if not all(isinstance(tp, types.NPTimedelta) for tp in args):\n return\n return signature(types.boolean, left, right)", "metadata": "root.TimedeltaCmpOp.generic", "header": "['class', 'TimedeltaCmpOp', '(', 'AbstractTemplate', ')', ':', '___EOS___']", "index": 46 }, { "content": "class TimedeltaOrderedCmpOp(AbstractTemplate):\n", "metadata": "root.TimedeltaOrderedCmpOp", "header": "['module', '___EOS___']", "index": 54 }, { "content": " def generic(self, args, kws):\n # For ordered comparisons, units must be compatible\n left, right = args\n if not all(isinstance(tp, types.NPTimedelta) for tp in args):\n return\n if (npdatetime.can_cast_timedelta_units(left.unit, right.unit) or\n npdatetime.can_cast_timedelta_units(right.unit, left.unit)):\n return signature(types.boolean, left, right)", "metadata": "root.TimedeltaOrderedCmpOp.generic", "header": "['class', 'TimedeltaOrderedCmpOp', '(', 'AbstractTemplate', ')', ':', '___EOS___']", "index": 56 }, { "content": "class TimedeltaMixOp(AbstractTemplate):\n", "metadata": "root.TimedeltaMixOp", "header": "['module', '___EOS___']", "index": 66 }, { "content": " def generic(self, args, kws):\n \"\"\"\n (timedelta64, {int, float}) -> timedelta64\n ({int, float}, timedelta64) -> timedelta64\n \"\"\"\n left, right = args\n if isinstance(right, types.NPTimedelta):\n td, other = right, left\n sig_factory = lambda other: signature(td, other, td)\n elif isinstance(left, types.NPTimedelta):\n td, other = left, right\n sig_factory = lambda other: signature(td, td, other)\n else:\n return\n if not isinstance(other, (types.Float, types.Integer)):\n return\n # Force integer types to convert to signed because it matches\n # timedelta64 semantics better.\n if isinstance(other, types.Integer):\n other = types.int64\n return sig_factory(other)", "metadata": "root.TimedeltaMixOp.generic", "header": "['class', 'TimedeltaMixOp', '(', 'AbstractTemplate', ')', ':', '___EOS___']", "index": 68 }, { "content": "class TimedeltaDivOp(AbstractTemplate):\n", "metadata": "root.TimedeltaDivOp", "header": "['module', '___EOS___']", "index": 91 }, { "content": " def generic(self, args, kws):\n \"\"\"\n (timedelta64, {int, float}) -> timedelta64\n (timedelta64, timedelta64) -> float\n \"\"\"\n left, right = args\n if not isinstance(left, types.NPTimedelta):\n return\n if isinstance(right, types.NPTimedelta):\n if (npdatetime.can_cast_timedelta_units(left.unit, right.unit)\n or npdatetime.can_cast_timedelta_units(right.unit, left.unit)):\n return signature(types.float64, left, right)\n elif isinstance(right, (types.Float)):\n return signature(left, left, right)\n elif isinstance(right, (types.Integer)):\n # Force integer types to convert to signed because it matches\n # timedelta64 semantics better.\n return signature(left, left, types.int64)", "metadata": "root.TimedeltaDivOp.generic", "header": "['class', 'TimedeltaDivOp', '(', 'AbstractTemplate', ')', ':', '___EOS___']", "index": 93 }, { "content": "@infer\nclass TimedeltaUnaryPos(TimedeltaUnaryOp):\n key = \"+\"", "metadata": "root.TimedeltaUnaryPos", "header": "['module', '___EOS___']", "index": 113 }, { "content": "@infer\nclass TimedeltaUnaryNeg(TimedeltaUnaryOp):\n key = \"-\"", "metadata": "root.TimedeltaUnaryNeg", "header": "['module', '___EOS___']", "index": 117 }, { "content": "@infer\nclass TimedeltaBinAdd(TimedeltaBinOp):\n key = \"+\"", "metadata": "root.TimedeltaBinAdd", "header": "['module', '___EOS___']", "index": 121 }, { "content": "@infer\nclass TimedeltaBinSub(TimedeltaBinOp):\n key = \"-\"", "metadata": "root.TimedeltaBinSub", "header": "['module', '___EOS___']", "index": 125 }, { "content": "@infer\nclass TimedeltaBinMult(TimedeltaMixOp):\n key = \"*\"", "metadata": "root.TimedeltaBinMult", "header": "['module', '___EOS___']", "index": 129 }, { "content": "@infer\nclass TimedeltaTrueDiv(TimedeltaDivOp):\n key = \"/\"", "metadata": "root.TimedeltaTrueDiv", "header": "['module', '___EOS___']", "index": 133 }, { "content": "@infer\nclass TimedeltaFloorDiv(TimedeltaDivOp):\n key = \"//\"", "metadata": "root.TimedeltaFloorDiv", "header": "['module', '___EOS___']", "index": 137 }, { "content": "@infer\nclass TimedeltaLegacyDiv(TimedeltaDivOp):\n key = \"/?\"", "metadata": "root.TimedeltaLegacyDiv", "header": "['module', '___EOS___']", "index": 141 }, { "content": "@infer\nclass TimedeltaCmpEq(TimedeltaCmpOp):\n key = '=='", "metadata": "root.TimedeltaCmpEq", "header": "['module', '___EOS___']", "index": 145 }, { "content": "@infer\nclass TimedeltaCmpNe(TimedeltaCmpOp):\n key = '!='", "metadata": "root.TimedeltaCmpNe", "header": "['module', '___EOS___']", "index": 149 }, { "content": "@infer\nclass TimedeltaCmpLt(TimedeltaOrderedCmpOp):\n key = '<'", "metadata": "root.TimedeltaCmpLt", "header": "['module', '___EOS___']", "index": 153 }, { "content": "@infer\nclass TimedeltaCmpLE(TimedeltaOrderedCmpOp):\n key = '<='", "metadata": "root.TimedeltaCmpLE", "header": "['module', '___EOS___']", "index": 157 }, { "content": "@infer\nclass TimedeltaCmpGt(TimedeltaOrderedCmpOp):\n key = '>'", "metadata": "root.TimedeltaCmpGt", "header": "['module', '___EOS___']", "index": 161 }, { "content": "@infer\nclass TimedeltaCmpGE(TimedeltaOrderedCmpOp):\n key = '>='", "metadata": "root.TimedeltaCmpGE", "header": "['module', '___EOS___']", "index": 165 }, { "content": "@infer_global(abs)\nclass TimedeltaAbs(TimedeltaUnaryOp):\n pass", "metadata": "root.TimedeltaAbs", "header": "['module', '___EOS___']", "index": 170 }, { "content": "@infer\nclass DatetimePlusTimedelta(AbstractTemplate):\n key = '+'\n", "metadata": "root.DatetimePlusTimedelta", "header": "['module', '___EOS___']", "index": 177 }, { "content": " def generic(self, args, kws):\n if len(args) == 1:\n # Guard against unary +\n return\n left, right = args\n if isinstance(right, types.NPTimedelta):\n dt = left\n td = right\n elif isinstance(left, types.NPTimedelta):\n dt = right\n td = left\n else:\n return\n if isinstance(dt, types.NPDatetime):\n unit = npdatetime.combine_datetime_timedelta_units(dt.unit, td.unit)\n if unit is not None:\n return signature(types.NPDatetime(unit), left, right)", "metadata": "root.DatetimePlusTimedelta.generic", "header": "['class', 'DatetimePlusTimedelta', '(', 'AbstractTemplate', ')', ':', '___EOS___']", "index": 181 }, { "content": "@infer\nclass DatetimeMinusTimedelta(AbstractTemplate):\n key = '-'\n", "metadata": "root.DatetimeMinusTimedelta", "header": "['module', '___EOS___']", "index": 199 }, { "content": " def generic(self, args, kws):\n if len(args) == 1:\n # Guard against unary -\n return\n dt, td = args\n if isinstance(dt, types.NPDatetime) and isinstance(td, types.NPTimedelta):\n unit = npdatetime.combine_datetime_timedelta_units(dt.unit, td.unit)\n if unit is not None:\n return signature(types.NPDatetime(unit), dt, td)", "metadata": "root.DatetimeMinusTimedelta.generic", "header": "['class', 'DatetimeMinusTimedelta', '(', 'AbstractTemplate', ')', ':', '___EOS___']", "index": 203 }, { "content": "@infer\nclass DatetimeMinusDatetime(AbstractTemplate):\n key = '-'\n", "metadata": "root.DatetimeMinusDatetime", "header": "['module', '___EOS___']", "index": 213 }, { "content": " def generic(self, args, kws):\n if len(args) == 1:\n # Guard against unary -\n return\n left, right = args\n if isinstance(left, types.NPDatetime) and isinstance(right, types.NPDatetime):\n # All units compatible! Yoohoo!\n unit = npdatetime.get_best_unit(left.unit, right.unit)\n return signature(types.NPTimedelta(unit), left, right)", "metadata": "root.DatetimeMinusDatetime.generic", "header": "['class', 'DatetimeMinusDatetime', '(', 'AbstractTemplate', ')', ':', '___EOS___']", "index": 217 }, { "content": "class DatetimeCmpOp(AbstractTemplate):\n", "metadata": "root.DatetimeCmpOp", "header": "['module', '___EOS___']", "index": 228 }, { "content": " def generic(self, args, kws):\n # For datetime64 comparisons, all units are inter-comparable\n left, right = args\n if not all(isinstance(tp, types.NPDatetime) for tp in args):\n return\n return signature(types.boolean, left, right)", "metadata": "root.DatetimeCmpOp.generic", "header": "['class', 'DatetimeCmpOp', '(', 'AbstractTemplate', ')', ':', '___EOS___']", "index": 230 }, { "content": "@infer\nclass DatetimeCmpEq(DatetimeCmpOp):\n key = '=='", "metadata": "root.DatetimeCmpEq", "header": "['module', '___EOS___']", "index": 238 }, { "content": "@infer\nclass DatetimeCmpNe(DatetimeCmpOp):\n key = '!='", "metadata": "root.DatetimeCmpNe", "header": "['module', '___EOS___']", "index": 242 }, { "content": "@infer\nclass DatetimeCmpLt(DatetimeCmpOp):\n key = '<'", "metadata": "root.DatetimeCmpLt", "header": "['module', '___EOS___']", "index": 246 }, { "content": "@infer\nclass DatetimeCmpLE(DatetimeCmpOp):\n key = '<='", "metadata": "root.DatetimeCmpLE", "header": "['module', '___EOS___']", "index": 250 }, { "content": "@infer\nclass DatetimeCmpGt(DatetimeCmpOp):\n key = '>'", "metadata": "root.DatetimeCmpGt", "header": "['module', '___EOS___']", "index": 254 }, { "content": "@infer\nclass DatetimeCmpGE(DatetimeCmpOp):\n key = '>='", "metadata": "root.DatetimeCmpGE", "header": "['module', '___EOS___']", "index": 258 } ]
[ { "span": "from itertools import product", "start_line": 6, "start_column": 0, "end_line": 6, "end_column": 29 }, { "span": "from numba.utils import PYVERSION", "start_line": 9, "start_column": 0, "end_line": 9, "end_column": 33 }, { "span": "from numba.typing.templates import (AttributeTemplate, ConcreteTemplate,\n AbstractTemplate, infer_global, infer,\n infer_getattr, signature)", "start_line": 10, "start_column": 0, "end_line": 12, "end_column": 61 } ]
[]
1
false
[ "[CLS]_", "Un", "used_", "import_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\"\"\"", "\\", "10", ";", "Typ", "ing", " ", "declaration", "s", " ", "for", " ", "nump", "y", ".", "timedelta", "64.", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "\\u\\u", "future\\u\\u_", "import_", "print", "\\u", "function_", ",_", "division_", ",_", "abs", "olute", "\\u", "import_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "itertools_", "import_", "product_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "from_", "numba_", "import_", "np", "datetime_", ",_", "types_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numba_", "._", "utils_", "import_", "PY", "VERSION_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "numba_", "._", "typing_", "._", "templates_", "import_", "(_", "Attribute", "Template_", ",_", "Conc", "ret", "e", "Template_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "Abstract", "Template_", ",_", "infer", "\\u", "global_", ",_", "infer_", ",_", "\\u\\u\\uNL\\u\\u\\u_", "infer", "\\u", "getattr_", ",_", "signature_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "timedelta", "64", "-", "only", " ", "operations_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "datetime", "64", " ", "operations_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "class_", "Time", "delta", "Una", "ry", "Op_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Time", "delta", "Una", "ry", "Op_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "generic_", "(_", "self_", ",_", "args_", ",_", "kws_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", "==_", "2_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Guard", " ", "against", " ", "binar", "y", " ", "+", " ", "and", " ", "-_", "\\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_", "op_", ",_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "op_", ",_", "types_", "._", "NP", "Time", "delta_", ")_", ":_", "\\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_", "signature_", "(_", "op_", ",_", "op_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "delta", "Bin", "Op_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Time", "delta", "Bin", "Op_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "generic_", "(_", "self_", ",_", "args_", ",_", "kws_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Guard", " ", "against", " ", "una", "ry", " ", "+", " ", "and", " ", "-_", "\\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_", "left_", ",_", "right_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "all_", "(_", "isinstance_", "(_", "tp_", ",_", "types_", "._", "NP", "Time", "delta_", ")_", "for_", "tp_", "in_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "np", "datetime_", "._", "can", "\\u", "cast", "\\u", "timedelta", "\\u", "units_", "(_", "left_", "._", "unit_", ",_", "right_", "._", "unit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "signature_", "(_", "right_", ",_", "left_", ",_", "right_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "np", "datetime_", "._", "can", "\\u", "cast", "\\u", "timedelta", "\\u", "units_", "(_", "right_", "._", "unit_", ",_", "left_", "._", "unit_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "signature_", "(_", "left_", ",_", "left_", ",_", "right_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Time", "delta", "Cmp", "Op_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Time", "delta", "Cmp", "Op_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "generic_", "(_", "self_", ",_", "args_", ",_", "kws_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "equality", " ", "comparisons", ",", " ", "all", " ", "unit", "s", " ", "are", " ", "inter", "-", "compara", "ble_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", ",_", "right_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "all_", "(_", "isinstance_", "(_", "tp_", ",_", "types_", "._", "NP", "Time", "delta_", ")_", "for_", "tp_", "in_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "signature_", "(_", "types_", "._", "boolean_", ",_", "left_", ",_", "right_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "delta", "Order", "ed", "Cmp", "Op_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Time", "delta", "Order", "ed", "Cmp", "Op_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "generic_", "(_", "self_", ",_", "args_", ",_", "kws_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "order", "ed", " ", "comparisons", ",", " ", "unit", "s", " ", "must", " ", "be", " ", "compatible_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", ",_", "right_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "all_", "(_", "isinstance_", "(_", "tp_", ",_", "types_", "._", "NP", "Time", "delta_", ")_", "for_", "tp_", "in_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "(_", "np", "datetime_", "._", "can", "\\u", "cast", "\\u", "timedelta", "\\u", "units_", "(_", "left_", "._", "unit_", ",_", "right_", "._", "unit_", ")_", "or_", "\\u\\u\\uNL\\u\\u\\u_", "np", "datetime_", "._", "can", "\\u", "cast", "\\u", "timedelta", "\\u", "units_", "(_", "right_", "._", "unit_", ",_", "left_", "._", "unit_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "signature_", "(_", "types_", "._", "boolean_", ",_", "left_", ",_", "right_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Time", "delta", "Mix", "Op_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Time", "delta", "Mix", "Op_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "generic_", "(_", "self_", ",_", "args_", ",_", "kws_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "(", "timedelta", "64", ",", " ", "{", "int", ",", " ", "float", "})", " ", "->", " ", "timedelta", "64", "\\", "10", ";", " ", " ", " ", " ", "({", "int", ",", " ", "float", "},", " ", "timedelta", "64", ")", " ", "->", " ", "timedelta", "64", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "left_", ",_", "right_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "right_", ",_", "types_", "._", "NP", "Time", "delta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "td_", ",_", "other_", "=_", "right_", ",_", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sig", "\\u", "factory_", "=_", "lambda_", "other_", ":_", "signature_", "(_", "td_", ",_", "other_", ",_", "td_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "left_", ",_", "types_", "._", "NP", "Time", "delta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "td_", ",_", "other_", "=_", "left_", ",_", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "sig", "\\u", "factory_", "=_", "lambda_", "other_", ":_", "signature_", "(_", "td_", ",_", "td_", ",_", "other_", ")_", "\\u\\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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "other_", ",_", "(_", "types_", "._", "Float_", ",_", "types_", "._", "Integer_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Force", " ", "integ", "er", " ", "types", " ", "to", " ", "convert", " ", "to", " ", "sign", "ed", " ", "bec", "aus", "e", " ", "it", " ", "matches_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "timedelta", "64", " ", "semantics", " ", "bett", "er", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "other_", ",_", "types_", "._", "Integer_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "other_", "=_", "types_", "._", "int64_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "sig", "\\u", "factory_", "(_", "other_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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", "delta", "Di", "v", "Op_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Time", "delta", "Di", "v", "Op_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "generic_", "(_", "self_", ",_", "args_", ",_", "kws_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "\"\"\"", "\\", "10", ";", " ", " ", " ", " ", "(", "timedelta", "64", ",", " ", "{", "int", ",", " ", "float", "})", " ", "->", " ", "timedelta", "64", "\\", "10", ";", " ", " ", " ", " ", "(", "timedelta", "64", ",", " ", "timedelta", "64", ")", " ", "->", " ", "float", "\\", "10", ";", " ", " ", " ", " ", "\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "left_", ",_", "right_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "isinstance_", "(_", "left_", ",_", "types_", "._", "NP", "Time", "delta_", ")_", ":_", "\\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_", "isinstance_", "(_", "right_", ",_", "types_", "._", "NP", "Time", "delta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "(_", "np", "datetime_", "._", "can", "\\u", "cast", "\\u", "timedelta", "\\u", "units_", "(_", "left_", "._", "unit_", ",_", "right_", "._", "unit_", ")_", "\\u\\u\\uNL\\u\\u\\u_", "or_", "np", "datetime_", "._", "can", "\\u", "cast", "\\u", "timedelta", "\\u", "units_", "(_", "right_", "._", "unit_", ",_", "left_", "._", "unit_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "signature_", "(_", "types_", "._", "float64_", ",_", "left_", ",_", "right_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "right_", ",_", "(_", "types_", "._", "Float_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "signature_", "(_", "left_", ",_", "left_", ",_", "right_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "right_", ",_", "(_", "types_", "._", "Integer_", ")_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Force", " ", "integ", "er", " ", "types", " ", "to", " ", "convert", " ", "to", " ", "sign", "ed", " ", "bec", "aus", "e", " ", "it", " ", "matches_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "timedelta", "64", " ", "semantics", " ", "bett", "er", "._", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "signature_", "(_", "left_", ",_", "left_", ",_", "types_", "._", "int64_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Time", "delta", "Una", "ry", "Pos_", "(_", "Time", "delta", "Una", "ry", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Time", "delta", "Una", "ry", "Ne", "g_", "(_", "Time", "delta", "Una", "ry", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Time", "delta", "Bin", "Add_", "(_", "Time", "delta", "Bin", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Time", "delta", "Bin", "Sub_", "(_", "Time", "delta", "Bin", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Time", "delta", "Bin", "Mult", "_", "(_", "Time", "delta", "Mix", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Time", "delta", "Tru", "e", "Div_", "(_", "Time", "delta", "Di", "v", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Time", "delta", "Flo", "or", "Div_", "(_", "Time", "delta", "Di", "v", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Time", "delta", "Leg", "ac", "y", "Div_", "(_", "Time", "delta", "Di", "v", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Time", "delta", "Cmp", "Eq_", "(_", "Time", "delta", "Cmp", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Time", "delta", "Cmp", "Ne", "_", "(_", "Time", "delta", "Cmp", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Time", "delta", "Cmp", "Lt", "_", "(_", "Time", "delta", "Order", "ed", "Cmp", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Time", "delta", "Cmp", "LE_", "(_", "Time", "delta", "Order", "ed", "Cmp", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Time", "delta", "Cmp", "Gt", "_", "(_", "Time", "delta", "Order", "ed", "Cmp", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Time", "delta", "Cmp", "GE_", "(_", "Time", "delta", "Order", "ed", "Cmp", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "@_", "infer", "\\u", "global_", "(_", "abs_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Time", "delta", "Abs", "_", "(_", "Time", "delta", "Una", "ry", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "pass_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Date", "time", "Plus", "Time", "delta_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "'+'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Date", "time", "Plus", "Time", "delta_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "generic_", "(_", "self_", ",_", "args_", ",_", "kws_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Guard", " ", "against", " ", "una", "ry", " ", "+_", "\\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_", "left_", ",_", "right_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "right_", ",_", "types_", "._", "NP", "Time", "delta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dt_", "=_", "left_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "td_", "=_", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "elif_", "isinstance_", "(_", "left_", ",_", "types_", "._", "NP", "Time", "delta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "dt_", "=_", "right_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "td_", "=_", "left_", "\\u\\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_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "if_", "isinstance_", "(_", "dt_", ",_", "types_", "._", "NP", "Datetime_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unit_", "=_", "np", "datetime_", "._", "combin", "e\\u", "datetime", "\\u", "timedelta", "\\u", "units_", "(_", "dt_", "._", "unit_", ",_", "td_", "._", "unit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "unit_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "signature_", "(_", "types_", "._", "NP", "Datetime_", "(_", "unit_", ")_", ",_", "left_", ",_", "right_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Date", "time", "Minus", "Time", "delta_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "'-'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Date", "time", "Minus", "Time", "delta_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "generic_", "(_", "self_", ",_", "args_", ",_", "kws_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Guard", " ", "against", " ", "una", "ry", " ", "-_", "\\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_", "dt_", ",_", "td_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "dt_", ",_", "types_", "._", "NP", "Datetime_", ")_", "and_", "isinstance_", "(_", "td_", ",_", "types_", "._", "NP", "Time", "delta_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unit_", "=_", "np", "datetime_", "._", "combin", "e\\u", "datetime", "\\u", "timedelta", "\\u", "units_", "(_", "dt_", "._", "unit_", ",_", "td_", "._", "unit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "unit_", "is_", "not_", "None_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "signature_", "(_", "types_", "._", "NP", "Datetime_", "(_", "unit_", ")_", ",_", "dt_", ",_", "td_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Date", "time", "Minus", "Datetime_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "'-'_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Date", "time", "Minus", "Datetime_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "def_", "generic_", "(_", "self_", ",_", "args_", ",_", "kws_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "if_", "len_", "(_", "args_", ")_", "==_", "1_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "Guard", " ", "against", " ", "una", "ry", " ", "-_", "\\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_", "left_", ",_", "right_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "isinstance_", "(_", "left_", ",_", "types_", "._", "NP", "Datetime_", ")_", "and_", "isinstance_", "(_", "right_", ",_", "types_", "._", "NP", "Datetime_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "All", " ", "unit", "s", " ", "compatible", "!", " ", "Yo", "oh", "oo", "!", "_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "unit_", "=_", "np", "datetime_", "._", "get", "\\u", "best", "\\u", "unit_", "(_", "left_", "._", "unit_", ",_", "right_", "._", "unit_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "return_", "signature_", "(_", "types_", "._", "NP", "Time", "delta_", "(_", "unit_", ")_", ",_", "left_", ",_", "right_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\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_", "Date", "time", "Cmp", "Op_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "[SEP]_", "class_", "Date", "time", "Cmp", "Op_", "(_", "Abstract", "Template_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "generic_", "(_", "self_", ",_", "args_", ",_", "kws_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "#", " ", "For", " ", "datetime", "64", " ", "comparisons", ",", " ", "all", " ", "unit", "s", " ", "are", " ", "inter", "-", "compara", "ble_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "left_", ",_", "right_", "=_", "args_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "if_", "not_", "all_", "(_", "isinstance_", "(_", "tp_", ",_", "types_", "._", "NP", "Datetime_", ")_", "for_", "tp_", "in_", "args_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "return_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "signature_", "(_", "types_", "._", "boolean_", ",_", "left_", ",_", "right_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Date", "time", "Cmp", "Eq_", "(_", "Date", "time", "Cmp", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Date", "time", "Cmp", "Ne", "_", "(_", "Date", "time", "Cmp", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Date", "time", "Cmp", "Lt", "_", "(_", "Date", "time", "Cmp", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Date", "time", "Cmp", "LE_", "(_", "Date", "time", "Cmp", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Date", "time", "Cmp", "Gt", "_", "(_", "Date", "time", "Cmp", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "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_", "@_", "infer_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "class_", "Date", "time", "Cmp", "GE_", "(_", "Date", "time", "Cmp", "Op_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "key_", "=_", "'>='_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 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, 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, 4, 2, 2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bin/env python\n#-*- coding:utf-8 -*-\n\"\"\"\npopup multi levels menu by right click\n\nTested environment:\n Mac OS X 10.6.8\n\nhttp://developer.qt.nokia.com/doc/qt-4.8/qmenu.html#details\nhttp://diotavelli.net/PyQtWiki/Handling%20context%20menus\n\"\"\"\nimport sys\n\ntry:\n from PySide import QtCore\n from PySide import QtGui\nexcept ImportError:\n from PyQt4 import QtCore\n from PyQt4 import QtGui\n\n\n\nif __name__ == \"__main__\":\n app = QtGui.QApplication(sys.argv)\n\n demo = Demo()\n demo.show_and_raise()\n\n sys.exit(app.exec_())", "metadata": "root", "header": "['module', '___EOS___']", "index": 0 }, { "content": "class Demo(QtGui.QMainWindow):\n\n\n", "metadata": "root.Demo", "header": "['module', '___EOS___']", "index": 21 }, { "content": " def __init__(self):\n super(Demo, self).__init__()\n\n x, y, w, h = 500, 200, 300, 400\n self.setGeometry(x, y, w, h)\n\n self.popup_menu = QtGui.QMenu(self)\n\n # sub-menu\n self.sub_menu = self.popup_menu.addMenu(\"sub-menu\")\n print \"sub_menu:\", self.sub_menu\n\n self.item_add_act = QtGui.QAction(\"Add\", self)\n self.item_add_act.triggered.connect(self.add_cb)\n self.sub_menu.addAction(self.item_add_act)", "metadata": "root.Demo.__init__", "header": "['class', 'Demo', '(', 'QtGui', '.', 'QMainWindow', ')', ':', '___EOS___']", "index": 22 }, { "content": " def add_cb(self):\n print \"add callback\"", "metadata": "root.Demo.add_cb", "header": "['class', 'Demo', '(', 'QtGui', '.', 'QMainWindow', ')', ':', '___EOS___']", "index": 38 }, { "content": " def contextMenuEvent(self, event):\n point = self.mapToGlobal(event.pos())\n act = self.popup_menu.exec_(point)\n\n if act == self.item_add_act:\n print \"item add clicked\"\n\n return super(Demo, self).contextMenuEvent(event)", "metadata": "root.Demo.contextMenuEvent", "header": "['class', 'Demo', '(', 'QtGui', '.', 'QMainWindow', ')', ':', '___EOS___']", "index": 41 }, { "content": " def show_and_raise(self):\n self.show()\n self.raise_()", "metadata": "root.Demo.show_and_raise", "header": "['class', 'Demo', '(', 'QtGui', '.', 'QMainWindow', ')', ':', '___EOS___']", "index": 50 } ]
[ { "span": "from PySide import QtCore", "start_line": 14, "start_column": 4, "end_line": 14, "end_column": 29 }, { "span": "from PyQt4 import QtCore", "start_line": 17, "start_column": 4, "end_line": 17, "end_column": 28 } ]
[]
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_", "\"\"\"", "\\", "10", ";", "popu", "p", " ", "multi", " ", "level", "s", " ", "menu", " ", "by", " ", "right", " ", "click", "\\", "10", ";", "\\", "10", ";", "Test", "ed", " ", "environ", "ment", ":", "\\", "10", ";", " ", " ", " ", " ", "Mac", " ", "OS", " ", "X", " ", "10.", "6.8", "\\", "10", ";", "\\", "10", ";", "http", "://", "developer", ".", "qt", ".", "no", "kia", ".", "com", "/", "doc", "/", "qt", "-", "4.8", "/", "qm", "enu", ".", "html", "#", "deta", "il", "s", "\\", "10", ";", "http", "://", "dio", "tav", "elli", ".", "net", "/", "Py", "Qt", "Wiki", "/", "Hand", "ling", "%", "20", "context", "%", "20", "menus", "\\", "10", ";\"\"\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "import_", "sys_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "try_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "from_", "Py", "Side_", "import_", "Qt", "Core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Py", "Side_", "import_", "Qt", "Gui_", "\\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_", "Py", "Qt4_", "import_", "Qt", "Core_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "from_", "Py", "Qt4_", "import_", "Qt", "Gui_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\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 ", " _", "app_", "=_", "Qt", "Gui_", "._", "QA", "ppl", "ication", "_", "(_", "sys_", "._", "argv_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "demo_", "=_", "Demo", "_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "demo_", "._", "show", "\\u", "and", "\\u", "raise_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "sys_", "._", "exit_", "(_", "app_", "._", "exec\\u_", "(_", ")_", ")_", "[SEP]_", "module_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "class_", "Demo", "_", "(_", "Qt", "Gui_", "._", "QM", "ain", "Window_", ")_", ":_", "\\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_", "Demo", "_", "(_", "Qt", "Gui_", "._", "QM", "ain", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "def_", "\\u\\u", "init\\u\\u_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "super_", "(_", "Demo", "_", ",_", "self_", ")_", "._", "\\u\\u", "init\\u\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "x_", ",_", "y_", ",_", "w_", ",_", "h_", "=_", "500_", ",_", "200_", ",_", "300_", ",_", "400_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "set", "Geometry_", "(_", "x_", ",_", "y_", ",_", "w_", ",_", "h_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "popu", "p", "\\u", "menu_", "=_", "Qt", "Gui_", "._", "QM", "enu_", "(_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "#", " ", "sub", "-", "menu_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "sub\\u", "menu_", "=_", "self_", "._", "popu", "p", "\\u", "menu_", "._", "add", "Menu_", "(_", "\"", "sub", "-", "menu", "\"_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "print_", "\"", "sub\\u", "menu", ":\"_", ",_", "self_", "._", "sub\\u", "menu_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "self_", "._", "item", "\\u", "add", "\\u", "act_", "=_", "Qt", "Gui_", "._", "QA", "ction_", "(_", "\"", "Add", "\"_", ",_", "self_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "item", "\\u", "add", "\\u", "act_", "._", "triggered_", "._", "connect_", "(_", "self_", "._", "add", "\\u", "cb_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "sub\\u", "menu_", "._", "add", "Action_", "(_", "self_", "._", "item", "\\u", "add", "\\u", "act_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Demo", "_", "(_", "Qt", "Gui_", "._", "QM", "ain", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "add", "\\u", "cb_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "add", " ", "callback", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Demo", "_", "(_", "Qt", "Gui_", "._", "QM", "ain", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "context", "Menu", "Event_", "(_", "self_", ",_", "event_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "point_", "=_", "self_", "._", "map", "To", "Global_", "(_", "event_", "._", "pos_", "(_", ")_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "act_", "=_", "self_", "._", "popu", "p", "\\u", "menu_", "._", "exec\\u_", "(_", "point_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "if_", "act_", "==_", "self_", "._", "item", "\\u", "add", "\\u", "act_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "print_", "\"", "item", " ", "add", " ", "click", "ed", "\"_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "return_", "super_", "(_", "Demo", "_", ",_", "self_", ")_", "._", "context", "Menu", "Event_", "(_", "event_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "[SEP]_", "class_", "Demo", "_", "(_", "Qt", "Gui_", "._", "QM", "ain", "Window_", ")_", ":_", "\\u\\u\\uEOS\\u\\u\\u_", "\\u\\u\\uNL\\u\\u\\u_", "\\u\\u\\uDEDENT\\u\\u\\u_", "def_", "show", "\\u", "and", "\\u", "raise_", "(_", "self_", ")_", ":_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "\\u\\u\\uINDENT\\u\\u\\u ", " _", "self_", "._", "show_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_", "self_", "._", "raise", "\\u_", "(_", ")_", "\\u\\u\\uNEWLINE\\u\\u\\u_" ]
[ 4, 4, 4, 4, 4, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 0, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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